aslakhellesoy-cucumber 0.1.99.4 → 0.1.99.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (254) hide show
  1. data/History.txt +4 -1
  2. data/Manifest.txt +2 -10
  3. data/cucumber.yml +1 -0
  4. data/examples/cs/README.textile +1 -0
  5. data/examples/cs/Rakefile +12 -0
  6. data/examples/cs/compile.bat +1 -0
  7. data/examples/cs/features/addition.feature +16 -0
  8. data/examples/cs/features/step_definitons/calculator_steps.rb +19 -0
  9. data/examples/cs/src/demo/Calculator.cs +20 -0
  10. data/examples/dos_line_endings/Rakefile +6 -0
  11. data/examples/dos_line_endings/features/dos_line_endings.feature +9 -0
  12. data/examples/i18n/README.textile +18 -0
  13. data/examples/i18n/Rakefile +32 -0
  14. data/examples/i18n/ar/Rakefile +6 -0
  15. data/examples/i18n/ar/features/addition.feature +17 -0
  16. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +28 -0
  17. data/examples/i18n/ar/lib/calculator.rb +10 -0
  18. data/examples/i18n/da/Rakefile +6 -0
  19. data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +24 -0
  20. data/examples/i18n/da/features/summering.feature +17 -0
  21. data/examples/i18n/da/lib/kalkulator.rb +11 -0
  22. data/examples/i18n/de/Rakefile +6 -0
  23. data/examples/i18n/de/features/addition.feature +16 -0
  24. data/examples/i18n/de/features/division.feature +9 -0
  25. data/examples/i18n/de/features/step_definitons/calculator_steps.rb +24 -0
  26. data/examples/i18n/de/lib/calculator.rb +14 -0
  27. data/examples/i18n/en/Rakefile +6 -0
  28. data/examples/i18n/en/features/addition.feature +16 -0
  29. data/examples/i18n/en/features/division.feature +9 -0
  30. data/examples/i18n/en/features/step_definitons/calculator_steps.rb +24 -0
  31. data/examples/i18n/en/lib/calculator.rb +14 -0
  32. data/examples/i18n/es/Rakefile +6 -0
  33. data/examples/i18n/es/features/adicion.feature +17 -0
  34. data/examples/i18n/es/features/step_definitons/calculador_steps.rb +24 -0
  35. data/examples/i18n/es/lib/calculador.rb +11 -0
  36. data/examples/i18n/et/Rakefile +6 -0
  37. data/examples/i18n/et/features/liitmine.feature +17 -0
  38. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +24 -0
  39. data/examples/i18n/et/lib/kalkulaator.rb +10 -0
  40. data/examples/i18n/fi/Rakefile +6 -0
  41. data/examples/i18n/fi/features/jakolasku.feature +9 -0
  42. data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +24 -0
  43. data/examples/i18n/fi/features/yhteenlasku.feature +16 -0
  44. data/examples/i18n/fi/lib/laskin.rb +14 -0
  45. data/examples/i18n/fr/Rakefile +6 -0
  46. data/examples/i18n/fr/features/addition.feature +15 -0
  47. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +27 -0
  48. data/examples/i18n/fr/lib/calculatrice.rb +10 -0
  49. data/examples/i18n/id/Rakefile +6 -0
  50. data/examples/i18n/id/features/addition.feature +16 -0
  51. data/examples/i18n/id/features/division.feature +9 -0
  52. data/examples/i18n/id/features/step_definitons/calculator_steps.rb +24 -0
  53. data/examples/i18n/id/lib/calculator.rb +14 -0
  54. data/examples/i18n/it/Rakefile +6 -0
  55. data/examples/i18n/it/features/somma.feature +10 -0
  56. data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +24 -0
  57. data/examples/i18n/it/lib/calcolatrice.rb +11 -0
  58. data/examples/i18n/ja/README.txt +5 -0
  59. data/examples/i18n/ja/Rakefile +6 -0
  60. data/examples/i18n/ja/features/addition.feature +16 -0
  61. data/examples/i18n/ja/features/division.feature +9 -0
  62. data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +24 -0
  63. data/examples/i18n/ja/lib/calculator.rb +14 -0
  64. data/examples/i18n/ko/Rakefile +6 -0
  65. data/examples/i18n/ko/features/addition.feature +16 -0
  66. data/examples/i18n/ko/features/division.feature +10 -0
  67. data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +24 -0
  68. data/examples/i18n/ko/lib/calculator.rb +14 -0
  69. data/examples/i18n/lt/Rakefile +6 -0
  70. data/examples/i18n/lt/features/addition.feature +17 -0
  71. data/examples/i18n/lt/features/division.feature +9 -0
  72. data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +24 -0
  73. data/examples/i18n/lt/lib/calculator.rb +14 -0
  74. data/examples/i18n/no/Rakefile +6 -0
  75. data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +24 -0
  76. data/examples/i18n/no/features/summering.feature +18 -0
  77. data/examples/i18n/no/lib/kalkulator.rb +11 -0
  78. data/examples/i18n/pt/Rakefile +6 -0
  79. data/examples/i18n/pt/features/adicao.feature +10 -0
  80. data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +24 -0
  81. data/examples/i18n/pt/lib/calculadora.rb +10 -0
  82. data/examples/i18n/ro/Rakefile +6 -0
  83. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +24 -0
  84. data/examples/i18n/ro/features/suma.feature +10 -0
  85. data/examples/i18n/ro/lib/calculator.rb +11 -0
  86. data/examples/i18n/se/Rakefile +6 -0
  87. data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +24 -0
  88. data/examples/i18n/se/features/summering.feature +17 -0
  89. data/examples/i18n/se/lib/kalkulator.rb +11 -0
  90. data/examples/i18n/zh-CN/Rakefile +6 -0
  91. data/examples/i18n/zh-CN/features/addition.feature +17 -0
  92. data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +26 -0
  93. data/examples/i18n/zh-CN/lib/calculator.rb +10 -0
  94. data/examples/java/README.textile +22 -0
  95. data/examples/java/Rakefile +12 -0
  96. data/examples/java/features/hello.feature +11 -0
  97. data/examples/java/features/step_definitons/hello_steps.rb +25 -0
  98. data/examples/java/features/step_definitons/tree_steps.rb +14 -0
  99. data/examples/java/features/tree.feature +9 -0
  100. data/examples/java/src/cucumber/demo/Hello.java +16 -0
  101. data/examples/jbehave/README.textile +17 -0
  102. data/examples/jbehave/features/support/env.rb +7 -0
  103. data/examples/jbehave/features/trading.feature +24 -0
  104. data/examples/jbehave/pom.xml +48 -0
  105. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/converters/TraderConverter.java +32 -0
  106. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Stock.java +42 -0
  107. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Trader.java +29 -0
  108. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/persistence/TraderPersister.java +22 -0
  109. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java +65 -0
  110. data/examples/selenium/Rakefile +6 -0
  111. data/examples/selenium/features/search.feature +9 -0
  112. data/examples/selenium/features/step_definitons/stories_steps.rb +40 -0
  113. data/examples/self_test/README.textile +6 -0
  114. data/examples/self_test/features/call_undefined_step_from_step_def.feature +7 -0
  115. data/examples/self_test/features/lots_of_undefined.feature +8 -0
  116. data/examples/self_test/features/outline_sample.feature +15 -0
  117. data/examples/self_test/features/sample.feature +16 -0
  118. data/examples/self_test/features/step_definitions/sample_steps.rb +25 -0
  119. data/examples/test_unit/Rakefile +6 -0
  120. data/examples/test_unit/features/step_definitions/test_unit_steps.rb +26 -0
  121. data/examples/test_unit/features/test_unit.feature +9 -0
  122. data/examples/tickets/Rakefile +11 -0
  123. data/examples/tickets/cucumber.yml +2 -0
  124. data/examples/tickets/features/lib/eatting_machine.rb +18 -0
  125. data/examples/tickets/features/lib/pantry.rb +20 -0
  126. data/examples/tickets/features/scenario_outline.feature +95 -0
  127. data/examples/tickets/features/step_definitons/scenario_outline_steps.rb +42 -0
  128. data/examples/tickets/features/step_definitons/tickets_steps.rb +60 -0
  129. data/examples/tickets/features/tickets.feature +28 -0
  130. data/examples/watir/README.textile +16 -0
  131. data/examples/watir/Rakefile +6 -0
  132. data/examples/watir/features/search.feature +9 -0
  133. data/examples/watir/features/step_definitons/search_steps.rb +24 -0
  134. data/examples/watir/features/support/env.rb +32 -0
  135. data/features/cucumber_cli.feature +331 -0
  136. data/features/cucumber_cli_outlines.feature +90 -0
  137. data/features/report_called_undefined_steps.feature +32 -0
  138. data/features/step_definitions/cucumber_steps.rb +31 -0
  139. data/features/step_definitions/extra_steps.rb +2 -0
  140. data/features/support/env.rb +7 -0
  141. data/gem_tasks/deployment.rake +11 -0
  142. data/gem_tasks/environment.rake +7 -0
  143. data/gem_tasks/features.rake +6 -0
  144. data/gem_tasks/fix_cr_lf.rake +10 -0
  145. data/gem_tasks/flog.rake +4 -0
  146. data/gem_tasks/gemspec.rake +10 -0
  147. data/gem_tasks/rspec.rake +35 -0
  148. data/gem_tasks/yard.rake +8 -0
  149. data/lib/autotest/cucumber.rb +6 -0
  150. data/lib/autotest/cucumber_mixin.rb +124 -0
  151. data/lib/autotest/cucumber_rails.rb +6 -0
  152. data/lib/autotest/cucumber_rails_rspec.rb +6 -0
  153. data/lib/autotest/cucumber_rspec.rb +6 -0
  154. data/lib/autotest/discover.rb +9 -0
  155. data/lib/cucumber.rb +72 -0
  156. data/lib/cucumber/ast.rb +27 -0
  157. data/lib/cucumber/ast/comment.rb +26 -0
  158. data/lib/cucumber/ast/examples.rb +22 -0
  159. data/lib/cucumber/ast/feature.rb +60 -0
  160. data/lib/cucumber/ast/features.rb +39 -0
  161. data/lib/cucumber/ast/filter.rb +22 -0
  162. data/lib/cucumber/ast/outline_table.rb +49 -0
  163. data/lib/cucumber/ast/py_string.rb +52 -0
  164. data/lib/cucumber/ast/scenario.rb +95 -0
  165. data/lib/cucumber/ast/scenario_outline.rb +83 -0
  166. data/lib/cucumber/ast/step.rb +139 -0
  167. data/lib/cucumber/ast/table.rb +214 -0
  168. data/lib/cucumber/ast/tags.rb +33 -0
  169. data/lib/cucumber/ast/visitor.rb +93 -0
  170. data/lib/cucumber/broadcaster.rb +15 -0
  171. data/lib/cucumber/cli.rb +414 -0
  172. data/lib/cucumber/core_ext/exception.rb +53 -0
  173. data/lib/cucumber/core_ext/instance_exec.rb +54 -0
  174. data/lib/cucumber/core_ext/proc.rb +33 -0
  175. data/lib/cucumber/core_ext/string.rb +48 -0
  176. data/lib/cucumber/formatter.rb +1 -0
  177. data/lib/cucumber/formatter/ansicolor.rb +106 -0
  178. data/lib/cucumber/formatter/console.rb +116 -0
  179. data/lib/cucumber/formatter/pretty.rb +158 -0
  180. data/lib/cucumber/formatter/profile.rb +77 -0
  181. data/lib/cucumber/formatter/progress.rb +68 -0
  182. data/lib/cucumber/formatter/rerun.rb +35 -0
  183. data/lib/cucumber/formatters/unicode.rb +2 -0
  184. data/lib/cucumber/jbehave.rb +104 -0
  185. data/lib/cucumber/languages.yml +314 -0
  186. data/lib/cucumber/parser.rb +24 -0
  187. data/lib/cucumber/parser/basic.rb +0 -0
  188. data/lib/cucumber/parser/feature.rb +1351 -0
  189. data/lib/cucumber/parser/feature.tt +160 -0
  190. data/lib/cucumber/parser/i18n.tt +27 -0
  191. data/lib/cucumber/parser/table.rb +396 -0
  192. data/lib/cucumber/parser/table.tt +53 -0
  193. data/lib/cucumber/parser/treetop_ext.rb +67 -0
  194. data/lib/cucumber/platform.rb +18 -0
  195. data/lib/cucumber/rails/rspec.rb +5 -0
  196. data/lib/cucumber/rails/world.rb +73 -0
  197. data/lib/cucumber/rake/task.rb +106 -0
  198. data/lib/cucumber/step_definition.rb +87 -0
  199. data/lib/cucumber/step_mother.rb +164 -0
  200. data/lib/cucumber/version.rb +10 -0
  201. data/pretty.txt +486 -0
  202. data/rails_generators/cucumber/USAGE +11 -0
  203. data/rails_generators/cucumber/cucumber_generator.rb +31 -0
  204. data/rails_generators/cucumber/templates/cucumber +8 -0
  205. data/rails_generators/cucumber/templates/cucumber.rake +7 -0
  206. data/rails_generators/cucumber/templates/env.rb +16 -0
  207. data/rails_generators/cucumber/templates/paths.rb +12 -0
  208. data/rails_generators/cucumber/templates/webrat_steps.rb +99 -0
  209. data/rails_generators/feature/USAGE +12 -0
  210. data/rails_generators/feature/feature_generator.rb +36 -0
  211. data/rails_generators/feature/templates/feature.erb +31 -0
  212. data/rails_generators/feature/templates/steps.erb +24 -0
  213. data/spec/cucumber/ast/feature_factory.rb +54 -0
  214. data/spec/cucumber/ast/feature_spec.rb +60 -0
  215. data/spec/cucumber/ast/py_string_spec.rb +40 -0
  216. data/spec/cucumber/ast/scenario_outline_spec.rb +64 -0
  217. data/spec/cucumber/ast/scenario_spec.rb +82 -0
  218. data/spec/cucumber/ast/step_spec.rb +45 -0
  219. data/spec/cucumber/ast/table_spec.rb +81 -0
  220. data/spec/cucumber/broadcaster_spec.rb +14 -0
  221. data/spec/cucumber/cli_spec.rb +416 -0
  222. data/spec/cucumber/core_ext/proc_spec.rb +37 -0
  223. data/spec/cucumber/core_ext/string_spec.rb +42 -0
  224. data/spec/cucumber/formatter/ansicolor_spec.rb +35 -0
  225. data/spec/cucumber/formatter/html/cucumber.css +37 -0
  226. data/spec/cucumber/formatter/html/cucumber.js +13 -0
  227. data/spec/cucumber/formatter/html/index.html +45 -0
  228. data/spec/cucumber/formatter/html/jquery-1.3.min.js +19 -0
  229. data/spec/cucumber/formatter/html/jquery.uitableedit.js +100 -0
  230. data/spec/cucumber/formatters/profile_formatter_spec.rb +198 -0
  231. data/spec/cucumber/parser/feature_parser_spec.rb +247 -0
  232. data/spec/cucumber/parser/table_parser_spec.rb +48 -0
  233. data/spec/cucumber/rails/stubs/mini_rails.rb +18 -0
  234. data/spec/cucumber/rails/stubs/test_help.rb +1 -0
  235. data/spec/cucumber/rails/world_spec.rb +11 -0
  236. data/spec/cucumber/sell_cucumbers.feature +19 -0
  237. data/spec/cucumber/step_definition_spec.rb +62 -0
  238. data/spec/cucumber/treetop_parser/empty_feature.feature +4 -0
  239. data/spec/cucumber/treetop_parser/empty_scenario.feature +9 -0
  240. data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +3 -0
  241. data/spec/cucumber/treetop_parser/fit_scenario.feature +8 -0
  242. data/spec/cucumber/treetop_parser/given_scenario.feature +9 -0
  243. data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +7 -0
  244. data/spec/cucumber/treetop_parser/multiline_steps.feature +17 -0
  245. data/spec/cucumber/treetop_parser/multiple_tables.feature +27 -0
  246. data/spec/cucumber/treetop_parser/scenario_outline.feature +16 -0
  247. data/spec/cucumber/treetop_parser/spaces.feature +12 -0
  248. data/spec/cucumber/treetop_parser/test_dos.feature +25 -0
  249. data/spec/cucumber/treetop_parser/with_comments.feature +10 -0
  250. data/spec/cucumber/treetop_parser/with_tags.feature +18 -0
  251. data/spec/cucumber/world/pending_spec.rb +47 -0
  252. data/spec/spec.opts +2 -0
  253. data/spec/spec_helper.rb +21 -0
  254. metadata +7 -1
@@ -0,0 +1,160 @@
1
+ module Cucumber
2
+ module Parser
3
+ # TIP: When you hack on the grammar, just delete feature.rb in this directory.
4
+ # Treetop will then generate the parser in-memory. When you're happy, just generate
5
+ # the rb file with tt feature.tt
6
+ grammar Feature
7
+ include I18n
8
+ include Table
9
+
10
+ rule feature
11
+ white comment white tags white header:(!(scenario_outline / scenario) .)* feature_elements {
12
+ def build
13
+ Ast::Feature.new(comment.build, tags.build, header.text_value, feature_elements.build)
14
+ end
15
+ }
16
+ end
17
+
18
+ rule tags
19
+ white ts:(tag (space/eol)+)* {
20
+ def build
21
+ tag_names = ts.elements.map{|e| e.tag.tag_name.text_value}
22
+ Ast::Tags.new(ts.line, tag_names)
23
+ end
24
+ }
25
+ end
26
+
27
+ rule tag
28
+ '@' tag_name:([a-z0-9])+
29
+ end
30
+
31
+ rule comment
32
+ (comment_line eol+)* {
33
+ def build
34
+ Ast::Comment.new(text_value)
35
+ end
36
+ }
37
+ end
38
+
39
+ rule comment_line
40
+ '#' line_to_eol
41
+ end
42
+
43
+ rule feature_elements
44
+ (scenario / scenario_outline)* {
45
+ def build
46
+ elements.map{|s| s.build}
47
+ end
48
+ }
49
+ end
50
+
51
+ rule scenario
52
+ comment tags white scenario_keyword space* name:line_to_eol (eol+ / eof) steps {
53
+ def build
54
+ Ast::Scenario.new(
55
+ comment.build,
56
+ tags.build,
57
+ scenario_keyword.line,
58
+ scenario_keyword.text_value,
59
+ name.text_value,
60
+ steps.build
61
+ )
62
+ end
63
+ }
64
+ end
65
+
66
+ rule scenario_outline
67
+ comment tags white scenario_outline_keyword space* name:line_to_eol white steps examples_sections {
68
+ def build
69
+ Ast::ScenarioOutline.new(
70
+ comment.build,
71
+ tags.build,
72
+ scenario_outline_keyword.line,
73
+ scenario_outline_keyword.text_value,
74
+ name.text_value,
75
+ steps.build,
76
+ examples_sections.build
77
+ )
78
+ end
79
+ }
80
+ end
81
+
82
+ rule steps
83
+ step* {
84
+ def build
85
+ elements.map{|e| e.build}
86
+ end
87
+ }
88
+ end
89
+
90
+ rule step
91
+ space* step_keyword space* name:line_to_eol (eol+ / eof) multi:multiline_arg? {
92
+ def build
93
+ if multi.respond_to?(:build)
94
+ Ast::Step.new(step_keyword.line, step_keyword.text_value, name.text_value, multi.build)
95
+ else
96
+ Ast::Step.new(step_keyword.line, step_keyword.text_value, name.text_value)
97
+ end
98
+ end
99
+ }
100
+ end
101
+
102
+ rule examples_sections
103
+ examples+ {
104
+ def build
105
+ elements.map{|e| e.build}
106
+ end
107
+ }
108
+ end
109
+
110
+ rule examples
111
+ space* examples_keyword space* name:line_to_eol? eol+ table {
112
+ def build
113
+ [examples_keyword.line, examples_keyword.text_value, name.text_value, table.raw]
114
+ end
115
+ }
116
+ end
117
+
118
+ rule multiline_arg
119
+ table / py_string
120
+ end
121
+
122
+ rule line_to_eol
123
+ (!eol .)+
124
+ end
125
+
126
+ rule py_string
127
+ open_py_string s:(!close_py_string .)* close_py_string {
128
+ def build
129
+ Ast::PyString.new(open_py_string.line, close_py_string.line, s.text_value, open_py_string.indentation)
130
+ end
131
+ }
132
+ end
133
+
134
+ rule open_py_string
135
+ white '"""' space* eol {
136
+ def indentation
137
+ white.text_value.length
138
+ end
139
+
140
+ def line
141
+ white.line
142
+ end
143
+ }
144
+ end
145
+
146
+ rule close_py_string
147
+ eol space* quotes:'"""' white {
148
+ def line
149
+ quotes.line
150
+ end
151
+ }
152
+ end
153
+
154
+ rule white
155
+ (space / eol)*
156
+ end
157
+
158
+ end
159
+ end
160
+ end
@@ -0,0 +1,27 @@
1
+ module Cucumber
2
+ module Parser
3
+ grammar I18n
4
+
5
+ rule scenario_keyword
6
+ '<%= keywords['scenario'] %>:'
7
+ end
8
+
9
+ rule scenario_outline_keyword
10
+ '<%= keywords['scenario_outline'] %>:'
11
+ end
12
+
13
+ rule step_keyword
14
+ '<%= keywords['given'] %>' /
15
+ '<%= keywords['when'] %>' /
16
+ '<%= keywords['then'] %>' /
17
+ '<%= keywords['and'] %>' /
18
+ '<%= keywords['but'] %>'
19
+ end
20
+
21
+ rule examples_keyword
22
+ '<%= keywords['examples'] %>' ':'?
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,396 @@
1
+ module Cucumber
2
+ module Parser
3
+ module Table
4
+ include Treetop::Runtime
5
+
6
+ def root
7
+ @root || :table
8
+ end
9
+
10
+ module Table0
11
+ def build
12
+ Ast::Table.new(raw)
13
+ end
14
+
15
+ def raw
16
+ elements.map{|e| e.build}
17
+ end
18
+ end
19
+
20
+ def _nt_table
21
+ start_index = index
22
+ if node_cache[:table].has_key?(index)
23
+ cached = node_cache[:table][index]
24
+ @index = cached.interval.end if cached
25
+ return cached
26
+ end
27
+
28
+ s0, i0 = [], index
29
+ loop do
30
+ r1 = _nt_table_row
31
+ if r1
32
+ s0 << r1
33
+ else
34
+ break
35
+ end
36
+ end
37
+ if s0.empty?
38
+ self.index = i0
39
+ r0 = nil
40
+ else
41
+ r0 = SyntaxNode.new(input, i0...index, s0)
42
+ r0.extend(Table0)
43
+ end
44
+
45
+ node_cache[:table][start_index] = r0
46
+
47
+ return r0
48
+ end
49
+
50
+ module TableRow0
51
+ def cell
52
+ elements[0]
53
+ end
54
+
55
+ end
56
+
57
+ module TableRow1
58
+ def cells
59
+ elements[2]
60
+ end
61
+
62
+ end
63
+
64
+ module TableRow2
65
+ def build
66
+ row = cells.elements.map do |elt|
67
+ value = elt.cell.text_value.strip
68
+ value.empty? ? nil : value
69
+ end
70
+
71
+ class << row
72
+ attr_accessor :line
73
+ end
74
+ row.line = cells.line
75
+
76
+ row
77
+ end
78
+ end
79
+
80
+ def _nt_table_row
81
+ start_index = index
82
+ if node_cache[:table_row].has_key?(index)
83
+ cached = node_cache[:table_row][index]
84
+ @index = cached.interval.end if cached
85
+ return cached
86
+ end
87
+
88
+ i0, s0 = index, []
89
+ s1, i1 = [], index
90
+ loop do
91
+ r2 = _nt_space
92
+ if r2
93
+ s1 << r2
94
+ else
95
+ break
96
+ end
97
+ end
98
+ r1 = SyntaxNode.new(input, i1...index, s1)
99
+ s0 << r1
100
+ if r1
101
+ if input.index('|', index) == index
102
+ r3 = (SyntaxNode).new(input, index...(index + 1))
103
+ @index += 1
104
+ else
105
+ terminal_parse_failure('|')
106
+ r3 = nil
107
+ end
108
+ s0 << r3
109
+ if r3
110
+ s4, i4 = [], index
111
+ loop do
112
+ i5, s5 = index, []
113
+ r6 = _nt_cell
114
+ s5 << r6
115
+ if r6
116
+ if input.index('|', index) == index
117
+ r7 = (SyntaxNode).new(input, index...(index + 1))
118
+ @index += 1
119
+ else
120
+ terminal_parse_failure('|')
121
+ r7 = nil
122
+ end
123
+ s5 << r7
124
+ end
125
+ if s5.last
126
+ r5 = (SyntaxNode).new(input, i5...index, s5)
127
+ r5.extend(TableRow0)
128
+ else
129
+ self.index = i5
130
+ r5 = nil
131
+ end
132
+ if r5
133
+ s4 << r5
134
+ else
135
+ break
136
+ end
137
+ end
138
+ if s4.empty?
139
+ self.index = i4
140
+ r4 = nil
141
+ else
142
+ r4 = SyntaxNode.new(input, i4...index, s4)
143
+ end
144
+ s0 << r4
145
+ if r4
146
+ s8, i8 = [], index
147
+ loop do
148
+ r9 = _nt_space
149
+ if r9
150
+ s8 << r9
151
+ else
152
+ break
153
+ end
154
+ end
155
+ r8 = SyntaxNode.new(input, i8...index, s8)
156
+ s0 << r8
157
+ if r8
158
+ i10 = index
159
+ s11, i11 = [], index
160
+ loop do
161
+ r12 = _nt_eol
162
+ if r12
163
+ s11 << r12
164
+ else
165
+ break
166
+ end
167
+ end
168
+ if s11.empty?
169
+ self.index = i11
170
+ r11 = nil
171
+ else
172
+ r11 = SyntaxNode.new(input, i11...index, s11)
173
+ end
174
+ if r11
175
+ r10 = r11
176
+ else
177
+ r13 = _nt_eof
178
+ if r13
179
+ r10 = r13
180
+ else
181
+ self.index = i10
182
+ r10 = nil
183
+ end
184
+ end
185
+ s0 << r10
186
+ end
187
+ end
188
+ end
189
+ end
190
+ if s0.last
191
+ r0 = (SyntaxNode).new(input, i0...index, s0)
192
+ r0.extend(TableRow1)
193
+ r0.extend(TableRow2)
194
+ else
195
+ self.index = i0
196
+ r0 = nil
197
+ end
198
+
199
+ node_cache[:table_row][start_index] = r0
200
+
201
+ return r0
202
+ end
203
+
204
+ module Cell0
205
+ end
206
+
207
+ def _nt_cell
208
+ start_index = index
209
+ if node_cache[:cell].has_key?(index)
210
+ cached = node_cache[:cell][index]
211
+ @index = cached.interval.end if cached
212
+ return cached
213
+ end
214
+
215
+ s0, i0 = [], index
216
+ loop do
217
+ i1, s1 = index, []
218
+ i2 = index
219
+ i3 = index
220
+ if input.index('|', index) == index
221
+ r4 = (SyntaxNode).new(input, index...(index + 1))
222
+ @index += 1
223
+ else
224
+ terminal_parse_failure('|')
225
+ r4 = nil
226
+ end
227
+ if r4
228
+ r3 = r4
229
+ else
230
+ r5 = _nt_eol
231
+ if r5
232
+ r3 = r5
233
+ else
234
+ self.index = i3
235
+ r3 = nil
236
+ end
237
+ end
238
+ if r3
239
+ r2 = nil
240
+ else
241
+ self.index = i2
242
+ r2 = SyntaxNode.new(input, index...index)
243
+ end
244
+ s1 << r2
245
+ if r2
246
+ if index < input_length
247
+ r6 = (SyntaxNode).new(input, index...(index + 1))
248
+ @index += 1
249
+ else
250
+ terminal_parse_failure("any character")
251
+ r6 = nil
252
+ end
253
+ s1 << r6
254
+ end
255
+ if s1.last
256
+ r1 = (SyntaxNode).new(input, i1...index, s1)
257
+ r1.extend(Cell0)
258
+ else
259
+ self.index = i1
260
+ r1 = nil
261
+ end
262
+ if r1
263
+ s0 << r1
264
+ else
265
+ break
266
+ end
267
+ end
268
+ r0 = SyntaxNode.new(input, i0...index, s0)
269
+
270
+ node_cache[:cell][start_index] = r0
271
+
272
+ return r0
273
+ end
274
+
275
+ def _nt_space
276
+ start_index = index
277
+ if node_cache[:space].has_key?(index)
278
+ cached = node_cache[:space][index]
279
+ @index = cached.interval.end if cached
280
+ return cached
281
+ end
282
+
283
+ if input.index(Regexp.new('[ \\t]'), index) == index
284
+ r0 = (SyntaxNode).new(input, index...(index + 1))
285
+ @index += 1
286
+ else
287
+ r0 = nil
288
+ end
289
+
290
+ node_cache[:space][start_index] = r0
291
+
292
+ return r0
293
+ end
294
+
295
+ module Eol0
296
+ end
297
+
298
+ def _nt_eol
299
+ start_index = index
300
+ if node_cache[:eol].has_key?(index)
301
+ cached = node_cache[:eol][index]
302
+ @index = cached.interval.end if cached
303
+ return cached
304
+ end
305
+
306
+ i0 = index
307
+ if input.index("\n", index) == index
308
+ r1 = (SyntaxNode).new(input, index...(index + 1))
309
+ @index += 1
310
+ else
311
+ terminal_parse_failure("\n")
312
+ r1 = nil
313
+ end
314
+ if r1
315
+ r0 = r1
316
+ else
317
+ i2, s2 = index, []
318
+ if input.index("\r", index) == index
319
+ r3 = (SyntaxNode).new(input, index...(index + 1))
320
+ @index += 1
321
+ else
322
+ terminal_parse_failure("\r")
323
+ r3 = nil
324
+ end
325
+ s2 << r3
326
+ if r3
327
+ if input.index("\n", index) == index
328
+ r5 = (SyntaxNode).new(input, index...(index + 1))
329
+ @index += 1
330
+ else
331
+ terminal_parse_failure("\n")
332
+ r5 = nil
333
+ end
334
+ if r5
335
+ r4 = r5
336
+ else
337
+ r4 = SyntaxNode.new(input, index...index)
338
+ end
339
+ s2 << r4
340
+ end
341
+ if s2.last
342
+ r2 = (SyntaxNode).new(input, i2...index, s2)
343
+ r2.extend(Eol0)
344
+ else
345
+ self.index = i2
346
+ r2 = nil
347
+ end
348
+ if r2
349
+ r0 = r2
350
+ else
351
+ self.index = i0
352
+ r0 = nil
353
+ end
354
+ end
355
+
356
+ node_cache[:eol][start_index] = r0
357
+
358
+ return r0
359
+ end
360
+
361
+ def _nt_eof
362
+ start_index = index
363
+ if node_cache[:eof].has_key?(index)
364
+ cached = node_cache[:eof][index]
365
+ @index = cached.interval.end if cached
366
+ return cached
367
+ end
368
+
369
+ i0 = index
370
+ if index < input_length
371
+ r1 = (SyntaxNode).new(input, index...(index + 1))
372
+ @index += 1
373
+ else
374
+ terminal_parse_failure("any character")
375
+ r1 = nil
376
+ end
377
+ if r1
378
+ r0 = nil
379
+ else
380
+ self.index = i0
381
+ r0 = SyntaxNode.new(input, index...index)
382
+ end
383
+
384
+ node_cache[:eof][start_index] = r0
385
+
386
+ return r0
387
+ end
388
+
389
+ end
390
+
391
+ class TableParser < Treetop::Runtime::CompiledParser
392
+ include Table
393
+ end
394
+
395
+ end
396
+ end