gherkin 1.0.1-i386-mswin32 → 1.0.2-i386-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/.mailmap +2 -0
- data/History.txt +9 -0
- data/README.rdoc +14 -43
- data/Rakefile +13 -17
- data/VERSION.yml +1 -1
- data/bin/gherkin +2 -7
- data/features/feature_parser.feature +36 -36
- data/features/native_lexer.feature +2 -2
- data/features/parser_with_native_lexer.feature +32 -32
- data/features/pretty_printer.feature +4 -4
- data/features/step_definitions/pretty_printer_steps.rb +2 -2
- data/features/steps_parser.feature +5 -5
- data/gherkin.gemspec +28 -16
- data/java/src/gherkin/FixJava.java +4 -4
- data/lib/gherkin/cli/main.rb +34 -0
- data/lib/gherkin/i18n.rb +8 -1
- data/lib/gherkin/i18n.yml +201 -201
- data/lib/gherkin/i18n_lexer.rb +8 -8
- data/lib/gherkin/lexer.rb +2 -1
- data/lib/gherkin/tools.rb +8 -0
- data/lib/gherkin/tools/files.rb +30 -0
- data/lib/gherkin/tools/{pretty_printer.rb → pretty_listener.rb} +5 -4
- data/lib/gherkin/tools/reformat.rb +19 -0
- data/lib/gherkin/tools/stats.rb +21 -0
- data/lib/gherkin/tools/stats_listener.rb +50 -0
- data/nativegems.sh +1 -1
- data/ragel/lexer.java.rl.erb +58 -58
- data/spec/gherkin/i18n_lexer_spec.rb +22 -0
- data/tasks/bench.rake +0 -7
- data/tasks/compile.rake +4 -4
- metadata +30 -12
- data/bin/gherkin-purdy +0 -16
data/.mailmap
ADDED
data/History.txt
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
== 1.0.2 (2009-12-30)
|
2
|
+
|
3
|
+
== Bugfixes
|
4
|
+
* Build passes on Ruby 1.9.2 (Aslak Hellesøy)
|
5
|
+
|
6
|
+
== New features
|
7
|
+
* New command line based on trollop. Commands: reformat, stats. (Aslak Hellesøy)
|
8
|
+
* I18nLexer#scan sets #language to the I18n for the language scanned (Mike Sassak)
|
9
|
+
* I18n#adverbs, brings I18n to parity with Cucumber::Parser::NaturalLanguage (Mike Sassak)
|
data/README.rdoc
CHANGED
@@ -1,54 +1,25 @@
|
|
1
1
|
= Gherkin
|
2
2
|
|
3
|
-
Fast Gherkin lexer based on Ragel.
|
3
|
+
Fast Gherkin lexer and parser based on Ragel. Gherkin is two things:
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
* The language that has evolved out of the Cucumber project.
|
6
|
+
* This library
|
7
7
|
|
8
|
-
|
9
|
-
that makes it possible to plug in a builder that can build an AST.
|
10
|
-
|
11
|
-
== Testing
|
8
|
+
== Running RSpec and Cucumber tests
|
12
9
|
|
13
10
|
rake clean spec cucumber
|
14
11
|
|
15
|
-
== Cleaning generated code
|
16
|
-
|
17
|
-
rake clobber
|
18
|
-
|
19
12
|
== Release process
|
20
13
|
|
21
|
-
Run
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
6) gem push pkg/... (for each native gem)
|
31
|
-
|
32
|
-
TODO: Also build windows gem with dll using rake-compiler. MinGW gem can be done on OS X/Linux, but
|
33
|
-
the one for the old Ruby one-click installers must be built with Visual Studio/nmake.
|
34
|
-
|
35
|
-
== Build windows gems on OS X
|
36
|
-
|
37
|
-
* http://www.copiousfreetime.org/articles/2008/10/12/building-gems-for-windows.html
|
38
|
-
* rake-compiler docs
|
39
|
-
|
40
|
-
== Notes
|
41
|
-
|
42
|
-
Ragel supports Ruby, but it's much slower than C. The ruby target will be used for development.
|
43
|
-
The final version will use C for MRI and Java for JRuby.
|
44
|
-
|
45
|
-
== Ragel links
|
46
|
-
|
47
|
-
* http://www.complang.org/ragel/
|
48
|
-
* http://dev.sipdoc.net/attachments/2/ragel_talk.pdf
|
49
|
-
* http://lambda-the-ultimate.org/node/1125
|
50
|
-
* http://www.zedshaw.com/essays/ragel_state_charts.html
|
51
|
-
* http://www.devchix.com/2008/01/13/a-hello-world-for-ruby-on-ragel-60/
|
14
|
+
* Run "rake clean spec cucumber" for each platform (1.8.6, 1.8.7, 1.9, jruby) to make sure all is green.
|
15
|
+
* rvm 1.8.7
|
16
|
+
* Bump version in the VERSION file
|
17
|
+
* rake clean jar compile
|
18
|
+
* rake gemspec
|
19
|
+
* git commit -a -m "Release vX.Y.Z"
|
20
|
+
* rake release
|
21
|
+
* ./nativegems.sh
|
22
|
+
* gem push pkg/... (for each native gem)
|
52
23
|
|
53
24
|
== Note on Patches/Pull Requests
|
54
25
|
|
@@ -57,7 +28,7 @@ The final version will use C for MRI and Java for JRuby.
|
|
57
28
|
* Make your feature addition or bug fix.
|
58
29
|
* Add tests for it. This is important so I don't break it in a
|
59
30
|
future version unintentionally.
|
60
|
-
* Commit, do not mess with
|
31
|
+
* Commit, do not mess with Rakefile, VERSION, or History.txt.
|
61
32
|
(if you want to have your own version, that is fine but
|
62
33
|
bump version in a commit by itself I can ignore when I pull)
|
63
34
|
* Send me a pull request. Bonus points for topic branches.
|
data/Rakefile
CHANGED
@@ -8,28 +8,24 @@ begin
|
|
8
8
|
require 'jeweler'
|
9
9
|
Jeweler::Tasks.new do |gem|
|
10
10
|
gem.name = "gherkin"
|
11
|
-
gem.summary = %Q{Fast Gherkin lexer}
|
12
|
-
gem.description = %Q{A fast Gherkin lexer
|
11
|
+
gem.summary = %Q{Fast Gherkin lexer/parser}
|
12
|
+
gem.description = %Q{A fast Gherkin lexer/parser based on the Ragel State Machine Compiler.}
|
13
13
|
gem.email = "cukes@googlegroups.com"
|
14
14
|
gem.homepage = "http://github.com/aslakhellesoy/gherkin"
|
15
15
|
gem.authors = ["Mike Sassak", "Gregory Hnatiuk", "Aslak Hellesøy"]
|
16
|
-
gem.
|
17
|
-
gem.
|
18
|
-
gem.add_development_dependency "rspec", "1.2.9"
|
19
|
-
gem.add_development_dependency "cucumber", "0.
|
20
|
-
gem.add_development_dependency "rake-compiler", "0.
|
16
|
+
gem.executables = ["gherkin"]
|
17
|
+
gem.add_dependency "trollop", ">= 1.15"
|
18
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
19
|
+
gem.add_development_dependency "cucumber", ">= 0.5.1"
|
20
|
+
gem.add_development_dependency "rake-compiler", ">= 0.7.0" unless defined?(JRUBY_VERSION)
|
21
21
|
|
22
22
|
case ENV['PLATFORM']
|
23
|
-
when '
|
24
|
-
gem.platform = '
|
23
|
+
when 'java'
|
24
|
+
gem.platform = 'java'
|
25
25
|
gem.files += FileList['lib/gherkin.jar']
|
26
26
|
gem.extensions = []
|
27
|
-
when 'i386-mswin32'
|
28
|
-
gem.platform = '
|
29
|
-
gem.files += FileList['lib/*.so']
|
30
|
-
gem.extensions = []
|
31
|
-
when 'i386-mingw32'
|
32
|
-
gem.platform = 'i386-mingw32'
|
27
|
+
when 'i386-mswin32', 'i386-mingw32'
|
28
|
+
gem.platform = ENV['PLATFORM']
|
33
29
|
gem.files += FileList['lib/*.so']
|
34
30
|
gem.extensions = []
|
35
31
|
else
|
@@ -42,10 +38,10 @@ begin
|
|
42
38
|
end
|
43
39
|
Jeweler::GemcutterTasks.new
|
44
40
|
rescue LoadError
|
45
|
-
|
41
|
+
warn "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
46
42
|
end
|
47
43
|
|
48
|
-
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
44
|
+
Dir['tasks/**/*.rake'].each { |rake| load File.expand_path(rake) }
|
49
45
|
|
50
46
|
task :default => [:spec, :cucumber]
|
51
47
|
task :spec => defined?(JRUBY_VERSION) ? :jar : :compile
|
data/VERSION.yml
CHANGED
data/bin/gherkin
CHANGED
@@ -1,10 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
$:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
|
3
3
|
|
4
|
-
require 'gherkin'
|
5
|
-
|
6
|
-
|
7
|
-
listener = Gherkin::Tools::PrettyPrinter.new(STDOUT)
|
8
|
-
parser = Gherkin::Parser.new(listener, true) # We could skip the parser here, if we don't want to verify well-formedness
|
9
|
-
lexer = Gherkin::I18nLexer.new(parser)
|
10
|
-
lexer.scan(IO.read(ARGV[0]))
|
4
|
+
require 'gherkin/cli/main'
|
5
|
+
Gherkin::Cli::Main.run(ARGV)
|
@@ -3,9 +3,9 @@ Feature: Gherkin Feature lexer
|
|
3
3
|
In order to make it easy to control the Gherkin syntax
|
4
4
|
As a Gherkin developer bent on Gherkin world-domination
|
5
5
|
I want a feature lexer that uses a feature parser to
|
6
|
-
|
6
|
+
make all the syntax decisions for me
|
7
7
|
|
8
|
-
Background:
|
8
|
+
Background:
|
9
9
|
Given a "en", "ruby" "root" parser
|
10
10
|
|
11
11
|
Scenario: Correctly formed feature
|
@@ -22,13 +22,13 @@ Feature: Gherkin Feature lexer
|
|
22
22
|
Background:
|
23
23
|
Given I have a transmogrifier
|
24
24
|
And I am a member of G.R.O.S.S
|
25
|
-
|
25
|
+
|
26
26
|
Scenario: Whoozit to whatzit transmogrification
|
27
27
|
Given I have a whoozit
|
28
28
|
When I put it in the transmogrifier
|
29
29
|
And I press the "transmogrify" button
|
30
30
|
Then I should have a whatzit
|
31
|
-
|
31
|
+
|
32
32
|
Scenario Outline: Imaginary Beings
|
33
33
|
Given I have a <boring being>
|
34
34
|
When I transmogrify it with the incantation:
|
@@ -36,7 +36,7 @@ Feature: Gherkin Feature lexer
|
|
36
36
|
ALAKAZAM!
|
37
37
|
\"\"\"
|
38
38
|
Then I should have an <exciting being>
|
39
|
-
|
39
|
+
|
40
40
|
Examples:
|
41
41
|
| boring being | exciting being |
|
42
42
|
| Sparrow | Alicanto |
|
@@ -60,8 +60,8 @@ Feature: Gherkin Feature lexer
|
|
60
60
|
When I read it
|
61
61
|
Then I should be amused
|
62
62
|
"""
|
63
|
-
|
64
|
-
|
63
|
+
Then there should be no parse errors
|
64
|
+
|
65
65
|
Scenario: Keyword before feature
|
66
66
|
Given the following text is parsed:
|
67
67
|
"""
|
@@ -91,7 +91,7 @@ Feature: Gherkin Feature lexer
|
|
91
91
|
Then it shouldn't work
|
92
92
|
"""
|
93
93
|
Then there should be parse errors on lines 5, 10 and 12
|
94
|
-
|
94
|
+
|
95
95
|
Scenario: Tables
|
96
96
|
Given the following text is parsed:
|
97
97
|
"""
|
@@ -124,48 +124,48 @@ Feature: Gherkin Feature lexer
|
|
124
124
|
\"\"\" # Not interpreted as a pystring, just plain text
|
125
125
|
Oh hai
|
126
126
|
\"\"\"
|
127
|
-
|
127
|
+
|
128
128
|
La la la
|
129
|
-
|
129
|
+
|
130
130
|
Examples:
|
131
131
|
| one | two |
|
132
132
|
| foo | bar |
|
133
|
-
|
133
|
+
|
134
134
|
\"\"\"
|
135
135
|
Oh Hello
|
136
136
|
\"\"\"
|
137
|
-
|
137
|
+
|
138
138
|
# Body of the scenario outline starts below
|
139
139
|
Given <something>
|
140
140
|
And something <else>
|
141
|
-
|
141
|
+
|
142
142
|
# The real examples table
|
143
143
|
Examples:
|
144
144
|
| something | else |
|
145
145
|
| orange | apple |
|
146
146
|
"""
|
147
|
-
|
147
|
+
Then there should be no parse errors
|
148
148
|
|
149
149
|
Scenario: Scenario Outline with multiple Example groups
|
150
150
|
Given the following text is parsed:
|
151
151
|
"""
|
152
152
|
Feature: Outline Sample
|
153
|
-
|
153
|
+
|
154
154
|
Scenario: I have no steps
|
155
|
-
|
155
|
+
|
156
156
|
Scenario Outline: Test state
|
157
157
|
Given <state> without a table
|
158
158
|
Given <other_state> without a table
|
159
|
-
|
159
|
+
|
160
160
|
Examples: Rainbow colours
|
161
|
-
|
|
162
|
-
| missing |
|
163
|
-
| passing| passing
|
164
|
-
| failing | passing
|
161
|
+
| state | other_state |
|
162
|
+
| missing | passing |
|
163
|
+
| passing | passing |
|
164
|
+
| failing | passing |
|
165
165
|
|
166
166
|
Examples: Only passing
|
167
|
-
|
|
168
|
-
| passing
|
167
|
+
| state | other_state |
|
168
|
+
| passing | passing |
|
169
169
|
"""
|
170
170
|
Then there should be no parse errors
|
171
171
|
|
@@ -175,20 +175,20 @@ Feature: Gherkin Feature lexer
|
|
175
175
|
Feature: Test
|
176
176
|
Scenario Outline: with step tables
|
177
177
|
Given I have the following fruits in my pantry
|
178
|
-
|
|
179
|
-
| cucumbers |
|
180
|
-
| strawberrys |
|
181
|
-
| apricots |
|
182
|
-
|
178
|
+
| name | quantity |
|
179
|
+
| cucumbers | 10 |
|
180
|
+
| strawberrys | 5 |
|
181
|
+
| apricots | 7 |
|
182
|
+
|
183
183
|
When I eat <number> <fruits> from the pantry
|
184
184
|
Then I should have <left> <fruits> in the pantry
|
185
|
-
|
185
|
+
|
186
186
|
Examples:
|
187
|
-
| number |
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
187
|
+
| number | fruits | left |
|
188
|
+
| 2 | cucumbers | 8 |
|
189
|
+
| 4 | strawberrys | 1 |
|
190
|
+
| 2 | apricots | 5 |
|
191
|
+
|
192
192
|
Scenario Outline: placeholder in a multiline string
|
193
193
|
Given my shopping list
|
194
194
|
\"\"\"
|
@@ -198,9 +198,9 @@ Feature: Gherkin Feature lexer
|
|
198
198
|
\"\"\"
|
199
199
|
Must buy some cucumbers
|
200
200
|
\"\"\"
|
201
|
-
|
201
|
+
|
202
202
|
Examples:
|
203
|
-
|
|
203
|
+
| fruits |
|
204
204
|
| cucumbers |
|
205
205
|
"""
|
206
206
|
Then there should be no parse errors
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Feature: Native (C/Java) Lexer
|
2
2
|
|
3
|
-
Background:
|
3
|
+
Background:
|
4
4
|
Given a "en", "native" "root" parser
|
5
5
|
|
6
6
|
Scenario: Parsing an empty feature
|
@@ -9,7 +9,7 @@ Feature: Native (C/Java) Lexer
|
|
9
9
|
Feature: blah
|
10
10
|
"""
|
11
11
|
Then there should be no parse errors
|
12
|
-
|
12
|
+
|
13
13
|
Scenario: Parsing a comment
|
14
14
|
Given the following text is parsed:
|
15
15
|
"""
|
@@ -4,7 +4,7 @@ Feature: Gherkin Feature lexer/parser
|
|
4
4
|
I want a feature lexer that uses a feature parser to
|
5
5
|
make all the syntax decisions for me
|
6
6
|
|
7
|
-
Background:
|
7
|
+
Background:
|
8
8
|
Given a "en", "native" "root" parser
|
9
9
|
|
10
10
|
Scenario: Correctly formed feature
|
@@ -27,7 +27,7 @@ Feature: Gherkin Feature lexer/parser
|
|
27
27
|
When I put it in the transmogrifier
|
28
28
|
And I press the "transmogrify" button
|
29
29
|
Then I should have a whatzit
|
30
|
-
|
30
|
+
|
31
31
|
Scenario Outline: Imaginary Beings
|
32
32
|
Given I have a <boring being>
|
33
33
|
When I transmogrify it with the incantation:
|
@@ -35,7 +35,7 @@ Feature: Gherkin Feature lexer/parser
|
|
35
35
|
ALAKAZAM!
|
36
36
|
\"\"\"
|
37
37
|
Then I should have an <exciting being>
|
38
|
-
|
38
|
+
|
39
39
|
Examples:
|
40
40
|
| boring being | exciting being |
|
41
41
|
| Sparrow | Alicanto |
|
@@ -59,8 +59,8 @@ Feature: Gherkin Feature lexer/parser
|
|
59
59
|
When I read it
|
60
60
|
Then I should be amused
|
61
61
|
"""
|
62
|
-
|
63
|
-
|
62
|
+
Then there should be no parse errors
|
63
|
+
|
64
64
|
Scenario: Keyword before feature
|
65
65
|
When the following text is parsed:
|
66
66
|
"""
|
@@ -90,7 +90,7 @@ Feature: Gherkin Feature lexer/parser
|
|
90
90
|
Then it shouldn't work
|
91
91
|
"""
|
92
92
|
Then there should be parse errors on lines 5, 10 and 12
|
93
|
-
|
93
|
+
|
94
94
|
Scenario: Tables
|
95
95
|
When the following text is parsed:
|
96
96
|
"""
|
@@ -123,44 +123,44 @@ Feature: Gherkin Feature lexer/parser
|
|
123
123
|
\"\"\" # Not interpreted as a pystring, just plain text
|
124
124
|
Oh hai
|
125
125
|
\"\"\"
|
126
|
-
|
126
|
+
|
127
127
|
La la la
|
128
|
-
|
128
|
+
|
129
129
|
Examples:
|
130
130
|
| one | two |
|
131
131
|
| foo | bar |
|
132
|
-
|
132
|
+
|
133
133
|
\"\"\"
|
134
134
|
Oh Hello
|
135
135
|
\"\"\"
|
136
|
-
|
136
|
+
|
137
137
|
# Body of the scenario outline starts below
|
138
138
|
Given <something>
|
139
139
|
And something <else>
|
140
|
-
|
140
|
+
|
141
141
|
# The real examples table
|
142
142
|
Examples:
|
143
143
|
| something | else |
|
144
144
|
| orange | apple |
|
145
145
|
"""
|
146
|
-
|
146
|
+
Then there should be no parse errors
|
147
147
|
|
148
148
|
Scenario: Scenario Outline with multiple Example groups
|
149
149
|
When the following text is parsed:
|
150
150
|
"""
|
151
151
|
Feature: Outline Sample
|
152
|
-
|
152
|
+
|
153
153
|
Scenario: I have no steps
|
154
|
-
|
154
|
+
|
155
155
|
Scenario Outline: Test state
|
156
156
|
Given <state> without a table
|
157
157
|
Given <other_state> without a table
|
158
|
-
|
158
|
+
|
159
159
|
Examples: Rainbow colours
|
160
|
-
|
|
161
|
-
| missing |
|
162
|
-
| passing| passing
|
163
|
-
| failing | passing
|
160
|
+
| state | other_state |
|
161
|
+
| missing | passing |
|
162
|
+
| passing | passing |
|
163
|
+
| failing | passing |
|
164
164
|
|
165
165
|
Examples: Only passing
|
166
166
|
| state | other_state |
|
@@ -174,20 +174,20 @@ Feature: Gherkin Feature lexer/parser
|
|
174
174
|
Feature: Test
|
175
175
|
Scenario Outline: with step tables
|
176
176
|
Given I have the following fruits in my pantry
|
177
|
-
|
|
178
|
-
| cucumbers |
|
179
|
-
| strawberrys |
|
180
|
-
| apricots |
|
181
|
-
|
177
|
+
| name | quantity |
|
178
|
+
| cucumbers | 10 |
|
179
|
+
| strawberrys | 5 |
|
180
|
+
| apricots | 7 |
|
181
|
+
|
182
182
|
When I eat <number> <fruits> from the pantry
|
183
183
|
Then I should have <left> <fruits> in the pantry
|
184
|
-
|
184
|
+
|
185
185
|
Examples:
|
186
|
-
| number |
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
186
|
+
| number | fruits | left |
|
187
|
+
| 2 | cucumbers | 8 |
|
188
|
+
| 4 | strawberrys | 1 |
|
189
|
+
| 2 | apricots | 5 |
|
190
|
+
|
191
191
|
Scenario Outline: placeholder in a multiline string
|
192
192
|
Given my shopping list
|
193
193
|
\"\"\"
|
@@ -197,9 +197,9 @@ Feature: Gherkin Feature lexer/parser
|
|
197
197
|
\"\"\"
|
198
198
|
Must buy some cucumbers
|
199
199
|
\"\"\"
|
200
|
-
|
200
|
+
|
201
201
|
Examples:
|
202
|
-
|
|
202
|
+
| fruits |
|
203
203
|
| cucumbers |
|
204
204
|
"""
|
205
205
|
Then there should be no parse errors
|