gherkin 1.0.5-java → 1.0.6-java

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ rdoc
5
5
  pkg
6
6
  ext
7
7
  tmp
8
+ release
@@ -1,4 +1,15 @@
1
- == 1.0.5 (2009-04-08)
1
+ == 1.0.6 (2010-04-10)
2
+
3
+ === New Features
4
+ * Fully automated release process. (Aslak Hellesøy)
5
+
6
+ === Changed Features
7
+ * Made generated classes use a more uniform naming convention. (Aslak Hellesøy)
8
+
9
+ === Removed Features
10
+ * Removed C# port, obsoleted by IKVM build from 1.0.5. (Aslak Hellesøy)
11
+
12
+ == 1.0.5 (2010-04-08)
2
13
 
3
14
  === New Features
4
15
  * New .NET build of gherkin - an ikvmc build of gherkin.jar to gherkin.dll. (Aslak Hellesøy)
@@ -6,7 +17,7 @@
6
17
  === Bugfixes
7
18
  * Made parsers reusable so that the same instance can parse several features. (Aslak Hellesøy)
8
19
 
9
- == 1.0.4 (2009-04-07)
20
+ == 1.0.4 (2010-04-07)
10
21
 
11
22
  === New features
12
23
  * Pure java releases of Gherkin at http://cukes.info/maven
@@ -15,7 +26,7 @@
15
26
  === Changed features
16
27
  * The Lexer now emits the '@' for tags. (Aslak Hellesøy)
17
28
 
18
- == 1.0.3 (2009-03-31)
29
+ == 1.0.3 (2010-03-31)
19
30
 
20
31
  === Bugfixes
21
32
  * The C lexer correctly instantiates a new array for each table, instead of reusing the old one. (Aslak Hellesøy)
@@ -28,21 +28,10 @@ E.g. in Bash, export RL_LANG="en,fr,no". This can be quite helpful when modifyin
28
28
 
29
29
  == Release process
30
30
 
31
- * Bump version in the VERSION file
32
- * Do a file search and replace from old version number to new one.
33
- * Run "rake clean spec cucumber" for each platform (1.8.6, 1.8.7, 1.9, jruby) to make sure all is green.
34
- * rvm 1.8.7
35
- * rake clean jar compile
36
- * rake gemspec
37
- * git commit -a -m "Release vX.Y.Z"
38
- * rake gemcutter:release
39
- * rake git:release
40
- * ./nativegems.sh
41
- * gem push pkg/... (for each native gem)
42
- * cd java && mvn deploy
43
- * rake ikvm
44
- * Upload pkg/gherkin-X.Y.Z.dll to Github: http://github.com/aslakhellesoy/gherkin/downloads
45
-
31
+ * Bump version in the VERSION.yml file and:
32
+ ** java/pom.xml
33
+ ** ikvm/Gherkin/Gherkin,csproj
34
+ * rake release:ALL
46
35
  * Announce on Cucumber list, IRC and Twitter.
47
36
 
48
37
  == Configuring Rake-Compiler for cross compilation
data/Rakefile CHANGED
@@ -22,9 +22,7 @@ begin
22
22
  gem.add_development_dependency "rspec", ">= 1.3.0"
23
23
  gem.add_development_dependency "cucumber", ">= 0.6.4"
24
24
  gem.add_development_dependency "rake-compiler", ">= 0.7.0" unless defined?(JRUBY_VERSION)
25
- gem.add_development_dependency "albacore", ">= 0.1.2"
26
25
 
27
- gem.files -= FileList['dotnet/**/*']
28
26
  gem.files -= FileList['ikvm/**/*']
29
27
  gem.files -= FileList['java/**/*']
30
28
  case ENV['PLATFORM']
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 0
3
- :patch: 5
3
+ :patch: 6
4
4
  :major: 1
@@ -1,10 +1,8 @@
1
1
  module Gherkin
2
2
  module CLexer
3
- def self.[](i18n_language_name)
4
- name = i18n_language_name.gsub(/[\s-]/, '')
5
- require "gherkin_lexer_#{name}"
6
- i18n_lexer_class_name = name.capitalize
7
- const_get(i18n_lexer_class_name)
3
+ def self.[](i18n_sanitized_key)
4
+ require "gherkin_lexer_#{i18n_sanitized_key}"
5
+ const_get(i18n_sanitized_key.capitalize)
8
6
  end
9
7
  end
10
8
  end
@@ -65,16 +65,16 @@ module Gherkin
65
65
 
66
66
  def c(listener)
67
67
  require 'gherkin/c_lexer'
68
- CLexer[@key].new(listener)
68
+ CLexer[sanitized_key].new(listener)
69
69
  end
70
70
 
71
71
  def rb(listener)
72
72
  require 'gherkin/rb_lexer'
73
- RbLexer[@key].new(listener)
73
+ RbLexer[sanitized_key].new(listener)
74
74
  end
75
75
 
76
76
  def sanitized_key
77
- @key.gsub(/[\s-]/, '')
77
+ @key.gsub(/[\s-]/, '_').downcase
78
78
  end
79
79
 
80
80
  def incomplete?
@@ -495,6 +495,19 @@
495
495
  then: "*|O zaman"
496
496
  and: "*|Ve"
497
497
  but: "*|Fakat|Ama"
498
+ "uk":
499
+ name: Ukrainian
500
+ native: Українська
501
+ feature: Функціонал
502
+ background: Передумова
503
+ scenario: Сценарій
504
+ scenario_outline: Структура сценарію
505
+ examples: Приклади
506
+ given: "*|Припустимо|Припустимо, що|Нехай"
507
+ when: "*|Якщо"
508
+ then: "*|То"
509
+ and: "*|І"
510
+ but: "*|Але"
498
511
  "uz":
499
512
  name: Uzbek
500
513
  native: Узбекча
@@ -1,10 +1,8 @@
1
1
  module Gherkin
2
2
  module RbLexer
3
- def self.[](i18n_language_name)
4
- name = i18n_language_name.gsub(/[\s-]/, '')
5
- require "gherkin/rb_lexer/#{name}"
6
- i18n_lexer_class_name = name.capitalize
7
- const_get(i18n_lexer_class_name)
3
+ def self.[](i18n_sanitized_key)
4
+ require "gherkin/rb_lexer/#{i18n_sanitized_key}"
5
+ const_get(i18n_sanitized_key.capitalize)
8
6
  end
9
7
  end
10
8
  end
@@ -8,7 +8,7 @@ import gherkin.Lexer;
8
8
  import gherkin.Listener;
9
9
  import gherkin.LexingError;
10
10
 
11
- public class <%= @i18n.sanitized_key.capitalize %> implements Lexer {
11
+ public class <%= @i18n.sanitized_key.upcase %> implements Lexer {
12
12
  %%{
13
13
  machine lexer;
14
14
  alphtype byte;
@@ -134,7 +134,7 @@ public class <%= @i18n.sanitized_key.capitalize %> implements Lexer {
134
134
 
135
135
  private final Listener listener;
136
136
 
137
- public <%= @i18n.sanitized_key.capitalize %>(Listener listener) {
137
+ public <%= @i18n.sanitized_key.upcase %>(Listener listener) {
138
138
  this.listener = listener;
139
139
  }
140
140
 
@@ -8,10 +8,7 @@ CLEAN.include [
8
8
  'ragel/i18n/*.rl',
9
9
  'lib/gherkin/rb_lexer/*.rb',
10
10
  'ext/**/*.c',
11
- 'java/src/gherkin/lexer/*.java',
12
- 'dotnet/Gherkin/Lexer',
13
- 'dotnet/Gherkin/obj',
14
- 'dotnet/Gherkin/bin'
11
+ 'java/src/main/java/gherkin/lexer/*.java'
15
12
  ]
16
13
 
17
14
  desc "Compile the Java extensions"
@@ -21,83 +18,14 @@ file 'lib/gherkin.jar' => Dir['java/src/main/java/**/*.java'] do
21
18
  sh("mvn -f java/pom.xml package")
22
19
  end
23
20
 
24
- namespace :dotnet do
25
- require 'albacore'
26
-
27
- FileList['lib/gherkin/parser/*'].each do |src|
28
- dst = "dotnet/Gherkin/StateMachine/#{File.basename(src)}"
29
- file dst => src do
30
- cp src, dst, :verbose => true
31
- end
32
- task :compile => dst
33
- end
34
-
35
- task :compile => :lexer
36
-
37
- if (`which mono` rescue "") =~ /mono/
38
- xbuild :compile do |msb|
39
- msb.properties :configuration => :Release
40
- msb.targets :Build
41
- msb.solution = 'dotnet/Gherkin.sln'
42
- end
43
-
44
- require 'rake/xunittask'
45
- class XUnitTestRunner
46
- def execute
47
- system("mono dotnet/lib/xunit/xunit.console.exe dotnet/Gherkin.Tests/bin/Release/Gherkin.Tests.dll")
48
- exit 1 if $? != 0
49
- end
50
- end
51
- else
52
- msbuild :compile do |msb|
53
- msb.properties :configuration => :Release
54
- msb.targets :Build
55
- msb.solution = 'dotnet/Gherkin.sln'
56
- end
57
- end
58
-
59
- xunit :test => :compile do |xunit|
60
- xunit.path_to_command = "dotnet/lib/xunit/xunit.console.exe"
61
- xunit.assembly = "dotnet/Gherkin.Tests/bin/Release/Gherkin.Tests.dll"
62
- end
63
-
64
- task :package => :test do
65
- cp 'dotnet/Gherkin/bin/Release/Gherkin.dll', 'lib/Gherkin.dll'
66
- end
67
- end
68
-
69
- desc "Compile and package the .NET extensions"
70
- task :dotnet => ['dotnet:package']
71
-
72
- class CSharpSByteFixTask
73
- def initialize(source)
74
- @source = source
75
- define_tasks
76
- end
77
-
78
- def define_tasks
79
- directory File.dirname(target)
80
- file target => [File.dirname(target), @source] do
81
- sh "cat #{@source} | sed ""s/sbyte/short/g"" > #{target}"
82
- end
83
- end
84
-
85
- def target
86
- "dotnet/Gherkin/Lexer/#{File.basename(@source)}"
87
- end
88
- end
89
-
90
21
  rl_langs = ENV['RL_LANGS'] ? ENV['RL_LANGS'].split(',') : []
91
22
  langs = Gherkin::I18n.all.select { |lang| rl_langs.empty? || rl_langs.include?(lang.key) }
92
23
 
93
24
  langs.each do |i18n|
94
25
  java = RagelTask.new('java', i18n)
95
26
  rb = RagelTask.new('rb', i18n)
96
- csharp_tmp = RagelTask.new('csharp', i18n)
97
- csharp = CSharpSByteFixTask.new(csharp_tmp.target)
98
27
 
99
- task :jar => [java.target, rb.target]
100
- task 'dotnet:lexer' => csharp.target
28
+ file 'lib/gherkin.jar' => [java.target, rb.target]
101
29
 
102
30
  begin
103
31
  unless defined?(JRUBY_VERSION)
@@ -0,0 +1,31 @@
1
+ namespace :gems do
2
+ desc 'Release JRuby gem'
3
+ task :jruby => :release_dir do
4
+ sh "rvm jruby rake clean spec gemspec build PLATFORM=java"
5
+ mv "pkg/gherkin-#{GHERKIN_VERSION}-java.gem", 'release'
6
+ end
7
+
8
+ desc "Release MRI/C POSIX gem"
9
+ task :posix => :release_dir do
10
+ sh "rvm 1.8.7 rake clean spec gemspec build"
11
+ mv "pkg/gherkin-#{GHERKIN_VERSION}.gem", 'release'
12
+ end
13
+
14
+ [:mswin32, :mingw32].each do |win_compiler|
15
+ desc "Release MRI/C precompiled #{win_compiler} gem"
16
+ task win_compiler => :posix do
17
+ sh "rvm 1.8.7 rake cross compile gemspec build PLATFORM=i386-#{win_compiler} RUBY_CC_VERSION=1.8.6"
18
+ mv "pkg/gherkin-#{GHERKIN_VERSION}-x86-#{win_compiler}.gem", 'release'
19
+ end
20
+ end
21
+
22
+ task :release_dir do
23
+ mkdir 'release' unless File.directory?('release')
24
+ end
25
+
26
+ task :clean_release_dir do
27
+ rm_rf 'release' if File.directory?('release')
28
+ end
29
+ end
30
+
31
+ task :gems => ['gems:clean_release_dir', 'gems:jruby', 'gems:posix', 'gems:mswin32', 'gems:mingw32']
@@ -26,19 +26,19 @@ namespace :ikvm do
26
26
  task :dll => 'pkg/gherkin.dll'
27
27
 
28
28
  file 'pkg/gherkin.exe' => 'lib/gherkin.jar' do
29
- mkdir_p 'pkg' unless File.directory?('pkg')
30
- sh("mono /usr/local/ikvm/bin/ikvmc.exe -target:exe lib/gherkin.jar -out:pkg/gherkin-#{GHERKIN_VERSION}.exe")
29
+ mkdir_p 'release' unless File.directory?('release')
30
+ sh("mono /usr/local/ikvm/bin/ikvmc.exe -target:exe lib/gherkin.jar -out:release/gherkin-#{GHERKIN_VERSION}.exe")
31
31
  end
32
32
 
33
33
  file 'pkg/gherkin.dll' => 'lib/gherkin.jar' do
34
- mkdir_p 'pkg' unless File.directory?('pkg')
35
- sh("mono /usr/local/ikvm/bin/ikvmc.exe -target:library lib/gherkin.jar -out:pkg/gherkin-#{GHERKIN_VERSION}.dll")
34
+ mkdir_p 'release' unless File.directory?('release')
35
+ sh("mono /usr/local/ikvm/bin/ikvmc.exe -target:library lib/gherkin.jar -out:release/gherkin-#{GHERKIN_VERSION}.dll")
36
36
  end
37
37
 
38
38
  desc 'Copy the IKVM .dll files over to the pkg dir'
39
39
  task :copy_ikvm_dlls do
40
40
  Dir['/usr/local/ikvm/bin/{IKVM.OpenJDK.Core,IKVM.OpenJDK.Text,IKVM.Runtime}.dll'].each do |dll|
41
- cp dll, 'pkg'
41
+ cp dll, 'release'
42
42
  end
43
43
  end
44
44
  end
@@ -28,7 +28,7 @@ class RagelTask
28
28
  def target
29
29
  {
30
30
  'c' => "ext/gherkin_lexer_#{@i18n.sanitized_key}/gherkin_lexer_#{@i18n.sanitized_key}.c",
31
- 'java' => "java/src/main/java/gherkin/lexer/#{@i18n.sanitized_key.capitalize}.java",
31
+ 'java' => "java/src/main/java/gherkin/lexer/#{@i18n.sanitized_key.upcase}.java",
32
32
  'rb' => "lib/gherkin/rb_lexer/#{@i18n.sanitized_key}.rb",
33
33
  'csharp' => "tmp/#{@i18n.sanitized_key}.cs"
34
34
  }[@lang]
@@ -0,0 +1,26 @@
1
+ namespace :release do
2
+ desc 'Uplad all packages and tag git'
3
+ task :ALL => [:_gems, :dll, :jar, 'git:release']
4
+
5
+ task :_gems => :gems do
6
+ Dir.chdir('release') do
7
+ Dir['*.gem'].each do |gem_file|
8
+ sh("gem push #{gem_file}")
9
+ end
10
+ end
11
+ end
12
+
13
+ task :dll => :ikvm do
14
+ Dir.chdir('release') do
15
+ # This requires aslakhellesoy's build of the github gem,
16
+ # which has tekkub's upload command.
17
+ sh("github upload #{Dir['gherkin*.dll'][0]}")
18
+ end
19
+ end
20
+
21
+ task :jar do
22
+ Dir.chdir('java') do
23
+ sh("mvn deploy")
24
+ end
25
+ end
26
+ end
metadata CHANGED
@@ -1,247 +1,199 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gherkin
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 0
8
- - 5
9
- version: 1.0.5
4
+ version: 1.0.6
10
5
  platform: java
11
6
  authors:
12
- - Mike Sassak
13
- - Gregory Hnatiuk
14
- - "Aslak Helles\xC3\xB8y"
7
+ - Mike Sassak
8
+ - Gregory Hnatiuk
9
+ - "Aslak Helles\xC3\xB8y"
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
13
 
19
- date: 2010-04-08 00:00:00 +02:00
14
+ date: 2010-04-10 00:00:00 +02:00
20
15
  default_executable: gherkin
21
16
  dependencies:
22
- - !ruby/object:Gem::Dependency
23
- name: trollop
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- segments:
30
- - 1
31
- - 15
32
- version: "1.15"
33
- type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: rspec
37
- prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- segments:
43
- - 1
44
- - 3
45
- - 0
46
- version: 1.3.0
47
- type: :development
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
- name: cucumber
51
- prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- segments:
57
- - 0
58
- - 6
59
- - 4
60
- version: 0.6.4
61
- type: :development
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
64
- name: rake-compiler
65
- prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- segments:
71
- - 0
72
- - 7
73
- - 0
74
- version: 0.7.0
75
- type: :development
76
- version_requirements: *id004
77
- - !ruby/object:Gem::Dependency
78
- name: albacore
79
- prerelease: false
80
- requirement: &id005 !ruby/object:Gem::Requirement
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- segments:
85
- - 0
86
- - 1
87
- - 2
88
- version: 0.1.2
89
- type: :development
90
- version_requirements: *id005
17
+ - !ruby/object:Gem::Dependency
18
+ name: trollop
19
+ type: :runtime
20
+ version_requirement:
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: "1.15"
26
+ version:
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ type: :development
30
+ version_requirement:
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 1.3.0
36
+ version:
37
+ - !ruby/object:Gem::Dependency
38
+ name: cucumber
39
+ type: :development
40
+ version_requirement:
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.6.4
46
+ version:
91
47
  description: A fast Gherkin lexer/parser based on the Ragel State Machine Compiler.
92
48
  email: cukes@googlegroups.com
93
49
  executables:
94
- - gherkin
50
+ - gherkin
95
51
  extensions: []
96
52
 
97
53
  extra_rdoc_files:
98
- - LICENSE
99
- - README.rdoc
54
+ - LICENSE
55
+ - README.rdoc
100
56
  files:
101
- - .gitattributes
102
- - .gitignore
103
- - .mailmap
104
- - History.txt
105
- - LICENSE
106
- - README.rdoc
107
- - Rakefile
108
- - VERSION.yml
109
- - bin/gherkin
110
- - cucumber.yml
111
- - dotnet/.gitignore
112
- - features/feature_parser.feature
113
- - features/native_lexer.feature
114
- - features/parser_with_native_lexer.feature
115
- - features/pretty_printer.feature
116
- - features/step_definitions/gherkin_steps.rb
117
- - features/step_definitions/pretty_listener_step.rb
118
- - features/steps_parser.feature
119
- - features/support/env.rb
120
- - gherkin.gemspec
121
- - ikvm/.gitignore
122
- - java/.gitignore
123
- - java/Gherkin.iml
124
- - java/src/main/java/gherkin/lexer/.gitignore
125
- - lib/.gitignore
126
- - lib/gherkin.jar
127
- - lib/gherkin.rb
128
- - lib/gherkin/c_lexer.rb
129
- - lib/gherkin/cli/main.rb
130
- - lib/gherkin/core_ext/array.rb
131
- - lib/gherkin/csharp_lexer.rb
132
- - lib/gherkin/formatter/argument.rb
133
- - lib/gherkin/formatter/colors.rb
134
- - lib/gherkin/formatter/monochrome_format.rb
135
- - lib/gherkin/formatter/pretty_listener.rb
136
- - lib/gherkin/i18n.rb
137
- - lib/gherkin/i18n.yml
138
- - lib/gherkin/i18n_lexer.rb
139
- - lib/gherkin/parser/filter_listener.rb
140
- - lib/gherkin/parser/meta.txt
141
- - lib/gherkin/parser/parser.rb
142
- - lib/gherkin/parser/root.txt
143
- - lib/gherkin/parser/sexp.rb
144
- - lib/gherkin/parser/steps.txt
145
- - lib/gherkin/parser/tag_expression.rb
146
- - lib/gherkin/rb_lexer.rb
147
- - lib/gherkin/rb_lexer/.gitignore
148
- - lib/gherkin/rb_lexer/README.rdoc
149
- - lib/gherkin/tools.rb
150
- - lib/gherkin/tools/files.rb
151
- - lib/gherkin/tools/reformat.rb
152
- - lib/gherkin/tools/stats.rb
153
- - lib/gherkin/tools/stats_listener.rb
154
- - nativegems.sh
155
- - ragel/i18n/.gitignore
156
- - ragel/lexer.c.rl.erb
157
- - ragel/lexer.csharp.rl.erb
158
- - ragel/lexer.java.rl.erb
159
- - ragel/lexer.rb.rl.erb
160
- - ragel/lexer_common.rl.erb
161
- - spec/gherkin/c_lexer_spec.rb
162
- - spec/gherkin/csharp_lexer_spec.rb
163
- - spec/gherkin/fixtures/1.feature
164
- - spec/gherkin/fixtures/comments_in_table.feature
165
- - spec/gherkin/fixtures/complex.feature
166
- - spec/gherkin/fixtures/dos_line_endings.feature
167
- - spec/gherkin/fixtures/i18n_fr.feature
168
- - spec/gherkin/fixtures/i18n_no.feature
169
- - spec/gherkin/fixtures/i18n_zh-CN.feature
170
- - spec/gherkin/fixtures/simple.feature
171
- - spec/gherkin/fixtures/simple_with_comments.feature
172
- - spec/gherkin/fixtures/simple_with_tags.feature
173
- - spec/gherkin/formatter/argument_spec.rb
174
- - spec/gherkin/formatter/colors_spec.rb
175
- - spec/gherkin/formatter/pretty_listener_spec.rb
176
- - spec/gherkin/i18n_lexer_spec.rb
177
- - spec/gherkin/i18n_spec.rb
178
- - spec/gherkin/java_lexer_spec.rb
179
- - spec/gherkin/parser/filter_listener_spec.rb
180
- - spec/gherkin/parser/parser_spec.rb
181
- - spec/gherkin/parser/tag_expression_spec.rb
182
- - spec/gherkin/rb_lexer_spec.rb
183
- - spec/gherkin/sexp_recorder.rb
184
- - spec/gherkin/shared/lexer_spec.rb
185
- - spec/gherkin/shared/py_string_spec.rb
186
- - spec/gherkin/shared/row_spec.rb
187
- - spec/gherkin/shared/tags_spec.rb
188
- - spec/spec_helper.rb
189
- - tasks/bench.rake
190
- - tasks/bench/feature_builder.rb
191
- - tasks/bench/generated/.gitignore
192
- - tasks/bench/null_listener.rb
193
- - tasks/compile.rake
194
- - tasks/cucumber.rake
195
- - tasks/ikvm.rake
196
- - tasks/ragel_task.rb
197
- - tasks/rdoc.rake
198
- - tasks/rspec.rake
57
+ - .gitattributes
58
+ - .gitignore
59
+ - .mailmap
60
+ - History.txt
61
+ - LICENSE
62
+ - README.rdoc
63
+ - Rakefile
64
+ - VERSION.yml
65
+ - bin/gherkin
66
+ - cucumber.yml
67
+ - features/feature_parser.feature
68
+ - features/native_lexer.feature
69
+ - features/parser_with_native_lexer.feature
70
+ - features/pretty_printer.feature
71
+ - features/step_definitions/gherkin_steps.rb
72
+ - features/step_definitions/pretty_listener_step.rb
73
+ - features/steps_parser.feature
74
+ - features/support/env.rb
75
+ - ikvm/.gitignore
76
+ - java/.gitignore
77
+ - java/src/main/java/gherkin/lexer/.gitignore
78
+ - lib/.gitignore
79
+ - lib/gherkin.jar
80
+ - lib/gherkin.rb
81
+ - lib/gherkin/c_lexer.rb
82
+ - lib/gherkin/cli/main.rb
83
+ - lib/gherkin/core_ext/array.rb
84
+ - lib/gherkin/csharp_lexer.rb
85
+ - lib/gherkin/formatter/argument.rb
86
+ - lib/gherkin/formatter/colors.rb
87
+ - lib/gherkin/formatter/monochrome_format.rb
88
+ - lib/gherkin/formatter/pretty_listener.rb
89
+ - lib/gherkin/i18n.rb
90
+ - lib/gherkin/i18n.yml
91
+ - lib/gherkin/i18n_lexer.rb
92
+ - lib/gherkin/parser/filter_listener.rb
93
+ - lib/gherkin/parser/meta.txt
94
+ - lib/gherkin/parser/parser.rb
95
+ - lib/gherkin/parser/root.txt
96
+ - lib/gherkin/parser/sexp.rb
97
+ - lib/gherkin/parser/steps.txt
98
+ - lib/gherkin/parser/tag_expression.rb
99
+ - lib/gherkin/rb_lexer.rb
100
+ - lib/gherkin/rb_lexer/.gitignore
101
+ - lib/gherkin/rb_lexer/README.rdoc
102
+ - lib/gherkin/tools.rb
103
+ - lib/gherkin/tools/files.rb
104
+ - lib/gherkin/tools/reformat.rb
105
+ - lib/gherkin/tools/stats.rb
106
+ - lib/gherkin/tools/stats_listener.rb
107
+ - nativegems.sh
108
+ - ragel/i18n/.gitignore
109
+ - ragel/lexer.c.rl.erb
110
+ - ragel/lexer.java.rl.erb
111
+ - ragel/lexer.rb.rl.erb
112
+ - ragel/lexer_common.rl.erb
113
+ - spec/gherkin/c_lexer_spec.rb
114
+ - spec/gherkin/csharp_lexer_spec.rb
115
+ - spec/gherkin/fixtures/1.feature
116
+ - spec/gherkin/fixtures/comments_in_table.feature
117
+ - spec/gherkin/fixtures/complex.feature
118
+ - spec/gherkin/fixtures/dos_line_endings.feature
119
+ - spec/gherkin/fixtures/i18n_fr.feature
120
+ - spec/gherkin/fixtures/i18n_no.feature
121
+ - spec/gherkin/fixtures/i18n_zh-CN.feature
122
+ - spec/gherkin/fixtures/simple.feature
123
+ - spec/gherkin/fixtures/simple_with_comments.feature
124
+ - spec/gherkin/fixtures/simple_with_tags.feature
125
+ - spec/gherkin/formatter/argument_spec.rb
126
+ - spec/gherkin/formatter/colors_spec.rb
127
+ - spec/gherkin/formatter/pretty_listener_spec.rb
128
+ - spec/gherkin/i18n_lexer_spec.rb
129
+ - spec/gherkin/i18n_spec.rb
130
+ - spec/gherkin/java_lexer_spec.rb
131
+ - spec/gherkin/parser/filter_listener_spec.rb
132
+ - spec/gherkin/parser/parser_spec.rb
133
+ - spec/gherkin/parser/tag_expression_spec.rb
134
+ - spec/gherkin/rb_lexer_spec.rb
135
+ - spec/gherkin/sexp_recorder.rb
136
+ - spec/gherkin/shared/lexer_spec.rb
137
+ - spec/gherkin/shared/py_string_spec.rb
138
+ - spec/gherkin/shared/row_spec.rb
139
+ - spec/gherkin/shared/tags_spec.rb
140
+ - spec/spec_helper.rb
141
+ - tasks/bench.rake
142
+ - tasks/bench/feature_builder.rb
143
+ - tasks/bench/generated/.gitignore
144
+ - tasks/bench/null_listener.rb
145
+ - tasks/compile.rake
146
+ - tasks/cucumber.rake
147
+ - tasks/gems.rake
148
+ - tasks/ikvm.rake
149
+ - tasks/ragel_task.rb
150
+ - tasks/rdoc.rake
151
+ - tasks/release.rake
152
+ - tasks/rspec.rake
199
153
  has_rdoc: true
200
154
  homepage: http://github.com/aslakhellesoy/gherkin
201
155
  licenses: []
202
156
 
203
157
  post_install_message:
204
158
  rdoc_options:
205
- - --charset=UTF-8
159
+ - --charset=UTF-8
206
160
  require_paths:
207
- - lib
161
+ - lib
208
162
  required_ruby_version: !ruby/object:Gem::Requirement
209
163
  requirements:
210
- - - ">="
211
- - !ruby/object:Gem::Version
212
- segments:
213
- - 0
214
- version: "0"
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: "0"
167
+ version:
215
168
  required_rubygems_version: !ruby/object:Gem::Requirement
216
169
  requirements:
217
- - - ">="
218
- - !ruby/object:Gem::Version
219
- segments:
220
- - 0
221
- version: "0"
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: "0"
173
+ version:
222
174
  requirements: []
223
175
 
224
176
  rubyforge_project:
225
- rubygems_version: 1.3.6
177
+ rubygems_version: 1.3.5
226
178
  signing_key:
227
179
  specification_version: 3
228
180
  summary: Fast Gherkin lexer/parser
229
181
  test_files:
230
- - spec/gherkin/c_lexer_spec.rb
231
- - spec/gherkin/csharp_lexer_spec.rb
232
- - spec/gherkin/formatter/argument_spec.rb
233
- - spec/gherkin/formatter/colors_spec.rb
234
- - spec/gherkin/formatter/pretty_listener_spec.rb
235
- - spec/gherkin/i18n_lexer_spec.rb
236
- - spec/gherkin/i18n_spec.rb
237
- - spec/gherkin/java_lexer_spec.rb
238
- - spec/gherkin/parser/filter_listener_spec.rb
239
- - spec/gherkin/parser/parser_spec.rb
240
- - spec/gherkin/parser/tag_expression_spec.rb
241
- - spec/gherkin/rb_lexer_spec.rb
242
- - spec/gherkin/sexp_recorder.rb
243
- - spec/gherkin/shared/lexer_spec.rb
244
- - spec/gherkin/shared/py_string_spec.rb
245
- - spec/gherkin/shared/row_spec.rb
246
- - spec/gherkin/shared/tags_spec.rb
247
- - spec/spec_helper.rb
182
+ - spec/spec_helper.rb
183
+ - spec/gherkin/c_lexer_spec.rb
184
+ - spec/gherkin/csharp_lexer_spec.rb
185
+ - spec/gherkin/i18n_lexer_spec.rb
186
+ - spec/gherkin/i18n_spec.rb
187
+ - spec/gherkin/java_lexer_spec.rb
188
+ - spec/gherkin/rb_lexer_spec.rb
189
+ - spec/gherkin/sexp_recorder.rb
190
+ - spec/gherkin/formatter/argument_spec.rb
191
+ - spec/gherkin/formatter/colors_spec.rb
192
+ - spec/gherkin/formatter/pretty_listener_spec.rb
193
+ - spec/gherkin/parser/filter_listener_spec.rb
194
+ - spec/gherkin/parser/parser_spec.rb
195
+ - spec/gherkin/parser/tag_expression_spec.rb
196
+ - spec/gherkin/shared/lexer_spec.rb
197
+ - spec/gherkin/shared/py_string_spec.rb
198
+ - spec/gherkin/shared/row_spec.rb
199
+ - spec/gherkin/shared/tags_spec.rb
@@ -1,13 +0,0 @@
1
- *.user
2
- *.suo
3
- bin
4
- obj
5
- Gherkin/StateMachine/meta.txt
6
- Gherkin/StateMachine/root.txt
7
- Gherkin/StateMachine/steps.txt
8
- Gherkin/Lexer/*.cs
9
- *.sln.cache
10
- _ReSharper*
11
- Gherkin.sln.proj
12
- *.pidb
13
- *.userprefs
@@ -1,173 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{gherkin}
8
- s.version = "1.0.5"
9
- s.platform = %q{java}
10
-
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.authors = ["Mike Sassak", "Gregory Hnatiuk", "Aslak Helles\303\270y"]
13
- s.date = %q{2010-04-08}
14
- s.default_executable = %q{gherkin}
15
- s.description = %q{A fast Gherkin lexer/parser based on the Ragel State Machine Compiler.}
16
- s.email = %q{cukes@googlegroups.com}
17
- s.executables = ["gherkin"]
18
- s.extra_rdoc_files = [
19
- "LICENSE",
20
- "README.rdoc"
21
- ]
22
- s.files = [
23
- ".gitattributes",
24
- ".gitignore",
25
- ".mailmap",
26
- "History.txt",
27
- "LICENSE",
28
- "README.rdoc",
29
- "Rakefile",
30
- "VERSION.yml",
31
- "bin/gherkin",
32
- "cucumber.yml",
33
- "dotnet/.gitignore",
34
- "features/feature_parser.feature",
35
- "features/native_lexer.feature",
36
- "features/parser_with_native_lexer.feature",
37
- "features/pretty_printer.feature",
38
- "features/step_definitions/gherkin_steps.rb",
39
- "features/step_definitions/pretty_listener_step.rb",
40
- "features/steps_parser.feature",
41
- "features/support/env.rb",
42
- "gherkin.gemspec",
43
- "ikvm/.gitignore",
44
- "java/.gitignore",
45
- "java/Gherkin.iml",
46
- "java/src/main/java/gherkin/lexer/.gitignore",
47
- "lib/.gitignore",
48
- "lib/gherkin.jar",
49
- "lib/gherkin.rb",
50
- "lib/gherkin/c_lexer.rb",
51
- "lib/gherkin/cli/main.rb",
52
- "lib/gherkin/core_ext/array.rb",
53
- "lib/gherkin/csharp_lexer.rb",
54
- "lib/gherkin/formatter/argument.rb",
55
- "lib/gherkin/formatter/colors.rb",
56
- "lib/gherkin/formatter/monochrome_format.rb",
57
- "lib/gherkin/formatter/pretty_listener.rb",
58
- "lib/gherkin/i18n.rb",
59
- "lib/gherkin/i18n.yml",
60
- "lib/gherkin/i18n_lexer.rb",
61
- "lib/gherkin/parser/filter_listener.rb",
62
- "lib/gherkin/parser/meta.txt",
63
- "lib/gherkin/parser/parser.rb",
64
- "lib/gherkin/parser/root.txt",
65
- "lib/gherkin/parser/sexp.rb",
66
- "lib/gherkin/parser/steps.txt",
67
- "lib/gherkin/parser/tag_expression.rb",
68
- "lib/gherkin/rb_lexer.rb",
69
- "lib/gherkin/rb_lexer/.gitignore",
70
- "lib/gherkin/rb_lexer/README.rdoc",
71
- "lib/gherkin/tools.rb",
72
- "lib/gherkin/tools/files.rb",
73
- "lib/gherkin/tools/reformat.rb",
74
- "lib/gherkin/tools/stats.rb",
75
- "lib/gherkin/tools/stats_listener.rb",
76
- "nativegems.sh",
77
- "ragel/i18n/.gitignore",
78
- "ragel/lexer.c.rl.erb",
79
- "ragel/lexer.csharp.rl.erb",
80
- "ragel/lexer.java.rl.erb",
81
- "ragel/lexer.rb.rl.erb",
82
- "ragel/lexer_common.rl.erb",
83
- "spec/gherkin/c_lexer_spec.rb",
84
- "spec/gherkin/csharp_lexer_spec.rb",
85
- "spec/gherkin/fixtures/1.feature",
86
- "spec/gherkin/fixtures/comments_in_table.feature",
87
- "spec/gherkin/fixtures/complex.feature",
88
- "spec/gherkin/fixtures/dos_line_endings.feature",
89
- "spec/gherkin/fixtures/i18n_fr.feature",
90
- "spec/gherkin/fixtures/i18n_no.feature",
91
- "spec/gherkin/fixtures/i18n_zh-CN.feature",
92
- "spec/gherkin/fixtures/simple.feature",
93
- "spec/gherkin/fixtures/simple_with_comments.feature",
94
- "spec/gherkin/fixtures/simple_with_tags.feature",
95
- "spec/gherkin/formatter/argument_spec.rb",
96
- "spec/gherkin/formatter/colors_spec.rb",
97
- "spec/gherkin/formatter/pretty_listener_spec.rb",
98
- "spec/gherkin/i18n_lexer_spec.rb",
99
- "spec/gherkin/i18n_spec.rb",
100
- "spec/gherkin/java_lexer_spec.rb",
101
- "spec/gherkin/parser/filter_listener_spec.rb",
102
- "spec/gherkin/parser/parser_spec.rb",
103
- "spec/gherkin/parser/tag_expression_spec.rb",
104
- "spec/gherkin/rb_lexer_spec.rb",
105
- "spec/gherkin/sexp_recorder.rb",
106
- "spec/gherkin/shared/lexer_spec.rb",
107
- "spec/gherkin/shared/py_string_spec.rb",
108
- "spec/gherkin/shared/row_spec.rb",
109
- "spec/gherkin/shared/tags_spec.rb",
110
- "spec/spec_helper.rb",
111
- "tasks/bench.rake",
112
- "tasks/bench/feature_builder.rb",
113
- "tasks/bench/generated/.gitignore",
114
- "tasks/bench/null_listener.rb",
115
- "tasks/compile.rake",
116
- "tasks/cucumber.rake",
117
- "tasks/ikvm.rake",
118
- "tasks/ragel_task.rb",
119
- "tasks/rdoc.rake",
120
- "tasks/rspec.rake"
121
- ]
122
- s.homepage = %q{http://github.com/aslakhellesoy/gherkin}
123
- s.rdoc_options = ["--charset=UTF-8"]
124
- s.require_paths = ["lib"]
125
- s.rubygems_version = %q{1.3.6}
126
- s.summary = %q{Fast Gherkin lexer/parser}
127
- s.test_files = [
128
- "spec/gherkin/c_lexer_spec.rb",
129
- "spec/gherkin/csharp_lexer_spec.rb",
130
- "spec/gherkin/formatter/argument_spec.rb",
131
- "spec/gherkin/formatter/colors_spec.rb",
132
- "spec/gherkin/formatter/pretty_listener_spec.rb",
133
- "spec/gherkin/i18n_lexer_spec.rb",
134
- "spec/gherkin/i18n_spec.rb",
135
- "spec/gherkin/java_lexer_spec.rb",
136
- "spec/gherkin/parser/filter_listener_spec.rb",
137
- "spec/gherkin/parser/parser_spec.rb",
138
- "spec/gherkin/parser/tag_expression_spec.rb",
139
- "spec/gherkin/rb_lexer_spec.rb",
140
- "spec/gherkin/sexp_recorder.rb",
141
- "spec/gherkin/shared/lexer_spec.rb",
142
- "spec/gherkin/shared/py_string_spec.rb",
143
- "spec/gherkin/shared/row_spec.rb",
144
- "spec/gherkin/shared/tags_spec.rb",
145
- "spec/spec_helper.rb"
146
- ]
147
-
148
- if s.respond_to? :specification_version then
149
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
150
- s.specification_version = 3
151
-
152
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
153
- s.add_runtime_dependency(%q<trollop>, [">= 1.15"])
154
- s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
155
- s.add_development_dependency(%q<cucumber>, [">= 0.6.4"])
156
- s.add_development_dependency(%q<rake-compiler>, [">= 0.7.0"])
157
- s.add_development_dependency(%q<albacore>, [">= 0.1.2"])
158
- else
159
- s.add_dependency(%q<trollop>, [">= 1.15"])
160
- s.add_dependency(%q<rspec>, [">= 1.3.0"])
161
- s.add_dependency(%q<cucumber>, [">= 0.6.4"])
162
- s.add_dependency(%q<rake-compiler>, [">= 0.7.0"])
163
- s.add_dependency(%q<albacore>, [">= 0.1.2"])
164
- end
165
- else
166
- s.add_dependency(%q<trollop>, [">= 1.15"])
167
- s.add_dependency(%q<rspec>, [">= 1.3.0"])
168
- s.add_dependency(%q<cucumber>, [">= 0.6.4"])
169
- s.add_dependency(%q<rake-compiler>, [">= 0.7.0"])
170
- s.add_dependency(%q<albacore>, [">= 0.1.2"])
171
- end
172
- end
173
-
@@ -1,16 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="false">
4
- <output url="file://$MODULE_DIR$/target/classes" />
5
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
- <content url="file://$MODULE_DIR$">
7
- <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8
- <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
9
- <excludeFolder url="file://$MODULE_DIR$/target" />
10
- </content>
11
- <orderEntry type="inheritedJdk" />
12
- <orderEntry type="sourceFolder" forTests="false" />
13
- <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.8.1" level="project" />
14
- </component>
15
- </module>
16
-
@@ -1,240 +0,0 @@
1
- namespace Gherkin.Lexer
2
- {
3
- using System.Text;
4
- using System.Text.RegularExpressions;
5
- using System.IO;
6
- using System.Collections.Generic;
7
- using System.Linq;
8
-
9
- [Language("<%= @i18n.sanitized_key.downcase %>")]
10
- public class <%= @i18n.sanitized_key.capitalize %> : ILexer {
11
- %%{
12
- machine lexer;
13
- alphtype char;
14
-
15
- action begin_content {
16
- contentStart = p;
17
- contentCol = p - lastNewline + 1;
18
- contentNewline = lastNewline;
19
- currentLine = lineNumber;
20
- }
21
-
22
- action start_pystring {
23
- currentLine = lineNumber;
24
- pystringStartCol = p - lastNewline;
25
- pystringStartNewline = lastNewline;
26
- }
27
-
28
- action begin_pystring_content {
29
- contentStart = p;
30
- }
31
-
32
- action store_pystring_content {
33
- string con = Unindent(pystringStartCol, new Regex("(\\r?\\n)?( )*\\Z").Replace(Substring(data, contentStart, nextKeywordStart-1), "", 1));
34
- listener.PythonString(new Token(con, GetCharacterPosition(data, pystringStartNewline, currentLine, pystringStartCol+1)));
35
- }
36
-
37
- action store_feature_content {
38
- string con = MultilineStrip(KeywordContent(data, p, eof, nextKeywordStart, contentStart).Trim());
39
- listener.Feature(new Token(keyword, GetCharacterPosition(data, keywordNewline, currentLine, keywordCol)), new Token(con, GetCharacterPosition(data, contentNewline, currentLine, contentCol)));
40
- if(nextKeywordStart != -1) p = nextKeywordStart - 1;
41
- nextKeywordStart = -1;
42
- }
43
-
44
- action store_background_content {
45
- string con = MultilineStrip(KeywordContent(data, p, eof, nextKeywordStart, contentStart));
46
- listener.Background(new Token(keyword, GetCharacterPosition(data, keywordNewline, currentLine, keywordCol)), new Token(con, GetCharacterPosition(data, contentNewline, currentLine, contentCol)));
47
- if(nextKeywordStart != -1) p = nextKeywordStart - 1;
48
- nextKeywordStart = -1;
49
- }
50
-
51
- action store_scenario_content {
52
- string con = MultilineStrip(KeywordContent(data, p, eof, nextKeywordStart, contentStart));
53
- listener.Scenario(new Token(keyword, GetCharacterPosition(data, keywordNewline, currentLine, keywordCol)), new Token(con, GetCharacterPosition(data, contentNewline, currentLine, contentCol)));
54
- if(nextKeywordStart != -1) p = nextKeywordStart - 1;
55
- nextKeywordStart = -1;
56
- }
57
-
58
- action store_scenario_outline_content {
59
- string con = MultilineStrip(KeywordContent(data, p, eof, nextKeywordStart, contentStart));
60
- listener.ScenarioOutline(new Token(keyword, GetCharacterPosition(data, keywordNewline, currentLine, keywordCol)), new Token(con, GetCharacterPosition(data, contentNewline, currentLine, contentCol)));
61
- if(nextKeywordStart != -1) p = nextKeywordStart - 1;
62
- nextKeywordStart = -1;
63
- }
64
-
65
- action store_examples_content {
66
- string con = MultilineStrip(KeywordContent(data, p, eof, nextKeywordStart, contentStart));
67
- listener.Examples(new Token(keyword, GetCharacterPosition(data, keywordNewline, currentLine, keywordCol)), new Token(con, GetCharacterPosition(data, contentNewline, currentLine, contentCol)));
68
- if(nextKeywordStart != -1) p = nextKeywordStart - 1;
69
- nextKeywordStart = -1;
70
- }
71
-
72
- action store_step_content {
73
- listener.Step(
74
- new Token(keyword, GetCharacterPosition(data, keywordNewline, currentLine, keywordCol)),
75
- new Token(Substring(data, contentStart, p).Trim(), GetCharacterPosition(data, contentNewline, currentLine, contentCol)),
76
- LookupStepKind(keyword));
77
- }
78
-
79
- action store_comment_content {
80
- listener.Comment(new Token(Substring(data, contentStart, p).Trim(), GetCharacterPosition(data, contentNewline, currentLine, contentCol)));
81
- keywordStart = -1;
82
- }
83
-
84
- action store_tag_content {
85
- listener.Tag(new Token(Substring(data, contentStart, p).Trim(), GetCharacterPosition(data, contentNewline, currentLine, contentCol-1)));
86
- keywordStart = -1;
87
- }
88
-
89
- action inc_line_number {
90
- lineNumber++;
91
- }
92
-
93
- action last_newline {
94
- lastNewline = p + 1;
95
- }
96
-
97
- action start_keyword {
98
- if(keywordStart == -1) keywordStart = p;
99
- if(nextKeywordStart == -1)
100
- {
101
- keywordCol = p - lastNewline + 1;
102
- keywordNewline = lastNewline;
103
- }
104
- }
105
-
106
- action end_keyword {
107
- keyword = new Regex(":$").Replace(Substring(data, keywordStart, p), "", 1);
108
- keywordStart = -1;
109
- }
110
-
111
- action next_keyword_start {
112
- nextKeywordStart = p;
113
- }
114
-
115
- action start_row {
116
- p = p - 1;
117
- contentCol = p - lastNewline + 1;
118
- currentRow = new List<Token>();
119
- currentLine = lineNumber;
120
- }
121
-
122
- action begin_cell_content {
123
- contentStart = p;
124
- }
125
-
126
- action store_cell_content {
127
- currentRow.Add(new Token(Substring(data, contentStart, p).Trim(), GetCharacterPosition(data, lastNewline, lineNumber, contentStart - lastNewline + 1)));
128
- }
129
-
130
- action store_row {
131
- listener.Row(currentRow, GetCharacterPosition(data, contentNewline, currentLine, contentCol));
132
- }
133
-
134
- action end_feature {
135
- if(cs < lexer_first_final) {
136
- string content = CurrentLineContent(data, lastNewline);
137
- throw new LexingException("Lexing error on line " + lineNumber + ": '" + content + "'");
138
- } else {
139
- listener.Eof();
140
- }
141
- }
142
-
143
- include lexer_common "lexer_common.<%= @i18n.sanitized_key %>.rl";
144
- }%%
145
-
146
- private readonly IListener listener;
147
-
148
- private static readonly IDictionary<string, StepKind> stepKeywords = new Dictionary<string, StepKind>();
149
-
150
- static <%= @i18n.sanitized_key.capitalize %>()
151
- {
152
- <% @i18n.keywords('given', true).reject{|kw| kw == '* '}.each do |keyword| %>
153
- stepKeywords["<%=keyword%>"] = StepKind.Given;
154
- <% end %>
155
- <% @i18n.keywords('when', true).reject{|kw| kw == '* '}.each do |keyword| %>
156
- stepKeywords["<%=keyword%>"] = StepKind.When;
157
- <% end %>
158
- <% @i18n.keywords('then', true).reject{|kw| kw == '* '}.each do |keyword| %>
159
- stepKeywords["<%=keyword%>"] = StepKind.Then;
160
- <% end %>
161
- <% @i18n.keywords('and', true).reject{|kw| kw == '* '}.each do |keyword| %>
162
- stepKeywords["<%=keyword%>"] = StepKind.And;
163
- <% end %>
164
- <% @i18n.keywords('but', true).reject{|kw| kw == '* '}.each do |keyword| %>
165
- stepKeywords["<%=keyword%>"] = StepKind.But;
166
- <% end %>
167
- stepKeywords["* "] = StepKind.Any;
168
- }
169
-
170
- private static StepKind LookupStepKind(string keyword)
171
- {
172
- if (!stepKeywords.Keys.Contains(keyword))
173
- return StepKind.Unknown;
174
- return stepKeywords[keyword];
175
- }
176
-
177
- public <%= @i18n.sanitized_key.capitalize %>(IListener listener) {
178
- this.listener = listener;
179
-
180
- }
181
-
182
- %% write data noerror;
183
-
184
- public void Scan(TextReader inputSequence) {
185
- string input = inputSequence.ReadToEnd() + "\n%_FEATURE_END_%";
186
- char[] data = Encoding.GetEncoding("iso-8859-1").GetChars(Encoding.UTF8.GetBytes(input));
187
- int cs, p = 0, pe = data.Length;
188
- int eof = pe;
189
-
190
- int lineNumber = 1;
191
- int lastNewline = 0;
192
-
193
- int keywordCol = -1;
194
- int keywordNewline = 0;
195
- int contentCol = -1;
196
- int contentNewline = 0;
197
- int contentStart = -1;
198
- int currentLine = -1;
199
- int pystringStartNewline = 0;
200
- int pystringStartCol = -1;
201
- int nextKeywordStart = -1;
202
- int keywordStart = -1;
203
- string keyword = null;
204
- IList<Token> currentRow = null;
205
-
206
- %% write init;
207
- %% write exec;
208
- }
209
-
210
- private string KeywordContent(char[] data, int p, int eof, int nextKeywordStart, int contentStart) {
211
- int endPoint = (nextKeywordStart == -1 || (p == eof)) ? p : nextKeywordStart;
212
- return Substring(data, contentStart, endPoint);
213
- }
214
-
215
- private string MultilineStrip(string text) {
216
- var result = new StringBuilder();
217
- foreach (var s in text.Split(new [] {'\n'})) {
218
- result.AppendLine(s.Trim());
219
- }
220
- return result.ToString().Trim();
221
- }
222
-
223
- private string Unindent(int startCol, string text) {
224
- return new Regex("^ {0," + startCol + "}", RegexOptions.Multiline).Replace(text, "");
225
- }
226
-
227
- private string CurrentLineContent(char[] data, int lastNewline) {
228
- return Substring(data, lastNewline, data.Length).Trim();
229
- }
230
-
231
- private string Substring(char[] data, int start, int end) {
232
- return Encoding.UTF8.GetString(Encoding.GetEncoding("iso-8859-1").GetBytes(data, start, end-start));
233
- }
234
-
235
- private Position GetCharacterPosition(char[] data, int lineStart, int line, int bytecol) {
236
- return new Position(line,
237
- Encoding.UTF8.GetCharCount(Encoding.GetEncoding("iso-8859-1").GetBytes(data, lineStart, bytecol)));
238
- }
239
- }
240
- }