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
@@ -0,0 +1,43 @@
1
+ require 'erb'
2
+ require 'cucumber/platform'
3
+ require 'cucumber/ast'
4
+ require 'cucumber/parser/treetop_ext'
5
+ require 'cucumber/parser/table'
6
+
7
+ module Cucumber
8
+ # Classes in this module parse feature files and translate the parse tree
9
+ # (concrete syntax tree) into an abstract syntax tree (AST) using
10
+ # <a href="http://martinfowler.com/dslwip/EmbeddedTranslation.html">Embedded translation</a>.
11
+ #
12
+ # The AST is built by the various <tt>#build</tt> methods in the parse tree.
13
+ #
14
+ # The AST classes are defined in the Cucumber::Ast module.
15
+ module Parser
16
+ translator = Module.new do
17
+ def keywordz(key)
18
+ 'Scenario'
19
+ end
20
+ end
21
+
22
+ def self.load_parser(keywords)
23
+ Loader.new(keywords)
24
+ end
25
+
26
+ class Loader
27
+ def initialize(keywords)
28
+ @keywords = keywords
29
+ i18n_tt = File.expand_path(File.dirname(__FILE__) + '/parser/i18n.tt')
30
+ template = File.open(i18n_tt, Cucumber.file_mode('r')).read
31
+ erb = ERB.new(template)
32
+ grammar = erb.result(binding)
33
+ Treetop.load_from_string(grammar)
34
+ require 'cucumber/parser/feature'
35
+ end
36
+
37
+ def keywords(key)
38
+ values = @keywords[key].split('|')
39
+ values.map{|value| "'#{value}'"}.join(" / ")
40
+ end
41
+ end
42
+ end
43
+ end
File without changes
@@ -0,0 +1,1487 @@
1
+ module Cucumber
2
+ module Parser
3
+ # TIP: When you hack on the grammar, just delete feature.rb in this directory.
4
+ # Also make sure you have uninstalled all cucumber gems (don't forget xxx-cucumber
5
+ # github gems).
6
+ #
7
+ # Treetop will then generate the parser in-memory. When you're happy, just generate
8
+ # the rb file with tt feature.tt
9
+ module Feature
10
+ include Treetop::Runtime
11
+
12
+ def root
13
+ @root || :feature
14
+ end
15
+
16
+ include I18n
17
+
18
+ include Table
19
+
20
+ module Feature0
21
+ end
22
+
23
+ module Feature1
24
+ def white
25
+ elements[0]
26
+ end
27
+
28
+ def comment
29
+ elements[1]
30
+ end
31
+
32
+ def white
33
+ elements[2]
34
+ end
35
+
36
+ def tags
37
+ elements[3]
38
+ end
39
+
40
+ def white
41
+ elements[4]
42
+ end
43
+
44
+ def header
45
+ elements[5]
46
+ end
47
+
48
+ def bg
49
+ elements[6]
50
+ end
51
+
52
+ def feature_elements
53
+ elements[7]
54
+ end
55
+
56
+ end
57
+
58
+ module Feature2
59
+ def build
60
+ background = bg.respond_to?(:build) ? bg.build : nil
61
+ Ast::Feature.new(
62
+ background,
63
+ comment.build,
64
+ tags.build,
65
+ header.text_value,
66
+ feature_elements.build(background)
67
+ )
68
+ end
69
+ end
70
+
71
+ def _nt_feature
72
+ start_index = index
73
+ if node_cache[:feature].has_key?(index)
74
+ cached = node_cache[:feature][index]
75
+ @index = cached.interval.end if cached
76
+ return cached
77
+ end
78
+
79
+ i0, s0 = index, []
80
+ r1 = _nt_white
81
+ s0 << r1
82
+ if r1
83
+ r2 = _nt_comment
84
+ s0 << r2
85
+ if r2
86
+ r3 = _nt_white
87
+ s0 << r3
88
+ if r3
89
+ r4 = _nt_tags
90
+ s0 << r4
91
+ if r4
92
+ r5 = _nt_white
93
+ s0 << r5
94
+ if r5
95
+ s6, i6 = [], index
96
+ loop do
97
+ i7, s7 = index, []
98
+ i8 = index
99
+ i9 = index
100
+ r10 = _nt_scenario_outline
101
+ if r10
102
+ r9 = r10
103
+ else
104
+ r11 = _nt_scenario
105
+ if r11
106
+ r9 = r11
107
+ else
108
+ r12 = _nt_background
109
+ if r12
110
+ r9 = r12
111
+ else
112
+ self.index = i9
113
+ r9 = nil
114
+ end
115
+ end
116
+ end
117
+ if r9
118
+ r8 = nil
119
+ else
120
+ self.index = i8
121
+ r8 = SyntaxNode.new(input, index...index)
122
+ end
123
+ s7 << r8
124
+ if r8
125
+ if index < input_length
126
+ r13 = (SyntaxNode).new(input, index...(index + 1))
127
+ @index += 1
128
+ else
129
+ terminal_parse_failure("any character")
130
+ r13 = nil
131
+ end
132
+ s7 << r13
133
+ end
134
+ if s7.last
135
+ r7 = (SyntaxNode).new(input, i7...index, s7)
136
+ r7.extend(Feature0)
137
+ else
138
+ self.index = i7
139
+ r7 = nil
140
+ end
141
+ if r7
142
+ s6 << r7
143
+ else
144
+ break
145
+ end
146
+ end
147
+ r6 = SyntaxNode.new(input, i6...index, s6)
148
+ s0 << r6
149
+ if r6
150
+ r15 = _nt_background
151
+ if r15
152
+ r14 = r15
153
+ else
154
+ r14 = SyntaxNode.new(input, index...index)
155
+ end
156
+ s0 << r14
157
+ if r14
158
+ r16 = _nt_feature_elements
159
+ s0 << r16
160
+ if r16
161
+ r18 = _nt_comment
162
+ if r18
163
+ r17 = r18
164
+ else
165
+ r17 = SyntaxNode.new(input, index...index)
166
+ end
167
+ s0 << r17
168
+ end
169
+ end
170
+ end
171
+ end
172
+ end
173
+ end
174
+ end
175
+ end
176
+ if s0.last
177
+ r0 = (SyntaxNode).new(input, i0...index, s0)
178
+ r0.extend(Feature1)
179
+ r0.extend(Feature2)
180
+ else
181
+ self.index = i0
182
+ r0 = nil
183
+ end
184
+
185
+ node_cache[:feature][start_index] = r0
186
+
187
+ return r0
188
+ end
189
+
190
+ module Tags0
191
+ def tag
192
+ elements[0]
193
+ end
194
+
195
+ end
196
+
197
+ module Tags1
198
+ def white
199
+ elements[0]
200
+ end
201
+
202
+ def ts
203
+ elements[1]
204
+ end
205
+ end
206
+
207
+ module Tags2
208
+ def build
209
+ tag_names = ts.elements.map{|e| e.tag.tag_name.text_value}
210
+ Ast::Tags.new(ts.line, tag_names)
211
+ end
212
+ end
213
+
214
+ def _nt_tags
215
+ start_index = index
216
+ if node_cache[:tags].has_key?(index)
217
+ cached = node_cache[:tags][index]
218
+ @index = cached.interval.end if cached
219
+ return cached
220
+ end
221
+
222
+ i0, s0 = index, []
223
+ r1 = _nt_white
224
+ s0 << r1
225
+ if r1
226
+ s2, i2 = [], index
227
+ loop do
228
+ i3, s3 = index, []
229
+ r4 = _nt_tag
230
+ s3 << r4
231
+ if r4
232
+ s5, i5 = [], index
233
+ loop do
234
+ i6 = index
235
+ r7 = _nt_space
236
+ if r7
237
+ r6 = r7
238
+ else
239
+ r8 = _nt_eol
240
+ if r8
241
+ r6 = r8
242
+ else
243
+ self.index = i6
244
+ r6 = nil
245
+ end
246
+ end
247
+ if r6
248
+ s5 << r6
249
+ else
250
+ break
251
+ end
252
+ end
253
+ if s5.empty?
254
+ self.index = i5
255
+ r5 = nil
256
+ else
257
+ r5 = SyntaxNode.new(input, i5...index, s5)
258
+ end
259
+ s3 << r5
260
+ end
261
+ if s3.last
262
+ r3 = (SyntaxNode).new(input, i3...index, s3)
263
+ r3.extend(Tags0)
264
+ else
265
+ self.index = i3
266
+ r3 = nil
267
+ end
268
+ if r3
269
+ s2 << r3
270
+ else
271
+ break
272
+ end
273
+ end
274
+ r2 = SyntaxNode.new(input, i2...index, s2)
275
+ s0 << r2
276
+ end
277
+ if s0.last
278
+ r0 = (SyntaxNode).new(input, i0...index, s0)
279
+ r0.extend(Tags1)
280
+ r0.extend(Tags2)
281
+ else
282
+ self.index = i0
283
+ r0 = nil
284
+ end
285
+
286
+ node_cache[:tags][start_index] = r0
287
+
288
+ return r0
289
+ end
290
+
291
+ module Tag0
292
+ def tag_name
293
+ elements[1]
294
+ end
295
+ end
296
+
297
+ def _nt_tag
298
+ start_index = index
299
+ if node_cache[:tag].has_key?(index)
300
+ cached = node_cache[:tag][index]
301
+ @index = cached.interval.end if cached
302
+ return cached
303
+ end
304
+
305
+ i0, s0 = index, []
306
+ if input.index('@', index) == index
307
+ r1 = (SyntaxNode).new(input, index...(index + 1))
308
+ @index += 1
309
+ else
310
+ terminal_parse_failure('@')
311
+ r1 = nil
312
+ end
313
+ s0 << r1
314
+ if r1
315
+ s2, i2 = [], index
316
+ loop do
317
+ if input.index(Regexp.new('[^@\\r\\n\\t ]'), index) == index
318
+ r3 = (SyntaxNode).new(input, index...(index + 1))
319
+ @index += 1
320
+ else
321
+ r3 = nil
322
+ end
323
+ if r3
324
+ s2 << r3
325
+ else
326
+ break
327
+ end
328
+ end
329
+ if s2.empty?
330
+ self.index = i2
331
+ r2 = nil
332
+ else
333
+ r2 = SyntaxNode.new(input, i2...index, s2)
334
+ end
335
+ s0 << r2
336
+ end
337
+ if s0.last
338
+ r0 = (SyntaxNode).new(input, i0...index, s0)
339
+ r0.extend(Tag0)
340
+ else
341
+ self.index = i0
342
+ r0 = nil
343
+ end
344
+
345
+ node_cache[:tag][start_index] = r0
346
+
347
+ return r0
348
+ end
349
+
350
+ module Comment0
351
+ def comment_line
352
+ elements[0]
353
+ end
354
+
355
+ def white
356
+ elements[1]
357
+ end
358
+ end
359
+
360
+ module Comment1
361
+ def build
362
+ Ast::Comment.new(text_value)
363
+ end
364
+ end
365
+
366
+ def _nt_comment
367
+ start_index = index
368
+ if node_cache[:comment].has_key?(index)
369
+ cached = node_cache[:comment][index]
370
+ @index = cached.interval.end if cached
371
+ return cached
372
+ end
373
+
374
+ s0, i0 = [], index
375
+ loop do
376
+ i1, s1 = index, []
377
+ r2 = _nt_comment_line
378
+ s1 << r2
379
+ if r2
380
+ r3 = _nt_white
381
+ s1 << r3
382
+ end
383
+ if s1.last
384
+ r1 = (SyntaxNode).new(input, i1...index, s1)
385
+ r1.extend(Comment0)
386
+ else
387
+ self.index = i1
388
+ r1 = nil
389
+ end
390
+ if r1
391
+ s0 << r1
392
+ else
393
+ break
394
+ end
395
+ end
396
+ r0 = SyntaxNode.new(input, i0...index, s0)
397
+ r0.extend(Comment1)
398
+
399
+ node_cache[:comment][start_index] = r0
400
+
401
+ return r0
402
+ end
403
+
404
+ module CommentLine0
405
+ def line_to_eol
406
+ elements[1]
407
+ end
408
+ end
409
+
410
+ def _nt_comment_line
411
+ start_index = index
412
+ if node_cache[:comment_line].has_key?(index)
413
+ cached = node_cache[:comment_line][index]
414
+ @index = cached.interval.end if cached
415
+ return cached
416
+ end
417
+
418
+ i0, s0 = index, []
419
+ if input.index('#', index) == index
420
+ r1 = (SyntaxNode).new(input, index...(index + 1))
421
+ @index += 1
422
+ else
423
+ terminal_parse_failure('#')
424
+ r1 = nil
425
+ end
426
+ s0 << r1
427
+ if r1
428
+ r2 = _nt_line_to_eol
429
+ s0 << r2
430
+ end
431
+ if s0.last
432
+ r0 = (SyntaxNode).new(input, i0...index, s0)
433
+ r0.extend(CommentLine0)
434
+ else
435
+ self.index = i0
436
+ r0 = nil
437
+ end
438
+
439
+ node_cache[:comment_line][start_index] = r0
440
+
441
+ return r0
442
+ end
443
+
444
+ module Background0
445
+ def comment
446
+ elements[0]
447
+ end
448
+
449
+ def white
450
+ elements[1]
451
+ end
452
+
453
+ def background_keyword
454
+ elements[2]
455
+ end
456
+
457
+ def steps
458
+ elements[5]
459
+ end
460
+ end
461
+
462
+ module Background1
463
+ def build
464
+ Ast::Background.new(
465
+ comment.build,
466
+ background_keyword.line,
467
+ background_keyword.text_value,
468
+ steps.build
469
+ )
470
+ end
471
+ end
472
+
473
+ def _nt_background
474
+ start_index = index
475
+ if node_cache[:background].has_key?(index)
476
+ cached = node_cache[:background][index]
477
+ @index = cached.interval.end if cached
478
+ return cached
479
+ end
480
+
481
+ i0, s0 = index, []
482
+ r1 = _nt_comment
483
+ s0 << r1
484
+ if r1
485
+ r2 = _nt_white
486
+ s0 << r2
487
+ if r2
488
+ r3 = _nt_background_keyword
489
+ s0 << r3
490
+ if r3
491
+ s4, i4 = [], index
492
+ loop do
493
+ r5 = _nt_space
494
+ if r5
495
+ s4 << r5
496
+ else
497
+ break
498
+ end
499
+ end
500
+ r4 = SyntaxNode.new(input, i4...index, s4)
501
+ s0 << r4
502
+ if r4
503
+ i6 = index
504
+ s7, i7 = [], index
505
+ loop do
506
+ r8 = _nt_eol
507
+ if r8
508
+ s7 << r8
509
+ else
510
+ break
511
+ end
512
+ end
513
+ if s7.empty?
514
+ self.index = i7
515
+ r7 = nil
516
+ else
517
+ r7 = SyntaxNode.new(input, i7...index, s7)
518
+ end
519
+ if r7
520
+ r6 = r7
521
+ else
522
+ r9 = _nt_eof
523
+ if r9
524
+ r6 = r9
525
+ else
526
+ self.index = i6
527
+ r6 = nil
528
+ end
529
+ end
530
+ s0 << r6
531
+ if r6
532
+ r10 = _nt_steps
533
+ s0 << r10
534
+ end
535
+ end
536
+ end
537
+ end
538
+ end
539
+ if s0.last
540
+ r0 = (SyntaxNode).new(input, i0...index, s0)
541
+ r0.extend(Background0)
542
+ r0.extend(Background1)
543
+ else
544
+ self.index = i0
545
+ r0 = nil
546
+ end
547
+
548
+ node_cache[:background][start_index] = r0
549
+
550
+ return r0
551
+ end
552
+
553
+ module FeatureElements0
554
+ def build(background)
555
+ elements.map{|s| s.build(background)}
556
+ end
557
+ end
558
+
559
+ def _nt_feature_elements
560
+ start_index = index
561
+ if node_cache[:feature_elements].has_key?(index)
562
+ cached = node_cache[:feature_elements][index]
563
+ @index = cached.interval.end if cached
564
+ return cached
565
+ end
566
+
567
+ s0, i0 = [], index
568
+ loop do
569
+ i1 = index
570
+ r2 = _nt_scenario
571
+ if r2
572
+ r1 = r2
573
+ else
574
+ r3 = _nt_scenario_outline
575
+ if r3
576
+ r1 = r3
577
+ else
578
+ self.index = i1
579
+ r1 = nil
580
+ end
581
+ end
582
+ if r1
583
+ s0 << r1
584
+ else
585
+ break
586
+ end
587
+ end
588
+ r0 = SyntaxNode.new(input, i0...index, s0)
589
+ r0.extend(FeatureElements0)
590
+
591
+ node_cache[:feature_elements][start_index] = r0
592
+
593
+ return r0
594
+ end
595
+
596
+ module Scenario0
597
+ def comment
598
+ elements[0]
599
+ end
600
+
601
+ def tags
602
+ elements[1]
603
+ end
604
+
605
+ def white
606
+ elements[2]
607
+ end
608
+
609
+ def scenario_keyword
610
+ elements[3]
611
+ end
612
+
613
+ def name
614
+ elements[5]
615
+ end
616
+
617
+ def white
618
+ elements[6]
619
+ end
620
+
621
+ def steps
622
+ elements[7]
623
+ end
624
+
625
+ def white
626
+ elements[8]
627
+ end
628
+ end
629
+
630
+ module Scenario1
631
+ def build(background)
632
+ Ast::Scenario.new(
633
+ background,
634
+ comment.build,
635
+ tags.build,
636
+ scenario_keyword.line,
637
+ scenario_keyword.text_value,
638
+ name.text_value,
639
+ steps.build
640
+ )
641
+ end
642
+ end
643
+
644
+ def _nt_scenario
645
+ start_index = index
646
+ if node_cache[:scenario].has_key?(index)
647
+ cached = node_cache[:scenario][index]
648
+ @index = cached.interval.end if cached
649
+ return cached
650
+ end
651
+
652
+ i0, s0 = index, []
653
+ r1 = _nt_comment
654
+ s0 << r1
655
+ if r1
656
+ r2 = _nt_tags
657
+ s0 << r2
658
+ if r2
659
+ r3 = _nt_white
660
+ s0 << r3
661
+ if r3
662
+ r4 = _nt_scenario_keyword
663
+ s0 << r4
664
+ if r4
665
+ s5, i5 = [], index
666
+ loop do
667
+ r6 = _nt_space
668
+ if r6
669
+ s5 << r6
670
+ else
671
+ break
672
+ end
673
+ end
674
+ r5 = SyntaxNode.new(input, i5...index, s5)
675
+ s0 << r5
676
+ if r5
677
+ r7 = _nt_line_to_eol
678
+ s0 << r7
679
+ if r7
680
+ r8 = _nt_white
681
+ s0 << r8
682
+ if r8
683
+ r9 = _nt_steps
684
+ s0 << r9
685
+ if r9
686
+ r10 = _nt_white
687
+ s0 << r10
688
+ end
689
+ end
690
+ end
691
+ end
692
+ end
693
+ end
694
+ end
695
+ end
696
+ if s0.last
697
+ r0 = (SyntaxNode).new(input, i0...index, s0)
698
+ r0.extend(Scenario0)
699
+ r0.extend(Scenario1)
700
+ else
701
+ self.index = i0
702
+ r0 = nil
703
+ end
704
+
705
+ node_cache[:scenario][start_index] = r0
706
+
707
+ return r0
708
+ end
709
+
710
+ module ScenarioOutline0
711
+ def comment
712
+ elements[0]
713
+ end
714
+
715
+ def tags
716
+ elements[1]
717
+ end
718
+
719
+ def white
720
+ elements[2]
721
+ end
722
+
723
+ def scenario_outline_keyword
724
+ elements[3]
725
+ end
726
+
727
+ def name
728
+ elements[5]
729
+ end
730
+
731
+ def white
732
+ elements[6]
733
+ end
734
+
735
+ def steps
736
+ elements[7]
737
+ end
738
+
739
+ def examples_sections
740
+ elements[8]
741
+ end
742
+
743
+ def white
744
+ elements[9]
745
+ end
746
+ end
747
+
748
+ module ScenarioOutline1
749
+ def build(background)
750
+ Ast::ScenarioOutline.new(
751
+ background,
752
+ comment.build,
753
+ tags.build,
754
+ scenario_outline_keyword.line,
755
+ scenario_outline_keyword.text_value,
756
+ name.text_value,
757
+ steps.build,
758
+ examples_sections.build
759
+ )
760
+ end
761
+ end
762
+
763
+ def _nt_scenario_outline
764
+ start_index = index
765
+ if node_cache[:scenario_outline].has_key?(index)
766
+ cached = node_cache[:scenario_outline][index]
767
+ @index = cached.interval.end if cached
768
+ return cached
769
+ end
770
+
771
+ i0, s0 = index, []
772
+ r1 = _nt_comment
773
+ s0 << r1
774
+ if r1
775
+ r2 = _nt_tags
776
+ s0 << r2
777
+ if r2
778
+ r3 = _nt_white
779
+ s0 << r3
780
+ if r3
781
+ r4 = _nt_scenario_outline_keyword
782
+ s0 << r4
783
+ if r4
784
+ s5, i5 = [], index
785
+ loop do
786
+ r6 = _nt_space
787
+ if r6
788
+ s5 << r6
789
+ else
790
+ break
791
+ end
792
+ end
793
+ r5 = SyntaxNode.new(input, i5...index, s5)
794
+ s0 << r5
795
+ if r5
796
+ r7 = _nt_line_to_eol
797
+ s0 << r7
798
+ if r7
799
+ r8 = _nt_white
800
+ s0 << r8
801
+ if r8
802
+ r9 = _nt_steps
803
+ s0 << r9
804
+ if r9
805
+ r10 = _nt_examples_sections
806
+ s0 << r10
807
+ if r10
808
+ r11 = _nt_white
809
+ s0 << r11
810
+ end
811
+ end
812
+ end
813
+ end
814
+ end
815
+ end
816
+ end
817
+ end
818
+ end
819
+ if s0.last
820
+ r0 = (SyntaxNode).new(input, i0...index, s0)
821
+ r0.extend(ScenarioOutline0)
822
+ r0.extend(ScenarioOutline1)
823
+ else
824
+ self.index = i0
825
+ r0 = nil
826
+ end
827
+
828
+ node_cache[:scenario_outline][start_index] = r0
829
+
830
+ return r0
831
+ end
832
+
833
+ module Steps0
834
+ def build
835
+ elements.map{|e| e.build}
836
+ end
837
+ end
838
+
839
+ def _nt_steps
840
+ start_index = index
841
+ if node_cache[:steps].has_key?(index)
842
+ cached = node_cache[:steps][index]
843
+ @index = cached.interval.end if cached
844
+ return cached
845
+ end
846
+
847
+ s0, i0 = [], index
848
+ loop do
849
+ r1 = _nt_step
850
+ if r1
851
+ s0 << r1
852
+ else
853
+ break
854
+ end
855
+ end
856
+ r0 = SyntaxNode.new(input, i0...index, s0)
857
+ r0.extend(Steps0)
858
+
859
+ node_cache[:steps][start_index] = r0
860
+
861
+ return r0
862
+ end
863
+
864
+ module Step0
865
+ def comment
866
+ elements[0]
867
+ end
868
+
869
+ def step_keyword
870
+ elements[2]
871
+ end
872
+
873
+ def name
874
+ elements[4]
875
+ end
876
+
877
+ def multi
878
+ elements[6]
879
+ end
880
+
881
+ def white
882
+ elements[7]
883
+ end
884
+ end
885
+
886
+ module Step1
887
+ def build
888
+ if multi.respond_to?(:build)
889
+ Ast::Step.new(step_keyword.line, step_keyword.text_value, name.text_value.strip, multi.build)
890
+ else
891
+ Ast::Step.new(step_keyword.line, step_keyword.text_value, name.text_value.strip)
892
+ end
893
+ end
894
+ end
895
+
896
+ def _nt_step
897
+ start_index = index
898
+ if node_cache[:step].has_key?(index)
899
+ cached = node_cache[:step][index]
900
+ @index = cached.interval.end if cached
901
+ return cached
902
+ end
903
+
904
+ i0, s0 = index, []
905
+ r1 = _nt_comment
906
+ s0 << r1
907
+ if r1
908
+ s2, i2 = [], index
909
+ loop do
910
+ r3 = _nt_space
911
+ if r3
912
+ s2 << r3
913
+ else
914
+ break
915
+ end
916
+ end
917
+ r2 = SyntaxNode.new(input, i2...index, s2)
918
+ s0 << r2
919
+ if r2
920
+ r4 = _nt_step_keyword
921
+ s0 << r4
922
+ if r4
923
+ s5, i5 = [], index
924
+ loop do
925
+ r6 = _nt_space
926
+ if r6
927
+ s5 << r6
928
+ else
929
+ break
930
+ end
931
+ end
932
+ r5 = SyntaxNode.new(input, i5...index, s5)
933
+ s0 << r5
934
+ if r5
935
+ r7 = _nt_line_to_eol
936
+ s0 << r7
937
+ if r7
938
+ i8 = index
939
+ s9, i9 = [], index
940
+ loop do
941
+ r10 = _nt_eol
942
+ if r10
943
+ s9 << r10
944
+ else
945
+ break
946
+ end
947
+ end
948
+ if s9.empty?
949
+ self.index = i9
950
+ r9 = nil
951
+ else
952
+ r9 = SyntaxNode.new(input, i9...index, s9)
953
+ end
954
+ if r9
955
+ r8 = r9
956
+ else
957
+ r11 = _nt_eof
958
+ if r11
959
+ r8 = r11
960
+ else
961
+ self.index = i8
962
+ r8 = nil
963
+ end
964
+ end
965
+ s0 << r8
966
+ if r8
967
+ r13 = _nt_multiline_arg
968
+ if r13
969
+ r12 = r13
970
+ else
971
+ r12 = SyntaxNode.new(input, index...index)
972
+ end
973
+ s0 << r12
974
+ if r12
975
+ r14 = _nt_white
976
+ s0 << r14
977
+ end
978
+ end
979
+ end
980
+ end
981
+ end
982
+ end
983
+ end
984
+ if s0.last
985
+ r0 = (SyntaxNode).new(input, i0...index, s0)
986
+ r0.extend(Step0)
987
+ r0.extend(Step1)
988
+ else
989
+ self.index = i0
990
+ r0 = nil
991
+ end
992
+
993
+ node_cache[:step][start_index] = r0
994
+
995
+ return r0
996
+ end
997
+
998
+ module ExamplesSections0
999
+ def build
1000
+ elements.map{|e| e.build}
1001
+ end
1002
+ end
1003
+
1004
+ def _nt_examples_sections
1005
+ start_index = index
1006
+ if node_cache[:examples_sections].has_key?(index)
1007
+ cached = node_cache[:examples_sections][index]
1008
+ @index = cached.interval.end if cached
1009
+ return cached
1010
+ end
1011
+
1012
+ s0, i0 = [], index
1013
+ loop do
1014
+ r1 = _nt_examples
1015
+ if r1
1016
+ s0 << r1
1017
+ else
1018
+ break
1019
+ end
1020
+ end
1021
+ r0 = SyntaxNode.new(input, i0...index, s0)
1022
+ r0.extend(ExamplesSections0)
1023
+
1024
+ node_cache[:examples_sections][start_index] = r0
1025
+
1026
+ return r0
1027
+ end
1028
+
1029
+ module Examples0
1030
+ def examples_keyword
1031
+ elements[1]
1032
+ end
1033
+
1034
+ def name
1035
+ elements[3]
1036
+ end
1037
+
1038
+ def eol
1039
+ elements[4]
1040
+ end
1041
+
1042
+ def table
1043
+ elements[5]
1044
+ end
1045
+
1046
+ def white
1047
+ elements[6]
1048
+ end
1049
+ end
1050
+
1051
+ module Examples1
1052
+ def build
1053
+ [examples_keyword.line, examples_keyword.text_value, name.text_value, table.raw]
1054
+ end
1055
+ end
1056
+
1057
+ def _nt_examples
1058
+ start_index = index
1059
+ if node_cache[:examples].has_key?(index)
1060
+ cached = node_cache[:examples][index]
1061
+ @index = cached.interval.end if cached
1062
+ return cached
1063
+ end
1064
+
1065
+ i0, s0 = index, []
1066
+ s1, i1 = [], index
1067
+ loop do
1068
+ r2 = _nt_space
1069
+ if r2
1070
+ s1 << r2
1071
+ else
1072
+ break
1073
+ end
1074
+ end
1075
+ r1 = SyntaxNode.new(input, i1...index, s1)
1076
+ s0 << r1
1077
+ if r1
1078
+ r3 = _nt_examples_keyword
1079
+ s0 << r3
1080
+ if r3
1081
+ s4, i4 = [], index
1082
+ loop do
1083
+ r5 = _nt_space
1084
+ if r5
1085
+ s4 << r5
1086
+ else
1087
+ break
1088
+ end
1089
+ end
1090
+ r4 = SyntaxNode.new(input, i4...index, s4)
1091
+ s0 << r4
1092
+ if r4
1093
+ r7 = _nt_line_to_eol
1094
+ if r7
1095
+ r6 = r7
1096
+ else
1097
+ r6 = SyntaxNode.new(input, index...index)
1098
+ end
1099
+ s0 << r6
1100
+ if r6
1101
+ r8 = _nt_eol
1102
+ s0 << r8
1103
+ if r8
1104
+ r9 = _nt_table
1105
+ s0 << r9
1106
+ if r9
1107
+ r10 = _nt_white
1108
+ s0 << r10
1109
+ end
1110
+ end
1111
+ end
1112
+ end
1113
+ end
1114
+ end
1115
+ if s0.last
1116
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1117
+ r0.extend(Examples0)
1118
+ r0.extend(Examples1)
1119
+ else
1120
+ self.index = i0
1121
+ r0 = nil
1122
+ end
1123
+
1124
+ node_cache[:examples][start_index] = r0
1125
+
1126
+ return r0
1127
+ end
1128
+
1129
+ def _nt_multiline_arg
1130
+ start_index = index
1131
+ if node_cache[:multiline_arg].has_key?(index)
1132
+ cached = node_cache[:multiline_arg][index]
1133
+ @index = cached.interval.end if cached
1134
+ return cached
1135
+ end
1136
+
1137
+ i0 = index
1138
+ r1 = _nt_table
1139
+ if r1
1140
+ r0 = r1
1141
+ else
1142
+ r2 = _nt_py_string
1143
+ if r2
1144
+ r0 = r2
1145
+ else
1146
+ self.index = i0
1147
+ r0 = nil
1148
+ end
1149
+ end
1150
+
1151
+ node_cache[:multiline_arg][start_index] = r0
1152
+
1153
+ return r0
1154
+ end
1155
+
1156
+ module LineToEol0
1157
+ end
1158
+
1159
+ def _nt_line_to_eol
1160
+ start_index = index
1161
+ if node_cache[:line_to_eol].has_key?(index)
1162
+ cached = node_cache[:line_to_eol][index]
1163
+ @index = cached.interval.end if cached
1164
+ return cached
1165
+ end
1166
+
1167
+ s0, i0 = [], index
1168
+ loop do
1169
+ i1, s1 = index, []
1170
+ i2 = index
1171
+ r3 = _nt_eol
1172
+ if r3
1173
+ r2 = nil
1174
+ else
1175
+ self.index = i2
1176
+ r2 = SyntaxNode.new(input, index...index)
1177
+ end
1178
+ s1 << r2
1179
+ if r2
1180
+ if index < input_length
1181
+ r4 = (SyntaxNode).new(input, index...(index + 1))
1182
+ @index += 1
1183
+ else
1184
+ terminal_parse_failure("any character")
1185
+ r4 = nil
1186
+ end
1187
+ s1 << r4
1188
+ end
1189
+ if s1.last
1190
+ r1 = (SyntaxNode).new(input, i1...index, s1)
1191
+ r1.extend(LineToEol0)
1192
+ else
1193
+ self.index = i1
1194
+ r1 = nil
1195
+ end
1196
+ if r1
1197
+ s0 << r1
1198
+ else
1199
+ break
1200
+ end
1201
+ end
1202
+ r0 = SyntaxNode.new(input, i0...index, s0)
1203
+
1204
+ node_cache[:line_to_eol][start_index] = r0
1205
+
1206
+ return r0
1207
+ end
1208
+
1209
+ module PyString0
1210
+ end
1211
+
1212
+ module PyString1
1213
+ def open_py_string
1214
+ elements[0]
1215
+ end
1216
+
1217
+ def s
1218
+ elements[1]
1219
+ end
1220
+
1221
+ def close_py_string
1222
+ elements[2]
1223
+ end
1224
+ end
1225
+
1226
+ module PyString2
1227
+ def build
1228
+ Ast::PyString.new(open_py_string.line, close_py_string.line, s.text_value, open_py_string.indentation)
1229
+ end
1230
+ end
1231
+
1232
+ def _nt_py_string
1233
+ start_index = index
1234
+ if node_cache[:py_string].has_key?(index)
1235
+ cached = node_cache[:py_string][index]
1236
+ @index = cached.interval.end if cached
1237
+ return cached
1238
+ end
1239
+
1240
+ i0, s0 = index, []
1241
+ r1 = _nt_open_py_string
1242
+ s0 << r1
1243
+ if r1
1244
+ s2, i2 = [], index
1245
+ loop do
1246
+ i3, s3 = index, []
1247
+ i4 = index
1248
+ r5 = _nt_close_py_string
1249
+ if r5
1250
+ r4 = nil
1251
+ else
1252
+ self.index = i4
1253
+ r4 = SyntaxNode.new(input, index...index)
1254
+ end
1255
+ s3 << r4
1256
+ if r4
1257
+ if index < input_length
1258
+ r6 = (SyntaxNode).new(input, index...(index + 1))
1259
+ @index += 1
1260
+ else
1261
+ terminal_parse_failure("any character")
1262
+ r6 = nil
1263
+ end
1264
+ s3 << r6
1265
+ end
1266
+ if s3.last
1267
+ r3 = (SyntaxNode).new(input, i3...index, s3)
1268
+ r3.extend(PyString0)
1269
+ else
1270
+ self.index = i3
1271
+ r3 = nil
1272
+ end
1273
+ if r3
1274
+ s2 << r3
1275
+ else
1276
+ break
1277
+ end
1278
+ end
1279
+ r2 = SyntaxNode.new(input, i2...index, s2)
1280
+ s0 << r2
1281
+ if r2
1282
+ r7 = _nt_close_py_string
1283
+ s0 << r7
1284
+ end
1285
+ end
1286
+ if s0.last
1287
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1288
+ r0.extend(PyString1)
1289
+ r0.extend(PyString2)
1290
+ else
1291
+ self.index = i0
1292
+ r0 = nil
1293
+ end
1294
+
1295
+ node_cache[:py_string][start_index] = r0
1296
+
1297
+ return r0
1298
+ end
1299
+
1300
+ module OpenPyString0
1301
+ def white
1302
+ elements[0]
1303
+ end
1304
+
1305
+ def eol
1306
+ elements[3]
1307
+ end
1308
+ end
1309
+
1310
+ module OpenPyString1
1311
+ def indentation
1312
+ white.text_value.length
1313
+ end
1314
+
1315
+ def line
1316
+ white.line
1317
+ end
1318
+ end
1319
+
1320
+ def _nt_open_py_string
1321
+ start_index = index
1322
+ if node_cache[:open_py_string].has_key?(index)
1323
+ cached = node_cache[:open_py_string][index]
1324
+ @index = cached.interval.end if cached
1325
+ return cached
1326
+ end
1327
+
1328
+ i0, s0 = index, []
1329
+ r1 = _nt_white
1330
+ s0 << r1
1331
+ if r1
1332
+ if input.index('"""', index) == index
1333
+ r2 = (SyntaxNode).new(input, index...(index + 3))
1334
+ @index += 3
1335
+ else
1336
+ terminal_parse_failure('"""')
1337
+ r2 = nil
1338
+ end
1339
+ s0 << r2
1340
+ if r2
1341
+ s3, i3 = [], index
1342
+ loop do
1343
+ r4 = _nt_space
1344
+ if r4
1345
+ s3 << r4
1346
+ else
1347
+ break
1348
+ end
1349
+ end
1350
+ r3 = SyntaxNode.new(input, i3...index, s3)
1351
+ s0 << r3
1352
+ if r3
1353
+ r5 = _nt_eol
1354
+ s0 << r5
1355
+ end
1356
+ end
1357
+ end
1358
+ if s0.last
1359
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1360
+ r0.extend(OpenPyString0)
1361
+ r0.extend(OpenPyString1)
1362
+ else
1363
+ self.index = i0
1364
+ r0 = nil
1365
+ end
1366
+
1367
+ node_cache[:open_py_string][start_index] = r0
1368
+
1369
+ return r0
1370
+ end
1371
+
1372
+ module ClosePyString0
1373
+ def eol
1374
+ elements[0]
1375
+ end
1376
+
1377
+ def quotes
1378
+ elements[2]
1379
+ end
1380
+
1381
+ def white
1382
+ elements[3]
1383
+ end
1384
+ end
1385
+
1386
+ module ClosePyString1
1387
+ def line
1388
+ quotes.line
1389
+ end
1390
+ end
1391
+
1392
+ def _nt_close_py_string
1393
+ start_index = index
1394
+ if node_cache[:close_py_string].has_key?(index)
1395
+ cached = node_cache[:close_py_string][index]
1396
+ @index = cached.interval.end if cached
1397
+ return cached
1398
+ end
1399
+
1400
+ i0, s0 = index, []
1401
+ r1 = _nt_eol
1402
+ s0 << r1
1403
+ if r1
1404
+ s2, i2 = [], index
1405
+ loop do
1406
+ r3 = _nt_space
1407
+ if r3
1408
+ s2 << r3
1409
+ else
1410
+ break
1411
+ end
1412
+ end
1413
+ r2 = SyntaxNode.new(input, i2...index, s2)
1414
+ s0 << r2
1415
+ if r2
1416
+ if input.index('"""', index) == index
1417
+ r4 = (SyntaxNode).new(input, index...(index + 3))
1418
+ @index += 3
1419
+ else
1420
+ terminal_parse_failure('"""')
1421
+ r4 = nil
1422
+ end
1423
+ s0 << r4
1424
+ if r4
1425
+ r5 = _nt_white
1426
+ s0 << r5
1427
+ end
1428
+ end
1429
+ end
1430
+ if s0.last
1431
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1432
+ r0.extend(ClosePyString0)
1433
+ r0.extend(ClosePyString1)
1434
+ else
1435
+ self.index = i0
1436
+ r0 = nil
1437
+ end
1438
+
1439
+ node_cache[:close_py_string][start_index] = r0
1440
+
1441
+ return r0
1442
+ end
1443
+
1444
+ def _nt_white
1445
+ start_index = index
1446
+ if node_cache[:white].has_key?(index)
1447
+ cached = node_cache[:white][index]
1448
+ @index = cached.interval.end if cached
1449
+ return cached
1450
+ end
1451
+
1452
+ s0, i0 = [], index
1453
+ loop do
1454
+ i1 = index
1455
+ r2 = _nt_space
1456
+ if r2
1457
+ r1 = r2
1458
+ else
1459
+ r3 = _nt_eol
1460
+ if r3
1461
+ r1 = r3
1462
+ else
1463
+ self.index = i1
1464
+ r1 = nil
1465
+ end
1466
+ end
1467
+ if r1
1468
+ s0 << r1
1469
+ else
1470
+ break
1471
+ end
1472
+ end
1473
+ r0 = SyntaxNode.new(input, i0...index, s0)
1474
+
1475
+ node_cache[:white][start_index] = r0
1476
+
1477
+ return r0
1478
+ end
1479
+
1480
+ end
1481
+
1482
+ class FeatureParser < Treetop::Runtime::CompiledParser
1483
+ include Feature
1484
+ end
1485
+
1486
+ end
1487
+ end