aslakhellesoy-cucumber 0.1.99.4 → 0.1.99.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (254) hide show
  1. data/History.txt +4 -1
  2. data/Manifest.txt +2 -10
  3. data/cucumber.yml +1 -0
  4. data/examples/cs/README.textile +1 -0
  5. data/examples/cs/Rakefile +12 -0
  6. data/examples/cs/compile.bat +1 -0
  7. data/examples/cs/features/addition.feature +16 -0
  8. data/examples/cs/features/step_definitons/calculator_steps.rb +19 -0
  9. data/examples/cs/src/demo/Calculator.cs +20 -0
  10. data/examples/dos_line_endings/Rakefile +6 -0
  11. data/examples/dos_line_endings/features/dos_line_endings.feature +9 -0
  12. data/examples/i18n/README.textile +18 -0
  13. data/examples/i18n/Rakefile +32 -0
  14. data/examples/i18n/ar/Rakefile +6 -0
  15. data/examples/i18n/ar/features/addition.feature +17 -0
  16. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +28 -0
  17. data/examples/i18n/ar/lib/calculator.rb +10 -0
  18. data/examples/i18n/da/Rakefile +6 -0
  19. data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +24 -0
  20. data/examples/i18n/da/features/summering.feature +17 -0
  21. data/examples/i18n/da/lib/kalkulator.rb +11 -0
  22. data/examples/i18n/de/Rakefile +6 -0
  23. data/examples/i18n/de/features/addition.feature +16 -0
  24. data/examples/i18n/de/features/division.feature +9 -0
  25. data/examples/i18n/de/features/step_definitons/calculator_steps.rb +24 -0
  26. data/examples/i18n/de/lib/calculator.rb +14 -0
  27. data/examples/i18n/en/Rakefile +6 -0
  28. data/examples/i18n/en/features/addition.feature +16 -0
  29. data/examples/i18n/en/features/division.feature +9 -0
  30. data/examples/i18n/en/features/step_definitons/calculator_steps.rb +24 -0
  31. data/examples/i18n/en/lib/calculator.rb +14 -0
  32. data/examples/i18n/es/Rakefile +6 -0
  33. data/examples/i18n/es/features/adicion.feature +17 -0
  34. data/examples/i18n/es/features/step_definitons/calculador_steps.rb +24 -0
  35. data/examples/i18n/es/lib/calculador.rb +11 -0
  36. data/examples/i18n/et/Rakefile +6 -0
  37. data/examples/i18n/et/features/liitmine.feature +17 -0
  38. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +24 -0
  39. data/examples/i18n/et/lib/kalkulaator.rb +10 -0
  40. data/examples/i18n/fi/Rakefile +6 -0
  41. data/examples/i18n/fi/features/jakolasku.feature +9 -0
  42. data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +24 -0
  43. data/examples/i18n/fi/features/yhteenlasku.feature +16 -0
  44. data/examples/i18n/fi/lib/laskin.rb +14 -0
  45. data/examples/i18n/fr/Rakefile +6 -0
  46. data/examples/i18n/fr/features/addition.feature +15 -0
  47. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +27 -0
  48. data/examples/i18n/fr/lib/calculatrice.rb +10 -0
  49. data/examples/i18n/id/Rakefile +6 -0
  50. data/examples/i18n/id/features/addition.feature +16 -0
  51. data/examples/i18n/id/features/division.feature +9 -0
  52. data/examples/i18n/id/features/step_definitons/calculator_steps.rb +24 -0
  53. data/examples/i18n/id/lib/calculator.rb +14 -0
  54. data/examples/i18n/it/Rakefile +6 -0
  55. data/examples/i18n/it/features/somma.feature +10 -0
  56. data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +24 -0
  57. data/examples/i18n/it/lib/calcolatrice.rb +11 -0
  58. data/examples/i18n/ja/README.txt +5 -0
  59. data/examples/i18n/ja/Rakefile +6 -0
  60. data/examples/i18n/ja/features/addition.feature +16 -0
  61. data/examples/i18n/ja/features/division.feature +9 -0
  62. data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +24 -0
  63. data/examples/i18n/ja/lib/calculator.rb +14 -0
  64. data/examples/i18n/ko/Rakefile +6 -0
  65. data/examples/i18n/ko/features/addition.feature +16 -0
  66. data/examples/i18n/ko/features/division.feature +10 -0
  67. data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +24 -0
  68. data/examples/i18n/ko/lib/calculator.rb +14 -0
  69. data/examples/i18n/lt/Rakefile +6 -0
  70. data/examples/i18n/lt/features/addition.feature +17 -0
  71. data/examples/i18n/lt/features/division.feature +9 -0
  72. data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +24 -0
  73. data/examples/i18n/lt/lib/calculator.rb +14 -0
  74. data/examples/i18n/no/Rakefile +6 -0
  75. data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +24 -0
  76. data/examples/i18n/no/features/summering.feature +18 -0
  77. data/examples/i18n/no/lib/kalkulator.rb +11 -0
  78. data/examples/i18n/pt/Rakefile +6 -0
  79. data/examples/i18n/pt/features/adicao.feature +10 -0
  80. data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +24 -0
  81. data/examples/i18n/pt/lib/calculadora.rb +10 -0
  82. data/examples/i18n/ro/Rakefile +6 -0
  83. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +24 -0
  84. data/examples/i18n/ro/features/suma.feature +10 -0
  85. data/examples/i18n/ro/lib/calculator.rb +11 -0
  86. data/examples/i18n/se/Rakefile +6 -0
  87. data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +24 -0
  88. data/examples/i18n/se/features/summering.feature +17 -0
  89. data/examples/i18n/se/lib/kalkulator.rb +11 -0
  90. data/examples/i18n/zh-CN/Rakefile +6 -0
  91. data/examples/i18n/zh-CN/features/addition.feature +17 -0
  92. data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +26 -0
  93. data/examples/i18n/zh-CN/lib/calculator.rb +10 -0
  94. data/examples/java/README.textile +22 -0
  95. data/examples/java/Rakefile +12 -0
  96. data/examples/java/features/hello.feature +11 -0
  97. data/examples/java/features/step_definitons/hello_steps.rb +25 -0
  98. data/examples/java/features/step_definitons/tree_steps.rb +14 -0
  99. data/examples/java/features/tree.feature +9 -0
  100. data/examples/java/src/cucumber/demo/Hello.java +16 -0
  101. data/examples/jbehave/README.textile +17 -0
  102. data/examples/jbehave/features/support/env.rb +7 -0
  103. data/examples/jbehave/features/trading.feature +24 -0
  104. data/examples/jbehave/pom.xml +48 -0
  105. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/converters/TraderConverter.java +32 -0
  106. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Stock.java +42 -0
  107. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Trader.java +29 -0
  108. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/persistence/TraderPersister.java +22 -0
  109. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java +65 -0
  110. data/examples/selenium/Rakefile +6 -0
  111. data/examples/selenium/features/search.feature +9 -0
  112. data/examples/selenium/features/step_definitons/stories_steps.rb +40 -0
  113. data/examples/self_test/README.textile +6 -0
  114. data/examples/self_test/features/call_undefined_step_from_step_def.feature +7 -0
  115. data/examples/self_test/features/lots_of_undefined.feature +8 -0
  116. data/examples/self_test/features/outline_sample.feature +15 -0
  117. data/examples/self_test/features/sample.feature +16 -0
  118. data/examples/self_test/features/step_definitions/sample_steps.rb +25 -0
  119. data/examples/test_unit/Rakefile +6 -0
  120. data/examples/test_unit/features/step_definitions/test_unit_steps.rb +26 -0
  121. data/examples/test_unit/features/test_unit.feature +9 -0
  122. data/examples/tickets/Rakefile +11 -0
  123. data/examples/tickets/cucumber.yml +2 -0
  124. data/examples/tickets/features/lib/eatting_machine.rb +18 -0
  125. data/examples/tickets/features/lib/pantry.rb +20 -0
  126. data/examples/tickets/features/scenario_outline.feature +95 -0
  127. data/examples/tickets/features/step_definitons/scenario_outline_steps.rb +42 -0
  128. data/examples/tickets/features/step_definitons/tickets_steps.rb +60 -0
  129. data/examples/tickets/features/tickets.feature +28 -0
  130. data/examples/watir/README.textile +16 -0
  131. data/examples/watir/Rakefile +6 -0
  132. data/examples/watir/features/search.feature +9 -0
  133. data/examples/watir/features/step_definitons/search_steps.rb +24 -0
  134. data/examples/watir/features/support/env.rb +32 -0
  135. data/features/cucumber_cli.feature +331 -0
  136. data/features/cucumber_cli_outlines.feature +90 -0
  137. data/features/report_called_undefined_steps.feature +32 -0
  138. data/features/step_definitions/cucumber_steps.rb +31 -0
  139. data/features/step_definitions/extra_steps.rb +2 -0
  140. data/features/support/env.rb +7 -0
  141. data/gem_tasks/deployment.rake +11 -0
  142. data/gem_tasks/environment.rake +7 -0
  143. data/gem_tasks/features.rake +6 -0
  144. data/gem_tasks/fix_cr_lf.rake +10 -0
  145. data/gem_tasks/flog.rake +4 -0
  146. data/gem_tasks/gemspec.rake +10 -0
  147. data/gem_tasks/rspec.rake +35 -0
  148. data/gem_tasks/yard.rake +8 -0
  149. data/lib/autotest/cucumber.rb +6 -0
  150. data/lib/autotest/cucumber_mixin.rb +124 -0
  151. data/lib/autotest/cucumber_rails.rb +6 -0
  152. data/lib/autotest/cucumber_rails_rspec.rb +6 -0
  153. data/lib/autotest/cucumber_rspec.rb +6 -0
  154. data/lib/autotest/discover.rb +9 -0
  155. data/lib/cucumber.rb +72 -0
  156. data/lib/cucumber/ast.rb +27 -0
  157. data/lib/cucumber/ast/comment.rb +26 -0
  158. data/lib/cucumber/ast/examples.rb +22 -0
  159. data/lib/cucumber/ast/feature.rb +60 -0
  160. data/lib/cucumber/ast/features.rb +39 -0
  161. data/lib/cucumber/ast/filter.rb +22 -0
  162. data/lib/cucumber/ast/outline_table.rb +49 -0
  163. data/lib/cucumber/ast/py_string.rb +52 -0
  164. data/lib/cucumber/ast/scenario.rb +95 -0
  165. data/lib/cucumber/ast/scenario_outline.rb +83 -0
  166. data/lib/cucumber/ast/step.rb +139 -0
  167. data/lib/cucumber/ast/table.rb +214 -0
  168. data/lib/cucumber/ast/tags.rb +33 -0
  169. data/lib/cucumber/ast/visitor.rb +93 -0
  170. data/lib/cucumber/broadcaster.rb +15 -0
  171. data/lib/cucumber/cli.rb +414 -0
  172. data/lib/cucumber/core_ext/exception.rb +53 -0
  173. data/lib/cucumber/core_ext/instance_exec.rb +54 -0
  174. data/lib/cucumber/core_ext/proc.rb +33 -0
  175. data/lib/cucumber/core_ext/string.rb +48 -0
  176. data/lib/cucumber/formatter.rb +1 -0
  177. data/lib/cucumber/formatter/ansicolor.rb +106 -0
  178. data/lib/cucumber/formatter/console.rb +116 -0
  179. data/lib/cucumber/formatter/pretty.rb +158 -0
  180. data/lib/cucumber/formatter/profile.rb +77 -0
  181. data/lib/cucumber/formatter/progress.rb +68 -0
  182. data/lib/cucumber/formatter/rerun.rb +35 -0
  183. data/lib/cucumber/formatters/unicode.rb +2 -0
  184. data/lib/cucumber/jbehave.rb +104 -0
  185. data/lib/cucumber/languages.yml +314 -0
  186. data/lib/cucumber/parser.rb +24 -0
  187. data/lib/cucumber/parser/basic.rb +0 -0
  188. data/lib/cucumber/parser/feature.rb +1351 -0
  189. data/lib/cucumber/parser/feature.tt +160 -0
  190. data/lib/cucumber/parser/i18n.tt +27 -0
  191. data/lib/cucumber/parser/table.rb +396 -0
  192. data/lib/cucumber/parser/table.tt +53 -0
  193. data/lib/cucumber/parser/treetop_ext.rb +67 -0
  194. data/lib/cucumber/platform.rb +18 -0
  195. data/lib/cucumber/rails/rspec.rb +5 -0
  196. data/lib/cucumber/rails/world.rb +73 -0
  197. data/lib/cucumber/rake/task.rb +106 -0
  198. data/lib/cucumber/step_definition.rb +87 -0
  199. data/lib/cucumber/step_mother.rb +164 -0
  200. data/lib/cucumber/version.rb +10 -0
  201. data/pretty.txt +486 -0
  202. data/rails_generators/cucumber/USAGE +11 -0
  203. data/rails_generators/cucumber/cucumber_generator.rb +31 -0
  204. data/rails_generators/cucumber/templates/cucumber +8 -0
  205. data/rails_generators/cucumber/templates/cucumber.rake +7 -0
  206. data/rails_generators/cucumber/templates/env.rb +16 -0
  207. data/rails_generators/cucumber/templates/paths.rb +12 -0
  208. data/rails_generators/cucumber/templates/webrat_steps.rb +99 -0
  209. data/rails_generators/feature/USAGE +12 -0
  210. data/rails_generators/feature/feature_generator.rb +36 -0
  211. data/rails_generators/feature/templates/feature.erb +31 -0
  212. data/rails_generators/feature/templates/steps.erb +24 -0
  213. data/spec/cucumber/ast/feature_factory.rb +54 -0
  214. data/spec/cucumber/ast/feature_spec.rb +60 -0
  215. data/spec/cucumber/ast/py_string_spec.rb +40 -0
  216. data/spec/cucumber/ast/scenario_outline_spec.rb +64 -0
  217. data/spec/cucumber/ast/scenario_spec.rb +82 -0
  218. data/spec/cucumber/ast/step_spec.rb +45 -0
  219. data/spec/cucumber/ast/table_spec.rb +81 -0
  220. data/spec/cucumber/broadcaster_spec.rb +14 -0
  221. data/spec/cucumber/cli_spec.rb +416 -0
  222. data/spec/cucumber/core_ext/proc_spec.rb +37 -0
  223. data/spec/cucumber/core_ext/string_spec.rb +42 -0
  224. data/spec/cucumber/formatter/ansicolor_spec.rb +35 -0
  225. data/spec/cucumber/formatter/html/cucumber.css +37 -0
  226. data/spec/cucumber/formatter/html/cucumber.js +13 -0
  227. data/spec/cucumber/formatter/html/index.html +45 -0
  228. data/spec/cucumber/formatter/html/jquery-1.3.min.js +19 -0
  229. data/spec/cucumber/formatter/html/jquery.uitableedit.js +100 -0
  230. data/spec/cucumber/formatters/profile_formatter_spec.rb +198 -0
  231. data/spec/cucumber/parser/feature_parser_spec.rb +247 -0
  232. data/spec/cucumber/parser/table_parser_spec.rb +48 -0
  233. data/spec/cucumber/rails/stubs/mini_rails.rb +18 -0
  234. data/spec/cucumber/rails/stubs/test_help.rb +1 -0
  235. data/spec/cucumber/rails/world_spec.rb +11 -0
  236. data/spec/cucumber/sell_cucumbers.feature +19 -0
  237. data/spec/cucumber/step_definition_spec.rb +62 -0
  238. data/spec/cucumber/treetop_parser/empty_feature.feature +4 -0
  239. data/spec/cucumber/treetop_parser/empty_scenario.feature +9 -0
  240. data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +3 -0
  241. data/spec/cucumber/treetop_parser/fit_scenario.feature +8 -0
  242. data/spec/cucumber/treetop_parser/given_scenario.feature +9 -0
  243. data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +7 -0
  244. data/spec/cucumber/treetop_parser/multiline_steps.feature +17 -0
  245. data/spec/cucumber/treetop_parser/multiple_tables.feature +27 -0
  246. data/spec/cucumber/treetop_parser/scenario_outline.feature +16 -0
  247. data/spec/cucumber/treetop_parser/spaces.feature +12 -0
  248. data/spec/cucumber/treetop_parser/test_dos.feature +25 -0
  249. data/spec/cucumber/treetop_parser/with_comments.feature +10 -0
  250. data/spec/cucumber/treetop_parser/with_tags.feature +18 -0
  251. data/spec/cucumber/world/pending_spec.rb +47 -0
  252. data/spec/spec.opts +2 -0
  253. data/spec/spec_helper.rb +21 -0
  254. metadata +7 -1
@@ -0,0 +1,24 @@
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
+ def self.load_parser(keywords)
17
+ template = File.open(File.dirname(__FILE__) + "/parser/i18n.tt", Cucumber.file_mode('r')).read
18
+ erb = ERB.new(template)
19
+ grammar = erb.result(binding)
20
+ Treetop.load_from_string(grammar)
21
+ require 'cucumber/parser/feature'
22
+ end
23
+ end
24
+ end
File without changes
@@ -0,0 +1,1351 @@
1
+ module Cucumber
2
+ module Parser
3
+ # TIP: When you hack on the grammar, just delete feature.rb in this directory.
4
+ # Treetop will then generate the parser in-memory. When you're happy, just generate
5
+ # the rb file with tt feature.tt
6
+ module Feature
7
+ include Treetop::Runtime
8
+
9
+ def root
10
+ @root || :feature
11
+ end
12
+
13
+ include I18n
14
+
15
+ include Table
16
+
17
+ module Feature0
18
+ end
19
+
20
+ module Feature1
21
+ def white
22
+ elements[0]
23
+ end
24
+
25
+ def comment
26
+ elements[1]
27
+ end
28
+
29
+ def white
30
+ elements[2]
31
+ end
32
+
33
+ def tags
34
+ elements[3]
35
+ end
36
+
37
+ def white
38
+ elements[4]
39
+ end
40
+
41
+ def header
42
+ elements[5]
43
+ end
44
+
45
+ def feature_elements
46
+ elements[6]
47
+ end
48
+ end
49
+
50
+ module Feature2
51
+ def build
52
+ Ast::Feature.new(comment.build, tags.build, header.text_value, feature_elements.build)
53
+ end
54
+ end
55
+
56
+ def _nt_feature
57
+ start_index = index
58
+ if node_cache[:feature].has_key?(index)
59
+ cached = node_cache[:feature][index]
60
+ @index = cached.interval.end if cached
61
+ return cached
62
+ end
63
+
64
+ i0, s0 = index, []
65
+ r1 = _nt_white
66
+ s0 << r1
67
+ if r1
68
+ r2 = _nt_comment
69
+ s0 << r2
70
+ if r2
71
+ r3 = _nt_white
72
+ s0 << r3
73
+ if r3
74
+ r4 = _nt_tags
75
+ s0 << r4
76
+ if r4
77
+ r5 = _nt_white
78
+ s0 << r5
79
+ if r5
80
+ s6, i6 = [], index
81
+ loop do
82
+ i7, s7 = index, []
83
+ i8 = index
84
+ i9 = index
85
+ r10 = _nt_scenario_outline
86
+ if r10
87
+ r9 = r10
88
+ else
89
+ r11 = _nt_scenario
90
+ if r11
91
+ r9 = r11
92
+ else
93
+ self.index = i9
94
+ r9 = nil
95
+ end
96
+ end
97
+ if r9
98
+ r8 = nil
99
+ else
100
+ self.index = i8
101
+ r8 = SyntaxNode.new(input, index...index)
102
+ end
103
+ s7 << r8
104
+ if r8
105
+ if index < input_length
106
+ r12 = (SyntaxNode).new(input, index...(index + 1))
107
+ @index += 1
108
+ else
109
+ terminal_parse_failure("any character")
110
+ r12 = nil
111
+ end
112
+ s7 << r12
113
+ end
114
+ if s7.last
115
+ r7 = (SyntaxNode).new(input, i7...index, s7)
116
+ r7.extend(Feature0)
117
+ else
118
+ self.index = i7
119
+ r7 = nil
120
+ end
121
+ if r7
122
+ s6 << r7
123
+ else
124
+ break
125
+ end
126
+ end
127
+ r6 = SyntaxNode.new(input, i6...index, s6)
128
+ s0 << r6
129
+ if r6
130
+ r13 = _nt_feature_elements
131
+ s0 << r13
132
+ end
133
+ end
134
+ end
135
+ end
136
+ end
137
+ end
138
+ if s0.last
139
+ r0 = (SyntaxNode).new(input, i0...index, s0)
140
+ r0.extend(Feature1)
141
+ r0.extend(Feature2)
142
+ else
143
+ self.index = i0
144
+ r0 = nil
145
+ end
146
+
147
+ node_cache[:feature][start_index] = r0
148
+
149
+ return r0
150
+ end
151
+
152
+ module Tags0
153
+ def tag
154
+ elements[0]
155
+ end
156
+
157
+ end
158
+
159
+ module Tags1
160
+ def white
161
+ elements[0]
162
+ end
163
+
164
+ def ts
165
+ elements[1]
166
+ end
167
+ end
168
+
169
+ module Tags2
170
+ def build
171
+ tag_names = ts.elements.map{|e| e.tag.tag_name.text_value}
172
+ Ast::Tags.new(ts.line, tag_names)
173
+ end
174
+ end
175
+
176
+ def _nt_tags
177
+ start_index = index
178
+ if node_cache[:tags].has_key?(index)
179
+ cached = node_cache[:tags][index]
180
+ @index = cached.interval.end if cached
181
+ return cached
182
+ end
183
+
184
+ i0, s0 = index, []
185
+ r1 = _nt_white
186
+ s0 << r1
187
+ if r1
188
+ s2, i2 = [], index
189
+ loop do
190
+ i3, s3 = index, []
191
+ r4 = _nt_tag
192
+ s3 << r4
193
+ if r4
194
+ s5, i5 = [], index
195
+ loop do
196
+ i6 = index
197
+ r7 = _nt_space
198
+ if r7
199
+ r6 = r7
200
+ else
201
+ r8 = _nt_eol
202
+ if r8
203
+ r6 = r8
204
+ else
205
+ self.index = i6
206
+ r6 = nil
207
+ end
208
+ end
209
+ if r6
210
+ s5 << r6
211
+ else
212
+ break
213
+ end
214
+ end
215
+ if s5.empty?
216
+ self.index = i5
217
+ r5 = nil
218
+ else
219
+ r5 = SyntaxNode.new(input, i5...index, s5)
220
+ end
221
+ s3 << r5
222
+ end
223
+ if s3.last
224
+ r3 = (SyntaxNode).new(input, i3...index, s3)
225
+ r3.extend(Tags0)
226
+ else
227
+ self.index = i3
228
+ r3 = nil
229
+ end
230
+ if r3
231
+ s2 << r3
232
+ else
233
+ break
234
+ end
235
+ end
236
+ r2 = SyntaxNode.new(input, i2...index, s2)
237
+ s0 << r2
238
+ end
239
+ if s0.last
240
+ r0 = (SyntaxNode).new(input, i0...index, s0)
241
+ r0.extend(Tags1)
242
+ r0.extend(Tags2)
243
+ else
244
+ self.index = i0
245
+ r0 = nil
246
+ end
247
+
248
+ node_cache[:tags][start_index] = r0
249
+
250
+ return r0
251
+ end
252
+
253
+ module Tag0
254
+ def tag_name
255
+ elements[1]
256
+ end
257
+ end
258
+
259
+ def _nt_tag
260
+ start_index = index
261
+ if node_cache[:tag].has_key?(index)
262
+ cached = node_cache[:tag][index]
263
+ @index = cached.interval.end if cached
264
+ return cached
265
+ end
266
+
267
+ i0, s0 = index, []
268
+ if input.index('@', index) == index
269
+ r1 = (SyntaxNode).new(input, index...(index + 1))
270
+ @index += 1
271
+ else
272
+ terminal_parse_failure('@')
273
+ r1 = nil
274
+ end
275
+ s0 << r1
276
+ if r1
277
+ s2, i2 = [], index
278
+ loop do
279
+ if input.index(Regexp.new('[a-z0-9]'), index) == index
280
+ r3 = (SyntaxNode).new(input, index...(index + 1))
281
+ @index += 1
282
+ else
283
+ r3 = nil
284
+ end
285
+ if r3
286
+ s2 << r3
287
+ else
288
+ break
289
+ end
290
+ end
291
+ if s2.empty?
292
+ self.index = i2
293
+ r2 = nil
294
+ else
295
+ r2 = SyntaxNode.new(input, i2...index, s2)
296
+ end
297
+ s0 << r2
298
+ end
299
+ if s0.last
300
+ r0 = (SyntaxNode).new(input, i0...index, s0)
301
+ r0.extend(Tag0)
302
+ else
303
+ self.index = i0
304
+ r0 = nil
305
+ end
306
+
307
+ node_cache[:tag][start_index] = r0
308
+
309
+ return r0
310
+ end
311
+
312
+ module Comment0
313
+ def comment_line
314
+ elements[0]
315
+ end
316
+
317
+ end
318
+
319
+ module Comment1
320
+ def build
321
+ Ast::Comment.new(text_value)
322
+ end
323
+ end
324
+
325
+ def _nt_comment
326
+ start_index = index
327
+ if node_cache[:comment].has_key?(index)
328
+ cached = node_cache[:comment][index]
329
+ @index = cached.interval.end if cached
330
+ return cached
331
+ end
332
+
333
+ s0, i0 = [], index
334
+ loop do
335
+ i1, s1 = index, []
336
+ r2 = _nt_comment_line
337
+ s1 << r2
338
+ if r2
339
+ s3, i3 = [], index
340
+ loop do
341
+ r4 = _nt_eol
342
+ if r4
343
+ s3 << r4
344
+ else
345
+ break
346
+ end
347
+ end
348
+ if s3.empty?
349
+ self.index = i3
350
+ r3 = nil
351
+ else
352
+ r3 = SyntaxNode.new(input, i3...index, s3)
353
+ end
354
+ s1 << r3
355
+ end
356
+ if s1.last
357
+ r1 = (SyntaxNode).new(input, i1...index, s1)
358
+ r1.extend(Comment0)
359
+ else
360
+ self.index = i1
361
+ r1 = nil
362
+ end
363
+ if r1
364
+ s0 << r1
365
+ else
366
+ break
367
+ end
368
+ end
369
+ r0 = SyntaxNode.new(input, i0...index, s0)
370
+ r0.extend(Comment1)
371
+
372
+ node_cache[:comment][start_index] = r0
373
+
374
+ return r0
375
+ end
376
+
377
+ module CommentLine0
378
+ def line_to_eol
379
+ elements[1]
380
+ end
381
+ end
382
+
383
+ def _nt_comment_line
384
+ start_index = index
385
+ if node_cache[:comment_line].has_key?(index)
386
+ cached = node_cache[:comment_line][index]
387
+ @index = cached.interval.end if cached
388
+ return cached
389
+ end
390
+
391
+ i0, s0 = index, []
392
+ if input.index('#', index) == index
393
+ r1 = (SyntaxNode).new(input, index...(index + 1))
394
+ @index += 1
395
+ else
396
+ terminal_parse_failure('#')
397
+ r1 = nil
398
+ end
399
+ s0 << r1
400
+ if r1
401
+ r2 = _nt_line_to_eol
402
+ s0 << r2
403
+ end
404
+ if s0.last
405
+ r0 = (SyntaxNode).new(input, i0...index, s0)
406
+ r0.extend(CommentLine0)
407
+ else
408
+ self.index = i0
409
+ r0 = nil
410
+ end
411
+
412
+ node_cache[:comment_line][start_index] = r0
413
+
414
+ return r0
415
+ end
416
+
417
+ module FeatureElements0
418
+ def build
419
+ elements.map{|s| s.build}
420
+ end
421
+ end
422
+
423
+ def _nt_feature_elements
424
+ start_index = index
425
+ if node_cache[:feature_elements].has_key?(index)
426
+ cached = node_cache[:feature_elements][index]
427
+ @index = cached.interval.end if cached
428
+ return cached
429
+ end
430
+
431
+ s0, i0 = [], index
432
+ loop do
433
+ i1 = index
434
+ r2 = _nt_scenario
435
+ if r2
436
+ r1 = r2
437
+ else
438
+ r3 = _nt_scenario_outline
439
+ if r3
440
+ r1 = r3
441
+ else
442
+ self.index = i1
443
+ r1 = nil
444
+ end
445
+ end
446
+ if r1
447
+ s0 << r1
448
+ else
449
+ break
450
+ end
451
+ end
452
+ r0 = SyntaxNode.new(input, i0...index, s0)
453
+ r0.extend(FeatureElements0)
454
+
455
+ node_cache[:feature_elements][start_index] = r0
456
+
457
+ return r0
458
+ end
459
+
460
+ module Scenario0
461
+ def comment
462
+ elements[0]
463
+ end
464
+
465
+ def tags
466
+ elements[1]
467
+ end
468
+
469
+ def white
470
+ elements[2]
471
+ end
472
+
473
+ def scenario_keyword
474
+ elements[3]
475
+ end
476
+
477
+ def name
478
+ elements[5]
479
+ end
480
+
481
+ def steps
482
+ elements[7]
483
+ end
484
+ end
485
+
486
+ module Scenario1
487
+ def build
488
+ Ast::Scenario.new(
489
+ comment.build,
490
+ tags.build,
491
+ scenario_keyword.line,
492
+ scenario_keyword.text_value,
493
+ name.text_value,
494
+ steps.build
495
+ )
496
+ end
497
+ end
498
+
499
+ def _nt_scenario
500
+ start_index = index
501
+ if node_cache[:scenario].has_key?(index)
502
+ cached = node_cache[:scenario][index]
503
+ @index = cached.interval.end if cached
504
+ return cached
505
+ end
506
+
507
+ i0, s0 = index, []
508
+ r1 = _nt_comment
509
+ s0 << r1
510
+ if r1
511
+ r2 = _nt_tags
512
+ s0 << r2
513
+ if r2
514
+ r3 = _nt_white
515
+ s0 << r3
516
+ if r3
517
+ r4 = _nt_scenario_keyword
518
+ s0 << r4
519
+ if r4
520
+ s5, i5 = [], index
521
+ loop do
522
+ r6 = _nt_space
523
+ if r6
524
+ s5 << r6
525
+ else
526
+ break
527
+ end
528
+ end
529
+ r5 = SyntaxNode.new(input, i5...index, s5)
530
+ s0 << r5
531
+ if r5
532
+ r7 = _nt_line_to_eol
533
+ s0 << r7
534
+ if r7
535
+ i8 = index
536
+ s9, i9 = [], index
537
+ loop do
538
+ r10 = _nt_eol
539
+ if r10
540
+ s9 << r10
541
+ else
542
+ break
543
+ end
544
+ end
545
+ if s9.empty?
546
+ self.index = i9
547
+ r9 = nil
548
+ else
549
+ r9 = SyntaxNode.new(input, i9...index, s9)
550
+ end
551
+ if r9
552
+ r8 = r9
553
+ else
554
+ r11 = _nt_eof
555
+ if r11
556
+ r8 = r11
557
+ else
558
+ self.index = i8
559
+ r8 = nil
560
+ end
561
+ end
562
+ s0 << r8
563
+ if r8
564
+ r12 = _nt_steps
565
+ s0 << r12
566
+ end
567
+ end
568
+ end
569
+ end
570
+ end
571
+ end
572
+ end
573
+ if s0.last
574
+ r0 = (SyntaxNode).new(input, i0...index, s0)
575
+ r0.extend(Scenario0)
576
+ r0.extend(Scenario1)
577
+ else
578
+ self.index = i0
579
+ r0 = nil
580
+ end
581
+
582
+ node_cache[:scenario][start_index] = r0
583
+
584
+ return r0
585
+ end
586
+
587
+ module ScenarioOutline0
588
+ def comment
589
+ elements[0]
590
+ end
591
+
592
+ def tags
593
+ elements[1]
594
+ end
595
+
596
+ def white
597
+ elements[2]
598
+ end
599
+
600
+ def scenario_outline_keyword
601
+ elements[3]
602
+ end
603
+
604
+ def name
605
+ elements[5]
606
+ end
607
+
608
+ def white
609
+ elements[6]
610
+ end
611
+
612
+ def steps
613
+ elements[7]
614
+ end
615
+
616
+ def examples_sections
617
+ elements[8]
618
+ end
619
+ end
620
+
621
+ module ScenarioOutline1
622
+ def build
623
+ Ast::ScenarioOutline.new(
624
+ comment.build,
625
+ tags.build,
626
+ scenario_outline_keyword.line,
627
+ scenario_outline_keyword.text_value,
628
+ name.text_value,
629
+ steps.build,
630
+ examples_sections.build
631
+ )
632
+ end
633
+ end
634
+
635
+ def _nt_scenario_outline
636
+ start_index = index
637
+ if node_cache[:scenario_outline].has_key?(index)
638
+ cached = node_cache[:scenario_outline][index]
639
+ @index = cached.interval.end if cached
640
+ return cached
641
+ end
642
+
643
+ i0, s0 = index, []
644
+ r1 = _nt_comment
645
+ s0 << r1
646
+ if r1
647
+ r2 = _nt_tags
648
+ s0 << r2
649
+ if r2
650
+ r3 = _nt_white
651
+ s0 << r3
652
+ if r3
653
+ r4 = _nt_scenario_outline_keyword
654
+ s0 << r4
655
+ if r4
656
+ s5, i5 = [], index
657
+ loop do
658
+ r6 = _nt_space
659
+ if r6
660
+ s5 << r6
661
+ else
662
+ break
663
+ end
664
+ end
665
+ r5 = SyntaxNode.new(input, i5...index, s5)
666
+ s0 << r5
667
+ if r5
668
+ r7 = _nt_line_to_eol
669
+ s0 << r7
670
+ if r7
671
+ r8 = _nt_white
672
+ s0 << r8
673
+ if r8
674
+ r9 = _nt_steps
675
+ s0 << r9
676
+ if r9
677
+ r10 = _nt_examples_sections
678
+ s0 << r10
679
+ end
680
+ end
681
+ end
682
+ end
683
+ end
684
+ end
685
+ end
686
+ end
687
+ if s0.last
688
+ r0 = (SyntaxNode).new(input, i0...index, s0)
689
+ r0.extend(ScenarioOutline0)
690
+ r0.extend(ScenarioOutline1)
691
+ else
692
+ self.index = i0
693
+ r0 = nil
694
+ end
695
+
696
+ node_cache[:scenario_outline][start_index] = r0
697
+
698
+ return r0
699
+ end
700
+
701
+ module Steps0
702
+ def build
703
+ elements.map{|e| e.build}
704
+ end
705
+ end
706
+
707
+ def _nt_steps
708
+ start_index = index
709
+ if node_cache[:steps].has_key?(index)
710
+ cached = node_cache[:steps][index]
711
+ @index = cached.interval.end if cached
712
+ return cached
713
+ end
714
+
715
+ s0, i0 = [], index
716
+ loop do
717
+ r1 = _nt_step
718
+ if r1
719
+ s0 << r1
720
+ else
721
+ break
722
+ end
723
+ end
724
+ r0 = SyntaxNode.new(input, i0...index, s0)
725
+ r0.extend(Steps0)
726
+
727
+ node_cache[:steps][start_index] = r0
728
+
729
+ return r0
730
+ end
731
+
732
+ module Step0
733
+ def step_keyword
734
+ elements[1]
735
+ end
736
+
737
+ def name
738
+ elements[3]
739
+ end
740
+
741
+ def multi
742
+ elements[5]
743
+ end
744
+ end
745
+
746
+ module Step1
747
+ def build
748
+ if multi.respond_to?(:build)
749
+ Ast::Step.new(step_keyword.line, step_keyword.text_value, name.text_value, multi.build)
750
+ else
751
+ Ast::Step.new(step_keyword.line, step_keyword.text_value, name.text_value)
752
+ end
753
+ end
754
+ end
755
+
756
+ def _nt_step
757
+ start_index = index
758
+ if node_cache[:step].has_key?(index)
759
+ cached = node_cache[:step][index]
760
+ @index = cached.interval.end if cached
761
+ return cached
762
+ end
763
+
764
+ i0, s0 = index, []
765
+ s1, i1 = [], index
766
+ loop do
767
+ r2 = _nt_space
768
+ if r2
769
+ s1 << r2
770
+ else
771
+ break
772
+ end
773
+ end
774
+ r1 = SyntaxNode.new(input, i1...index, s1)
775
+ s0 << r1
776
+ if r1
777
+ r3 = _nt_step_keyword
778
+ s0 << r3
779
+ if r3
780
+ s4, i4 = [], index
781
+ loop do
782
+ r5 = _nt_space
783
+ if r5
784
+ s4 << r5
785
+ else
786
+ break
787
+ end
788
+ end
789
+ r4 = SyntaxNode.new(input, i4...index, s4)
790
+ s0 << r4
791
+ if r4
792
+ r6 = _nt_line_to_eol
793
+ s0 << r6
794
+ if r6
795
+ i7 = index
796
+ s8, i8 = [], index
797
+ loop do
798
+ r9 = _nt_eol
799
+ if r9
800
+ s8 << r9
801
+ else
802
+ break
803
+ end
804
+ end
805
+ if s8.empty?
806
+ self.index = i8
807
+ r8 = nil
808
+ else
809
+ r8 = SyntaxNode.new(input, i8...index, s8)
810
+ end
811
+ if r8
812
+ r7 = r8
813
+ else
814
+ r10 = _nt_eof
815
+ if r10
816
+ r7 = r10
817
+ else
818
+ self.index = i7
819
+ r7 = nil
820
+ end
821
+ end
822
+ s0 << r7
823
+ if r7
824
+ r12 = _nt_multiline_arg
825
+ if r12
826
+ r11 = r12
827
+ else
828
+ r11 = SyntaxNode.new(input, index...index)
829
+ end
830
+ s0 << r11
831
+ end
832
+ end
833
+ end
834
+ end
835
+ end
836
+ if s0.last
837
+ r0 = (SyntaxNode).new(input, i0...index, s0)
838
+ r0.extend(Step0)
839
+ r0.extend(Step1)
840
+ else
841
+ self.index = i0
842
+ r0 = nil
843
+ end
844
+
845
+ node_cache[:step][start_index] = r0
846
+
847
+ return r0
848
+ end
849
+
850
+ module ExamplesSections0
851
+ def build
852
+ elements.map{|e| e.build}
853
+ end
854
+ end
855
+
856
+ def _nt_examples_sections
857
+ start_index = index
858
+ if node_cache[:examples_sections].has_key?(index)
859
+ cached = node_cache[:examples_sections][index]
860
+ @index = cached.interval.end if cached
861
+ return cached
862
+ end
863
+
864
+ s0, i0 = [], index
865
+ loop do
866
+ r1 = _nt_examples
867
+ if r1
868
+ s0 << r1
869
+ else
870
+ break
871
+ end
872
+ end
873
+ if s0.empty?
874
+ self.index = i0
875
+ r0 = nil
876
+ else
877
+ r0 = SyntaxNode.new(input, i0...index, s0)
878
+ r0.extend(ExamplesSections0)
879
+ end
880
+
881
+ node_cache[:examples_sections][start_index] = r0
882
+
883
+ return r0
884
+ end
885
+
886
+ module Examples0
887
+ def examples_keyword
888
+ elements[1]
889
+ end
890
+
891
+ def name
892
+ elements[3]
893
+ end
894
+
895
+ def table
896
+ elements[5]
897
+ end
898
+ end
899
+
900
+ module Examples1
901
+ def build
902
+ [examples_keyword.line, examples_keyword.text_value, name.text_value, table.raw]
903
+ end
904
+ end
905
+
906
+ def _nt_examples
907
+ start_index = index
908
+ if node_cache[:examples].has_key?(index)
909
+ cached = node_cache[:examples][index]
910
+ @index = cached.interval.end if cached
911
+ return cached
912
+ end
913
+
914
+ i0, s0 = index, []
915
+ s1, i1 = [], index
916
+ loop do
917
+ r2 = _nt_space
918
+ if r2
919
+ s1 << r2
920
+ else
921
+ break
922
+ end
923
+ end
924
+ r1 = SyntaxNode.new(input, i1...index, s1)
925
+ s0 << r1
926
+ if r1
927
+ r3 = _nt_examples_keyword
928
+ s0 << r3
929
+ if r3
930
+ s4, i4 = [], index
931
+ loop do
932
+ r5 = _nt_space
933
+ if r5
934
+ s4 << r5
935
+ else
936
+ break
937
+ end
938
+ end
939
+ r4 = SyntaxNode.new(input, i4...index, s4)
940
+ s0 << r4
941
+ if r4
942
+ r7 = _nt_line_to_eol
943
+ if r7
944
+ r6 = r7
945
+ else
946
+ r6 = SyntaxNode.new(input, index...index)
947
+ end
948
+ s0 << r6
949
+ if r6
950
+ s8, i8 = [], index
951
+ loop do
952
+ r9 = _nt_eol
953
+ if r9
954
+ s8 << r9
955
+ else
956
+ break
957
+ end
958
+ end
959
+ if s8.empty?
960
+ self.index = i8
961
+ r8 = nil
962
+ else
963
+ r8 = SyntaxNode.new(input, i8...index, s8)
964
+ end
965
+ s0 << r8
966
+ if r8
967
+ r10 = _nt_table
968
+ s0 << r10
969
+ end
970
+ end
971
+ end
972
+ end
973
+ end
974
+ if s0.last
975
+ r0 = (SyntaxNode).new(input, i0...index, s0)
976
+ r0.extend(Examples0)
977
+ r0.extend(Examples1)
978
+ else
979
+ self.index = i0
980
+ r0 = nil
981
+ end
982
+
983
+ node_cache[:examples][start_index] = r0
984
+
985
+ return r0
986
+ end
987
+
988
+ def _nt_multiline_arg
989
+ start_index = index
990
+ if node_cache[:multiline_arg].has_key?(index)
991
+ cached = node_cache[:multiline_arg][index]
992
+ @index = cached.interval.end if cached
993
+ return cached
994
+ end
995
+
996
+ i0 = index
997
+ r1 = _nt_table
998
+ if r1
999
+ r0 = r1
1000
+ else
1001
+ r2 = _nt_py_string
1002
+ if r2
1003
+ r0 = r2
1004
+ else
1005
+ self.index = i0
1006
+ r0 = nil
1007
+ end
1008
+ end
1009
+
1010
+ node_cache[:multiline_arg][start_index] = r0
1011
+
1012
+ return r0
1013
+ end
1014
+
1015
+ module LineToEol0
1016
+ end
1017
+
1018
+ def _nt_line_to_eol
1019
+ start_index = index
1020
+ if node_cache[:line_to_eol].has_key?(index)
1021
+ cached = node_cache[:line_to_eol][index]
1022
+ @index = cached.interval.end if cached
1023
+ return cached
1024
+ end
1025
+
1026
+ s0, i0 = [], index
1027
+ loop do
1028
+ i1, s1 = index, []
1029
+ i2 = index
1030
+ r3 = _nt_eol
1031
+ if r3
1032
+ r2 = nil
1033
+ else
1034
+ self.index = i2
1035
+ r2 = SyntaxNode.new(input, index...index)
1036
+ end
1037
+ s1 << r2
1038
+ if r2
1039
+ if index < input_length
1040
+ r4 = (SyntaxNode).new(input, index...(index + 1))
1041
+ @index += 1
1042
+ else
1043
+ terminal_parse_failure("any character")
1044
+ r4 = nil
1045
+ end
1046
+ s1 << r4
1047
+ end
1048
+ if s1.last
1049
+ r1 = (SyntaxNode).new(input, i1...index, s1)
1050
+ r1.extend(LineToEol0)
1051
+ else
1052
+ self.index = i1
1053
+ r1 = nil
1054
+ end
1055
+ if r1
1056
+ s0 << r1
1057
+ else
1058
+ break
1059
+ end
1060
+ end
1061
+ if s0.empty?
1062
+ self.index = i0
1063
+ r0 = nil
1064
+ else
1065
+ r0 = SyntaxNode.new(input, i0...index, s0)
1066
+ end
1067
+
1068
+ node_cache[:line_to_eol][start_index] = r0
1069
+
1070
+ return r0
1071
+ end
1072
+
1073
+ module PyString0
1074
+ end
1075
+
1076
+ module PyString1
1077
+ def open_py_string
1078
+ elements[0]
1079
+ end
1080
+
1081
+ def s
1082
+ elements[1]
1083
+ end
1084
+
1085
+ def close_py_string
1086
+ elements[2]
1087
+ end
1088
+ end
1089
+
1090
+ module PyString2
1091
+ def build
1092
+ Ast::PyString.new(open_py_string.line, close_py_string.line, s.text_value, open_py_string.indentation)
1093
+ end
1094
+ end
1095
+
1096
+ def _nt_py_string
1097
+ start_index = index
1098
+ if node_cache[:py_string].has_key?(index)
1099
+ cached = node_cache[:py_string][index]
1100
+ @index = cached.interval.end if cached
1101
+ return cached
1102
+ end
1103
+
1104
+ i0, s0 = index, []
1105
+ r1 = _nt_open_py_string
1106
+ s0 << r1
1107
+ if r1
1108
+ s2, i2 = [], index
1109
+ loop do
1110
+ i3, s3 = index, []
1111
+ i4 = index
1112
+ r5 = _nt_close_py_string
1113
+ if r5
1114
+ r4 = nil
1115
+ else
1116
+ self.index = i4
1117
+ r4 = SyntaxNode.new(input, index...index)
1118
+ end
1119
+ s3 << r4
1120
+ if r4
1121
+ if index < input_length
1122
+ r6 = (SyntaxNode).new(input, index...(index + 1))
1123
+ @index += 1
1124
+ else
1125
+ terminal_parse_failure("any character")
1126
+ r6 = nil
1127
+ end
1128
+ s3 << r6
1129
+ end
1130
+ if s3.last
1131
+ r3 = (SyntaxNode).new(input, i3...index, s3)
1132
+ r3.extend(PyString0)
1133
+ else
1134
+ self.index = i3
1135
+ r3 = nil
1136
+ end
1137
+ if r3
1138
+ s2 << r3
1139
+ else
1140
+ break
1141
+ end
1142
+ end
1143
+ r2 = SyntaxNode.new(input, i2...index, s2)
1144
+ s0 << r2
1145
+ if r2
1146
+ r7 = _nt_close_py_string
1147
+ s0 << r7
1148
+ end
1149
+ end
1150
+ if s0.last
1151
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1152
+ r0.extend(PyString1)
1153
+ r0.extend(PyString2)
1154
+ else
1155
+ self.index = i0
1156
+ r0 = nil
1157
+ end
1158
+
1159
+ node_cache[:py_string][start_index] = r0
1160
+
1161
+ return r0
1162
+ end
1163
+
1164
+ module OpenPyString0
1165
+ def white
1166
+ elements[0]
1167
+ end
1168
+
1169
+ def eol
1170
+ elements[3]
1171
+ end
1172
+ end
1173
+
1174
+ module OpenPyString1
1175
+ def indentation
1176
+ white.text_value.length
1177
+ end
1178
+
1179
+ def line
1180
+ white.line
1181
+ end
1182
+ end
1183
+
1184
+ def _nt_open_py_string
1185
+ start_index = index
1186
+ if node_cache[:open_py_string].has_key?(index)
1187
+ cached = node_cache[:open_py_string][index]
1188
+ @index = cached.interval.end if cached
1189
+ return cached
1190
+ end
1191
+
1192
+ i0, s0 = index, []
1193
+ r1 = _nt_white
1194
+ s0 << r1
1195
+ if r1
1196
+ if input.index('"""', index) == index
1197
+ r2 = (SyntaxNode).new(input, index...(index + 3))
1198
+ @index += 3
1199
+ else
1200
+ terminal_parse_failure('"""')
1201
+ r2 = nil
1202
+ end
1203
+ s0 << r2
1204
+ if r2
1205
+ s3, i3 = [], index
1206
+ loop do
1207
+ r4 = _nt_space
1208
+ if r4
1209
+ s3 << r4
1210
+ else
1211
+ break
1212
+ end
1213
+ end
1214
+ r3 = SyntaxNode.new(input, i3...index, s3)
1215
+ s0 << r3
1216
+ if r3
1217
+ r5 = _nt_eol
1218
+ s0 << r5
1219
+ end
1220
+ end
1221
+ end
1222
+ if s0.last
1223
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1224
+ r0.extend(OpenPyString0)
1225
+ r0.extend(OpenPyString1)
1226
+ else
1227
+ self.index = i0
1228
+ r0 = nil
1229
+ end
1230
+
1231
+ node_cache[:open_py_string][start_index] = r0
1232
+
1233
+ return r0
1234
+ end
1235
+
1236
+ module ClosePyString0
1237
+ def eol
1238
+ elements[0]
1239
+ end
1240
+
1241
+ def quotes
1242
+ elements[2]
1243
+ end
1244
+
1245
+ def white
1246
+ elements[3]
1247
+ end
1248
+ end
1249
+
1250
+ module ClosePyString1
1251
+ def line
1252
+ quotes.line
1253
+ end
1254
+ end
1255
+
1256
+ def _nt_close_py_string
1257
+ start_index = index
1258
+ if node_cache[:close_py_string].has_key?(index)
1259
+ cached = node_cache[:close_py_string][index]
1260
+ @index = cached.interval.end if cached
1261
+ return cached
1262
+ end
1263
+
1264
+ i0, s0 = index, []
1265
+ r1 = _nt_eol
1266
+ s0 << r1
1267
+ if r1
1268
+ s2, i2 = [], index
1269
+ loop do
1270
+ r3 = _nt_space
1271
+ if r3
1272
+ s2 << r3
1273
+ else
1274
+ break
1275
+ end
1276
+ end
1277
+ r2 = SyntaxNode.new(input, i2...index, s2)
1278
+ s0 << r2
1279
+ if r2
1280
+ if input.index('"""', index) == index
1281
+ r4 = (SyntaxNode).new(input, index...(index + 3))
1282
+ @index += 3
1283
+ else
1284
+ terminal_parse_failure('"""')
1285
+ r4 = nil
1286
+ end
1287
+ s0 << r4
1288
+ if r4
1289
+ r5 = _nt_white
1290
+ s0 << r5
1291
+ end
1292
+ end
1293
+ end
1294
+ if s0.last
1295
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1296
+ r0.extend(ClosePyString0)
1297
+ r0.extend(ClosePyString1)
1298
+ else
1299
+ self.index = i0
1300
+ r0 = nil
1301
+ end
1302
+
1303
+ node_cache[:close_py_string][start_index] = r0
1304
+
1305
+ return r0
1306
+ end
1307
+
1308
+ def _nt_white
1309
+ start_index = index
1310
+ if node_cache[:white].has_key?(index)
1311
+ cached = node_cache[:white][index]
1312
+ @index = cached.interval.end if cached
1313
+ return cached
1314
+ end
1315
+
1316
+ s0, i0 = [], index
1317
+ loop do
1318
+ i1 = index
1319
+ r2 = _nt_space
1320
+ if r2
1321
+ r1 = r2
1322
+ else
1323
+ r3 = _nt_eol
1324
+ if r3
1325
+ r1 = r3
1326
+ else
1327
+ self.index = i1
1328
+ r1 = nil
1329
+ end
1330
+ end
1331
+ if r1
1332
+ s0 << r1
1333
+ else
1334
+ break
1335
+ end
1336
+ end
1337
+ r0 = SyntaxNode.new(input, i0...index, s0)
1338
+
1339
+ node_cache[:white][start_index] = r0
1340
+
1341
+ return r0
1342
+ end
1343
+
1344
+ end
1345
+
1346
+ class FeatureParser < Treetop::Runtime::CompiledParser
1347
+ include Feature
1348
+ end
1349
+
1350
+ end
1351
+ end