cucumber 0.1.16 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (322) hide show
  1. data/History.txt +111 -5
  2. data/License.txt +1 -1
  3. data/Manifest.txt +141 -83
  4. data/Rakefile +1 -1
  5. data/bin/cucumber +2 -2
  6. data/config/hoe.rb +8 -2
  7. data/examples/cs/features/addition.feature +4 -5
  8. data/examples/cs/features/step_definitons/calculator_steps.rb +1 -5
  9. data/examples/i18n/README.textile +1 -1
  10. data/examples/i18n/Rakefile +5 -5
  11. data/examples/i18n/ar/features/addition.feature +10 -11
  12. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -10
  13. data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +1 -1
  14. data/examples/i18n/de/features/addition.feature +10 -11
  15. data/examples/i18n/de/features/division.feature +0 -1
  16. data/examples/i18n/de/features/step_definitons/calculator_steps.rb +2 -10
  17. data/examples/i18n/en-lol/Rakefile +6 -0
  18. data/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb +16 -0
  19. data/examples/i18n/en-lol/features/stuffing.feature +8 -0
  20. data/examples/i18n/en-lol/features/support/env.rb +8 -0
  21. data/examples/i18n/en-lol/lib/basket.rb +12 -0
  22. data/examples/i18n/en-lol/lib/belly.rb +11 -0
  23. data/examples/i18n/en/features/addition.feature +10 -11
  24. data/examples/i18n/en/features/division.feature +0 -1
  25. data/examples/i18n/en/features/step_definitons/calculator_steps.rb +2 -6
  26. data/examples/i18n/es/features/adicion.feature +11 -12
  27. data/examples/i18n/es/features/step_definitons/calculador_steps.rb +7 -10
  28. data/examples/i18n/es/lib/calculador.rb +4 -1
  29. data/examples/i18n/et/features/jagamine.feature +9 -0
  30. data/examples/i18n/et/features/liitmine.feature +10 -11
  31. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +4 -8
  32. data/examples/i18n/et/lib/kalkulaator.rb +5 -1
  33. data/examples/i18n/fi/Rakefile +6 -0
  34. data/examples/i18n/fi/features/jakolasku.feature +9 -0
  35. data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +24 -0
  36. data/examples/i18n/fi/features/yhteenlasku.feature +16 -0
  37. data/examples/i18n/fi/lib/laskin.rb +14 -0
  38. data/examples/i18n/fr/features/addition.feature +14 -12
  39. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +11 -13
  40. data/examples/i18n/fr/lib/calculatrice.rb +1 -1
  41. data/examples/i18n/id/features/addition.feature +10 -11
  42. data/examples/i18n/id/features/division.feature +0 -1
  43. data/examples/i18n/id/features/step_definitons/calculator_steps.rb +2 -11
  44. data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +1 -1
  45. data/examples/i18n/ja/features/addition.feature +10 -11
  46. data/examples/i18n/ja/features/division.feature +2 -3
  47. data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +4 -13
  48. data/examples/i18n/ko/features/addition.feature +7 -8
  49. data/examples/i18n/ko/features/division.feature +3 -4
  50. data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +1 -5
  51. data/examples/i18n/lt/features/addition.feature +11 -11
  52. data/examples/i18n/lt/features/division.feature +0 -1
  53. data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +2 -11
  54. data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +3 -10
  55. data/examples/i18n/no/features/summering.feature +1 -0
  56. data/examples/i18n/no/features/support/env.rb +6 -0
  57. data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +1 -1
  58. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +1 -1
  59. data/examples/i18n/ru/Rakefile +6 -0
  60. data/examples/i18n/ru/features/addition.feature +10 -0
  61. data/examples/i18n/ru/features/consecutive_calculations.feature +16 -0
  62. data/examples/i18n/ru/features/division.feature +15 -0
  63. data/examples/i18n/ru/features/step_definitons/calculator_steps.rb +19 -0
  64. data/examples/i18n/ru/features/support/env.rb +6 -0
  65. data/examples/i18n/ru/features/support/world.rb +7 -0
  66. data/examples/i18n/ru/lib/calculator.rb +24 -0
  67. data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +1 -1
  68. data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +2 -2
  69. data/examples/i18n/zh-TW/Rakefile +6 -0
  70. data/examples/i18n/zh-TW/features/addition.feature +16 -0
  71. data/examples/i18n/zh-TW/features/division.feature +10 -0
  72. data/examples/i18n/zh-TW/features/step_definitons/calculator_steps.rb +24 -0
  73. data/examples/i18n/zh-TW/lib/calculator.rb +14 -0
  74. data/examples/java/src/cucumber/demo/Hello.java +16 -0
  75. data/examples/jbehave/README.textile +20 -0
  76. data/examples/jbehave/features/support/env.rb +7 -0
  77. data/examples/jbehave/features/trading.feature +28 -0
  78. data/examples/jbehave/pom.xml +53 -0
  79. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/converters/TraderConverter.java +32 -0
  80. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Stock.java +42 -0
  81. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Trader.java +29 -0
  82. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/persistence/TraderPersister.java +22 -0
  83. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java +70 -0
  84. data/examples/selenium/features/step_definitons/search_steps.rb +13 -0
  85. data/examples/selenium/features/support/env.rb +19 -0
  86. data/examples/{calculator_ruby_features → selenium_webrat}/Rakefile +0 -0
  87. data/examples/selenium_webrat/features/search.feature +9 -0
  88. data/examples/selenium_webrat/features/step_definitons/search_steps.rb +13 -0
  89. data/examples/selenium_webrat/features/support/env.rb +41 -0
  90. data/examples/self_test/README.textile +4 -1
  91. data/examples/self_test/Rakefile +6 -0
  92. data/examples/self_test/features/background/failing_background.feature +11 -0
  93. data/examples/self_test/features/background/failing_background_after_success.feature +11 -0
  94. data/examples/self_test/features/background/multiline_args_background.feature +32 -0
  95. data/examples/self_test/features/background/passing_background.feature +10 -0
  96. data/examples/self_test/features/background/pending_background.feature +10 -0
  97. data/examples/self_test/features/background/scenario_outline_failing_background.feature +16 -0
  98. data/examples/self_test/features/background/scenario_outline_passing_background.feature +16 -0
  99. data/examples/self_test/features/call_undefined_step_from_step_def.feature +7 -0
  100. data/examples/self_test/features/failing_expectation.feature +4 -0
  101. data/examples/self_test/features/lots_of_undefined.feature +8 -0
  102. data/examples/self_test/features/outline_sample.feature +11 -5
  103. data/examples/self_test/features/sample.feature +8 -3
  104. data/examples/self_test/features/step_definitions/sample_steps.rb +55 -4
  105. data/examples/self_test/features/support/env.rb +1 -0
  106. data/examples/self_test/features/support/tag_count_formatter.rb +25 -0
  107. data/examples/sinatra/Rakefile +6 -0
  108. data/examples/sinatra/app.rb +14 -0
  109. data/examples/sinatra/features/add.feature +11 -0
  110. data/examples/sinatra/features/step_definitions/add_steps.rb +15 -0
  111. data/examples/sinatra/features/support/env.rb +20 -0
  112. data/examples/sinatra/views/add.erb +5 -0
  113. data/examples/sinatra/views/layout.erb +8 -0
  114. data/examples/tickets/Rakefile +13 -8
  115. data/examples/tickets/cucumber.yml +2 -1
  116. data/examples/tickets/features/172.feature +28 -0
  117. data/examples/tickets/features/177/1.feature +29 -0
  118. data/examples/tickets/features/177/2.feature +21 -0
  119. data/examples/tickets/features/177/3.feature +18 -0
  120. data/examples/tickets/features/180.feature +7 -0
  121. data/examples/tickets/features/236.feature +13 -0
  122. data/examples/tickets/features/241.feature +13 -0
  123. data/examples/tickets/features/scenario_outline.feature +6 -1
  124. data/examples/tickets/features/step_definitons/tickets_steps.rb +41 -4
  125. data/examples/tickets/features/tickets.feature +5 -1
  126. data/features/background.feature +221 -0
  127. data/features/cucumber_cli.feature +263 -97
  128. data/features/cucumber_cli_diff_disabled.feature +45 -0
  129. data/features/cucumber_cli_outlines.feature +50 -42
  130. data/features/custom_formatter.feature +11 -0
  131. data/features/report_called_undefined_steps.feature +34 -0
  132. data/features/step_definitions/cucumber_steps.rb +6 -3
  133. data/features/step_definitions/extra_steps.rb +1 -1
  134. data/features/support/env.rb +3 -2
  135. data/gem_tasks/features.rake +1 -1
  136. data/gem_tasks/flog.rake +1 -1
  137. data/gem_tasks/gemspec.rake +2 -2
  138. data/gem_tasks/jar.rake +67 -0
  139. data/gem_tasks/rspec.rake +2 -0
  140. data/lib/autotest/cucumber_mixin.rb +18 -23
  141. data/lib/cucumber.rb +55 -11
  142. data/lib/cucumber/ast.rb +29 -0
  143. data/lib/cucumber/ast/background.rb +50 -0
  144. data/lib/cucumber/ast/comment.rb +26 -0
  145. data/lib/cucumber/ast/examples.rb +38 -0
  146. data/lib/cucumber/ast/feature.rb +62 -0
  147. data/lib/cucumber/ast/feature_element.rb +46 -0
  148. data/lib/cucumber/ast/features.rb +20 -0
  149. data/lib/cucumber/ast/outline_table.rb +81 -0
  150. data/lib/cucumber/ast/py_string.rb +58 -0
  151. data/lib/cucumber/ast/scenario.rb +64 -0
  152. data/lib/cucumber/ast/scenario_outline.rb +90 -0
  153. data/lib/cucumber/ast/step.rb +122 -0
  154. data/lib/cucumber/ast/step_collection.rb +66 -0
  155. data/lib/cucumber/ast/step_invocation.rb +110 -0
  156. data/lib/cucumber/ast/table.rb +318 -0
  157. data/lib/cucumber/ast/tags.rb +33 -0
  158. data/lib/cucumber/ast/visitor.rb +125 -0
  159. data/lib/cucumber/broadcaster.rb +2 -9
  160. data/lib/cucumber/cli/configuration.rb +364 -0
  161. data/lib/cucumber/cli/language_help_formatter.rb +59 -0
  162. data/lib/cucumber/cli/main.rb +109 -0
  163. data/lib/cucumber/core_ext/exception.rb +41 -8
  164. data/lib/cucumber/core_ext/instance_exec.rb +54 -0
  165. data/lib/cucumber/core_ext/proc.rb +29 -65
  166. data/lib/cucumber/core_ext/string.rb +19 -0
  167. data/lib/cucumber/formatter.rb +1 -0
  168. data/lib/cucumber/{formatters → formatter}/ansicolor.rb +13 -16
  169. data/lib/cucumber/formatter/color_io.rb +23 -0
  170. data/lib/cucumber/formatter/console.rb +109 -0
  171. data/lib/cucumber/formatter/cucumber.css +55 -0
  172. data/lib/cucumber/formatter/cucumber.sass +49 -0
  173. data/lib/cucumber/formatter/html.rb +133 -0
  174. data/lib/cucumber/formatter/pretty.rb +179 -0
  175. data/lib/cucumber/formatter/profile.rb +77 -0
  176. data/lib/cucumber/formatter/progress.rb +60 -0
  177. data/lib/cucumber/formatter/rerun.rb +35 -0
  178. data/lib/cucumber/formatter/unicode.rb +35 -0
  179. data/lib/cucumber/formatters/unicode.rb +2 -35
  180. data/lib/cucumber/jbehave.rb +97 -0
  181. data/lib/cucumber/languages.yml +196 -80
  182. data/lib/cucumber/parser.rb +43 -0
  183. data/lib/cucumber/parser/basic.rb +0 -0
  184. data/lib/cucumber/parser/feature.rb +1487 -0
  185. data/lib/cucumber/parser/feature.tt +193 -0
  186. data/lib/cucumber/parser/i18n.tt +31 -0
  187. data/lib/cucumber/parser/table.rb +402 -0
  188. data/lib/cucumber/parser/table.tt +59 -0
  189. data/lib/cucumber/parser/treetop_ext.rb +75 -0
  190. data/lib/cucumber/platform.rb +2 -17
  191. data/lib/cucumber/rails/rspec.rb +5 -9
  192. data/lib/cucumber/rails/world.rb +2 -2
  193. data/lib/cucumber/rake/task.rb +39 -7
  194. data/lib/cucumber/step_definition.rb +103 -0
  195. data/lib/cucumber/step_match.rb +49 -0
  196. data/lib/cucumber/step_mother.rb +183 -67
  197. data/lib/cucumber/version.rb +2 -2
  198. data/lib/cucumber/world.rb +53 -1
  199. data/rails_generators/cucumber/cucumber_generator.rb +22 -3
  200. data/rails_generators/cucumber/templates/cucumber +2 -1
  201. data/rails_generators/cucumber/templates/cucumber.rake +13 -5
  202. data/rails_generators/cucumber/templates/env.rb +4 -3
  203. data/rails_generators/cucumber/templates/paths.rb +18 -11
  204. data/rails_generators/cucumber/templates/webrat_steps.rb +41 -25
  205. data/rails_generators/feature/feature_generator.rb +4 -0
  206. data/rails_generators/feature/templates/steps.erb +0 -4
  207. data/spec/cucumber/ast/background_spec.rb +49 -0
  208. data/spec/cucumber/ast/feature_factory.rb +63 -0
  209. data/spec/cucumber/ast/feature_spec.rb +37 -0
  210. data/spec/cucumber/ast/py_string_spec.rb +47 -0
  211. data/spec/cucumber/ast/scenario_outline_spec.rb +67 -0
  212. data/spec/cucumber/ast/scenario_spec.rb +65 -0
  213. data/spec/cucumber/ast/step_collection_spec.rb +8 -0
  214. data/spec/cucumber/ast/step_spec.rb +66 -0
  215. data/spec/cucumber/ast/table_spec.rb +149 -0
  216. data/spec/cucumber/ast/tags_spec.rb +19 -0
  217. data/spec/cucumber/broadcaster_spec.rb +6 -18
  218. data/spec/cucumber/cli/configuration_spec.rb +275 -0
  219. data/spec/cucumber/cli/main_spec.rb +203 -0
  220. data/spec/cucumber/core_ext/proc_spec.rb +27 -35
  221. data/spec/cucumber/core_ext/string_spec.rb +8 -0
  222. data/spec/cucumber/{formatters → formatter}/ansicolor_spec.rb +2 -2
  223. data/spec/cucumber/formatter/color_io_spec.rb +26 -0
  224. data/spec/cucumber/formatter/html/cucumber.css +37 -0
  225. data/spec/cucumber/formatter/html/cucumber.js +13 -0
  226. data/spec/cucumber/formatter/html/index.html +45 -0
  227. data/spec/cucumber/formatter/html/jquery-1.3.min.js +19 -0
  228. data/spec/cucumber/formatter/html/jquery.uitableedit.js +100 -0
  229. data/spec/cucumber/formatters/profile_formatter_spec.rb +17 -16
  230. data/spec/cucumber/parser/feature_parser_spec.rb +282 -0
  231. data/spec/cucumber/parser/table_parser_spec.rb +48 -0
  232. data/spec/cucumber/step_definition_spec.rb +81 -0
  233. data/spec/cucumber/step_mother_spec.rb +50 -51
  234. data/spec/cucumber/treetop_parser/empty_feature.feature +1 -1
  235. data/spec/cucumber/treetop_parser/multiple_tables.feature +6 -8
  236. data/spec/cucumber/treetop_parser/scenario_outline.feature +1 -1
  237. data/spec/cucumber/treetop_parser/spaces.feature +3 -1
  238. data/spec/cucumber/treetop_parser/with_comments.feature +1 -1
  239. data/spec/cucumber/treetop_parser/with_tags.feature +18 -0
  240. data/spec/cucumber/world/pending_spec.rb +13 -12
  241. data/spec/spec_helper.rb +1 -1
  242. metadata +165 -88
  243. data/examples/calculator_ruby_features/features/addition.rb +0 -39
  244. data/examples/calculator_ruby_features/features/step_definitons/calculator_steps.rb +0 -43
  245. data/examples/i18n/ja/README.txt +0 -5
  246. data/examples/selenium/features/step_definitons/stories_steps.rb +0 -40
  247. data/gem_tasks/treetop.rake +0 -41
  248. data/lib/cucumber/cli.rb +0 -356
  249. data/lib/cucumber/executor.rb +0 -205
  250. data/lib/cucumber/formatters.rb +0 -1
  251. data/lib/cucumber/formatters/autotest_formatter.rb +0 -23
  252. data/lib/cucumber/formatters/cucumber.css +0 -132
  253. data/lib/cucumber/formatters/cucumber.js +0 -11
  254. data/lib/cucumber/formatters/html_formatter.rb +0 -151
  255. data/lib/cucumber/formatters/jquery.js +0 -32
  256. data/lib/cucumber/formatters/pretty_formatter.rb +0 -285
  257. data/lib/cucumber/formatters/profile_formatter.rb +0 -92
  258. data/lib/cucumber/formatters/progress_formatter.rb +0 -61
  259. data/lib/cucumber/model.rb +0 -1
  260. data/lib/cucumber/model/table.rb +0 -32
  261. data/lib/cucumber/step_methods.rb +0 -49
  262. data/lib/cucumber/tree.rb +0 -16
  263. data/lib/cucumber/tree/feature.rb +0 -105
  264. data/lib/cucumber/tree/features.rb +0 -21
  265. data/lib/cucumber/tree/given_scenario.rb +0 -13
  266. data/lib/cucumber/tree/scenario.rb +0 -240
  267. data/lib/cucumber/tree/step.rb +0 -173
  268. data/lib/cucumber/tree/table.rb +0 -26
  269. data/lib/cucumber/tree/top_down_visitor.rb +0 -23
  270. data/lib/cucumber/treetop_parser/feature.treetop.erb +0 -254
  271. data/lib/cucumber/treetop_parser/feature_ar.rb +0 -1951
  272. data/lib/cucumber/treetop_parser/feature_cy.rb +0 -1951
  273. data/lib/cucumber/treetop_parser/feature_da.rb +0 -1951
  274. data/lib/cucumber/treetop_parser/feature_de.rb +0 -1951
  275. data/lib/cucumber/treetop_parser/feature_en-lol.rb +0 -1951
  276. data/lib/cucumber/treetop_parser/feature_en-tx.rb +0 -1951
  277. data/lib/cucumber/treetop_parser/feature_en.rb +0 -1951
  278. data/lib/cucumber/treetop_parser/feature_es.rb +0 -1951
  279. data/lib/cucumber/treetop_parser/feature_et.rb +0 -1951
  280. data/lib/cucumber/treetop_parser/feature_fr.rb +0 -1951
  281. data/lib/cucumber/treetop_parser/feature_id.rb +0 -1951
  282. data/lib/cucumber/treetop_parser/feature_it.rb +0 -1951
  283. data/lib/cucumber/treetop_parser/feature_ja.rb +0 -1951
  284. data/lib/cucumber/treetop_parser/feature_ko.rb +0 -1951
  285. data/lib/cucumber/treetop_parser/feature_lt.rb +0 -1951
  286. data/lib/cucumber/treetop_parser/feature_nl.rb +0 -1951
  287. data/lib/cucumber/treetop_parser/feature_no.rb +0 -1951
  288. data/lib/cucumber/treetop_parser/feature_parser.rb +0 -36
  289. data/lib/cucumber/treetop_parser/feature_pl.rb +0 -1951
  290. data/lib/cucumber/treetop_parser/feature_pt.rb +0 -1951
  291. data/lib/cucumber/treetop_parser/feature_ro.rb +0 -1951
  292. data/lib/cucumber/treetop_parser/feature_ro2.rb +0 -1951
  293. data/lib/cucumber/treetop_parser/feature_ru.rb +0 -1951
  294. data/lib/cucumber/treetop_parser/feature_se.rb +0 -1951
  295. data/lib/cucumber/treetop_parser/feature_zh-CN.rb +0 -1951
  296. data/lib/cucumber/world/pending.rb +0 -22
  297. data/script/console +0 -10
  298. data/script/console.cmd +0 -1
  299. data/script/destroy +0 -14
  300. data/script/destroy.cmd +0 -1
  301. data/script/generate +0 -14
  302. data/script/generate.cmd +0 -1
  303. data/script/txt2html +0 -74
  304. data/script/txt2html.cmd +0 -1
  305. data/setup.rb +0 -1585
  306. data/spec/cucumber/cli_spec.rb +0 -521
  307. data/spec/cucumber/executor_spec.rb +0 -382
  308. data/spec/cucumber/formatters/autotest_formatter_spec.rb +0 -26
  309. data/spec/cucumber/formatters/features.html +0 -269
  310. data/spec/cucumber/formatters/html_formatter_spec.rb +0 -104
  311. data/spec/cucumber/formatters/pretty_formatter_spec.rb +0 -410
  312. data/spec/cucumber/formatters/progress_formatter_spec.rb +0 -81
  313. data/spec/cucumber/model/table_spec.rb +0 -32
  314. data/spec/cucumber/tree/feature_spec.rb +0 -122
  315. data/spec/cucumber/tree/row_scenario_outline_spec.rb +0 -73
  316. data/spec/cucumber/tree/row_scenario_spec.rb +0 -55
  317. data/spec/cucumber/tree/row_step_outline_spec.rb +0 -38
  318. data/spec/cucumber/tree/scenario_outline_spec.rb +0 -50
  319. data/spec/cucumber/tree/scenario_spec.rb +0 -134
  320. data/spec/cucumber/tree/step_outline_spec.rb +0 -17
  321. data/spec/cucumber/tree/step_spec.rb +0 -59
  322. data/spec/cucumber/treetop_parser/feature_parser_spec.rb +0 -120
@@ -1,1951 +0,0 @@
1
- # encoding: utf-8
2
- module Cucumber
3
- # :stopdoc:
4
- module TreetopParser
5
- module Feature
6
- include Treetop::Runtime
7
-
8
- def root
9
- @root || :root
10
- end
11
-
12
- module Root0
13
- def header
14
- elements[1]
15
- end
16
-
17
- def scenario_sequence
18
- elements[2]
19
- end
20
-
21
- end
22
-
23
- module Root1
24
- def compile
25
- feature = Tree::Feature.new(header.text_value.strip)
26
- scenario_sequence.compile(feature)
27
- feature
28
- end
29
- end
30
-
31
- def _nt_root
32
- start_index = index
33
- if node_cache[:root].has_key?(index)
34
- cached = node_cache[:root][index]
35
- @index = cached.interval.end if cached
36
- return cached
37
- end
38
-
39
- i0, s0 = index, []
40
- r2 = _nt_space
41
- if r2
42
- r1 = r2
43
- else
44
- r1 = SyntaxNode.new(input, index...index)
45
- end
46
- s0 << r1
47
- if r1
48
- r3 = _nt_header
49
- s0 << r3
50
- if r3
51
- r4 = _nt_scenario_sequence
52
- s0 << r4
53
- if r4
54
- r6 = _nt_space
55
- if r6
56
- r5 = r6
57
- else
58
- r5 = SyntaxNode.new(input, index...index)
59
- end
60
- s0 << r5
61
- end
62
- end
63
- end
64
- if s0.last
65
- r0 = (SyntaxNode).new(input, i0...index, s0)
66
- r0.extend(Root0)
67
- r0.extend(Root1)
68
- else
69
- self.index = i0
70
- r0 = nil
71
- end
72
-
73
- node_cache[:root][start_index] = r0
74
-
75
- return r0
76
- end
77
-
78
- module Header0
79
- end
80
-
81
- def _nt_header
82
- start_index = index
83
- if node_cache[:header].has_key?(index)
84
- cached = node_cache[:header][index]
85
- @index = cached.interval.end if cached
86
- return cached
87
- end
88
-
89
- s0, i0 = [], index
90
- loop do
91
- i1, s1 = index, []
92
- i2 = index
93
- i3 = index
94
- r4 = _nt_scenario_keyword
95
- if r4
96
- r3 = r4
97
- else
98
- r5 = _nt_scenario_outline_keyword
99
- if r5
100
- r3 = r5
101
- else
102
- r6 = _nt_comment_to_eol
103
- if r6
104
- r3 = r6
105
- else
106
- self.index = i3
107
- r3 = nil
108
- end
109
- end
110
- end
111
- if r3
112
- r2 = nil
113
- else
114
- self.index = i2
115
- r2 = SyntaxNode.new(input, index...index)
116
- end
117
- s1 << r2
118
- if r2
119
- if index < input_length
120
- r7 = (SyntaxNode).new(input, index...(index + 1))
121
- @index += 1
122
- else
123
- terminal_parse_failure("any character")
124
- r7 = nil
125
- end
126
- s1 << r7
127
- end
128
- if s1.last
129
- r1 = (SyntaxNode).new(input, i1...index, s1)
130
- r1.extend(Header0)
131
- else
132
- self.index = i1
133
- r1 = nil
134
- end
135
- if r1
136
- s0 << r1
137
- else
138
- break
139
- end
140
- end
141
- if s0.empty?
142
- self.index = i0
143
- r0 = nil
144
- else
145
- r0 = SyntaxNode.new(input, i0...index, s0)
146
- end
147
-
148
- node_cache[:header][start_index] = r0
149
-
150
- return r0
151
- end
152
-
153
- module ScenarioSequence0
154
- def space
155
- elements[0]
156
- end
157
-
158
- def scenario_or_scenario_outline_or_table
159
- elements[1]
160
- end
161
- end
162
-
163
- module ScenarioSequence1
164
- def head
165
- elements[0]
166
- end
167
-
168
- def tail
169
- elements[1]
170
- end
171
- end
172
-
173
- module ScenarioSequence2
174
- def compile(feature)
175
- ([head] + tail).each do |scenario_or_scenario_outline_or_table|
176
- scenario_or_scenario_outline_or_table.compile(feature) if scenario_or_scenario_outline_or_table.respond_to?(:compile)
177
- end
178
- end
179
-
180
- def tail
181
- super.elements.map { |elt| elt.scenario_or_scenario_outline_or_table }
182
- end
183
- end
184
-
185
- def _nt_scenario_sequence
186
- start_index = index
187
- if node_cache[:scenario_sequence].has_key?(index)
188
- cached = node_cache[:scenario_sequence][index]
189
- @index = cached.interval.end if cached
190
- return cached
191
- end
192
-
193
- i0, s0 = index, []
194
- r2 = _nt_scenario_outline_or_scenario
195
- if r2
196
- r1 = r2
197
- else
198
- r1 = SyntaxNode.new(input, index...index)
199
- end
200
- s0 << r1
201
- if r1
202
- s3, i3 = [], index
203
- loop do
204
- i4, s4 = index, []
205
- r5 = _nt_space
206
- s4 << r5
207
- if r5
208
- r6 = _nt_scenario_or_scenario_outline_or_table
209
- s4 << r6
210
- end
211
- if s4.last
212
- r4 = (SyntaxNode).new(input, i4...index, s4)
213
- r4.extend(ScenarioSequence0)
214
- else
215
- self.index = i4
216
- r4 = nil
217
- end
218
- if r4
219
- s3 << r4
220
- else
221
- break
222
- end
223
- end
224
- r3 = SyntaxNode.new(input, i3...index, s3)
225
- s0 << r3
226
- end
227
- if s0.last
228
- r0 = (SyntaxNode).new(input, i0...index, s0)
229
- r0.extend(ScenarioSequence1)
230
- r0.extend(ScenarioSequence2)
231
- else
232
- self.index = i0
233
- r0 = nil
234
- end
235
-
236
- node_cache[:scenario_sequence][start_index] = r0
237
-
238
- return r0
239
- end
240
-
241
- def _nt_scenario_outline_or_scenario
242
- start_index = index
243
- if node_cache[:scenario_outline_or_scenario].has_key?(index)
244
- cached = node_cache[:scenario_outline_or_scenario][index]
245
- @index = cached.interval.end if cached
246
- return cached
247
- end
248
-
249
- i0 = index
250
- r1 = _nt_scenario_outline
251
- if r1
252
- r0 = r1
253
- else
254
- r2 = _nt_scenario
255
- if r2
256
- r0 = r2
257
- else
258
- self.index = i0
259
- r0 = nil
260
- end
261
- end
262
-
263
- node_cache[:scenario_outline_or_scenario][start_index] = r0
264
-
265
- return r0
266
- end
267
-
268
- module Scenario0
269
- def space
270
- elements[0]
271
- end
272
-
273
- def step_sequence
274
- elements[1]
275
- end
276
- end
277
-
278
- module Scenario1
279
- def scenario_keyword
280
- elements[0]
281
- end
282
-
283
- def name
284
- elements[2]
285
- end
286
-
287
- def steps
288
- elements[3]
289
- end
290
- end
291
-
292
- module Scenario2
293
- def compile(feature)
294
- line = input.line_of(interval.first)
295
- scenario = feature.add_scenario(name.text_value.strip, line)
296
- steps.step_sequence.compile(scenario) if steps.respond_to?(:step_sequence)
297
- # TODO - GET RID OF THIS last_scenario NASTINESS
298
- # Use a better datastructure, like a linked list...
299
- Feature.last_scenario = scenario
300
- end
301
- end
302
-
303
- def _nt_scenario
304
- start_index = index
305
- if node_cache[:scenario].has_key?(index)
306
- cached = node_cache[:scenario][index]
307
- @index = cached.interval.end if cached
308
- return cached
309
- end
310
-
311
- i0, s0 = index, []
312
- r1 = _nt_scenario_keyword
313
- s0 << r1
314
- if r1
315
- r3 = _nt_space
316
- if r3
317
- r2 = r3
318
- else
319
- r2 = SyntaxNode.new(input, index...index)
320
- end
321
- s0 << r2
322
- if r2
323
- r4 = _nt_line_to_eol
324
- s0 << r4
325
- if r4
326
- i6, s6 = index, []
327
- r7 = _nt_space
328
- s6 << r7
329
- if r7
330
- r8 = _nt_step_sequence
331
- s6 << r8
332
- end
333
- if s6.last
334
- r6 = (SyntaxNode).new(input, i6...index, s6)
335
- r6.extend(Scenario0)
336
- else
337
- self.index = i6
338
- r6 = nil
339
- end
340
- if r6
341
- r5 = r6
342
- else
343
- r5 = SyntaxNode.new(input, index...index)
344
- end
345
- s0 << r5
346
- end
347
- end
348
- end
349
- if s0.last
350
- r0 = (SyntaxNode).new(input, i0...index, s0)
351
- r0.extend(Scenario1)
352
- r0.extend(Scenario2)
353
- else
354
- self.index = i0
355
- r0 = nil
356
- end
357
-
358
- node_cache[:scenario][start_index] = r0
359
-
360
- return r0
361
- end
362
-
363
- module ScenarioOutline0
364
- def scenario_outline_keyword
365
- elements[0]
366
- end
367
-
368
- def name
369
- elements[2]
370
- end
371
-
372
- def outline_body
373
- elements[3]
374
- end
375
- end
376
-
377
- module ScenarioOutline1
378
- def compile(feature)
379
- line = input.line_of(interval.first)
380
- scenario = feature.add_scenario_outline(name.text_value.strip, line)
381
- Feature.last_scenario = scenario
382
- outline_body.compile(feature, scenario) if outline_body.respond_to?(:compile)
383
- end
384
- end
385
-
386
- def _nt_scenario_outline
387
- start_index = index
388
- if node_cache[:scenario_outline].has_key?(index)
389
- cached = node_cache[:scenario_outline][index]
390
- @index = cached.interval.end if cached
391
- return cached
392
- end
393
-
394
- i0, s0 = index, []
395
- r1 = _nt_scenario_outline_keyword
396
- s0 << r1
397
- if r1
398
- r3 = _nt_space
399
- if r3
400
- r2 = r3
401
- else
402
- r2 = SyntaxNode.new(input, index...index)
403
- end
404
- s0 << r2
405
- if r2
406
- r4 = _nt_line_to_eol
407
- s0 << r4
408
- if r4
409
- r6 = _nt_steps_and_optional_examples
410
- if r6
411
- r5 = r6
412
- else
413
- r5 = SyntaxNode.new(input, index...index)
414
- end
415
- s0 << r5
416
- end
417
- end
418
- end
419
- if s0.last
420
- r0 = (SyntaxNode).new(input, i0...index, s0)
421
- r0.extend(ScenarioOutline0)
422
- r0.extend(ScenarioOutline1)
423
- else
424
- self.index = i0
425
- r0 = nil
426
- end
427
-
428
- node_cache[:scenario_outline][start_index] = r0
429
-
430
- return r0
431
- end
432
-
433
- def _nt_scenario_or_scenario_outline_or_table
434
- start_index = index
435
- if node_cache[:scenario_or_scenario_outline_or_table].has_key?(index)
436
- cached = node_cache[:scenario_or_scenario_outline_or_table][index]
437
- @index = cached.interval.end if cached
438
- return cached
439
- end
440
-
441
- i0 = index
442
- r1 = _nt_scenario_outline
443
- if r1
444
- r0 = r1
445
- else
446
- i2 = index
447
- r3 = _nt_scenario
448
- if r3
449
- r2 = r3
450
- else
451
- r4 = _nt_more_examples
452
- if r4
453
- r2 = r4
454
- else
455
- self.index = i2
456
- r2 = nil
457
- end
458
- end
459
- if r2
460
- r0 = r2
461
- else
462
- self.index = i0
463
- r0 = nil
464
- end
465
- end
466
-
467
- node_cache[:scenario_or_scenario_outline_or_table][start_index] = r0
468
-
469
- return r0
470
- end
471
-
472
- module StepsAndOptionalExamples0
473
- def space
474
- elements[0]
475
- end
476
-
477
- def step_sequence
478
- elements[1]
479
- end
480
- end
481
-
482
- module StepsAndOptionalExamples1
483
- def space
484
- elements[0]
485
- end
486
-
487
- def examples
488
- elements[1]
489
- end
490
- end
491
-
492
- module StepsAndOptionalExamples2
493
- def steps
494
- elements[0]
495
- end
496
-
497
- def table
498
- elements[1]
499
- end
500
- end
501
-
502
- module StepsAndOptionalExamples3
503
- def compile(feature, scenario)
504
- steps.step_sequence.compile(scenario) if steps.respond_to?(:step_sequence)
505
- table.examples.compile(feature, scenario) if table.respond_to?(:examples) && table.examples.respond_to?(:compile)
506
- end
507
- end
508
-
509
- def _nt_steps_and_optional_examples
510
- start_index = index
511
- if node_cache[:steps_and_optional_examples].has_key?(index)
512
- cached = node_cache[:steps_and_optional_examples][index]
513
- @index = cached.interval.end if cached
514
- return cached
515
- end
516
-
517
- i0, s0 = index, []
518
- i1, s1 = index, []
519
- r2 = _nt_space
520
- s1 << r2
521
- if r2
522
- r3 = _nt_step_sequence
523
- s1 << r3
524
- end
525
- if s1.last
526
- r1 = (SyntaxNode).new(input, i1...index, s1)
527
- r1.extend(StepsAndOptionalExamples0)
528
- else
529
- self.index = i1
530
- r1 = nil
531
- end
532
- s0 << r1
533
- if r1
534
- i5, s5 = index, []
535
- r6 = _nt_space
536
- s5 << r6
537
- if r6
538
- r7 = _nt_examples
539
- s5 << r7
540
- end
541
- if s5.last
542
- r5 = (SyntaxNode).new(input, i5...index, s5)
543
- r5.extend(StepsAndOptionalExamples1)
544
- else
545
- self.index = i5
546
- r5 = nil
547
- end
548
- if r5
549
- r4 = r5
550
- else
551
- r4 = SyntaxNode.new(input, index...index)
552
- end
553
- s0 << r4
554
- end
555
- if s0.last
556
- r0 = (SyntaxNode).new(input, i0...index, s0)
557
- r0.extend(StepsAndOptionalExamples2)
558
- r0.extend(StepsAndOptionalExamples3)
559
- else
560
- self.index = i0
561
- r0 = nil
562
- end
563
-
564
- node_cache[:steps_and_optional_examples][start_index] = r0
565
-
566
- return r0
567
- end
568
-
569
- module MoreExamples0
570
- def more_examples_keyword
571
- elements[0]
572
- end
573
-
574
- def table
575
- elements[1]
576
- end
577
- end
578
-
579
- module MoreExamples1
580
- def compile(f)
581
- table.compile(f)
582
- end
583
- end
584
-
585
- def _nt_more_examples
586
- start_index = index
587
- if node_cache[:more_examples].has_key?(index)
588
- cached = node_cache[:more_examples][index]
589
- @index = cached.interval.end if cached
590
- return cached
591
- end
592
-
593
- i0, s0 = index, []
594
- r1 = _nt_more_examples_keyword
595
- s0 << r1
596
- if r1
597
- r2 = _nt_table
598
- s0 << r2
599
- end
600
- if s0.last
601
- r0 = (SyntaxNode).new(input, i0...index, s0)
602
- r0.extend(MoreExamples0)
603
- r0.extend(MoreExamples1)
604
- else
605
- self.index = i0
606
- r0 = nil
607
- end
608
-
609
- node_cache[:more_examples][start_index] = r0
610
-
611
- return r0
612
- end
613
-
614
- module Examples0
615
- def examples_keyword
616
- elements[0]
617
- end
618
-
619
- def table
620
- elements[1]
621
- end
622
- end
623
-
624
- module Examples1
625
- def compile(feature, scenario)
626
- table.compile_examples(feature, scenario)
627
- end
628
- end
629
-
630
- def _nt_examples
631
- start_index = index
632
- if node_cache[:examples].has_key?(index)
633
- cached = node_cache[:examples][index]
634
- @index = cached.interval.end if cached
635
- return cached
636
- end
637
-
638
- i0, s0 = index, []
639
- r1 = _nt_examples_keyword
640
- s0 << r1
641
- if r1
642
- r2 = _nt_table
643
- s0 << r2
644
- end
645
- if s0.last
646
- r0 = (SyntaxNode).new(input, i0...index, s0)
647
- r0.extend(Examples0)
648
- r0.extend(Examples1)
649
- else
650
- self.index = i0
651
- r0 = nil
652
- end
653
-
654
- node_cache[:examples][start_index] = r0
655
-
656
- return r0
657
- end
658
-
659
- module Table0
660
- def eol
661
- elements[1]
662
- end
663
-
664
- def table_line
665
- elements[3]
666
- end
667
- end
668
-
669
- module Table1
670
- def space
671
- elements[0]
672
- end
673
-
674
- def head
675
- elements[1]
676
- end
677
-
678
- def body
679
- elements[2]
680
- end
681
- end
682
-
683
- module Table2
684
- def compile(feature)
685
- Feature.last_scenario.table_header = head.cell_values
686
- body.each do |table_line|
687
- feature.add_row_scenario(Feature.last_scenario, table_line.cell_values, table_line.line)
688
- end
689
- end
690
-
691
- def compile_examples(feature, scenario)
692
- scenario.table_header = head.cell_values
693
- body.each do |table_line|
694
- feature.add_row_scenario_outline(scenario, table_line.cell_values, table_line.line)
695
- end
696
- end
697
-
698
- def matrix
699
- ([head] + body).map do |table_line|
700
- table_line.cell_values # We're losing the line - we'll get it back when we make our own class
701
- end
702
- end
703
-
704
- def to_arg
705
- Model::Table.new(matrix)
706
- end
707
-
708
- def body
709
- super.elements.map { |elt| elt.table_line }
710
- end
711
- end
712
-
713
- def _nt_table
714
- start_index = index
715
- if node_cache[:table].has_key?(index)
716
- cached = node_cache[:table][index]
717
- @index = cached.interval.end if cached
718
- return cached
719
- end
720
-
721
- i0, s0 = index, []
722
- r1 = _nt_space
723
- s0 << r1
724
- if r1
725
- r2 = _nt_table_line
726
- s0 << r2
727
- if r2
728
- s3, i3 = [], index
729
- loop do
730
- i4, s4 = index, []
731
- s5, i5 = [], index
732
- loop do
733
- r6 = _nt_blank
734
- if r6
735
- s5 << r6
736
- else
737
- break
738
- end
739
- end
740
- r5 = SyntaxNode.new(input, i5...index, s5)
741
- s4 << r5
742
- if r5
743
- r7 = _nt_eol
744
- s4 << r7
745
- if r7
746
- r9 = _nt_space
747
- if r9
748
- r8 = r9
749
- else
750
- r8 = SyntaxNode.new(input, index...index)
751
- end
752
- s4 << r8
753
- if r8
754
- r10 = _nt_table_line
755
- s4 << r10
756
- end
757
- end
758
- end
759
- if s4.last
760
- r4 = (SyntaxNode).new(input, i4...index, s4)
761
- r4.extend(Table0)
762
- else
763
- self.index = i4
764
- r4 = nil
765
- end
766
- if r4
767
- s3 << r4
768
- else
769
- break
770
- end
771
- end
772
- r3 = SyntaxNode.new(input, i3...index, s3)
773
- s0 << r3
774
- end
775
- end
776
- if s0.last
777
- r0 = (SyntaxNode).new(input, i0...index, s0)
778
- r0.extend(Table1)
779
- r0.extend(Table2)
780
- else
781
- self.index = i0
782
- r0 = nil
783
- end
784
-
785
- node_cache[:table][start_index] = r0
786
-
787
- return r0
788
- end
789
-
790
- module TableLine0
791
- def cell_value
792
- elements[1]
793
- end
794
-
795
- def separator
796
- elements[3]
797
- end
798
- end
799
-
800
- module TableLine1
801
- def separator
802
- elements[0]
803
- end
804
-
805
- def cells
806
- elements[1]
807
- end
808
- end
809
-
810
- module TableLine2
811
- def cell_values
812
- cells.elements.map { |elt| elt.cell_value.text_value.strip }
813
- end
814
-
815
- def line
816
- input.line_of(interval.first)
817
- end
818
- end
819
-
820
- def _nt_table_line
821
- start_index = index
822
- if node_cache[:table_line].has_key?(index)
823
- cached = node_cache[:table_line][index]
824
- @index = cached.interval.end if cached
825
- return cached
826
- end
827
-
828
- i0, s0 = index, []
829
- r1 = _nt_separator
830
- s0 << r1
831
- if r1
832
- s2, i2 = [], index
833
- loop do
834
- i3, s3 = index, []
835
- s4, i4 = [], index
836
- loop do
837
- r5 = _nt_blank
838
- if r5
839
- s4 << r5
840
- else
841
- break
842
- end
843
- end
844
- r4 = SyntaxNode.new(input, i4...index, s4)
845
- s3 << r4
846
- if r4
847
- r6 = _nt_cell_value
848
- s3 << r6
849
- if r6
850
- s7, i7 = [], index
851
- loop do
852
- r8 = _nt_blank
853
- if r8
854
- s7 << r8
855
- else
856
- break
857
- end
858
- end
859
- r7 = SyntaxNode.new(input, i7...index, s7)
860
- s3 << r7
861
- if r7
862
- r9 = _nt_separator
863
- s3 << r9
864
- end
865
- end
866
- end
867
- if s3.last
868
- r3 = (SyntaxNode).new(input, i3...index, s3)
869
- r3.extend(TableLine0)
870
- else
871
- self.index = i3
872
- r3 = nil
873
- end
874
- if r3
875
- s2 << r3
876
- else
877
- break
878
- end
879
- end
880
- if s2.empty?
881
- self.index = i2
882
- r2 = nil
883
- else
884
- r2 = SyntaxNode.new(input, i2...index, s2)
885
- end
886
- s0 << r2
887
- end
888
- if s0.last
889
- r0 = (SyntaxNode).new(input, i0...index, s0)
890
- r0.extend(TableLine1)
891
- r0.extend(TableLine2)
892
- else
893
- self.index = i0
894
- r0 = nil
895
- end
896
-
897
- node_cache[:table_line][start_index] = r0
898
-
899
- return r0
900
- end
901
-
902
- module CellValue0
903
- end
904
-
905
- def _nt_cell_value
906
- start_index = index
907
- if node_cache[:cell_value].has_key?(index)
908
- cached = node_cache[:cell_value][index]
909
- @index = cached.interval.end if cached
910
- return cached
911
- end
912
-
913
- s0, i0 = [], index
914
- loop do
915
- i1, s1 = index, []
916
- i2 = index
917
- i3 = index
918
- r4 = _nt_separator
919
- if r4
920
- r3 = r4
921
- else
922
- r5 = _nt_eol
923
- if r5
924
- r3 = r5
925
- else
926
- self.index = i3
927
- r3 = nil
928
- end
929
- end
930
- if r3
931
- r2 = nil
932
- else
933
- self.index = i2
934
- r2 = SyntaxNode.new(input, index...index)
935
- end
936
- s1 << r2
937
- if r2
938
- if index < input_length
939
- r6 = (SyntaxNode).new(input, index...(index + 1))
940
- @index += 1
941
- else
942
- terminal_parse_failure("any character")
943
- r6 = nil
944
- end
945
- s1 << r6
946
- end
947
- if s1.last
948
- r1 = (SyntaxNode).new(input, i1...index, s1)
949
- r1.extend(CellValue0)
950
- else
951
- self.index = i1
952
- r1 = nil
953
- end
954
- if r1
955
- s0 << r1
956
- else
957
- break
958
- end
959
- end
960
- r0 = SyntaxNode.new(input, i0...index, s0)
961
-
962
- node_cache[:cell_value][start_index] = r0
963
-
964
- return r0
965
- end
966
-
967
- module StepSequence0
968
- def space
969
- elements[0]
970
- end
971
-
972
- def step
973
- elements[1]
974
- end
975
- end
976
-
977
- module StepSequence1
978
- def head
979
- elements[0]
980
- end
981
-
982
- def tail
983
- elements[1]
984
- end
985
- end
986
-
987
- module StepSequence2
988
- def compile(scenario)
989
- ([head] + tail).each do |step|
990
- step.compile(scenario)
991
- end
992
- end
993
-
994
- def tail
995
- super.elements.map { |elt| elt.step }
996
- end
997
- end
998
-
999
- def _nt_step_sequence
1000
- start_index = index
1001
- if node_cache[:step_sequence].has_key?(index)
1002
- cached = node_cache[:step_sequence][index]
1003
- @index = cached.interval.end if cached
1004
- return cached
1005
- end
1006
-
1007
- i0, s0 = index, []
1008
- r1 = _nt_step
1009
- s0 << r1
1010
- if r1
1011
- s2, i2 = [], index
1012
- loop do
1013
- i3, s3 = index, []
1014
- r4 = _nt_space
1015
- s3 << r4
1016
- if r4
1017
- r5 = _nt_step
1018
- s3 << r5
1019
- end
1020
- if s3.last
1021
- r3 = (SyntaxNode).new(input, i3...index, s3)
1022
- r3.extend(StepSequence0)
1023
- else
1024
- self.index = i3
1025
- r3 = nil
1026
- end
1027
- if r3
1028
- s2 << r3
1029
- else
1030
- break
1031
- end
1032
- end
1033
- r2 = SyntaxNode.new(input, i2...index, s2)
1034
- s0 << r2
1035
- end
1036
- if s0.last
1037
- r0 = (SyntaxNode).new(input, i0...index, s0)
1038
- r0.extend(StepSequence1)
1039
- r0.extend(StepSequence2)
1040
- else
1041
- self.index = i0
1042
- r0 = nil
1043
- end
1044
-
1045
- node_cache[:step_sequence][start_index] = r0
1046
-
1047
- return r0
1048
- end
1049
-
1050
- def _nt_step
1051
- start_index = index
1052
- if node_cache[:step].has_key?(index)
1053
- cached = node_cache[:step][index]
1054
- @index = cached.interval.end if cached
1055
- return cached
1056
- end
1057
-
1058
- i0 = index
1059
- r1 = _nt_given_scenario
1060
- if r1
1061
- r0 = r1
1062
- else
1063
- r2 = _nt_plain_step
1064
- if r2
1065
- r0 = r2
1066
- else
1067
- self.index = i0
1068
- r0 = nil
1069
- end
1070
- end
1071
-
1072
- node_cache[:step][start_index] = r0
1073
-
1074
- return r0
1075
- end
1076
-
1077
- module GivenScenario0
1078
- def given_scenario_keyword
1079
- elements[0]
1080
- end
1081
-
1082
- def name
1083
- elements[2]
1084
- end
1085
- end
1086
-
1087
- module GivenScenario1
1088
- def compile(scenario)
1089
- line = input.line_of(interval.first)
1090
- scenario.create_given_scenario(name.text_value.strip, line)
1091
- end
1092
- end
1093
-
1094
- def _nt_given_scenario
1095
- start_index = index
1096
- if node_cache[:given_scenario].has_key?(index)
1097
- cached = node_cache[:given_scenario][index]
1098
- @index = cached.interval.end if cached
1099
- return cached
1100
- end
1101
-
1102
- i0, s0 = index, []
1103
- r1 = _nt_given_scenario_keyword
1104
- s0 << r1
1105
- if r1
1106
- r3 = _nt_space
1107
- if r3
1108
- r2 = r3
1109
- else
1110
- r2 = SyntaxNode.new(input, index...index)
1111
- end
1112
- s0 << r2
1113
- if r2
1114
- r4 = _nt_line_to_eol
1115
- s0 << r4
1116
- end
1117
- end
1118
- if s0.last
1119
- r0 = (SyntaxNode).new(input, i0...index, s0)
1120
- r0.extend(GivenScenario0)
1121
- r0.extend(GivenScenario1)
1122
- else
1123
- self.index = i0
1124
- r0 = nil
1125
- end
1126
-
1127
- node_cache[:given_scenario][start_index] = r0
1128
-
1129
- return r0
1130
- end
1131
-
1132
- module PlainStep0
1133
- def step_keyword
1134
- elements[0]
1135
- end
1136
-
1137
- def name
1138
- elements[2]
1139
- end
1140
-
1141
- def multi
1142
- elements[3]
1143
- end
1144
- end
1145
-
1146
- module PlainStep1
1147
- def compile(scenario)
1148
- line = input.line_of(interval.first)
1149
- step = scenario.create_step(step_keyword.text_value, name.text_value.strip, line)
1150
-
1151
- if multi.respond_to?(:to_arg)
1152
- step.extra_args << multi.to_arg
1153
- end
1154
- end
1155
- end
1156
-
1157
- def _nt_plain_step
1158
- start_index = index
1159
- if node_cache[:plain_step].has_key?(index)
1160
- cached = node_cache[:plain_step][index]
1161
- @index = cached.interval.end if cached
1162
- return cached
1163
- end
1164
-
1165
- i0, s0 = index, []
1166
- r1 = _nt_step_keyword
1167
- s0 << r1
1168
- if r1
1169
- r3 = _nt_space
1170
- if r3
1171
- r2 = r3
1172
- else
1173
- r2 = SyntaxNode.new(input, index...index)
1174
- end
1175
- s0 << r2
1176
- if r2
1177
- r4 = _nt_line_to_eol
1178
- s0 << r4
1179
- if r4
1180
- r6 = _nt_multiline_arg
1181
- if r6
1182
- r5 = r6
1183
- else
1184
- r5 = SyntaxNode.new(input, index...index)
1185
- end
1186
- s0 << r5
1187
- end
1188
- end
1189
- end
1190
- if s0.last
1191
- r0 = (SyntaxNode).new(input, i0...index, s0)
1192
- r0.extend(PlainStep0)
1193
- r0.extend(PlainStep1)
1194
- else
1195
- self.index = i0
1196
- r0 = nil
1197
- end
1198
-
1199
- node_cache[:plain_step][start_index] = r0
1200
-
1201
- return r0
1202
- end
1203
-
1204
- def _nt_multiline_arg
1205
- start_index = index
1206
- if node_cache[:multiline_arg].has_key?(index)
1207
- cached = node_cache[:multiline_arg][index]
1208
- @index = cached.interval.end if cached
1209
- return cached
1210
- end
1211
-
1212
- i0 = index
1213
- r1 = _nt_table
1214
- if r1
1215
- r0 = r1
1216
- else
1217
- r2 = _nt_multiline_string
1218
- if r2
1219
- r0 = r2
1220
- else
1221
- self.index = i0
1222
- r0 = nil
1223
- end
1224
- end
1225
-
1226
- node_cache[:multiline_arg][start_index] = r0
1227
-
1228
- return r0
1229
- end
1230
-
1231
- module MultilineString0
1232
- end
1233
-
1234
- module MultilineString1
1235
- def eol
1236
- elements[0]
1237
- end
1238
-
1239
- def indent
1240
- elements[1]
1241
- end
1242
-
1243
- def triple_quote
1244
- elements[2]
1245
- end
1246
-
1247
- def string
1248
- elements[3]
1249
- end
1250
-
1251
- def triple_quote
1252
- elements[4]
1253
- end
1254
- end
1255
-
1256
- module MultilineString2
1257
- def to_arg
1258
- indent_length = indent.text_value.length
1259
- significant_lines = string.text_value.split("\n")[1..-2]
1260
- significant_lines.map do |l|
1261
- l[indent_length..-1]
1262
- end.join("\n")
1263
- end
1264
- end
1265
-
1266
- def _nt_multiline_string
1267
- start_index = index
1268
- if node_cache[:multiline_string].has_key?(index)
1269
- cached = node_cache[:multiline_string][index]
1270
- @index = cached.interval.end if cached
1271
- return cached
1272
- end
1273
-
1274
- i0, s0 = index, []
1275
- r1 = _nt_eol
1276
- s0 << r1
1277
- if r1
1278
- r2 = _nt_space
1279
- s0 << r2
1280
- if r2
1281
- r3 = _nt_triple_quote
1282
- s0 << r3
1283
- if r3
1284
- s4, i4 = [], index
1285
- loop do
1286
- i5, s5 = index, []
1287
- i6 = index
1288
- r7 = _nt_triple_quote
1289
- if r7
1290
- r6 = nil
1291
- else
1292
- self.index = i6
1293
- r6 = SyntaxNode.new(input, index...index)
1294
- end
1295
- s5 << r6
1296
- if r6
1297
- if index < input_length
1298
- r8 = (SyntaxNode).new(input, index...(index + 1))
1299
- @index += 1
1300
- else
1301
- terminal_parse_failure("any character")
1302
- r8 = nil
1303
- end
1304
- s5 << r8
1305
- end
1306
- if s5.last
1307
- r5 = (SyntaxNode).new(input, i5...index, s5)
1308
- r5.extend(MultilineString0)
1309
- else
1310
- self.index = i5
1311
- r5 = nil
1312
- end
1313
- if r5
1314
- s4 << r5
1315
- else
1316
- break
1317
- end
1318
- end
1319
- r4 = SyntaxNode.new(input, i4...index, s4)
1320
- s0 << r4
1321
- if r4
1322
- r9 = _nt_triple_quote
1323
- s0 << r9
1324
- end
1325
- end
1326
- end
1327
- end
1328
- if s0.last
1329
- r0 = (SyntaxNode).new(input, i0...index, s0)
1330
- r0.extend(MultilineString1)
1331
- r0.extend(MultilineString2)
1332
- else
1333
- self.index = i0
1334
- r0 = nil
1335
- end
1336
-
1337
- node_cache[:multiline_string][start_index] = r0
1338
-
1339
- return r0
1340
- end
1341
-
1342
- def _nt_triple_quote
1343
- start_index = index
1344
- if node_cache[:triple_quote].has_key?(index)
1345
- cached = node_cache[:triple_quote][index]
1346
- @index = cached.interval.end if cached
1347
- return cached
1348
- end
1349
-
1350
- if input.index('"""', index) == index
1351
- r0 = (SyntaxNode).new(input, index...(index + 3))
1352
- @index += 3
1353
- else
1354
- terminal_parse_failure('"""')
1355
- r0 = nil
1356
- end
1357
-
1358
- node_cache[:triple_quote][start_index] = r0
1359
-
1360
- return r0
1361
- end
1362
-
1363
- def _nt_separator
1364
- start_index = index
1365
- if node_cache[:separator].has_key?(index)
1366
- cached = node_cache[:separator][index]
1367
- @index = cached.interval.end if cached
1368
- return cached
1369
- end
1370
-
1371
- if input.index('|', index) == index
1372
- r0 = (SyntaxNode).new(input, index...(index + 1))
1373
- @index += 1
1374
- else
1375
- terminal_parse_failure('|')
1376
- r0 = nil
1377
- end
1378
-
1379
- node_cache[:separator][start_index] = r0
1380
-
1381
- return r0
1382
- end
1383
-
1384
- def _nt_space
1385
- start_index = index
1386
- if node_cache[:space].has_key?(index)
1387
- cached = node_cache[:space][index]
1388
- @index = cached.interval.end if cached
1389
- return cached
1390
- end
1391
-
1392
- s0, i0 = [], index
1393
- loop do
1394
- i1 = index
1395
- r2 = _nt_white
1396
- if r2
1397
- r1 = r2
1398
- else
1399
- r3 = _nt_comment_to_eol
1400
- if r3
1401
- r1 = r3
1402
- else
1403
- self.index = i1
1404
- r1 = nil
1405
- end
1406
- end
1407
- if r1
1408
- s0 << r1
1409
- else
1410
- break
1411
- end
1412
- end
1413
- if s0.empty?
1414
- self.index = i0
1415
- r0 = nil
1416
- else
1417
- r0 = SyntaxNode.new(input, i0...index, s0)
1418
- end
1419
-
1420
- node_cache[:space][start_index] = r0
1421
-
1422
- return r0
1423
- end
1424
-
1425
- module LineToEol0
1426
- end
1427
-
1428
- def _nt_line_to_eol
1429
- start_index = index
1430
- if node_cache[:line_to_eol].has_key?(index)
1431
- cached = node_cache[:line_to_eol][index]
1432
- @index = cached.interval.end if cached
1433
- return cached
1434
- end
1435
-
1436
- s0, i0 = [], index
1437
- loop do
1438
- i1, s1 = index, []
1439
- i2 = index
1440
- r3 = _nt_eol
1441
- if r3
1442
- r2 = nil
1443
- else
1444
- self.index = i2
1445
- r2 = SyntaxNode.new(input, index...index)
1446
- end
1447
- s1 << r2
1448
- if r2
1449
- if index < input_length
1450
- r4 = (SyntaxNode).new(input, index...(index + 1))
1451
- @index += 1
1452
- else
1453
- terminal_parse_failure("any character")
1454
- r4 = nil
1455
- end
1456
- s1 << r4
1457
- end
1458
- if s1.last
1459
- r1 = (SyntaxNode).new(input, i1...index, s1)
1460
- r1.extend(LineToEol0)
1461
- else
1462
- self.index = i1
1463
- r1 = nil
1464
- end
1465
- if r1
1466
- s0 << r1
1467
- else
1468
- break
1469
- end
1470
- end
1471
- r0 = SyntaxNode.new(input, i0...index, s0)
1472
-
1473
- node_cache[:line_to_eol][start_index] = r0
1474
-
1475
- return r0
1476
- end
1477
-
1478
- module CommentToEol0
1479
- def line_to_eol
1480
- elements[1]
1481
- end
1482
- end
1483
-
1484
- def _nt_comment_to_eol
1485
- start_index = index
1486
- if node_cache[:comment_to_eol].has_key?(index)
1487
- cached = node_cache[:comment_to_eol][index]
1488
- @index = cached.interval.end if cached
1489
- return cached
1490
- end
1491
-
1492
- i0, s0 = index, []
1493
- if input.index('#', index) == index
1494
- r1 = (SyntaxNode).new(input, index...(index + 1))
1495
- @index += 1
1496
- else
1497
- terminal_parse_failure('#')
1498
- r1 = nil
1499
- end
1500
- s0 << r1
1501
- if r1
1502
- r2 = _nt_line_to_eol
1503
- s0 << r2
1504
- end
1505
- if s0.last
1506
- r0 = (SyntaxNode).new(input, i0...index, s0)
1507
- r0.extend(CommentToEol0)
1508
- else
1509
- self.index = i0
1510
- r0 = nil
1511
- end
1512
-
1513
- node_cache[:comment_to_eol][start_index] = r0
1514
-
1515
- return r0
1516
- end
1517
-
1518
- def _nt_white
1519
- start_index = index
1520
- if node_cache[:white].has_key?(index)
1521
- cached = node_cache[:white][index]
1522
- @index = cached.interval.end if cached
1523
- return cached
1524
- end
1525
-
1526
- i0 = index
1527
- r1 = _nt_blank
1528
- if r1
1529
- r0 = r1
1530
- else
1531
- r2 = _nt_eol
1532
- if r2
1533
- r0 = r2
1534
- else
1535
- self.index = i0
1536
- r0 = nil
1537
- end
1538
- end
1539
-
1540
- node_cache[:white][start_index] = r0
1541
-
1542
- return r0
1543
- end
1544
-
1545
- def _nt_blank
1546
- start_index = index
1547
- if node_cache[:blank].has_key?(index)
1548
- cached = node_cache[:blank][index]
1549
- @index = cached.interval.end if cached
1550
- return cached
1551
- end
1552
-
1553
- if input.index(Regexp.new('[ \\t]'), index) == index
1554
- r0 = (SyntaxNode).new(input, index...(index + 1))
1555
- @index += 1
1556
- else
1557
- r0 = nil
1558
- end
1559
-
1560
- node_cache[:blank][start_index] = r0
1561
-
1562
- return r0
1563
- end
1564
-
1565
- module Eol0
1566
- end
1567
-
1568
- def _nt_eol
1569
- start_index = index
1570
- if node_cache[:eol].has_key?(index)
1571
- cached = node_cache[:eol][index]
1572
- @index = cached.interval.end if cached
1573
- return cached
1574
- end
1575
-
1576
- i0 = index
1577
- i1, s1 = index, []
1578
- if input.index("\r", index) == index
1579
- r2 = (SyntaxNode).new(input, index...(index + 1))
1580
- @index += 1
1581
- else
1582
- terminal_parse_failure("\r")
1583
- r2 = nil
1584
- end
1585
- s1 << r2
1586
- if r2
1587
- if input.index("\n", index) == index
1588
- r4 = (SyntaxNode).new(input, index...(index + 1))
1589
- @index += 1
1590
- else
1591
- terminal_parse_failure("\n")
1592
- r4 = nil
1593
- end
1594
- if r4
1595
- r3 = r4
1596
- else
1597
- r3 = SyntaxNode.new(input, index...index)
1598
- end
1599
- s1 << r3
1600
- end
1601
- if s1.last
1602
- r1 = (SyntaxNode).new(input, i1...index, s1)
1603
- r1.extend(Eol0)
1604
- else
1605
- self.index = i1
1606
- r1 = nil
1607
- end
1608
- if r1
1609
- r0 = r1
1610
- else
1611
- if input.index("\n", index) == index
1612
- r5 = (SyntaxNode).new(input, index...(index + 1))
1613
- @index += 1
1614
- else
1615
- terminal_parse_failure("\n")
1616
- r5 = nil
1617
- end
1618
- if r5
1619
- r0 = r5
1620
- else
1621
- self.index = i0
1622
- r0 = nil
1623
- end
1624
- end
1625
-
1626
- node_cache[:eol][start_index] = r0
1627
-
1628
- return r0
1629
- end
1630
-
1631
- def _nt_step_keyword
1632
- start_index = index
1633
- if node_cache[:step_keyword].has_key?(index)
1634
- cached = node_cache[:step_keyword][index]
1635
- @index = cached.interval.end if cached
1636
- return cached
1637
- end
1638
-
1639
- i0 = index
1640
- if input.index("前提", index) == index
1641
- r1 = (SyntaxNode).new(input, index...(index + 6))
1642
- @index += 6
1643
- else
1644
- terminal_parse_failure("前提")
1645
- r1 = nil
1646
- end
1647
- if r1
1648
- r0 = r1
1649
- else
1650
- if input.index("もし", index) == index
1651
- r2 = (SyntaxNode).new(input, index...(index + 6))
1652
- @index += 6
1653
- else
1654
- terminal_parse_failure("もし")
1655
- r2 = nil
1656
- end
1657
- if r2
1658
- r0 = r2
1659
- else
1660
- if input.index("ならば", index) == index
1661
- r3 = (SyntaxNode).new(input, index...(index + 9))
1662
- @index += 9
1663
- else
1664
- terminal_parse_failure("ならば")
1665
- r3 = nil
1666
- end
1667
- if r3
1668
- r0 = r3
1669
- else
1670
- if input.index("かつ", index) == index
1671
- r4 = (SyntaxNode).new(input, index...(index + 6))
1672
- @index += 6
1673
- else
1674
- terminal_parse_failure("かつ")
1675
- r4 = nil
1676
- end
1677
- if r4
1678
- r0 = r4
1679
- else
1680
- if input.index("しかし", index) == index
1681
- r5 = (SyntaxNode).new(input, index...(index + 9))
1682
- @index += 9
1683
- else
1684
- terminal_parse_failure("しかし")
1685
- r5 = nil
1686
- end
1687
- if r5
1688
- r0 = r5
1689
- else
1690
- self.index = i0
1691
- r0 = nil
1692
- end
1693
- end
1694
- end
1695
- end
1696
- end
1697
-
1698
- node_cache[:step_keyword][start_index] = r0
1699
-
1700
- return r0
1701
- end
1702
-
1703
- module ScenarioKeyword0
1704
- end
1705
-
1706
- def _nt_scenario_keyword
1707
- start_index = index
1708
- if node_cache[:scenario_keyword].has_key?(index)
1709
- cached = node_cache[:scenario_keyword][index]
1710
- @index = cached.interval.end if cached
1711
- return cached
1712
- end
1713
-
1714
- i0, s0 = index, []
1715
- if input.index("シナリオ", index) == index
1716
- r1 = (SyntaxNode).new(input, index...(index + 12))
1717
- @index += 12
1718
- else
1719
- terminal_parse_failure("シナリオ")
1720
- r1 = nil
1721
- end
1722
- s0 << r1
1723
- if r1
1724
- if input.index(":", index) == index
1725
- r3 = (SyntaxNode).new(input, index...(index + 1))
1726
- @index += 1
1727
- else
1728
- terminal_parse_failure(":")
1729
- r3 = nil
1730
- end
1731
- if r3
1732
- r2 = r3
1733
- else
1734
- r2 = SyntaxNode.new(input, index...index)
1735
- end
1736
- s0 << r2
1737
- end
1738
- if s0.last
1739
- r0 = (SyntaxNode).new(input, i0...index, s0)
1740
- r0.extend(ScenarioKeyword0)
1741
- else
1742
- self.index = i0
1743
- r0 = nil
1744
- end
1745
-
1746
- node_cache[:scenario_keyword][start_index] = r0
1747
-
1748
- return r0
1749
- end
1750
-
1751
- module ScenarioOutlineKeyword0
1752
- end
1753
-
1754
- def _nt_scenario_outline_keyword
1755
- start_index = index
1756
- if node_cache[:scenario_outline_keyword].has_key?(index)
1757
- cached = node_cache[:scenario_outline_keyword][index]
1758
- @index = cached.interval.end if cached
1759
- return cached
1760
- end
1761
-
1762
- i0, s0 = index, []
1763
- if input.index("Scenario Outline", index) == index
1764
- r1 = (SyntaxNode).new(input, index...(index + 16))
1765
- @index += 16
1766
- else
1767
- terminal_parse_failure("Scenario Outline")
1768
- r1 = nil
1769
- end
1770
- s0 << r1
1771
- if r1
1772
- if input.index(":", index) == index
1773
- r3 = (SyntaxNode).new(input, index...(index + 1))
1774
- @index += 1
1775
- else
1776
- terminal_parse_failure(":")
1777
- r3 = nil
1778
- end
1779
- if r3
1780
- r2 = r3
1781
- else
1782
- r2 = SyntaxNode.new(input, index...index)
1783
- end
1784
- s0 << r2
1785
- end
1786
- if s0.last
1787
- r0 = (SyntaxNode).new(input, i0...index, s0)
1788
- r0.extend(ScenarioOutlineKeyword0)
1789
- else
1790
- self.index = i0
1791
- r0 = nil
1792
- end
1793
-
1794
- node_cache[:scenario_outline_keyword][start_index] = r0
1795
-
1796
- return r0
1797
- end
1798
-
1799
- module MoreExamplesKeyword0
1800
- end
1801
-
1802
- def _nt_more_examples_keyword
1803
- start_index = index
1804
- if node_cache[:more_examples_keyword].has_key?(index)
1805
- cached = node_cache[:more_examples_keyword][index]
1806
- @index = cached.interval.end if cached
1807
- return cached
1808
- end
1809
-
1810
- i0, s0 = index, []
1811
- if input.index("他のサンプル", index) == index
1812
- r1 = (SyntaxNode).new(input, index...(index + 18))
1813
- @index += 18
1814
- else
1815
- terminal_parse_failure("他のサンプル")
1816
- r1 = nil
1817
- end
1818
- s0 << r1
1819
- if r1
1820
- if input.index(":", index) == index
1821
- r3 = (SyntaxNode).new(input, index...(index + 1))
1822
- @index += 1
1823
- else
1824
- terminal_parse_failure(":")
1825
- r3 = nil
1826
- end
1827
- if r3
1828
- r2 = r3
1829
- else
1830
- r2 = SyntaxNode.new(input, index...index)
1831
- end
1832
- s0 << r2
1833
- end
1834
- if s0.last
1835
- r0 = (SyntaxNode).new(input, i0...index, s0)
1836
- r0.extend(MoreExamplesKeyword0)
1837
- else
1838
- self.index = i0
1839
- r0 = nil
1840
- end
1841
-
1842
- node_cache[:more_examples_keyword][start_index] = r0
1843
-
1844
- return r0
1845
- end
1846
-
1847
- module ExamplesKeyword0
1848
- end
1849
-
1850
- def _nt_examples_keyword
1851
- start_index = index
1852
- if node_cache[:examples_keyword].has_key?(index)
1853
- cached = node_cache[:examples_keyword][index]
1854
- @index = cached.interval.end if cached
1855
- return cached
1856
- end
1857
-
1858
- i0, s0 = index, []
1859
- if input.index("Examples", index) == index
1860
- r1 = (SyntaxNode).new(input, index...(index + 8))
1861
- @index += 8
1862
- else
1863
- terminal_parse_failure("Examples")
1864
- r1 = nil
1865
- end
1866
- s0 << r1
1867
- if r1
1868
- if input.index(":", index) == index
1869
- r3 = (SyntaxNode).new(input, index...(index + 1))
1870
- @index += 1
1871
- else
1872
- terminal_parse_failure(":")
1873
- r3 = nil
1874
- end
1875
- if r3
1876
- r2 = r3
1877
- else
1878
- r2 = SyntaxNode.new(input, index...index)
1879
- end
1880
- s0 << r2
1881
- end
1882
- if s0.last
1883
- r0 = (SyntaxNode).new(input, i0...index, s0)
1884
- r0.extend(ExamplesKeyword0)
1885
- else
1886
- self.index = i0
1887
- r0 = nil
1888
- end
1889
-
1890
- node_cache[:examples_keyword][start_index] = r0
1891
-
1892
- return r0
1893
- end
1894
-
1895
- module GivenScenarioKeyword0
1896
- end
1897
-
1898
- def _nt_given_scenario_keyword
1899
- start_index = index
1900
- if node_cache[:given_scenario_keyword].has_key?(index)
1901
- cached = node_cache[:given_scenario_keyword][index]
1902
- @index = cached.interval.end if cached
1903
- return cached
1904
- end
1905
-
1906
- i0, s0 = index, []
1907
- if input.index("前提シナリオ", index) == index
1908
- r1 = (SyntaxNode).new(input, index...(index + 18))
1909
- @index += 18
1910
- else
1911
- terminal_parse_failure("前提シナリオ")
1912
- r1 = nil
1913
- end
1914
- s0 << r1
1915
- if r1
1916
- if input.index(":", index) == index
1917
- r3 = (SyntaxNode).new(input, index...(index + 1))
1918
- @index += 1
1919
- else
1920
- terminal_parse_failure(":")
1921
- r3 = nil
1922
- end
1923
- if r3
1924
- r2 = r3
1925
- else
1926
- r2 = SyntaxNode.new(input, index...index)
1927
- end
1928
- s0 << r2
1929
- end
1930
- if s0.last
1931
- r0 = (SyntaxNode).new(input, i0...index, s0)
1932
- r0.extend(GivenScenarioKeyword0)
1933
- else
1934
- self.index = i0
1935
- r0 = nil
1936
- end
1937
-
1938
- node_cache[:given_scenario_keyword][start_index] = r0
1939
-
1940
- return r0
1941
- end
1942
-
1943
- end
1944
-
1945
- class FeatureParser < Treetop::Runtime::CompiledParser
1946
- include Feature
1947
- end
1948
-
1949
-
1950
- end
1951
- end