gherkin 1.0.26-i386-mingw32 → 1.0.27-i386-mingw32

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/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 1.0.27 (2010-05-17)
2
+
3
+ === New Features
4
+ * Table cells can now contain escaped bars - \| and escaped backslashes - \\. (#48. Gregory Hnatiuk, Aslak Hellesøy)
5
+ * Luxemburgish (lu) added. (Christoph König)
6
+
1
7
  == 1.0.26 (2010-05-09)
2
8
 
3
9
  === New Features
data/Rakefile CHANGED
@@ -18,9 +18,9 @@ begin
18
18
  gem.homepage = "http://github.com/aslakhellesoy/gherkin"
19
19
  gem.authors = ["Mike Sassak", "Gregory Hnatiuk", "Aslak Hellesøy"]
20
20
  gem.executables = ["gherkin"]
21
- gem.add_dependency "trollop", ">= 1.15"
21
+ gem.add_dependency "trollop", ">= 1.16.2"
22
22
  gem.add_development_dependency "rspec", ">= 1.3.0"
23
- gem.add_development_dependency "cucumber", ">= 0.7.2"
23
+ # gem.add_development_dependency "cucumber", ">= 0.7.2"
24
24
  gem.add_development_dependency "rake-compiler", ">= 0.7.0" unless defined?(JRUBY_VERSION)
25
25
 
26
26
  gem.files -= FileList['ikvm/**/*']
data/VERSION.yml CHANGED
@@ -2,4 +2,4 @@
2
2
  :major: 1
3
3
  :minor: 0
4
4
  :build:
5
- :patch: 26
5
+ :patch: 27
@@ -0,0 +1,8 @@
1
+ Feature: Escaped pipes
2
+ Scenario: They are the future
3
+ Given they have arrived
4
+ | æ | o |
5
+ | a | ø |
6
+ Given they have arrived
7
+ | æ | \|o |
8
+ | \|a | ø\\ |
@@ -0,0 +1,3 @@
1
+ Given /^they have arrived$/ do |table|
2
+ announce table.raw
3
+ end
@@ -0,0 +1,15 @@
1
+ module Gherkin
2
+ module Formatter
3
+ module Escaping
4
+ # Escapes a pipes and backslashes:
5
+ #
6
+ # * | becomes \|
7
+ # * \ becomes \\
8
+ #
9
+ # This is used in the pretty formatter.
10
+ def escape_cell(s)
11
+ s.gsub(/\|/, "\\|").gsub(/\\(?!\|)/, "\\\\\\\\")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -3,6 +3,7 @@
3
3
  require 'gherkin/formatter/colors'
4
4
  require 'gherkin/formatter/monochrome_format'
5
5
  require 'gherkin/formatter/argument'
6
+ require 'gherkin/formatter/escaping'
6
7
 
7
8
  module Gherkin
8
9
  module Formatter
@@ -11,6 +12,7 @@ module Gherkin
11
12
  java_impl('gherkin.jar')
12
13
 
13
14
  include Colors
15
+ include Escaping
14
16
 
15
17
  def initialize(io, monochrome=false)
16
18
  @io = io
@@ -67,7 +69,7 @@ module Gherkin
67
69
 
68
70
  def row(row, line)
69
71
  @rows ||= []
70
- @rows << row
72
+ @rows << row.map{|cell| escape_cell(cell)}
71
73
  end
72
74
 
73
75
  def py_string(string, line)
data/lib/gherkin/i18n.rb CHANGED
@@ -8,10 +8,10 @@ module Gherkin
8
8
  java_impl('gherkin.jar')
9
9
  end
10
10
 
11
- ALL_KEYS = %w{name native feature background scenario scenario_outline examples given when then and but}
12
- KEYWORD_KEYS = ALL_KEYS - %w{name native}
13
- STEP_KEYWORD_KEYS = %w{given when then and but}
14
- LANGUAGES = YAML.load_file(File.dirname(__FILE__) + '/i18n.yml')
11
+ FEATURE_ELEMENT_KEYS = %w{feature background scenario scenario_outline examples}
12
+ STEP_KEYWORD_KEYS = %w{given when then and but}
13
+ KEYWORD_KEYS = FEATURE_ELEMENT_KEYS + STEP_KEYWORD_KEYS
14
+ LANGUAGES = YAML.load_file(File.dirname(__FILE__) + '/i18n.yml')
15
15
 
16
16
  class << self
17
17
  include Rubify
@@ -141,7 +141,7 @@ module Gherkin
141
141
  def keywords(iso_code)
142
142
  iso_code = iso_code.to_s
143
143
  raise "No #{iso_code.inspect} in #{@keywords.inspect}" if @keywords[iso_code].nil?
144
- @keywords[iso_code].split('|').map{|keyword| keyword_space(iso_code, keyword)}
144
+ @keywords[iso_code].split('|').map{|keyword| real_keyword(iso_code, keyword)}
145
145
  end
146
146
 
147
147
  def keyword_table
@@ -167,9 +167,9 @@ module Gherkin
167
167
 
168
168
  private
169
169
 
170
- def keyword_space(iso_code, keyword)
170
+ def real_keyword(iso_code, keyword)
171
171
  if(STEP_KEYWORD_KEYS.index(iso_code))
172
- (keyword + ' ').sub(/< $/,'')
172
+ (keyword + ' ').sub(/< $/, '')
173
173
  else
174
174
  keyword
175
175
  end
data/lib/gherkin/i18n.yml CHANGED
@@ -339,6 +339,19 @@
339
339
  then: "*|Tada"
340
340
  and: "*|Ir"
341
341
  but: "*|Bet"
342
+ "lu":
343
+ name: Luxemburgish
344
+ native: Lëtzebuergesch
345
+ feature: Funktionalitéit
346
+ background: Hannergrond
347
+ scenario: Szenario
348
+ scenario_outline: Plang vum Szenario
349
+ examples: Beispiller
350
+ given: "*|ugeholl"
351
+ when: "*|wann"
352
+ then: "*|dann"
353
+ and: "*|an|a"
354
+ but: "*|awer|mä"
342
355
  "lv":
343
356
  name: Latvian
344
357
  native: latviešu
data/ragel/lexer.c.rl.erb CHANGED
@@ -181,6 +181,10 @@ static VALUE rb_eGherkinLexingError;
181
181
  action store_cell_content {
182
182
  VALUE con = ENCODED_STR_NEW(PTR_TO(content_start), LEN(content_start, p));
183
183
  rb_funcall(con, rb_intern("strip!"), 0);
184
+ VALUE re_pipe = rb_reg_regcomp(rb_str_new2("\\\\\\|"));
185
+ VALUE re_backslash = rb_reg_regcomp(rb_str_new2("\\\\\\\\"));
186
+ rb_funcall(con, rb_intern("gsub!"), 2, re_pipe, rb_str_new2("|"));
187
+ rb_funcall(con, rb_intern("gsub!"), 2, re_backslash, rb_str_new2("\\"));
184
188
 
185
189
  rb_ary_push(current_row, con);
186
190
  }
@@ -114,7 +114,8 @@ public class <%= @i18n.underscored_iso_code.upcase %> implements Lexer {
114
114
  }
115
115
 
116
116
  action store_cell_content {
117
- currentRow.add(substring(data, contentStart, p).trim());
117
+ String con = substring(data, contentStart, p).trim();
118
+ currentRow.add(con.replaceAll("\\\\\\|", "|").replaceAll("\\\\\\\\", "\\\\"));
118
119
  }
119
120
 
120
121
  action store_row {
@@ -103,7 +103,7 @@ module Gherkin
103
103
 
104
104
  action store_cell_content {
105
105
  con = utf8_pack(data[@content_start...p]).strip
106
- current_row << con
106
+ current_row << con.gsub(/\\\|/, "|").gsub(/\\\\/, "\\")
107
107
  }
108
108
 
109
109
  action store_row {
@@ -11,6 +11,10 @@
11
11
 
12
12
  EOF = '%_FEATURE_END_%'; # Explicit EOF added before scanning begins
13
13
  EOL = ('\n' | '\r\n') @inc_line_number @last_newline;
14
+ BOM = 0xEF 0xBB 0xBF; # http://en.wikipedia.org/wiki/Byte_order_mark
15
+
16
+ PIPE = '|';
17
+ ESCAPED_PIPE = '\\|';
14
18
 
15
19
  FeatureHeadingEnd = EOL+ space* (I18N_Background | I18N_Scenario | I18N_ScenarioOutline | '@' | '#' | EOF) >next_keyword_start;
16
20
  ScenarioHeadingEnd = EOL+ space* ( I18N_Scenario | I18N_ScenarioOutline | I18N_Step | '@' | '#' | EOF ) >next_keyword_start;
@@ -30,16 +34,15 @@
30
34
  Tag = ( ('@' [^@\r\n\t ]+) >begin_content ) %store_tag_content;
31
35
  Tags = space* (Tag space*)+ EOL+;
32
36
 
33
- StartRow = space* '|' >start_row;
34
- EndRow = EOL space* ^('|') >next_keyword_start;
35
- Cell = '|' (any - '|')* >begin_cell_content %store_cell_content;
36
- RowBody = space* Cell* '|' :>> (space* EOL+ space*) %store_row;
37
+ StartRow = space* PIPE >start_row;
38
+ EndRow = EOL space* ^PIPE >next_keyword_start;
39
+ Cell = PIPE (ESCAPED_PIPE | (any - PIPE)+ )* >begin_cell_content %store_cell_content;
40
+ RowBody = space* Cell** PIPE :>> (space* EOL+ space*) %store_row;
37
41
  Row = StartRow :>> RowBody <: EndRow?;
38
42
 
39
43
  StartPyString = '"""' >start_pystring space* :>> EOL;
40
44
  EndPyString = (space* '"""') >next_keyword_start;
41
45
  PyString = space* StartPyString %begin_pystring_content (^EOL | EOL)* :>> EndPyString %store_pystring_content space* EOL+;
42
- BOM = 0xEF 0xBB 0xBF; # http://en.wikipedia.org/wiki/Byte_order_mark
43
46
 
44
47
  Tokens = BOM? (space | EOL)* (Tags | Comment | FeatureHeading | BackgroundHeading | ScenarioHeading | ScenarioOutlineHeading | ExamplesHeading | Step | Row | PyString)* (space | EOL)* EOF;
45
48
 
@@ -112,8 +112,8 @@ module Gherkin
112
112
  pystrings
113
113
  """
114
114
  And there is another step
115
- | æ | o |
116
- | a | ø |
115
+ | æ | \\|o |
116
+ | \\|a | ø\\\\ |
117
117
  Then we will see steps
118
118
  })
119
119
  end
@@ -148,6 +148,15 @@ Feature: Feature Description
148
148
  it "should preserve tabs" do
149
149
  assert_pretty(IO.read(File.dirname(__FILE__) + '/tabs.feature'), IO.read(File.dirname(__FILE__) + '/spaces.feature'))
150
150
  end
151
+
152
+ it "should escape backslashes and pipes" do
153
+ io = StringIO.new
154
+ l = PrettyFormatter.new(io, true)
155
+ l.row(['|', '\\'], 1)
156
+ l.flush_table
157
+ io.rewind
158
+ io.read.should == ' | \\| | \\\\ |' + "\n"
159
+ end
151
160
  end
152
161
  end
153
162
  end
@@ -96,6 +96,7 @@ module Gherkin
96
96
  | ja | Japanese | 日本語 |
97
97
  | ko | Korean | 한국어 |
98
98
  | lt | Lithuanian | lietuvių kalba |
99
+ | lu | Luxemburgish | Lëtzebuergesch |
99
100
  | lv | Latvian | latviešu |
100
101
  | nl | Dutch | Nederlands |
101
102
  | no | Norwegian | norsk |
@@ -25,6 +25,11 @@ module Gherkin
25
25
  @listener.should_receive(:row).with(r(%w{foo bar}), 1)
26
26
  @lexer.scan("| foo | bar |\n")
27
27
  end
28
+
29
+ it "should escape backslashed pipes" do
30
+ @listener.should_receive(:row).with(r(['|', 'the', '\a', '\\', '|\\|']), 1)
31
+ @lexer.scan('| \| | the | \a | \\ | \|\\\| |' + "\n")
32
+ end
28
33
 
29
34
  it "should parse cells with spaces within the content" do
30
35
  @listener.should_receive(:row).with(r(["Dill pickle", "Valencia orange"]), 1)
@@ -32,14 +37,6 @@ module Gherkin
32
37
  end
33
38
 
34
39
  it "should allow utf-8" do
35
- # Fails in 1.9.1!
36
- # 'Gherkin::Lexer::Table should allow utf-8 with using == to evaluate' FAILED
37
- # expected: [[:row, [["ůﻚ", "2"]], 1]],
38
- # got: [[:row, [["\xC5\xAF\xEF\xBB\x9A", "2"]], 1]] (using ==)
39
- # BUT, simply running:
40
- # [[:row, [["ůﻚ", "2"]], 1]].should == [[:row, [["\xC5\xAF\xEF\xBB\x9A", "2"]], 1]]
41
- # passes
42
- #
43
40
  @lexer.scan(" | ůﻚ | 2 | \n")
44
41
  @listener.to_sexp.should == [
45
42
  [:row, ["ůﻚ", "2"], 1],
data/tasks/ragel_task.rb CHANGED
@@ -29,8 +29,7 @@ class RagelTask
29
29
  {
30
30
  'c' => "ext/gherkin_lexer_#{@i18n.underscored_iso_code}/gherkin_lexer_#{@i18n.underscored_iso_code}.c",
31
31
  'java' => "java/src/main/java/gherkin/lexer/#{@i18n.underscored_iso_code.upcase}.java",
32
- 'rb' => "lib/gherkin/rb_lexer/#{@i18n.underscored_iso_code}.rb",
33
- 'csharp' => "tmp/#{@i18n.underscored_iso_code}.cs"
32
+ 'rb' => "lib/gherkin/rb_lexer/#{@i18n.underscored_iso_code}.rb"
34
33
  }[@lang]
35
34
  end
36
35
 
@@ -54,8 +53,7 @@ class RagelTask
54
53
  {
55
54
  'c' => '-C',
56
55
  'java' => '-J',
57
- 'rb' => '-R',
58
- 'csharp' => '-A -L -T0'
56
+ 'rb' => '-R'
59
57
  }[@lang]
60
58
  end
61
59
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 26
9
- version: 1.0.26
8
+ - 27
9
+ version: 1.0.27
10
10
  platform: i386-mingw32
11
11
  authors:
12
12
  - Mike Sassak
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-05-09 00:00:00 +02:00
19
+ date: 2010-05-18 00:00:00 +02:00
20
20
  default_executable: gherkin
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -28,8 +28,9 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  segments:
30
30
  - 1
31
- - 15
32
- version: "1.15"
31
+ - 16
32
+ - 2
33
+ version: 1.16.2
33
34
  type: :runtime
34
35
  version_requirements: *id001
35
36
  - !ruby/object:Gem::Dependency
@@ -46,24 +47,10 @@ dependencies:
46
47
  version: 1.3.0
47
48
  type: :development
48
49
  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
- - 7
59
- - 2
60
- version: 0.7.2
61
- type: :development
62
- version_requirements: *id003
63
50
  - !ruby/object:Gem::Dependency
64
51
  name: rake-compiler
65
52
  prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
53
+ requirement: &id003 !ruby/object:Gem::Requirement
67
54
  requirements:
68
55
  - - ">="
69
56
  - !ruby/object:Gem::Version
@@ -73,7 +60,7 @@ dependencies:
73
60
  - 0
74
61
  version: 0.7.0
75
62
  type: :development
76
- version_requirements: *id004
63
+ version_requirements: *id003
77
64
  description: A fast Gherkin lexer/parser based on the Ragel State Machine Compiler.
78
65
  email: cukes@googlegroups.com
79
66
  executables:
@@ -94,10 +81,12 @@ files:
94
81
  - VERSION.yml
95
82
  - bin/gherkin
96
83
  - cucumber.yml
84
+ - features/escaped_pipes.feature
97
85
  - features/feature_parser.feature
98
86
  - features/native_lexer.feature
99
87
  - features/parser_with_native_lexer.feature
100
88
  - features/pretty_printer.feature
89
+ - features/step_definitions/eyeball_steps.rb
101
90
  - features/step_definitions/gherkin_steps.rb
102
91
  - features/step_definitions/pretty_formatter_steps.rb
103
92
  - features/steps_parser.feature
@@ -132,6 +121,7 @@ files:
132
121
  - lib/1.8/gherkin_lexer_ja.so
133
122
  - lib/1.8/gherkin_lexer_ko.so
134
123
  - lib/1.8/gherkin_lexer_lt.so
124
+ - lib/1.8/gherkin_lexer_lu.so
135
125
  - lib/1.8/gherkin_lexer_lv.so
136
126
  - lib/1.8/gherkin_lexer_nl.so
137
127
  - lib/1.8/gherkin_lexer_no.so
@@ -175,6 +165,7 @@ files:
175
165
  - lib/1.9/gherkin_lexer_ja.so
176
166
  - lib/1.9/gherkin_lexer_ko.so
177
167
  - lib/1.9/gherkin_lexer_lt.so
168
+ - lib/1.9/gherkin_lexer_lu.so
178
169
  - lib/1.9/gherkin_lexer_lv.so
179
170
  - lib/1.9/gherkin_lexer_nl.so
180
171
  - lib/1.9/gherkin_lexer_no.so
@@ -198,6 +189,7 @@ files:
198
189
  - lib/gherkin/cli/main.rb
199
190
  - lib/gherkin/formatter/argument.rb
200
191
  - lib/gherkin/formatter/colors.rb
192
+ - lib/gherkin/formatter/escaping.rb
201
193
  - lib/gherkin/formatter/monochrome_format.rb
202
194
  - lib/gherkin/formatter/pretty_formatter.rb
203
195
  - lib/gherkin/i18n.rb