gherkin 2.11.3-java → 2.11.4-java

Sign up to get free protection for your applications and to get access to all the features.
data/History.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [2.11.4](https://github.com/cucumber/gherkin/compare/v2.11.3...v2.11.4)
2
+
3
+ * [Core] Support for file encodings different from UTF-8 in feature files. ([#158](https://github.com/cucumber/gherkin/issues/158) Aslak Hellesøy)
4
+ * [Core] Added Persian/Farsi (Sam Naseri)
5
+ * [JavaScript] Fix lexer instantiation. ([#197](https://github.com/cucumber/gherkin/pull/197) Julien Biezemans)
6
+
1
7
  ## [2.11.3](https://github.com/cucumber/gherkin/compare/v2.11.2...v2.11.3)
2
8
 
3
9
  * [.NET] Upgraded IKVM from 0.46.0.1 to 7.1.4532.2 - quite a version bump! (Aslak Hellesøy)
data/README.md CHANGED
@@ -54,7 +54,7 @@ The jar file is in the central Maven repo.
54
54
  <dependency>
55
55
  <groupId>info.cukes</groupId>
56
56
  <artifactId>gherkin</artifactId>
57
- <version>2.11.3</version>
57
+ <version>2.11.4</version>
58
58
  </dependency>
59
59
 
60
60
  You can get it manually from [Maven Central](http://search.maven.org/#browse%7C-2073395818)
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  # When both are building OK, do a `bundle exec rake install` in both cucumber and gherkin projects, revert the changes in the first 2 steps
16
16
  # and release both projects. Do this for both ruby 1.8.7, ruby 1.9.3 and jruby.
17
17
  #
18
- s.version = "2.11.3"
18
+ s.version = "2.11.4"
19
19
  s.authors = ["Mike Sassak", "Gregory Hnatiuk", "Aslak Hellesøy"]
20
20
  s.description = "A fast Gherkin lexer/parser based on the Ragel State Machine Compiler."
21
21
  s.summary = "#{s.name}-#{s.version}"
Binary file
@@ -237,6 +237,20 @@
237
237
  "and": "*|Ja",
238
238
  "but": "*|Kuid"
239
239
  },
240
+ "fa": {
241
+ "name": "Persian",
242
+ "native": "فارسی",
243
+ "feature": "وِیژگی",
244
+ "background": "زمینه",
245
+ "scenario": "سناریو",
246
+ "scenario_outline": "الگوی سناریو",
247
+ "examples": "نمونه ها",
248
+ "given": "*|با فرض",
249
+ "when": "*|هنگامی",
250
+ "then": "*|آنگاه",
251
+ "and": "*|و",
252
+ "but": "*|اما"
253
+ },
240
254
  "fi": {
241
255
  "name": "Finnish",
242
256
  "native": "suomi",
@@ -0,0 +1,34 @@
1
+ module Gherkin
2
+ module Lexer
3
+ class Encoding
4
+ native_impl('gherkin')
5
+
6
+ COMMENT_OR_EMPTY_LINE_PATTERN = /^\s*#|^\s*$/
7
+ ENCODING_PATTERN = /^\s*#\s*encoding\s*:\s*([0-9a-zA-Z\-]+)/i #:nodoc:
8
+
9
+ def read_file(path)
10
+ source = File.new(path).read
11
+ enc = encoding(source)
12
+ if(enc != 'UTF-8')
13
+ # Read it again with different encoding
14
+ source = File.new(path, "r:#{enc}:UTF-8").read
15
+ end
16
+ source
17
+ end
18
+
19
+ private
20
+
21
+ def encoding(source)
22
+ encoding = 'UTF-8'
23
+ source.each_line do |line|
24
+ break unless COMMENT_OR_EMPTY_LINE_PATTERN =~ line
25
+ if ENCODING_PATTERN =~ line
26
+ encoding = $1
27
+ break
28
+ end
29
+ end
30
+ encoding.upcase
31
+ end
32
+ end
33
+ end
34
+ end
@@ -5,6 +5,7 @@ class Class
5
5
  class << self
6
6
  def new(*args)
7
7
  js = {
8
+ # Add more mappings here if needed. The mappings are only used by test code.
8
9
  'Gherkin::Formatter::JSONFormatter' => 'js/lib/gherkin/formatter/json_formatter.js',
9
10
  'Gherkin::Lexer::En' => 'js/lib/gherkin/lexer/en.js'
10
11
  }[self.name]
@@ -39,7 +39,7 @@ public class <%= @i18n.underscored_iso_code.capitalize %> implements Lexer {
39
39
  }
40
40
 
41
41
  action store_docstring_content {
42
- String con = unindent(startCol, substring(data, contentStart, nextKeywordStart-1).replaceFirst("(\\r?\\n)?([\\t ])*\\Z", "").replaceAll("\\\\\"\\\\\"\\\\\"", "\"\"\""));
42
+ String con = unindent(startCol, substring(data, contentStart, nextKeywordStart-1).replaceFirst("(\\r?\\n)?([\\t ])*\\Z", "").replace("\\\"\\\"\\\"", "\"\"\""));
43
43
  String conType = substring(data, docstringContentTypeStart, docstringContentTypeEnd).trim();
44
44
  listener.docString(conType, con, currentLine);
45
45
  }
@@ -127,9 +127,9 @@ public class <%= @i18n.underscored_iso_code.capitalize %> implements Lexer {
127
127
  action store_cell_content {
128
128
  String con = substring(data, contentStart, p).trim();
129
129
  currentRow.add(con
130
- .replaceAll("\\\\\\|", "|")
131
- .replaceAll("\\\\n", "\n")
132
- .replaceAll("\\\\\\\\", "\\\\")
130
+ .replace("\\|", "|")
131
+ .replace("\\n", "\n")
132
+ .replace("\\\\", "\\")
133
133
  );
134
134
  }
135
135
 
@@ -215,7 +215,7 @@ if(typeof module !== 'undefined') {
215
215
  if (typeof define !== 'undefined') {
216
216
  if(define.amd) {
217
217
  define('gherkin/lexer/<%= @i18n.underscored_iso_code %>', [], function() {
218
- return Lexer
218
+ return Lexer;
219
219
  });
220
220
  } else {
221
221
  define('gherkin/lexer/<%= @i18n.underscored_iso_code %>', function(require, exports, module) {
@@ -15,7 +15,7 @@ module Gherkin
15
15
  it_should_behave_like "a Gherkin lexer lexing tags"
16
16
  it_should_behave_like "a Gherkin lexer lexing doc_strings"
17
17
  it_should_behave_like "a Gherkin lexer lexing rows"
18
- it_should_behave_like "parsing windows files"
18
+ it_should_behave_like "encoding"
19
19
  end
20
20
  end
21
21
  end
@@ -0,0 +1,6 @@
1
+ # language: no
2
+ # encoding: iSo-8859-1
3
+ Egenskap: ISO-8859-1
4
+ Scenario: ���
5
+ N�r this is encoded as Latin-1
6
+ S� everything should parse
@@ -184,6 +184,7 @@ module Gherkin
184
184
  | eo | Esperanto | Esperanto |
185
185
  | es | Spanish | español |
186
186
  | et | Estonian | eesti keel |
187
+ | fa | Persian | فارسی |
187
188
  | fi | Finnish | suomi |
188
189
  | fr | French | français |
189
190
  | he | Hebrew | עברית |
@@ -23,7 +23,7 @@ module Gherkin
23
23
  it_should_behave_like "a Gherkin lexer lexing tags"
24
24
  it_should_behave_like "a Gherkin lexer lexing doc_strings"
25
25
  it_should_behave_like "a Gherkin lexer lexing rows"
26
- it_should_behave_like "parsing windows files" unless ENV['GHERKIN_JS_NATIVE']
26
+ it_should_behave_like "encoding" unless ENV['GHERKIN_JS_NATIVE']
27
27
  end
28
28
  end
29
29
  end
@@ -0,0 +1,36 @@
1
+ #encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ module Gherkin
5
+ module Lexer
6
+ shared_examples_for "encoding" do
7
+ describe "with BOM" do
8
+ it "should work just fine" do
9
+ scan_file("with_bom.feature")
10
+ @listener.to_sexp.should == [
11
+ [:feature, "Feature", "Feature Text", "", 1],
12
+ [:scenario, "Scenario", "Reading a Scenario", "", 2],
13
+ [:step, "Given ", "there is a step", 3],
14
+ [:eof]
15
+ ]
16
+ end
17
+
18
+ describe "with ISO-8859-1 encoding" do
19
+ it "should work just fine" do
20
+ @lexer = Gherkin::Lexer::I18nLexer.new(@listener)
21
+ scan_file("iso-8859-1.feature")
22
+ @listener.to_sexp.should == [
23
+ [:comment, "# language: no", 1],
24
+ [:comment, "# encoding: iSo-8859-1", 2],
25
+ [:feature, "Egenskap", "ISO-8859-1", "", 3],
26
+ [:scenario, "Scenario", "ÆØÅ", "", 4],
27
+ [:step, "Når ", "this is encoded as Latin-1", 5],
28
+ [:step, "Så ", "everything should parse", 6],
29
+ [:eof]
30
+ ]
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -12,11 +12,12 @@ require 'gherkin'
12
12
  require 'stringio'
13
13
  require 'gherkin/sexp_recorder'
14
14
  require 'gherkin/output_stream_string_io'
15
- require 'gherkin/shared/bom_group'
15
+ require 'gherkin/shared/encoding_group'
16
16
  require 'gherkin/shared/lexer_group'
17
17
  require 'gherkin/shared/tags_group'
18
18
  require 'gherkin/shared/doc_string_group'
19
19
  require 'gherkin/shared/row_group'
20
+ require 'gherkin/lexer/encoding'
20
21
  $:.unshift(File.dirname(__FILE__))
21
22
 
22
23
  module GherkinSpecHelper
@@ -25,7 +26,8 @@ module GherkinSpecHelper
25
26
  end
26
27
 
27
28
  def fixture(file)
28
- File.new(File.dirname(__FILE__) + "/gherkin/fixtures/" + file).read
29
+ encoding = Gherkin::Lexer::Encoding.new
30
+ source = encoding.read_file(File.dirname(__FILE__) + "/gherkin/fixtures/" + file)
29
31
  end
30
32
 
31
33
  def rubify_hash(hash)
@@ -1,6 +1,6 @@
1
1
  namespace :release do
2
2
  desc 'Upload all packages and tag git'
3
- task :ALL => ['gems:sanity', 'ikvm:check', :mvn_deploy_jar, :mvn_deploy_site, :push_native_gems, :push_npm_package, 'ikvm:push', :release, 'api:doc', :post_release]
3
+ task :ALL => ['gems:sanity', 'ikvm:check', :mvn_deploy_jar, :push_native_gems, :push_npm_package, 'ikvm:push', :release, 'api:doc', :post_release]
4
4
 
5
5
  desc 'Push all gems to rubygems.org'
6
6
  task :push_native_gems do
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: 2.11.3
4
+ version: 2.11.4
5
5
  prerelease:
6
6
  platform: java
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-10-08 00:00:00.000000000 Z
14
+ date: 2012-10-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: json
@@ -109,22 +109,6 @@ dependencies:
109
109
  - - ! '>='
110
110
  - !ruby/object:Gem::Version
111
111
  version: 0.9.9
112
- - !ruby/object:Gem::Dependency
113
- name: therubyracer
114
- requirement: !ruby/object:Gem::Requirement
115
- none: false
116
- requirements:
117
- - - ! '>='
118
- - !ruby/object:Gem::Version
119
- version: 0.10.2
120
- type: :development
121
- prerelease: false
122
- version_requirements: !ruby/object:Gem::Requirement
123
- none: false
124
- requirements:
125
- - - ! '>='
126
- - !ruby/object:Gem::Version
127
- version: 0.10.2
128
112
  - !ruby/object:Gem::Dependency
129
113
  name: yard
130
114
  requirement: !ruby/object:Gem::Requirement
@@ -248,6 +232,7 @@ files:
248
232
  - lib/gherkin/i18n.json
249
233
  - lib/gherkin/i18n.rb
250
234
  - lib/gherkin/json_parser.rb
235
+ - lib/gherkin/lexer/encoding.rb
251
236
  - lib/gherkin/lexer/i18n_lexer.rb
252
237
  - lib/gherkin/listener/event.rb
253
238
  - lib/gherkin/listener/formatter_listener.rb
@@ -284,6 +269,7 @@ files:
284
269
  - spec/gherkin/fixtures/i18n_pt3.feature
285
270
  - spec/gherkin/fixtures/i18n_pt4.feature
286
271
  - spec/gherkin/fixtures/i18n_zh-CN.feature
272
+ - spec/gherkin/fixtures/iso-8859-1.feature
287
273
  - spec/gherkin/fixtures/issue_145.feature
288
274
  - spec/gherkin/fixtures/scenario_outline_with_tags.feature
289
275
  - spec/gherkin/fixtures/scenario_without_steps.feature
@@ -307,8 +293,8 @@ files:
307
293
  - spec/gherkin/output_stream_string_io.rb
308
294
  - spec/gherkin/parser/parser_spec.rb
309
295
  - spec/gherkin/sexp_recorder.rb
310
- - spec/gherkin/shared/bom_group.rb
311
296
  - spec/gherkin/shared/doc_string_group.rb
297
+ - spec/gherkin/shared/encoding_group.rb
312
298
  - spec/gherkin/shared/lexer_group.rb
313
299
  - spec/gherkin/shared/row_group.rb
314
300
  - spec/gherkin/shared/tags_group.rb
@@ -357,7 +343,7 @@ rubyforge_project:
357
343
  rubygems_version: 1.8.24
358
344
  signing_key:
359
345
  specification_version: 3
360
- summary: gherkin-2.11.3
346
+ summary: gherkin-2.11.4
361
347
  test_files:
362
348
  - features/escaped_pipes.feature
363
349
  - features/feature_parser.feature
@@ -391,6 +377,7 @@ test_files:
391
377
  - spec/gherkin/fixtures/i18n_pt3.feature
392
378
  - spec/gherkin/fixtures/i18n_pt4.feature
393
379
  - spec/gherkin/fixtures/i18n_zh-CN.feature
380
+ - spec/gherkin/fixtures/iso-8859-1.feature
394
381
  - spec/gherkin/fixtures/issue_145.feature
395
382
  - spec/gherkin/fixtures/scenario_outline_with_tags.feature
396
383
  - spec/gherkin/fixtures/scenario_without_steps.feature
@@ -414,8 +401,8 @@ test_files:
414
401
  - spec/gherkin/output_stream_string_io.rb
415
402
  - spec/gherkin/parser/parser_spec.rb
416
403
  - spec/gherkin/sexp_recorder.rb
417
- - spec/gherkin/shared/bom_group.rb
418
404
  - spec/gherkin/shared/doc_string_group.rb
405
+ - spec/gherkin/shared/encoding_group.rb
419
406
  - spec/gherkin/shared/lexer_group.rb
420
407
  - spec/gherkin/shared/row_group.rb
421
408
  - spec/gherkin/shared/tags_group.rb
@@ -1,20 +0,0 @@
1
- #encoding: utf-8
2
- require 'spec_helper'
3
-
4
- module Gherkin
5
- module Lexer
6
- shared_examples_for "parsing windows files" do
7
- describe "with BOM" do
8
- it "should work just fine" do
9
- scan_file("with_bom.feature")
10
- @listener.to_sexp.should == [
11
- [:feature, "Feature", "Feature Text", "", 1],
12
- [:scenario, "Scenario", "Reading a Scenario", "", 2],
13
- [:step, "Given ", "there is a step", 3],
14
- [:eof]
15
- ]
16
- end
17
- end
18
- end
19
- end
20
- end