antlr3 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/ANTLR-LICENSE.txt +26 -0
  2. data/History.txt +66 -0
  3. data/README.txt +139 -0
  4. data/bin/antlr4ruby +33 -0
  5. data/java/RubyTarget.java +524 -0
  6. data/java/antlr-full-3.2.1.jar +0 -0
  7. data/lib/antlr3.rb +176 -0
  8. data/lib/antlr3/constants.rb +88 -0
  9. data/lib/antlr3/debug.rb +701 -0
  10. data/lib/antlr3/debug/event-hub.rb +210 -0
  11. data/lib/antlr3/debug/record-event-listener.rb +25 -0
  12. data/lib/antlr3/debug/rule-tracer.rb +55 -0
  13. data/lib/antlr3/debug/socket.rb +360 -0
  14. data/lib/antlr3/debug/trace-event-listener.rb +92 -0
  15. data/lib/antlr3/dfa.rb +247 -0
  16. data/lib/antlr3/dot.rb +174 -0
  17. data/lib/antlr3/error.rb +657 -0
  18. data/lib/antlr3/main.rb +561 -0
  19. data/lib/antlr3/modes/ast-builder.rb +41 -0
  20. data/lib/antlr3/modes/filter.rb +56 -0
  21. data/lib/antlr3/profile.rb +322 -0
  22. data/lib/antlr3/recognizers.rb +1280 -0
  23. data/lib/antlr3/streams.rb +985 -0
  24. data/lib/antlr3/streams/interactive.rb +91 -0
  25. data/lib/antlr3/streams/rewrite.rb +412 -0
  26. data/lib/antlr3/test/call-stack.rb +57 -0
  27. data/lib/antlr3/test/config.rb +23 -0
  28. data/lib/antlr3/test/core-extensions.rb +269 -0
  29. data/lib/antlr3/test/diff.rb +165 -0
  30. data/lib/antlr3/test/functional.rb +207 -0
  31. data/lib/antlr3/test/grammar.rb +371 -0
  32. data/lib/antlr3/token.rb +592 -0
  33. data/lib/antlr3/tree.rb +1415 -0
  34. data/lib/antlr3/tree/debug.rb +163 -0
  35. data/lib/antlr3/tree/visitor.rb +84 -0
  36. data/lib/antlr3/tree/wizard.rb +481 -0
  37. data/lib/antlr3/util.rb +149 -0
  38. data/lib/antlr3/version.rb +27 -0
  39. data/samples/ANTLRv3Grammar.g +621 -0
  40. data/samples/Cpp.g +749 -0
  41. data/templates/AST.stg +335 -0
  42. data/templates/ASTDbg.stg +40 -0
  43. data/templates/ASTParser.stg +153 -0
  44. data/templates/ASTTreeParser.stg +272 -0
  45. data/templates/Dbg.stg +192 -0
  46. data/templates/Ruby.stg +1514 -0
  47. data/test/functional/ast-output/auto-ast.rb +797 -0
  48. data/test/functional/ast-output/construction.rb +555 -0
  49. data/test/functional/ast-output/hetero-nodes.rb +753 -0
  50. data/test/functional/ast-output/rewrites.rb +1327 -0
  51. data/test/functional/ast-output/tree-rewrite.rb +1662 -0
  52. data/test/functional/debugging/debug-mode.rb +689 -0
  53. data/test/functional/debugging/profile-mode.rb +165 -0
  54. data/test/functional/debugging/rule-tracing.rb +74 -0
  55. data/test/functional/delegation/import.rb +379 -0
  56. data/test/functional/lexer/basic.rb +559 -0
  57. data/test/functional/lexer/filter-mode.rb +245 -0
  58. data/test/functional/lexer/nuances.rb +47 -0
  59. data/test/functional/lexer/properties.rb +104 -0
  60. data/test/functional/lexer/syn-pred.rb +32 -0
  61. data/test/functional/lexer/xml.rb +206 -0
  62. data/test/functional/main/main-scripts.rb +245 -0
  63. data/test/functional/parser/actions.rb +224 -0
  64. data/test/functional/parser/backtracking.rb +244 -0
  65. data/test/functional/parser/basic.rb +282 -0
  66. data/test/functional/parser/calc.rb +98 -0
  67. data/test/functional/parser/ll-star.rb +143 -0
  68. data/test/functional/parser/nuances.rb +165 -0
  69. data/test/functional/parser/predicates.rb +103 -0
  70. data/test/functional/parser/properties.rb +242 -0
  71. data/test/functional/parser/rule-methods.rb +132 -0
  72. data/test/functional/parser/scopes.rb +274 -0
  73. data/test/functional/token-rewrite/basic.rb +318 -0
  74. data/test/functional/token-rewrite/via-parser.rb +100 -0
  75. data/test/functional/tree-parser/basic.rb +750 -0
  76. data/test/unit/sample-input/file-stream-1 +2 -0
  77. data/test/unit/sample-input/teststreams.input2 +2 -0
  78. data/test/unit/test-dfa.rb +52 -0
  79. data/test/unit/test-exceptions.rb +44 -0
  80. data/test/unit/test-recognizers.rb +55 -0
  81. data/test/unit/test-scheme.rb +62 -0
  82. data/test/unit/test-streams.rb +459 -0
  83. data/test/unit/test-tree-wizard.rb +535 -0
  84. data/test/unit/test-trees.rb +854 -0
  85. metadata +205 -0
@@ -0,0 +1,335 @@
1
+ group AST;
2
+
3
+ @parserBody.mixins() ::= <<
4
+ <@super.mixins()>
5
+ include ANTLR3::ASTBuilder
6
+ >>
7
+
8
+ gatedAction(block) ::= <<
9
+ <if(backtracking)>
10
+ if <actions.(actionScope).synpredgate>
11
+ <block>
12
+ end
13
+ <else>
14
+ <block>
15
+ <endif>
16
+ >>
17
+
18
+ ruleDeclarations() ::= <<
19
+ <super.ruleDeclarations()>
20
+ root_0 = nil<\n>
21
+ >>
22
+
23
+ ruleLabelDefs() ::= <<
24
+ <super.ruleLabelDefs()>
25
+ <[ruleDescriptor.tokenLabels,ruleDescriptor.wildcardTreeLabels,ruleDescriptor.wildcardTreeListLabels,ruleDescriptor.tokenListLabels]
26
+ :{tree_for_<it.label.text> = nil}; separator="\n">
27
+ <ruleDescriptor.allTokenRefsInAltsWithRewrites
28
+ :{stream_<it> = ANTLR3::AST::RewriteRule<rewriteElementType>Stream.new(@adaptor, "token <it>")}; separator="\n">
29
+ <ruleDescriptor.allRuleRefsInAltsWithRewrites
30
+ :{stream_<it> = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, "rule <it>")}; separator="\n">
31
+ >>
32
+
33
+ alt(elements,altNum,description,autoAST,outerAlt,treeLevel,rew) ::= <<
34
+ <if(autoAST)><if(outerAlt)><if(!rewriteMode)>
35
+ root_0 = @adaptor.create_flat_list!<\n><\n>
36
+ <endif><endif><endif>
37
+ # at line <description>
38
+ <elements:element()><rew>
39
+ >>
40
+
41
+ tokenRefTrack(token,label,elementIndex,hetero) ::= <<
42
+ <tokenRefBang(...)> <! Track implies no auto AST construction!>
43
+ <gatedAction({stream_<token>.add(<label; format="label">)})>
44
+ >>
45
+
46
+ tokenRefTrackAndListLabel(token,label,elementIndex,hetero) ::= <<
47
+ <tokenRefTrack(...)>
48
+ <addToList(elem={<label; format="label">},...)>
49
+ >>
50
+
51
+ tokenRefRuleRootTrack(token,label,elementIndex,hetero) ::= <<
52
+ <tokenRefBang(...)>
53
+ <gatedAction({stream_<token>.add(<label; format="label">)})>
54
+ >>
55
+
56
+ tokenRefRuleRootTrackAndListLabel(token,label,elementIndex,hetero) ::= <<
57
+ <tokenRefRuleRootTrack(...)>
58
+ <addToList(elem=label,...)>
59
+ >>
60
+
61
+ ruleRefTrack(rule,label,elementIndex,args,scope) ::= <<
62
+ <super.ruleRef(...)>
63
+ <gatedAction({stream_<rule.name>.add(<label; format="label">.tree)})>
64
+ >>
65
+
66
+ ruleRefTrackAndListLabel(rule,label,elementIndex,args,scope) ::= <<
67
+ <ruleRefTrack(...)>
68
+ <addToList(elem={<label; format="label">.tree},...)>
69
+ >>
70
+ ruleRefRuleRootTrack(rule,label,elementIndex,args,scope) ::= <<
71
+ <ruleRefRuleRoot(...)>
72
+ <gatedAction({stream_<rule.name>.add(<label; format="label">.tree)})>
73
+ >>
74
+
75
+ ruleRefRuleRootTrackAndListLabel(rule,label,elementIndex,args,scope) ::= <<
76
+ <ruleRefRuleRootTrack(...)>
77
+ <addToList(elem={<label; format="label">.tree},...)>
78
+ >>
79
+
80
+
81
+ rewriteCode(alts, description,
82
+ referencedElementsDeep, // ALL referenced elements to right of ->
83
+ referencedTokenLabels,
84
+ referencedTokenListLabels,
85
+ referencedRuleLabels,
86
+ referencedRuleListLabels,
87
+ referencedWildcardLabels,
88
+ referencedWildcardListLabels,
89
+ rewriteBlockLevel, enclosingTreeLevel, treeLevel) ::=
90
+ <<
91
+ # AST Rewrite
92
+ # elements: <referencedElementsDeep; separator=", ">
93
+ # token labels: <referencedTokenLabels; separator=", ">
94
+ # rule labels: <referencedRuleLabels; separator=", ">
95
+ # token list labels: <referencedTokenListLabels; separator=", ">
96
+ # rule list labels: <referencedRuleListLabels; separator=", ">
97
+ # wildcard labels: <[referencedWildcardLabels,referencedWildcardListLabels]; separator=", ">
98
+ <gatedAction({
99
+ <prevRuleRootRef(); format="label">.tree = root_0
100
+ <rewriteCodeLabels()>
101
+ root_0 = @adaptor.create_flat_list!
102
+ <first(alts):rewriteAltFirst(); anchor>
103
+
104
+ <rest(alts):{a| els<rewriteAltRest(a)>}; anchor, separator="\n\n">
105
+
106
+ <! if tree parser and rewrite=true !>
107
+ <if(TREE_PARSER)>
108
+ <if(rewriteMode)>
109
+ <prevRuleRootRef(); format="label">.tree = @adaptor.rule_post_processing(root_0)
110
+ @input.replace_children(
111
+ @adaptor.parent(return_value.start),
112
+ @adaptor.child_index(return_value.start),
113
+ @adaptor.child_index(_last),
114
+ return_value.tree
115
+ )<\n>
116
+ <endif>
117
+ <endif>
118
+
119
+ <! if parser or tree-parser and rewrite!=true, we need to set result !>
120
+ <if(!TREE_PARSER)>
121
+ <prevRuleRootRef(); format="label">.tree = root_0<\n>
122
+ <else>
123
+ <if(!rewriteMode)>
124
+ <prevRuleRootRef(); format="label">.tree = root_0<\n>
125
+ <endif>
126
+ <endif>
127
+ })>
128
+ >>
129
+
130
+ rewriteCodeLabels() ::= <<
131
+ <referencedTokenLabels:
132
+ {stream_<it> = <rewriteElementType; format="snakecase">_stream("token <it>", <it; format="label">)};
133
+ separator="\n">
134
+ <referencedTokenListLabels:
135
+ {stream_<it> = <rewriteElementType; format="snakecase">_stream("token <it>", list_of_<it; format="label">)};
136
+ separator="\n">
137
+ <referencedWildcardLabels:
138
+ {stream_<it> = subtree_stream("wildcard <it>", <it; format="label">)};
139
+ separator="\n">
140
+ <referencedWildcardListLabels:
141
+ {stream_<it> = subtree_stream("wildcard <it>", list_of_<it; format="label">)};
142
+ separator="\n">
143
+ <referencedRuleLabels:
144
+ {stream_<it> = <it; format="label"> ? subtree_stream("rule <it>", <it; format="label">.tree) : subtree_stream("token <it>")};
145
+ separator="\n">
146
+ <referencedRuleListLabels:
147
+ {stream_<it> = subtree_stream("token <it>", list_of_<it; format="label">)};
148
+ separator="\n">
149
+ >>
150
+
151
+ rewriteOptionalBlock(
152
+ alt,rewriteBlockLevel,
153
+ referencedElementsDeep, // all nested refs
154
+ referencedElements, // elements in immediately block; no nested blocks
155
+ description) ::=
156
+ <<
157
+ # at line <description>
158
+ if <referencedElementsDeep:{el | stream_<el>.has_next?}; separator=" || ">
159
+ <alt>
160
+ end
161
+
162
+ <referencedElementsDeep:{el | stream_<el>.reset();<\n>}>
163
+ >>
164
+
165
+ rewriteClosureBlock(
166
+ alt,rewriteBlockLevel,
167
+ referencedElementsDeep, // all nested refs
168
+ referencedElements, // elements in immediately block; no nested blocks
169
+ description) ::=
170
+ <<
171
+ # at line <description>
172
+ while <referencedElements:{el | stream_<el>.has_next?}; separator=" || ">
173
+ <alt>
174
+ end
175
+
176
+ <referencedElements:{el | stream_<el>.reset();<\n>}>
177
+ >>
178
+
179
+ rewritePositiveClosureBlock(
180
+ alt,rewriteBlockLevel,
181
+ referencedElementsDeep, // all nested refs
182
+ referencedElements, // elements in immediately block; no nested blocks
183
+ description) ::=
184
+ <<
185
+ # at line <description>
186
+ unless <referencedElements:{el | stream_<el>.has_next?}; separator=" || ">
187
+ raise ANTLR3::RewriteEarlyExit
188
+ end
189
+
190
+ while <referencedElements:{el | stream_<el>.has_next?}; separator=" || ">
191
+ <alt>
192
+ end
193
+
194
+ <referencedElements:{el | stream_<el>.reset<\n>}>
195
+ >>
196
+
197
+ rewriteAltRest(a) ::= <<
198
+ <if(a.pred)>
199
+ if <a.pred>
200
+ # <a.description>
201
+ <a.alt>
202
+ <else>
203
+ e <! little hack to get if .. elsif .. else block right !>
204
+ # <a.description>
205
+ <a.alt>
206
+ end
207
+ <endif>
208
+ >>
209
+
210
+ rewriteAltFirst(a) ::= <<
211
+ <if(a.pred)>
212
+ if <a.pred>
213
+ # <a.description>
214
+ <a.alt>
215
+ <else>
216
+ # <a.description>
217
+ <a.alt>
218
+ <endif>
219
+ >>
220
+
221
+ rewriteEmptyAlt() ::= "root_0 = nil"
222
+
223
+ rewriteTree(root,children,description,enclosingTreeLevel,treeLevel) ::= <<
224
+ # at line <description>
225
+ root_<treeLevel> = @adaptor.create_flat_list!
226
+ <root:rewriteElement()>
227
+ <children:rewriteElement()>
228
+ @adaptor.add_child(root_<enclosingTreeLevel>, root_<treeLevel>)<\n>
229
+ >>
230
+
231
+ rewriteElementList(elements) ::= "<elements:rewriteElement()>"
232
+ rewriteElement(e) ::= <<
233
+ <@pregen()>
234
+ <e.el>
235
+ >>
236
+
237
+ rewriteTokenRef(token,elementIndex,hetero,args) ::= <<
238
+ @adaptor.add_child(root_<treeLevel>, <createRewriteNodeFromElement(...)>)<\n>
239
+ >>
240
+
241
+ rewriteTokenLabelRef(label,elementIndex) ::= <<
242
+ @adaptor.add_child(root_<treeLevel>, stream_<label>.next_node)<\n>
243
+ >>
244
+
245
+ rewriteTokenListLabelRef(label,elementIndex) ::= <<
246
+ @adaptor.add_child(root_<treeLevel>, stream_<label>.next_node)<\n>
247
+ >>
248
+
249
+ rewriteTokenLabelRefRoot(label,elementIndex) ::= <<
250
+ root_<treeLevel> = @adaptor.become_root(stream_<label>.next_node, root_<treeLevel>)<\n>
251
+ >>
252
+
253
+ rewriteTokenListLabelRefRoot ::= rewriteTokenLabelRefRoot
254
+
255
+ rewriteTokenRefRoot(token,elementIndex,hetero,args) ::= <<
256
+ root_<treeLevel> = @adaptor.become_root(<createRewriteNodeFromElement(...)>, root_<treeLevel>)<\n>
257
+ >>
258
+
259
+ rewriteImaginaryTokenRef(args,token,hetero,elementIndex) ::= <<
260
+ @adaptor.add_child(root_<treeLevel>, <createImaginaryNode(tokenType=token, ...)>)<\n>
261
+ >>
262
+
263
+ rewriteImaginaryTokenRefRoot(args,token,hetero,elementIndex) ::= <<
264
+ root_<treeLevel> = @adaptor.become_root(<createImaginaryNode(tokenType=token, ...)>, root_<treeLevel>)<\n>
265
+ >>
266
+
267
+ rewriteAction(action) ::= <<
268
+ root_0 = <action><\n>
269
+ >>
270
+
271
+ prevRuleRootRef() ::= "return_value"
272
+
273
+ rewriteRuleRef(rule) ::= <<
274
+ @adaptor.add_child(root_<treeLevel>, stream_<rule>.next_tree)<\n>
275
+ >>
276
+
277
+ rewriteRuleRefRoot(rule) ::= <<
278
+ root_<treeLevel> = @adaptor.become_root(stream_<rule>.next_node(), root_<treeLevel>)<\n>
279
+ >>
280
+
281
+ rewriteNodeAction(action) ::= <<
282
+ @adaptor.add_child(root_<treeLevel>, <action>)<\n>
283
+ >>
284
+
285
+ rewriteNodeActionRoot(action) ::= <<
286
+ root_<treeLevel> = @adaptor.become_root(<action>, root_<treeLevel>)<\n>
287
+ >>
288
+
289
+ rewriteRuleLabelRef(label) ::= <<
290
+ @adaptor.add_child(root_<treeLevel>, stream_<label>.next_tree)<\n>
291
+ >>
292
+
293
+ rewriteRuleListLabelRef(label) ::= <<
294
+ @adaptor.add_child(root_<treeLevel>, stream_<label>.next_tree)<\n>
295
+ >>
296
+
297
+ rewriteRuleLabelRefRoot(label) ::= <<
298
+ root_<treeLevel> = @adaptor.become_root(stream_<label>.next_node, root_<treeLevel>)<\n>
299
+ >>
300
+
301
+ rewriteRuleListLabelRefRoot(label) ::= <<
302
+ root_<treeLevel> = @adaptor.become_root(stream_<label>.next_node(), root_<treeLevel>)<\n>
303
+ >>
304
+
305
+ rewriteWildcardLabelRef(label) ::= <<
306
+ @adaptor.add_child(root_<treeLevel>, stream_<label>.next_tree)<\n>
307
+ >>
308
+
309
+ createImaginaryNode(tokenType,hetero,args) ::= <<
310
+ <if(hetero)>
311
+ <hetero; format="constantPath">.new(create_token(<tokenType>)<if(args)>, <args; separator=", "><endif>)
312
+ <else>
313
+ <if(!args)>@adaptor.create_from_type!(<tokenType>, "<tokenType>")
314
+ <else>@adaptor.create!(<tokenType>, <args; separator=", ">)
315
+ <endif>
316
+ <endif>
317
+ >>
318
+
319
+ createRewriteNodeFromElement(token,hetero,args) ::= <<
320
+ <if(hetero)>
321
+ <hetero; format="constantPath">.new(stream_<token>.next<if(args)>, <args; separator=", "><endif>)
322
+ <else>
323
+ <if(args)><! must create new node from old !>
324
+ <! need to call different adaptor.create!*() methods depending of argument count !>
325
+ <if(!args)>@adaptor.create_from_type!(<token>, "<token>")
326
+ <else><if(!rest(args))>@adaptor.create_from_token!(<token>, <first(args)>)
327
+ <else><if(!rest(rest(args)))>@adaptor.create_from_token!(<token>, <first(args)>, <first(rest(args))>)
328
+ <endif>
329
+ <endif>
330
+ <endif>
331
+ <else>
332
+ stream_<token>.next_node
333
+ <endif>
334
+ <endif>
335
+ >>
@@ -0,0 +1,40 @@
1
+ group ASTDbg;
2
+
3
+ @parserBody.additionalMembers() ::= <<
4
+ def self.return_scope_members
5
+ super.push(:tree)
6
+ end
7
+
8
+ attr_reader :adaptor
9
+ def adaptor=(adaptor)
10
+ @adaptor =
11
+ adaptor.is_a?(ANTLR3::Debug::TreeAdaptor) ? adaptor :
12
+ ANTLR3::Debug::TreeAdaptor.wrap(adaptor, @debug_listener)
13
+ <grammar.directDelegates:{g|<g:delegateName()>.adaptor = @adaptor}; separator="\n">
14
+ end
15
+
16
+ alias tree_adaptor adaptor
17
+ alias tree_adaptor= adaptor=
18
+
19
+ >>
20
+
21
+
22
+ createListenerAndHandshake() ::= <<
23
+ options[:debug_listener] ||= begin
24
+ port = options[:port]
25
+ log = options[:log]
26
+ proxy = ANTLR3::Debug::EventSocketProxy.new(
27
+ self, :adaptor => adaptor,
28
+ :log => log, :port => port
29
+ )
30
+ proxy.handshake
31
+ proxy
32
+ end
33
+ >>
34
+ @parserConstructor.init() ::= "self.adaptor = adaptor"
35
+
36
+
37
+ @newDelegate.delegateOptions() ::= ", :adaptor => adaptor"
38
+
39
+
40
+ @rewriteElement.pregen() ::= "@debug_listener.location(<e.line>, <e.pos>)"
@@ -0,0 +1,153 @@
1
+ group ASTParser;
2
+ gatedAction(block) ::= <<
3
+ <if(backtracking)>
4
+ if <actions.(actionScope).synpredgate>
5
+ <block>
6
+ end
7
+ <else>
8
+ <block>
9
+ <endif>
10
+ >>
11
+
12
+ @ruleBody.setErrorReturnValue() ::= <<
13
+ return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)<\n>
14
+ >>
15
+
16
+ tokenRef(token,label,elementIndex,hetero) ::= <<
17
+ <super.tokenRef(...)>
18
+ <gatedAction({
19
+ tree_for_<label> = <createNodeFromToken(...)>
20
+ @adaptor.add_child(root_0, tree_for_<label>)
21
+ })>
22
+ >>
23
+
24
+ tokenRefBang(token,label,elementIndex) ::= "<super.tokenRef(...)>"
25
+
26
+ tokenRefRuleRoot(token,label,elementIndex,hetero) ::= <<
27
+ <super.tokenRef(...)>
28
+ <gatedAction({
29
+ tree_for_<label> = <createNodeFromToken(...)>
30
+ root_0 = @adaptor.become_root(tree_for_<label>, root_0)
31
+ })>
32
+ >>
33
+
34
+
35
+
36
+ tokenRefBangAndListLabel(token,label,elementIndex,hetero) ::= <<
37
+ <tokenRefBang(...)>
38
+ <addToList(elem={<label; format="label">},...)>
39
+ >>
40
+
41
+
42
+
43
+ tokenRefAndListLabel(token,label,elementIndex,hetero) ::= <<
44
+ <tokenRef(...)>
45
+ <addToList(elem={<label; format="label">},...)>
46
+ >>
47
+ tokenRefRuleRootAndListLabel(token,label,hetero,elementIndex) ::= <<
48
+ <tokenRefRuleRoot(...)>
49
+ <addToList(elem={<label; format="label">},...)>
50
+ >>
51
+
52
+
53
+
54
+ matchSet(s,label,hetero,elementIndex,postmatchCode) ::= <<
55
+ <super.matchSet(..., postmatchCode={<gatedAction({@adaptor.add_child(root_0, <createNodeFromToken(...)>)})>})>
56
+ >>
57
+
58
+
59
+
60
+ matchRuleBlockSet(s,label,hetero,elementIndex,postmatchCode,treeLevel="0") ::= <<
61
+ <matchSet(...)>
62
+ >>
63
+
64
+
65
+
66
+ matchSetBang(s,label,elementIndex,postmatchCode) ::= "<super.matchSet(...)>"
67
+ matchSetRuleRoot(s,label,hetero,elementIndex,debug) ::= <<
68
+ <if(label)>
69
+ <label; format="label"> = @input.look<\n>
70
+ <endif>
71
+ <super.matchSet(..., postmatchCode={<gatedAction({root_0 = @adaptor.become_root(<createNodeFromToken(...)>, root_0)})>})>
72
+ >>
73
+ matchSetRuleRootAndListLabel(s,label,hetero,elementIndex,debug) ::= <<
74
+ <matchSetRuleRoot(...)>
75
+ <addToList(elem={<label; format="label">},...)>
76
+ >>
77
+
78
+
79
+
80
+ ruleRef(rule,label,elementIndex,args,scope) ::= <<
81
+ <super.ruleRef(...)>
82
+ <gatedAction({@adaptor.add_child(root_0, <label; format="label">.tree)})>
83
+ >>
84
+
85
+
86
+
87
+ ruleRefBang(rule,label,elementIndex,args,scope) ::= "<super.ruleRef(...)>"
88
+
89
+
90
+
91
+ ruleRefRuleRoot(rule,label,elementIndex,args,scope) ::= <<
92
+ <super.ruleRef(...)>
93
+ <gatedAction({root_0 = @adaptor.become_root(<label; format="label">.tree, root_0)})>
94
+ >>
95
+
96
+
97
+
98
+ ruleRefAndListLabel(rule,label,elementIndex,args,scope) ::= <<
99
+ <ruleRef(...)>
100
+ <addToList(elem={<label; format="label">.tree},...)>
101
+ >>
102
+
103
+
104
+
105
+ ruleRefBangAndListLabel(rule,label,elementIndex,args,scope) ::= <<
106
+ <ruleRefBang(...)>
107
+ <addToList(elem={<label; format="label">.tree},...)>
108
+ >>
109
+
110
+
111
+
112
+ ruleRefRuleRootAndListLabel(rule,label,elementIndex,args,scope) ::= <<
113
+ <ruleRefRuleRoot(...)>
114
+ <addToList(elem={<label; format="label">.tree},...)>
115
+ >>
116
+
117
+ wildcard(label,elementIndex) ::= <<
118
+ <super.wildcard(...)>
119
+ <gatedAction({
120
+ tree_for_<label> = @adaptor.create_with_payload!(<label; format="label">)
121
+ @adaptor.add_child(root_0, tree_for_<label>)
122
+ })>
123
+ >>
124
+
125
+
126
+
127
+ wildcardBang(label,elementIndex) ::= "<super.wildcard(...)>"
128
+
129
+ wildcardRuleRoot(label,elementIndex) ::= <<
130
+ <super.wildcard(...)>
131
+ <gatedAction({
132
+ tree_for_<label> = @adaptor.create_with_payload!(<label; format="label">)
133
+ root_0 = @adaptor.become_root(tree_for_<label>, root_0)
134
+ })>
135
+ >>
136
+
137
+ createNodeFromToken(label,hetero) ::= <<
138
+ <if(hetero)>
139
+ <hetero; format="constantPath">.new(<label; format="label">)
140
+ <else>
141
+ @adaptor.create_with_payload!(<label; format="label">)
142
+ <endif>
143
+ >>
144
+
145
+ ruleCleanUp() ::= <<
146
+ <super.ruleCleanUp()>
147
+ <gatedAction({
148
+ return_value.tree = @adaptor.rule_post_processing(root_0)
149
+ @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)
150
+ })>
151
+ >>
152
+
153
+