Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of http://github.com/ghnatiuk/consuming-gherkin

  • Loading branch information...
commit 542bc55e1666e8ffe31bdb015a23e221d1196291 2 parents 8c12b9f + b4b200d
@msassak msassak authored
View
11 presentation/introduction/01_slide.md
@@ -6,6 +6,17 @@
# Who We Are
## Greg Hnatiuk & Mike Sassak
+!SLIDE bullets incremental
+# A Bit about Gherkin
+* Language
+* Parser
+
+!SLIDE
+# Call to arms
+
+### "We need a faster parser. I'm currently looking at Ragel - a super fast state machine compiler. It's used by Mongrel, Thin, RedCloth and Hpricot to name a few, so it has a good track record in the Ruby community... Previous experience with Ragel is not a must, but definitely a plus."
+## Aslak Hellesøy
+
!SLIDE smaller
# Step
I18N_Step = ("Given " | "When " | "Then ") \
View
BIN  presentation/ragel_syntax/.01_slide.md.swp
Binary file not shown
View
128 presentation/ragel_syntax/01_slide.md
@@ -172,6 +172,25 @@
end
* %%write exec
+!SLIDE bullets
+ @@@ Ruby
+ class RagelTest
+ %%{
+ machine m;
+ action print_me { puts data[p].chr; }
+ Vowels = [aeiou] >print_me;
+ main := (Vowels | any)+;
+ }%%
+
+ def initialize(str)
+ %%write data;
+ data = str.unpack("c*");
+ %%write init;
+ %%write exec;
+ end
+ end
+* data and p
+
!SLIDE center
![parts_of_speech](parts_of_speech.png)
@@ -191,14 +210,60 @@
/text/
any, white, lower, alnum, digit
-!SLIDE bullets
-# Regular Language Operators
+!SLIDE
+# Operators
+
+!SLIDE bullets center
+## Kleene star
+ @@@ Ruby
+ 'words'*
+## One or more
+ @@@ Ruby
+ 'words'+
+## Optional
+ @@@ Ruby
+ 'words'?
+## Negation
+ @@@ Ruby
+ !'words'
+ ^'\n'
+!SLIDE center
+# Union
+ @@@ Ruby
+ 'foo' | 'bar'
+!SLIDE center
+# Intersection
+ @@@ Ruby
+ any{10} & [aeiou]
+!SLIDE center
+# Difference
+ @@@ Ruby
+ any+ - 'foo'
+
+!SLIDE center
+# Concatenation
+ @@@ Ruby
+ [a-z]* . '\n'
+
+!SLIDE center
+# Concatenation
+ @@@ Ruby
+ [a-z]* '\n'
+
+!SLIDE
+ @@@Ruby
+ EOL = ('\n' | '\r\n');
+
+ Tag = ('@' [^@\r\n\t ]+);
+
+ I18N_Step = ("* " | "Given " |
+ "When " | "Then " | "And " | "But ");
+
+!SLIDE center
+### tokens = BOM? (space | EOL)* (Tags | Comment | FeatureHeading | BackgroundHeading | ScenarioHeading | ScenarioOutlineHeading | ExamplesH eading | Step | Row | PyString)* (space | EOL)* EOF;
-* Union
-* Intersection
-* Difference
-* Concatenation
-* Kleene star, etc... (*, +, ?, !)
+!SLIDE
+# So what?
!SLIDE bullets center
# Actions
@@ -249,7 +314,7 @@
!SLIDE center bullets
# Finishing Action
@@@ Ruby
- main := ('pon' 'y'+) @do_something
+ main := ('pon' 'y'+) @print_details
*
@@ -266,24 +331,51 @@
!SLIDE
# Guards and Nondeterminism
-!SLIDE bullets
-
-* finish-guarded
-* :>>
!SLIDE center
@@@ Ruby
- any* :>> 'STOP!'
+ any* 'No';
+!SLIDE center bullets
+ @@@ Ruby
+ any* 'No';
+*
+![no_guard](no_guard.png)
-!SLIDE bullets
-* entry-guarded
-* :>
+!SLIDE center bullets
+ @@@ Ruby
+ any* :>> 'No';
+*
+![guard](guard.png)
+### Finish-guarded
+
+!SLIDE center bullets
-!SLIDE center
@@@ Ruby
- any* :> 'STOP!'
+ any* :> 'No';
+*
+![entryguard](entryguard.png)
+### Entry-guarded
!SLIDE bullets
* left-guarded <:
* longest-match **
* named-priorities
+
+!SLIDE bullets
+ @@@ Ruby
+
+ action begin_content {
+ @content_start = p
+ @current_line = @line_number
+ }
+
+ action store_tag_content {
+ con = utf8_pack(data[@content_start...p])
+ @listener.tag(con, @curent_line)
+ }
+
+ Tag = (('@' [^@\r\n\t ]+) >begin_content) \
+ %store_tag_content;
+
+!SLIDE center
+![lexer_common](lexer_common.png)
View
BIN  presentation/ragel_syntax/entryguard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  presentation/ragel_syntax/guard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  presentation/ragel_syntax/lexer_common.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  presentation/ragel_syntax/no_guard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
6 ragel/guards.rl
@@ -0,0 +1,6 @@
+%%{
+ machine m;
+
+ main := any* <: 'No';
+
+}%%
Please sign in to comment.
Something went wrong with that request. Please try again.