gherkin 0.0.4-i386-mswin32 → 1.0.0-i386-mswin32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +4 -2
- data/Rakefile +3 -1
- data/VERSION.yml +2 -2
- data/gherkin.gemspec +3 -42
- data/lib/gherkin/i18n.rb +80 -0
- data/ragel/lexer.c.rl.erb +6 -4
- data/ragel/lexer.java.rl.erb +3 -3
- data/ragel/lexer.rb.rl.erb +2 -2
- data/ragel/lexer_common.rl.erb +6 -6
- data/tasks/bench.rake +12 -12
- data/tasks/compile.rake +13 -13
- data/tasks/ragel_task.rb +13 -26
- metadata +3 -42
data/README.rdoc
CHANGED
@@ -19,9 +19,11 @@ rake clobber
|
|
19
19
|
|
20
20
|
== Release process
|
21
21
|
|
22
|
-
Run just "rake" for each platform (1.8.6, 1.8.7, 1.9, jruby) to make sure all is green.
|
22
|
+
Run just "rake clean spec cucumber" for each platform (1.8.6, 1.8.7, 1.9, jruby) to make sure all is green.
|
23
23
|
|
24
|
-
1)
|
24
|
+
1) rvm 1.8.7
|
25
|
+
2) Bump version in the VERSION file
|
26
|
+
3) rake clean jar compile
|
25
27
|
2) rake gemspec
|
26
28
|
3) Commit everything
|
27
29
|
4) rake release
|
data/Rakefile
CHANGED
@@ -46,4 +46,6 @@ end
|
|
46
46
|
|
47
47
|
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
48
48
|
|
49
|
-
task :default
|
49
|
+
task :default => [:spec, :cucumber]
|
50
|
+
task :spec => defined?(JRUBY_VERSION) ? :jar : :compile
|
51
|
+
task :cucumber => defined?(JRUBY_VERSION) ? :jar : :compile
|
data/VERSION.yml
CHANGED
data/gherkin.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gherkin}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "1.0.0"
|
9
9
|
s.platform = %q{i386-mswin32}
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["Mike Sassak", "Gregory Hnatiuk", "Aslak Helles\303\270y"]
|
13
|
-
s.date = %q{2009-
|
13
|
+
s.date = %q{2009-12-01}
|
14
14
|
s.default_executable = %q{gherkin}
|
15
15
|
s.description = %q{A fast Gherkin lexer in Ragel}
|
16
16
|
s.email = %q{cukes@googlegroups.com}
|
@@ -51,6 +51,7 @@ Gem::Specification.new do |s|
|
|
51
51
|
"lib/gherkin.rb",
|
52
52
|
"lib/gherkin/c_lexer.rb",
|
53
53
|
"lib/gherkin/core_ext/array.rb",
|
54
|
+
"lib/gherkin/i18n.rb",
|
54
55
|
"lib/gherkin/i18n.yml",
|
55
56
|
"lib/gherkin/i18n_lexer.rb",
|
56
57
|
"lib/gherkin/java_lexer.rb",
|
@@ -64,46 +65,6 @@ Gem::Specification.new do |s|
|
|
64
65
|
"lib/gherkin/rb_lexer/README.rdoc",
|
65
66
|
"lib/gherkin/rb_parser.rb",
|
66
67
|
"lib/gherkin/tools/pretty_printer.rb",
|
67
|
-
"lib/gherkin_lexer_ar.so",
|
68
|
-
"lib/gherkin_lexer_bg.so",
|
69
|
-
"lib/gherkin_lexer_cat.so",
|
70
|
-
"lib/gherkin_lexer_cs.so",
|
71
|
-
"lib/gherkin_lexer_cy.so",
|
72
|
-
"lib/gherkin_lexer_da.so",
|
73
|
-
"lib/gherkin_lexer_de.so",
|
74
|
-
"lib/gherkin_lexer_en.so",
|
75
|
-
"lib/gherkin_lexer_enau.so",
|
76
|
-
"lib/gherkin_lexer_enlol.so",
|
77
|
-
"lib/gherkin_lexer_entx.so",
|
78
|
-
"lib/gherkin_lexer_es.so",
|
79
|
-
"lib/gherkin_lexer_et.so",
|
80
|
-
"lib/gherkin_lexer_fi.so",
|
81
|
-
"lib/gherkin_lexer_fr.so",
|
82
|
-
"lib/gherkin_lexer_he.so",
|
83
|
-
"lib/gherkin_lexer_hr.so",
|
84
|
-
"lib/gherkin_lexer_hu.so",
|
85
|
-
"lib/gherkin_lexer_id.so",
|
86
|
-
"lib/gherkin_lexer_it.so",
|
87
|
-
"lib/gherkin_lexer_ja.so",
|
88
|
-
"lib/gherkin_lexer_ko.so",
|
89
|
-
"lib/gherkin_lexer_lt.so",
|
90
|
-
"lib/gherkin_lexer_lv.so",
|
91
|
-
"lib/gherkin_lexer_nl.so",
|
92
|
-
"lib/gherkin_lexer_no.so",
|
93
|
-
"lib/gherkin_lexer_pl.so",
|
94
|
-
"lib/gherkin_lexer_pt.so",
|
95
|
-
"lib/gherkin_lexer_ro.so",
|
96
|
-
"lib/gherkin_lexer_ro2.so",
|
97
|
-
"lib/gherkin_lexer_ru.so",
|
98
|
-
"lib/gherkin_lexer_se.so",
|
99
|
-
"lib/gherkin_lexer_sk.so",
|
100
|
-
"lib/gherkin_lexer_sr.so",
|
101
|
-
"lib/gherkin_lexer_srLatn.so",
|
102
|
-
"lib/gherkin_lexer_tr.so",
|
103
|
-
"lib/gherkin_lexer_uz.so",
|
104
|
-
"lib/gherkin_lexer_vi.so",
|
105
|
-
"lib/gherkin_lexer_zhCN.so",
|
106
|
-
"lib/gherkin_lexer_zhTW.so",
|
107
68
|
"nativegems.sh",
|
108
69
|
"ragel/i18n/.gitignore",
|
109
70
|
"ragel/lexer.c.rl.erb",
|
data/lib/gherkin/i18n.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
module Gherkin
|
2
|
+
class I18n
|
3
|
+
KEYWORD_KEYS = %w{name native feature background scenario scenario_outline examples given when then and but}
|
4
|
+
LANGUAGES = YAML.load_file(File.dirname(__FILE__) + '/i18n.yml')
|
5
|
+
|
6
|
+
class << self
|
7
|
+
# Used by code generators for other lexer tools like pygments lexer and textmate bundle
|
8
|
+
def all
|
9
|
+
LANGUAGES.keys.sort.map{|key| get(key)}
|
10
|
+
end
|
11
|
+
|
12
|
+
def get(key)
|
13
|
+
languages[key] ||= new(key)
|
14
|
+
end
|
15
|
+
|
16
|
+
def languages
|
17
|
+
@languages ||= {}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(key)
|
22
|
+
@key = key
|
23
|
+
@keywords = LANGUAGES[key]
|
24
|
+
raise "Language not supported: #{key.inspect}" if @key.nil?
|
25
|
+
@keywords['grammar_name'] = @keywords['name'].gsub(/\s/, '')
|
26
|
+
@parser = nil
|
27
|
+
end
|
28
|
+
|
29
|
+
def sanitized_key
|
30
|
+
@key.gsub(/[\s-]/, '')
|
31
|
+
end
|
32
|
+
|
33
|
+
def incomplete?
|
34
|
+
KEYWORD_KEYS.detect{|key| @keywords[key].nil?}
|
35
|
+
end
|
36
|
+
|
37
|
+
def feature_keywords
|
38
|
+
keywords('feature')
|
39
|
+
end
|
40
|
+
|
41
|
+
def scenario_keywords
|
42
|
+
keywords('scenario')
|
43
|
+
end
|
44
|
+
|
45
|
+
def scenario_outline_keywords
|
46
|
+
keywords('scenario_outline')
|
47
|
+
end
|
48
|
+
|
49
|
+
def background_keywords
|
50
|
+
keywords('background')
|
51
|
+
end
|
52
|
+
|
53
|
+
def examples_keywords
|
54
|
+
keywords('examples')
|
55
|
+
end
|
56
|
+
|
57
|
+
def but_keywords(space=true)
|
58
|
+
keywords('but', space)
|
59
|
+
end
|
60
|
+
|
61
|
+
def and_keywords(space=true)
|
62
|
+
keywords('and', space)
|
63
|
+
end
|
64
|
+
|
65
|
+
def step_keywords
|
66
|
+
%w{given when then and but}.map{|key| keywords(key, true)}.flatten.uniq
|
67
|
+
end
|
68
|
+
|
69
|
+
def keywords(key, space=false)
|
70
|
+
raise "No #{key} in #{@keywords.inspect}" if @keywords[key].nil?
|
71
|
+
@keywords[key].split('|').map{|kw| space ? keyword_space(kw) : kw}
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def keyword_space(val)
|
77
|
+
(val + ' ').sub(/< $/,'')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/ragel/lexer.c.rl.erb
CHANGED
@@ -7,6 +7,8 @@
|
|
7
7
|
|
8
8
|
#ifdef HAVE_RUBY_RE_H
|
9
9
|
#include <ruby/re.h>
|
10
|
+
#else
|
11
|
+
#include <re.h>
|
10
12
|
#endif
|
11
13
|
|
12
14
|
#ifdef HAVE_RUBY_ENCODING_H
|
@@ -232,7 +234,7 @@ static VALUE rb_eGherkinLexerError;
|
|
232
234
|
}
|
233
235
|
}
|
234
236
|
|
235
|
-
include lexer_common "lexer_common.<%= @i18n %>.rl";
|
237
|
+
include lexer_common "lexer_common.<%= @i18n.sanitized_key %>.rl";
|
236
238
|
|
237
239
|
}%%
|
238
240
|
|
@@ -350,7 +352,7 @@ static VALUE CLexer_scan(VALUE self, VALUE input)
|
|
350
352
|
rb_str_append(input_copy, rb_str_new2("\n%_FEATURE_END_%"));
|
351
353
|
char *data = RSTRING_PTR(input_copy);
|
352
354
|
long len = RSTRING_LEN(input_copy);
|
353
|
-
|
355
|
+
|
354
356
|
if (len == 0) {
|
355
357
|
rb_raise(rb_eGherkinLexerError, "No content to lex.");
|
356
358
|
} else {
|
@@ -387,14 +389,14 @@ static VALUE CLexer_scan(VALUE self, VALUE input)
|
|
387
389
|
}
|
388
390
|
}
|
389
391
|
|
390
|
-
void Init_gherkin_lexer_<%= @i18n %>()
|
392
|
+
void Init_gherkin_lexer_<%= @i18n.sanitized_key %>()
|
391
393
|
{
|
392
394
|
mGherkin = rb_define_module("Gherkin");
|
393
395
|
mLexer = rb_const_get(mGherkin, rb_intern("Lexer"));
|
394
396
|
rb_eGherkinLexerError = rb_const_get(mLexer, rb_intern("LexingError"));
|
395
397
|
|
396
398
|
mCLexer = rb_define_module_under(mGherkin, "CLexer");
|
397
|
-
cI18nLexer = rb_define_class_under(mCLexer, "<%= @i18n.capitalize %>", rb_cObject);
|
399
|
+
cI18nLexer = rb_define_class_under(mCLexer, "<%= @i18n.sanitized_key.capitalize %>", rb_cObject);
|
398
400
|
rb_define_alloc_func(cI18nLexer, CLexer_alloc);
|
399
401
|
rb_define_method(cI18nLexer, "initialize", CLexer_init, 1);
|
400
402
|
rb_define_method(cI18nLexer, "scan", CLexer_scan, 1);
|
data/ragel/lexer.java.rl.erb
CHANGED
@@ -7,7 +7,7 @@ import gherkin.Lexer;
|
|
7
7
|
import gherkin.Listener;
|
8
8
|
import gherkin.LexingError;
|
9
9
|
|
10
|
-
public class <%= @i18n.capitalize %> implements Lexer {
|
10
|
+
public class <%= @i18n.sanitized_key.capitalize %> implements Lexer {
|
11
11
|
%%{
|
12
12
|
machine lexer;
|
13
13
|
alphtype byte;
|
@@ -136,12 +136,12 @@ public class <%= @i18n.capitalize %> implements Lexer {
|
|
136
136
|
}
|
137
137
|
}
|
138
138
|
|
139
|
-
include lexer_common "lexer_common.<%= @i18n %>.rl";
|
139
|
+
include lexer_common "lexer_common.<%= @i18n.sanitized_key %>.rl";
|
140
140
|
}%%
|
141
141
|
|
142
142
|
private final Listener listener;
|
143
143
|
|
144
|
-
public <%= @i18n.capitalize %>(Listener listener) {
|
144
|
+
public <%= @i18n.sanitized_key.capitalize %>(Listener listener) {
|
145
145
|
this.listener = listener;
|
146
146
|
}
|
147
147
|
|
data/ragel/lexer.rb.rl.erb
CHANGED
@@ -2,7 +2,7 @@ require 'gherkin/core_ext/array'
|
|
2
2
|
|
3
3
|
module Gherkin
|
4
4
|
module RbLexer
|
5
|
-
class <%= @i18n.capitalize %> #:nodoc:
|
5
|
+
class <%= @i18n.sanitized_key.capitalize %> #:nodoc:
|
6
6
|
%%{
|
7
7
|
machine lexer;
|
8
8
|
|
@@ -129,7 +129,7 @@ module Gherkin
|
|
129
129
|
end
|
130
130
|
}
|
131
131
|
|
132
|
-
include lexer_common "lexer_common.<%= @i18n %>.rl";
|
132
|
+
include lexer_common "lexer_common.<%= @i18n.sanitized_key %>.rl";
|
133
133
|
}%%
|
134
134
|
|
135
135
|
def initialize(listener)
|
data/ragel/lexer_common.rl.erb
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
machine lexer_common;
|
3
3
|
|
4
4
|
# Language specific
|
5
|
-
I18N_Feature = <%=
|
6
|
-
I18N_Background = <%=
|
7
|
-
I18N_ScenarioOutline = <%=
|
8
|
-
I18N_Scenario = <%=
|
9
|
-
I18N_Step =
|
10
|
-
I18N_Examples = <%=
|
5
|
+
I18N_Feature = (<%= ragel_list(@i18n.feature_keywords) %> ':') >start_keyword %end_keyword;
|
6
|
+
I18N_Background = (<%= ragel_list(@i18n.background_keywords) %> ':') >start_keyword %end_keyword;
|
7
|
+
I18N_ScenarioOutline = (<%= ragel_list(@i18n.scenario_outline_keywords) %> ':') >start_keyword %end_keyword;
|
8
|
+
I18N_Scenario = (<%= ragel_list(@i18n.scenario_keywords) %> ':') >start_keyword %end_keyword;
|
9
|
+
I18N_Step = <%= ragel_list(@i18n.step_keywords) %> >start_keyword %end_keyword;
|
10
|
+
I18N_Examples = (<%= ragel_list(@i18n.examples_keywords) %> ':') >start_keyword %end_keyword;
|
11
11
|
|
12
12
|
EOF = '%_FEATURE_END_%'; # Explicit EOF added before scanning begins
|
13
13
|
EOL = ('\r'? '\n') @inc_line_number @last_newline;
|
data/tasks/bench.rake
CHANGED
@@ -73,8 +73,8 @@ class Benchmarker
|
|
73
73
|
|
74
74
|
def report_all
|
75
75
|
Benchmark.bmbm do |x|
|
76
|
-
x.report("
|
77
|
-
x.report("
|
76
|
+
x.report("native_gherkin:") { run_native_gherkin }
|
77
|
+
x.report("native_gherkin_no_parser:") { run_native_gherkin_no_parser }
|
78
78
|
x.report("rb_gherkin:") { run_rb_gherkin }
|
79
79
|
x.report("cucumber:") { run_cucumber }
|
80
80
|
x.report("tt:") { run_tt }
|
@@ -115,21 +115,21 @@ class Benchmarker
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
-
def
|
118
|
+
def run_native_gherkin
|
119
119
|
require 'gherkin'
|
120
120
|
require 'null_listener'
|
121
121
|
@features.each do |feature|
|
122
122
|
parser = Gherkin::Parser.new(NullListener.new, true, "root")
|
123
|
-
lexer = Gherkin::
|
123
|
+
lexer = Gherkin::Lexer['en'].new(parser)
|
124
124
|
lexer.scan(File.read(feature))
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
|
-
def
|
128
|
+
def run_native_gherkin_no_parser
|
129
129
|
require 'gherkin'
|
130
130
|
require 'null_listener'
|
131
131
|
@features.each do |feature|
|
132
|
-
lexer = Gherkin::
|
132
|
+
lexer = Gherkin::Lexer['en'].new(NullListener.new)
|
133
133
|
lexer.scan(File.read(feature))
|
134
134
|
end
|
135
135
|
end
|
@@ -167,16 +167,16 @@ namespace :bench do
|
|
167
167
|
benchmarker.report("rb_gherkin")
|
168
168
|
end
|
169
169
|
|
170
|
-
desc "Benchmark the
|
171
|
-
task :
|
170
|
+
desc "Benchmark the ntive Gherkin lexer+parser with the features in tasks/bench/generated"
|
171
|
+
task :native_gherkin do
|
172
172
|
benchmarker = Benchmarker.new
|
173
|
-
benchmarker.report("
|
173
|
+
benchmarker.report("native_gherkin")
|
174
174
|
end
|
175
175
|
|
176
|
-
desc "Benchmark the
|
177
|
-
task :
|
176
|
+
desc "Benchmark the native Gherkin lexer (no parser) with the features in tasks/bench/generated"
|
177
|
+
task :native_gherkin_no_parser do
|
178
178
|
benchmarker = Benchmarker.new
|
179
|
-
benchmarker.report("
|
179
|
+
benchmarker.report("native_gherkin_no_parser")
|
180
180
|
end
|
181
181
|
|
182
182
|
desc "Show basic statistics about the features in tasks/bench/generated"
|
data/tasks/compile.rake
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/ragel_task'
|
2
|
+
require 'gherkin/i18n'
|
2
3
|
|
3
4
|
CLEAN.include [
|
4
5
|
'**/*.{o,bundle,jar,so,obj,pdb,lib,def,exp,log}', 'ext',
|
@@ -14,34 +15,33 @@ task :jar do
|
|
14
15
|
sh("ant -f java/build.xml")
|
15
16
|
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
java = RagelTask.new('java', i18n, keywords)
|
21
|
-
rb = RagelTask.new('rb', i18n, keywords)
|
18
|
+
Gherkin::I18n.all.each do |i18n|
|
19
|
+
java = RagelTask.new('java', i18n)
|
20
|
+
rb = RagelTask.new('rb', i18n)
|
22
21
|
|
23
22
|
task :jar => java.target
|
24
23
|
task :jar => rb.target
|
25
24
|
|
26
25
|
begin
|
27
26
|
require 'rake/extensiontask'
|
28
|
-
c = RagelTask.new('c', i18n
|
27
|
+
c = RagelTask.new('c', i18n)
|
29
28
|
|
30
|
-
extconf = "ext/gherkin_lexer_#{i18n}/extconf.rb"
|
29
|
+
extconf = "ext/gherkin_lexer_#{i18n.sanitized_key}/extconf.rb"
|
31
30
|
|
32
31
|
file extconf do
|
33
32
|
FileUtils.mkdir(File.dirname(extconf)) unless File.directory?(File.dirname(extconf))
|
34
33
|
File.open(extconf, "w") do |io|
|
35
34
|
io.write(<<-EOF)
|
36
35
|
require 'mkmf'
|
37
|
-
|
36
|
+
$CFLAGS << ' -O0 -Wall -Werror'
|
37
|
+
dir_config("gherkin_lexer_#{i18n.sanitized_key}")
|
38
38
|
have_library("c", "main")
|
39
|
-
create_makefile("gherkin_lexer_#{i18n}")
|
39
|
+
create_makefile("gherkin_lexer_#{i18n.sanitized_key}")
|
40
40
|
EOF
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
Rake::ExtensionTask.new("gherkin_lexer_#{i18n}") do |ext|
|
44
|
+
Rake::ExtensionTask.new("gherkin_lexer_#{i18n.sanitized_key}") do |ext|
|
45
45
|
if ENV['RUBY_CC_VERSION']
|
46
46
|
ext.cross_compile = true
|
47
47
|
ext.cross_platform = 'i386-mingw32'
|
@@ -53,9 +53,9 @@ EOF
|
|
53
53
|
|
54
54
|
# The way tasks are defined with compile:xxx (but without namespace) in rake-compiler forces us
|
55
55
|
# to use these hacks for setting up dependencies. Ugly!
|
56
|
-
Rake::Task["compile:gherkin_lexer_#{i18n}"].prerequisites.unshift(extconf)
|
57
|
-
Rake::Task["compile:gherkin_lexer_#{i18n}"].prerequisites.unshift(c.target)
|
58
|
-
Rake::Task["compile:gherkin_lexer_#{i18n}"].prerequisites.unshift(rb.target)
|
56
|
+
Rake::Task["compile:gherkin_lexer_#{i18n.sanitized_key}"].prerequisites.unshift(extconf)
|
57
|
+
Rake::Task["compile:gherkin_lexer_#{i18n.sanitized_key}"].prerequisites.unshift(c.target)
|
58
|
+
Rake::Task["compile:gherkin_lexer_#{i18n.sanitized_key}"].prerequisites.unshift(rb.target)
|
59
59
|
|
60
60
|
Rake::Task["compile"].prerequisites.unshift(extconf)
|
61
61
|
Rake::Task["compile"].prerequisites.unshift(c.target)
|
data/tasks/ragel_task.rb
CHANGED
@@ -4,10 +4,9 @@ require 'erb'
|
|
4
4
|
class RagelTask
|
5
5
|
RL_OUTPUT_DIR = File.dirname(__FILE__) + "/../ragel/i18n"
|
6
6
|
|
7
|
-
def initialize(lang, i18n
|
7
|
+
def initialize(lang, i18n)
|
8
8
|
@lang = lang
|
9
9
|
@i18n = i18n
|
10
|
-
@keywords = keywords
|
11
10
|
define_tasks
|
12
11
|
end
|
13
12
|
|
@@ -18,27 +17,24 @@ class RagelTask
|
|
18
17
|
end
|
19
18
|
|
20
19
|
file lang_ragel => lang_erb do
|
21
|
-
|
22
|
-
write(impl, lang_ragel)
|
20
|
+
write(ERB.new(IO.read(lang_erb)).result(binding), lang_ragel)
|
23
21
|
end
|
24
22
|
|
25
23
|
file common_ragel => common_erb do
|
26
|
-
|
27
|
-
common = ERB.new(IO.read(common_erb)).result(binding)
|
28
|
-
write(common, common_ragel)
|
24
|
+
write(ERB.new(IO.read(common_erb)).result(binding), common_ragel)
|
29
25
|
end
|
30
26
|
end
|
31
27
|
|
32
28
|
def target
|
33
29
|
{
|
34
|
-
'c' => "ext/gherkin_lexer_#{@i18n}/gherkin_lexer_#{@i18n}.c",
|
35
|
-
'java' => "java/src/gherkin/lexer/#{@i18n.capitalize}.java",
|
36
|
-
'rb' => "lib/gherkin/rb_lexer/#{@i18n}.rb"
|
30
|
+
'c' => "ext/gherkin_lexer_#{@i18n.sanitized_key}/gherkin_lexer_#{@i18n.sanitized_key}.c",
|
31
|
+
'java' => "java/src/gherkin/lexer/#{@i18n.sanitized_key.capitalize}.java",
|
32
|
+
'rb' => "lib/gherkin/rb_lexer/#{@i18n.sanitized_key}.rb"
|
37
33
|
}[@lang]
|
38
34
|
end
|
39
35
|
|
40
36
|
def common_ragel
|
41
|
-
RL_OUTPUT_DIR + "/lexer_common.#{@i18n}.rl"
|
37
|
+
RL_OUTPUT_DIR + "/lexer_common.#{@i18n.sanitized_key}.rl"
|
42
38
|
end
|
43
39
|
|
44
40
|
def common_erb
|
@@ -46,7 +42,7 @@ class RagelTask
|
|
46
42
|
end
|
47
43
|
|
48
44
|
def lang_ragel
|
49
|
-
RL_OUTPUT_DIR + "/#{@i18n}.#{@lang}.rl"
|
45
|
+
RL_OUTPUT_DIR + "/#{@i18n.sanitized_key}.#{@lang}.rl"
|
50
46
|
end
|
51
47
|
|
52
48
|
def lang_erb
|
@@ -61,23 +57,14 @@ class RagelTask
|
|
61
57
|
}[@lang]
|
62
58
|
end
|
63
59
|
|
64
|
-
def prep_keywords
|
65
|
-
keywords = @keywords.dup
|
66
|
-
delimited_keywords = %w{feature background scenario scenario_outline examples}
|
67
|
-
bare_keywords = %w{given when then and but}
|
68
|
-
all_keywords = delimited_keywords + bare_keywords
|
69
|
-
|
70
|
-
all_keywords.each { |k| keywords[k] = keywords[k].split("|") }
|
71
|
-
delimited_keywords.each { |k| keywords[k].map! { |v| v += ':'} }
|
72
|
-
bare_keywords.each { |k| keywords[k].map! { |v| (v + ' ').sub(/< $/, '')} }
|
73
|
-
all_keywords.each { |k| keywords[k] = '("' + keywords[k].join('" | "') + '")' }
|
74
|
-
keywords
|
75
|
-
end
|
76
|
-
|
77
60
|
def write(content, filename)
|
78
61
|
mkdir_p(File.dirname(filename)) unless File.directory?(File.dirname(filename))
|
79
62
|
File.open(filename, "wb") do |file|
|
80
63
|
file.write(content)
|
81
64
|
end
|
82
|
-
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def ragel_list(keywords)
|
68
|
+
"(#{keywords.map{|keyword| %{"#{keyword}"}}.join(' | ')})"
|
69
|
+
end
|
83
70
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gherkin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: i386-mswin32
|
6
6
|
authors:
|
7
7
|
- Mike Sassak
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2009-
|
14
|
+
date: 2009-12-01 00:00:00 +01:00
|
15
15
|
default_executable: gherkin
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/gherkin.rb
|
86
86
|
- lib/gherkin/c_lexer.rb
|
87
87
|
- lib/gherkin/core_ext/array.rb
|
88
|
+
- lib/gherkin/i18n.rb
|
88
89
|
- lib/gherkin/i18n.yml
|
89
90
|
- lib/gherkin/i18n_lexer.rb
|
90
91
|
- lib/gherkin/java_lexer.rb
|
@@ -98,46 +99,6 @@ files:
|
|
98
99
|
- lib/gherkin/rb_lexer/README.rdoc
|
99
100
|
- lib/gherkin/rb_parser.rb
|
100
101
|
- lib/gherkin/tools/pretty_printer.rb
|
101
|
-
- lib/gherkin_lexer_ar.so
|
102
|
-
- lib/gherkin_lexer_bg.so
|
103
|
-
- lib/gherkin_lexer_cat.so
|
104
|
-
- lib/gherkin_lexer_cs.so
|
105
|
-
- lib/gherkin_lexer_cy.so
|
106
|
-
- lib/gherkin_lexer_da.so
|
107
|
-
- lib/gherkin_lexer_de.so
|
108
|
-
- lib/gherkin_lexer_en.so
|
109
|
-
- lib/gherkin_lexer_enau.so
|
110
|
-
- lib/gherkin_lexer_enlol.so
|
111
|
-
- lib/gherkin_lexer_entx.so
|
112
|
-
- lib/gherkin_lexer_es.so
|
113
|
-
- lib/gherkin_lexer_et.so
|
114
|
-
- lib/gherkin_lexer_fi.so
|
115
|
-
- lib/gherkin_lexer_fr.so
|
116
|
-
- lib/gherkin_lexer_he.so
|
117
|
-
- lib/gherkin_lexer_hr.so
|
118
|
-
- lib/gherkin_lexer_hu.so
|
119
|
-
- lib/gherkin_lexer_id.so
|
120
|
-
- lib/gherkin_lexer_it.so
|
121
|
-
- lib/gherkin_lexer_ja.so
|
122
|
-
- lib/gherkin_lexer_ko.so
|
123
|
-
- lib/gherkin_lexer_lt.so
|
124
|
-
- lib/gherkin_lexer_lv.so
|
125
|
-
- lib/gherkin_lexer_nl.so
|
126
|
-
- lib/gherkin_lexer_no.so
|
127
|
-
- lib/gherkin_lexer_pl.so
|
128
|
-
- lib/gherkin_lexer_pt.so
|
129
|
-
- lib/gherkin_lexer_ro.so
|
130
|
-
- lib/gherkin_lexer_ro2.so
|
131
|
-
- lib/gherkin_lexer_ru.so
|
132
|
-
- lib/gherkin_lexer_se.so
|
133
|
-
- lib/gherkin_lexer_sk.so
|
134
|
-
- lib/gherkin_lexer_sr.so
|
135
|
-
- lib/gherkin_lexer_srLatn.so
|
136
|
-
- lib/gherkin_lexer_tr.so
|
137
|
-
- lib/gherkin_lexer_uz.so
|
138
|
-
- lib/gherkin_lexer_vi.so
|
139
|
-
- lib/gherkin_lexer_zhCN.so
|
140
|
-
- lib/gherkin_lexer_zhTW.so
|
141
102
|
- nativegems.sh
|
142
103
|
- ragel/i18n/.gitignore
|
143
104
|
- ragel/lexer.c.rl.erb
|