gherkin 2.2.5-x86-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.
Files changed (132) hide show
  1. data/.gitattributes +2 -0
  2. data/.gitignore +11 -0
  3. data/.mailmap +2 -0
  4. data/.rspec +1 -0
  5. data/.rvmrc +1 -0
  6. data/Gemfile +5 -0
  7. data/History.txt +306 -0
  8. data/LICENSE +20 -0
  9. data/README.rdoc +59 -0
  10. data/Rakefile +16 -0
  11. data/VERSION +1 -0
  12. data/bin/gherkin +5 -0
  13. data/build_native_gems.sh +8 -0
  14. data/cucumber.yml +3 -0
  15. data/features/escaped_pipes.feature +8 -0
  16. data/features/feature_parser.feature +237 -0
  17. data/features/json_formatter.feature +278 -0
  18. data/features/json_parser.feature +318 -0
  19. data/features/native_lexer.feature +19 -0
  20. data/features/parser_with_native_lexer.feature +205 -0
  21. data/features/pretty_formatter.feature +15 -0
  22. data/features/step_definitions/eyeball_steps.rb +3 -0
  23. data/features/step_definitions/gherkin_steps.rb +29 -0
  24. data/features/step_definitions/json_formatter_steps.rb +28 -0
  25. data/features/step_definitions/json_parser_steps.rb +20 -0
  26. data/features/step_definitions/pretty_formatter_steps.rb +82 -0
  27. data/features/steps_parser.feature +46 -0
  28. data/features/support/env.rb +38 -0
  29. data/gherkin.gemspec +59 -0
  30. data/ikvm/.gitignore +3 -0
  31. data/java/.gitignore +2 -0
  32. data/java/src/main/java/gherkin/lexer/i18n/.gitignore +1 -0
  33. data/java/src/main/resources/gherkin/.gitignore +1 -0
  34. data/lib/.gitignore +4 -0
  35. data/lib/gherkin.rb +2 -0
  36. data/lib/gherkin/c_lexer.rb +17 -0
  37. data/lib/gherkin/cli/main.rb +33 -0
  38. data/lib/gherkin/formatter/argument.rb +28 -0
  39. data/lib/gherkin/formatter/colors.rb +119 -0
  40. data/lib/gherkin/formatter/escaping.rb +15 -0
  41. data/lib/gherkin/formatter/filter_formatter.rb +136 -0
  42. data/lib/gherkin/formatter/json_formatter.rb +72 -0
  43. data/lib/gherkin/formatter/line_filter.rb +26 -0
  44. data/lib/gherkin/formatter/model.rb +231 -0
  45. data/lib/gherkin/formatter/monochrome_format.rb +9 -0
  46. data/lib/gherkin/formatter/pretty_formatter.rb +174 -0
  47. data/lib/gherkin/formatter/regexp_filter.rb +21 -0
  48. data/lib/gherkin/formatter/tag_count_formatter.rb +47 -0
  49. data/lib/gherkin/formatter/tag_filter.rb +19 -0
  50. data/lib/gherkin/i18n.rb +180 -0
  51. data/lib/gherkin/i18n.yml +601 -0
  52. data/lib/gherkin/json_parser.rb +88 -0
  53. data/lib/gherkin/lexer/i18n_lexer.rb +47 -0
  54. data/lib/gherkin/listener/event.rb +45 -0
  55. data/lib/gherkin/listener/formatter_listener.rb +113 -0
  56. data/lib/gherkin/native.rb +7 -0
  57. data/lib/gherkin/native/ikvm.rb +55 -0
  58. data/lib/gherkin/native/java.rb +55 -0
  59. data/lib/gherkin/native/null.rb +9 -0
  60. data/lib/gherkin/parser/meta.txt +5 -0
  61. data/lib/gherkin/parser/parser.rb +164 -0
  62. data/lib/gherkin/parser/root.txt +11 -0
  63. data/lib/gherkin/parser/steps.txt +4 -0
  64. data/lib/gherkin/rb_lexer.rb +8 -0
  65. data/lib/gherkin/rb_lexer/.gitignore +1 -0
  66. data/lib/gherkin/rb_lexer/README.rdoc +8 -0
  67. data/lib/gherkin/rubify.rb +24 -0
  68. data/lib/gherkin/tag_expression.rb +62 -0
  69. data/lib/gherkin/tools.rb +8 -0
  70. data/lib/gherkin/tools/files.rb +34 -0
  71. data/lib/gherkin/tools/reformat.rb +20 -0
  72. data/lib/gherkin/tools/stats.rb +20 -0
  73. data/lib/gherkin/tools/stats_listener.rb +60 -0
  74. data/lib/gherkin/version.rb +3 -0
  75. data/ragel/i18n/.gitignore +1 -0
  76. data/ragel/lexer.c.rl.erb +459 -0
  77. data/ragel/lexer.java.rl.erb +224 -0
  78. data/ragel/lexer.rb.rl.erb +179 -0
  79. data/ragel/lexer_common.rl.erb +50 -0
  80. data/spec/gherkin/c_lexer_spec.rb +21 -0
  81. data/spec/gherkin/fixtures/1.feature +8 -0
  82. data/spec/gherkin/fixtures/comments_in_table.feature +9 -0
  83. data/spec/gherkin/fixtures/complex.feature +45 -0
  84. data/spec/gherkin/fixtures/complex.json +143 -0
  85. data/spec/gherkin/fixtures/complex_for_filtering.feature +60 -0
  86. data/spec/gherkin/fixtures/complex_with_tags.feature +61 -0
  87. data/spec/gherkin/fixtures/dos_line_endings.feature +45 -0
  88. data/spec/gherkin/fixtures/hantu_pisang.feature +35 -0
  89. data/spec/gherkin/fixtures/i18n_fr.feature +14 -0
  90. data/spec/gherkin/fixtures/i18n_no.feature +7 -0
  91. data/spec/gherkin/fixtures/i18n_zh-CN.feature +9 -0
  92. data/spec/gherkin/fixtures/scenario_outline_with_tags.feature +13 -0
  93. data/spec/gherkin/fixtures/scenario_without_steps.feature +5 -0
  94. data/spec/gherkin/fixtures/simple_with_comments.feature +7 -0
  95. data/spec/gherkin/fixtures/simple_with_tags.feature +11 -0
  96. data/spec/gherkin/fixtures/with_bom.feature +3 -0
  97. data/spec/gherkin/formatter/argument_spec.rb +28 -0
  98. data/spec/gherkin/formatter/colors_spec.rb +18 -0
  99. data/spec/gherkin/formatter/filter_formatter_spec.rb +165 -0
  100. data/spec/gherkin/formatter/model_spec.rb +15 -0
  101. data/spec/gherkin/formatter/pretty_formatter_spec.rb +140 -0
  102. data/spec/gherkin/formatter/spaces.feature +9 -0
  103. data/spec/gherkin/formatter/tabs.feature +9 -0
  104. data/spec/gherkin/formatter/tag_count_formatter_spec.rb +30 -0
  105. data/spec/gherkin/i18n_spec.rb +149 -0
  106. data/spec/gherkin/java_lexer_spec.rb +20 -0
  107. data/spec/gherkin/json.rb +5 -0
  108. data/spec/gherkin/json_parser_spec.rb +67 -0
  109. data/spec/gherkin/lexer/i18n_lexer_spec.rb +43 -0
  110. data/spec/gherkin/output_stream_string_io.rb +24 -0
  111. data/spec/gherkin/parser/parser_spec.rb +16 -0
  112. data/spec/gherkin/rb_lexer_spec.rb +19 -0
  113. data/spec/gherkin/sexp_recorder.rb +56 -0
  114. data/spec/gherkin/shared/lexer_group.rb +592 -0
  115. data/spec/gherkin/shared/py_string_group.rb +153 -0
  116. data/spec/gherkin/shared/row_group.rb +120 -0
  117. data/spec/gherkin/shared/tags_group.rb +54 -0
  118. data/spec/gherkin/tag_expression_spec.rb +137 -0
  119. data/spec/spec_helper.rb +68 -0
  120. data/tasks/bench.rake +184 -0
  121. data/tasks/bench/feature_builder.rb +49 -0
  122. data/tasks/bench/generated/.gitignore +1 -0
  123. data/tasks/bench/null_listener.rb +4 -0
  124. data/tasks/compile.rake +102 -0
  125. data/tasks/cucumber.rake +18 -0
  126. data/tasks/gems.rake +42 -0
  127. data/tasks/ikvm.rake +54 -0
  128. data/tasks/ragel_task.rb +70 -0
  129. data/tasks/rdoc.rake +9 -0
  130. data/tasks/release.rake +30 -0
  131. data/tasks/rspec.rake +8 -0
  132. metadata +447 -0
@@ -0,0 +1,9 @@
1
+ Feature: Adding
2
+
3
+ Scenario: Add two numbers
4
+ Given the following input:
5
+ """
6
+ hello
7
+ """
8
+ When the calculator is run
9
+ Then the output should be 4
@@ -0,0 +1,30 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'gherkin/parser/parser'
4
+ require 'gherkin/formatter/tag_count_formatter'
5
+
6
+ module Gherkin
7
+ module Formatter
8
+ describe TagCountFormatter do
9
+ it "should count tags" do
10
+ tag_counts = {}
11
+ dummy = Gherkin::SexpRecorder.new
12
+ formatter = Gherkin::Formatter::TagCountFormatter.new(dummy, tag_counts)
13
+ parser = Gherkin::Parser::Parser.new(formatter)
14
+
15
+ f = File.new(File.dirname(__FILE__) + "/../fixtures/complex_with_tags.feature").read
16
+ parser.parse(f, 'f.feature', 0)
17
+
18
+ tag_counts.should == {
19
+ "@hamster" => ["f.feature:58"],
20
+ "@tag1" => ["f.feature:18","f.feature:23","f.feature:39","f.feature:52","f.feature:58"],
21
+ "@tag2" => ["f.feature:18","f.feature:23","f.feature:39","f.feature:52","f.feature:58"],
22
+ "@tag3" => ["f.feature:18", "f.feature:23"],
23
+ "@tag4" => ["f.feature:18"],
24
+ "@neat" => ["f.feature:52"],
25
+ "@more" => ["f.feature:52", "f.feature:58"]
26
+ }
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,149 @@
1
+ #encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ module Gherkin
5
+ module Lexer
6
+ describe I18n do
7
+ before do
8
+ @listener = Gherkin::SexpRecorder.new
9
+ end
10
+
11
+ def scan_file(lexer, file)
12
+ lexer.scan(File.new(File.dirname(__FILE__) + "/fixtures/" + file).read)
13
+ end
14
+
15
+ it "should recognize keywords in the language of the lexer" do
16
+ lexer = Gherkin::Lexer::I18nLexer.new(@listener, false)
17
+ scan_file(lexer, "i18n_no.feature")
18
+ @listener.to_sexp.should == [
19
+ [:comment, "#language:no", 1],
20
+ [:feature, "Egenskap", "i18n support", "", 2],
21
+ [:scenario, "Scenario", "Parsing many languages", "", 4],
22
+ [:step, "Gitt ", "Gherkin supports many languages", 5],
23
+ [:step, "Når ", "Norwegian keywords are parsed", 6],
24
+ [:step, "Så ", "they should be recognized", 7],
25
+ [:eof]
26
+ ]
27
+ end
28
+
29
+ it "should parse languages without a space after keywords" do
30
+ lexer = Gherkin::Lexer::I18nLexer.new(@listener, false)
31
+ scan_file(lexer, "i18n_zh-CN.feature")
32
+ @listener.to_sexp.should == [
33
+ [:comment, "#language:zh-CN", 1],
34
+ [:feature, "功能", "加法", "", 2],
35
+ [:scenario, "场景", "两个数相加", "", 4],
36
+ [:step, "假如", "我已经在计算器里输入6", 5],
37
+ [:step, "而且", "我已经在计算器里输入7", 6],
38
+ [:step, "当", "我按相加按钮", 7],
39
+ [:step, "那么", "我应该在屏幕上看到的结果是13", 8],
40
+ [:eof]
41
+ ]
42
+ end
43
+
44
+ it "should parse languages with spaces after some keywords but not others" do
45
+ lexer = Gherkin::Lexer::I18nLexer.new(@listener, false)
46
+ scan_file(lexer, "i18n_fr.feature")
47
+ @listener.to_sexp.should == [
48
+ [:comment, "#language:fr", 1],
49
+ [:feature, "Fonctionnalité", "Addition", "", 2],
50
+ [:scenario_outline, "Plan du scénario", "Addition de produits dérivés", "", 3],
51
+ [:step, "Soit ", "une calculatrice", 4],
52
+ [:step, "Etant donné ", "qu'on tape <a>", 5],
53
+ [:step, "Et ", "qu'on tape <b>", 6],
54
+ [:step, "Lorsqu'", "on tape additionner", 7],
55
+ [:step, "Alors ", "le résultat doit être <somme>", 8],
56
+ [:examples, "Exemples", "", "", 10],
57
+ [:row, %w{a b somme}, 11],
58
+ [:row, %w{2 2 4}, 12],
59
+ [:row, %w{2 3 5}, 13],
60
+ [:eof]
61
+ ]
62
+ end
63
+
64
+ describe 'keywords' do
65
+ it "should have code keywords without space, comma or apostrophe" do
66
+ ['Akkor', 'Etantdonné', 'Lorsque', '假設'].each do |code_keyword|
67
+ Gherkin::I18n.code_keywords.should include(code_keyword)
68
+ end
69
+ end
70
+
71
+ it "should report keyword regexp" do
72
+ Gherkin::I18n.keyword_regexp(:step).should =~ /\|Quando \|Quand \|Quan \|Pryd \|Pokud \|/
73
+ end
74
+
75
+ unless defined?(JRUBY_VERSION)
76
+ it "should print available languages" do
77
+ ("\n" + Gherkin::I18n.language_table).should == %{
78
+ | ar | Arabic | العربية |
79
+ | bg | Bulgarian | български |
80
+ | ca | Catalan | català |
81
+ | cs | Czech | Česky |
82
+ | cy-GB | Welsh | Cymraeg |
83
+ | da | Danish | dansk |
84
+ | de | German | Deutsch |
85
+ | en | English | English |
86
+ | en-Scouse | Scouse | Scouse |
87
+ | en-au | Australian | Australian |
88
+ | en-lol | LOLCAT | LOLCAT |
89
+ | en-pirate | Pirate | Pirate |
90
+ | en-tx | Texan | Texan |
91
+ | eo | Esperanto | Esperanto |
92
+ | es | Spanish | español |
93
+ | et | Estonian | eesti keel |
94
+ | fi | Finnish | suomi |
95
+ | fr | French | français |
96
+ | he | Hebrew | עברית |
97
+ | hr | Croatian | hrvatski |
98
+ | hu | Hungarian | magyar |
99
+ | id | Indonesian | Bahasa Indonesia |
100
+ | it | Italian | italiano |
101
+ | ja | Japanese | 日本語 |
102
+ | ko | Korean | 한국어 |
103
+ | lt | Lithuanian | lietuvių kalba |
104
+ | lu | Luxemburgish | Lëtzebuergesch |
105
+ | lv | Latvian | latviešu |
106
+ | nl | Dutch | Nederlands |
107
+ | no | Norwegian | norsk |
108
+ | pl | Polish | polski |
109
+ | pt | Portuguese | português |
110
+ | ro | Romanian | română |
111
+ | ro-RO | Romanian (diacritical) | română (diacritical) |
112
+ | ru | Russian | русский |
113
+ | sk | Slovak | Slovensky |
114
+ | sr-Cyrl | Serbian | Српски |
115
+ | sr-Latn | Serbian (Latin) | Srpski (Latinica) |
116
+ | sv | Swedish | Svenska |
117
+ | tr | Turkish | Türkçe |
118
+ | uk | Ukrainian | Українська |
119
+ | uz | Uzbek | Узбекча |
120
+ | vi | Vietnamese | Tiếng Việt |
121
+ | zh-CN | Chinese simplified | 简体中文 |
122
+ | zh-TW | Chinese traditional | 繁體中文 |
123
+ }
124
+ end
125
+ end
126
+
127
+ it "should print keywords for a given language" do
128
+ ("\n" + Gherkin::I18n.get('fr').keyword_table).should == %{
129
+ | feature | "Fonctionnalité" |
130
+ | background | "Contexte" |
131
+ | scenario | "Scénario" |
132
+ | scenario_outline | "Plan du scénario", "Plan du Scénario" |
133
+ | examples | "Exemples" |
134
+ | given | "* ", "Soit ", "Etant donné " |
135
+ | when | "* ", "Quand ", "Lorsque ", "Lorsqu'" |
136
+ | then | "* ", "Alors " |
137
+ | and | "* ", "Et " |
138
+ | but | "* ", "Mais " |
139
+ | given (code) | "Soit", "Etantdonné" |
140
+ | when (code) | "Quand", "Lorsque", "Lorsqu" |
141
+ | then (code) | "Alors" |
142
+ | and (code) | "Et" |
143
+ | but (code) | "Mais" |
144
+ }
145
+ end
146
+ end
147
+ end
148
+ end
149
+ end
@@ -0,0 +1,20 @@
1
+ #encoding: utf-8
2
+ if defined?(JRUBY_VERSION)
3
+ require 'spec_helper'
4
+
5
+ module Gherkin
6
+ module JavaLexer
7
+ describe "Java Lexer" do
8
+ before do
9
+ @listener = Gherkin::SexpRecorder.new
10
+ @lexer = Java::GherkinLexer::I18nLexer.new(@listener)
11
+ end
12
+
13
+ it_should_behave_like "a Gherkin lexer"
14
+ it_should_behave_like "a Gherkin lexer lexing tags"
15
+ it_should_behave_like "a Gherkin lexer lexing py_strings"
16
+ it_should_behave_like "a Gherkin lexer lexing rows"
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,5 @@
1
+ JSON_SIMPLE_JAR = ENV['HOME'] + '/.m2/repository/com/googlecode/json-simple/json-simple/1.1/json-simple-1.1.jar'
2
+
3
+ if defined?(JRUBY_VERSION)
4
+ require JSON_SIMPLE_JAR
5
+ end
@@ -0,0 +1,67 @@
1
+ #encoding: utf-8
2
+ require 'ap'
3
+ require 'spec_helper'
4
+ require 'gherkin/json_parser'
5
+ require 'gherkin/formatter/json_formatter'
6
+
7
+ module Gherkin
8
+ describe JSONParser do
9
+
10
+ def check_json(json)
11
+ io = StringIO.new
12
+ f = Formatter::JSONFormatter.new(io)
13
+ p = JSONParser.new(f)
14
+ p.parse(json, 'unknown.json', 0)
15
+ expected = JSON.parse(json)
16
+ actual = JSON.parse(io.string)
17
+
18
+ actual.should == expected
19
+ end
20
+
21
+ it "should parse a barely empty feature" do
22
+ check_json(%{{
23
+ "keyword": "Feature",
24
+ "name": "One",
25
+ "description": "",
26
+ "line" : 3
27
+ }})
28
+ end
29
+
30
+ it "should parse feature with tags and one scenario" do
31
+ check_json(%{{
32
+ "tags": [
33
+ {
34
+ "name": "@foo",
35
+ "line": 22
36
+ }
37
+ ],
38
+ "keyword": "Feature",
39
+ "name": "One",
40
+ "description": "",
41
+ "line": 3,
42
+ "elements": [
43
+ {
44
+ "type": "scenario",
45
+ "steps": [
46
+ {
47
+ "name": "Hello",
48
+ "multiline_arg": {
49
+ "type": "table",
50
+ "value": [
51
+ {
52
+ "cells": ["foo", "bar"]
53
+ }
54
+ ]
55
+ }
56
+ }
57
+ ]
58
+ }
59
+ ]
60
+ }})
61
+ end
62
+
63
+ it "shoud parse a complex feature" do
64
+ check_json(fixture("complex.json"))
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,43 @@
1
+ #encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ module Gherkin
5
+ module Lexer
6
+ describe I18nLexer do
7
+ before do
8
+ @lexer = Gherkin::Lexer::I18nLexer.new(Gherkin::SexpRecorder.new, false)
9
+ end
10
+
11
+ it "should store the i18n language of the last scanned feature" do
12
+ @lexer.scan("# language: fr\n")
13
+ @lexer.i18n_language.iso_code.should == "fr"
14
+ @lexer.scan("# language: no\n")
15
+ @lexer.i18n_language.iso_code.should == "no"
16
+ end
17
+
18
+ it "should detect language when there are spaces and CRLF" do
19
+ @lexer.scan("# language: da \r\n")
20
+ @lexer.i18n_language.iso_code.should == "da"
21
+ end
22
+
23
+ it "should detect language when the language comment is not the first line" do
24
+ @lexer.scan("# hello\n# language: no\n")
25
+ @lexer.i18n_language.iso_code.should == "no"
26
+ end
27
+
28
+ it "should detect language when the language is on the third line, and there are empty lines above" do
29
+ @lexer.scan("# hello\n\n# language: no\n")
30
+ @lexer.i18n_language.iso_code.should == "no"
31
+ end
32
+
33
+ it "should use English i18n by default" do
34
+ @lexer.scan("Feature: foo\n")
35
+ @lexer.i18n_language.iso_code.should == "en"
36
+ end
37
+
38
+ it "should === its ruby class, even when the impl is Java" do
39
+ Gherkin::Lexer::I18nLexer.should === Gherkin::Lexer::I18nLexer.new(Gherkin::SexpRecorder.new, true)
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,24 @@
1
+ if defined?(JRUBY_VERSION)
2
+ class OutputStreamStringIO < Java.java.io.ByteArrayOutputStream
3
+ def write(what)
4
+ if String === what
5
+ super(Java.java.lang.String.new(what).getBytes("UTF-8"))
6
+ else
7
+ super(what)
8
+ end
9
+ end
10
+
11
+ def string
12
+ toString("UTF-8")
13
+ end
14
+ end
15
+
16
+ require 'stringio'
17
+ class StringIO
18
+ class << self
19
+ def new
20
+ OutputStreamStringIO.new
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ module Gherkin
4
+ module Parser
5
+ describe Parser do
6
+ unless defined?(JRUBY_VERSION)
7
+ it "should raise when feature doesn't parse" do
8
+ p = Parser.new(mock('formatter').as_null_object)
9
+ lambda do
10
+ p.parse("Feature: f\nFeature: f", __FILE__, __LINE__-1)
11
+ end.should raise_error(/Parse error at/)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ #encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'gherkin/rb_lexer/en'
4
+
5
+ module Gherkin
6
+ module Lexer
7
+ describe "Ruby Lexer" do
8
+ before do
9
+ @listener = Gherkin::SexpRecorder.new
10
+ @lexer = Gherkin::RbLexer::En.new(@listener)
11
+ end
12
+
13
+ it_should_behave_like "a Gherkin lexer"
14
+ it_should_behave_like "a Gherkin lexer lexing tags"
15
+ it_should_behave_like "a Gherkin lexer lexing py_strings"
16
+ it_should_behave_like "a Gherkin lexer lexing rows"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,56 @@
1
+ require 'gherkin/rubify'
2
+ require 'gherkin/formatter/model'
3
+
4
+ module Gherkin
5
+ class SexpRecorder
6
+ include Rubify
7
+
8
+ def initialize
9
+ @sexps = []
10
+ end
11
+
12
+ def method_missing(event, *args)
13
+ event = :scenario_outline if event == :scenarioOutline # Special Java Lexer handling
14
+ event = :py_string if event == :pyString # Special Java Lexer handling
15
+ event = :syntax_error if event == :syntaxError # Special Java Lexer handling
16
+ args = rubify(args)
17
+ args = sexpify(args)
18
+ @sexps << [event] + args
19
+ end
20
+
21
+ def to_sexp
22
+ @sexps
23
+ end
24
+
25
+ # Useful in IRB
26
+ def reset!
27
+ @sexps = []
28
+ end
29
+
30
+ def errors
31
+ @sexps.select { |sexp| sexp[0] == :syntax_error }
32
+ end
33
+
34
+ def line(number)
35
+ @sexps.find { |sexp| sexp.last == number }
36
+ end
37
+
38
+ def sexpify(o)
39
+ if (defined?(JRUBY_VERSION) && Java.java.util.Collection === o) || Array === o
40
+ o.map{|e| sexpify(e)}
41
+ elsif(Formatter::Model::Row === o)
42
+ {
43
+ "cells" => sexpify(o.cells),
44
+ "comments" => sexpify(o.comments),
45
+ "line" => o.line,
46
+ }
47
+ elsif(Formatter::Model::Comment === o)
48
+ o.value
49
+ elsif(Formatter::Model::Tag === o)
50
+ o.name
51
+ else
52
+ o
53
+ end
54
+ end
55
+ end
56
+ end