antlr3 1.6.3 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/ruby
2
+ # encoding: utf-8
3
+
4
+ =begin ::about::
5
+ author: Kyle Yetter <kcy5b@yahoo.com>
6
+ created on: March 19, 2010
7
+ purpose: Loads the ANTLR recognition code for ANTLR Template Group files
8
+ =end
9
+
10
+ require 'antlr3/template/group-file-lexer'
11
+ require 'antlr3/template/group-file-parser'
12
+
13
+ module ANTLR3
14
+ module Template
15
+ class Group
16
+ Lexer = GroupFile::Lexer
17
+ Parser = GroupFile::Parser
18
+ end
19
+ end
20
+ end
@@ -836,15 +836,15 @@ class CommonTreeAdaptor
836
836
  end
837
837
 
838
838
  def create_flat_list
839
- return create_with_payload!( nil )
839
+ return create_with_payload( nil )
840
840
  end
841
841
  alias create_flat_list! create_flat_list
842
842
 
843
843
  def become_root( new_root, old_root )
844
- new_root = create!( new_root ) if new_root.is_a?( Token )
844
+ new_root = create( new_root ) if new_root.is_a?( Token )
845
845
  old_root or return( new_root )
846
846
 
847
- new_root = create_with_payload!( new_root ) unless CommonTree === new_root
847
+ new_root = create_with_payload( new_root ) unless CommonTree === new_root
848
848
  if new_root.flat_list?
849
849
  count = new_root.child_count
850
850
  if count == 1
@@ -862,13 +862,13 @@ class CommonTreeAdaptor
862
862
  from_token = from_token.dup
863
863
  from_token.type = token_type
864
864
  from_token.text = text.to_s if text
865
- tree = create_with_payload!( from_token )
865
+ tree = create_with_payload( from_token )
866
866
  return tree
867
867
  end
868
868
 
869
869
  def create_from_type( token_type, text )
870
870
  from_token = create_token( token_type, DEFAULT_CHANNEL, text )
871
- create_with_payload!( from_token )
871
+ create_with_payload( from_token )
872
872
  end
873
873
 
874
874
  def create_error_node( input, start, stop, exc )
@@ -881,11 +881,11 @@ class CommonTreeAdaptor
881
881
 
882
882
  def create( *args )
883
883
  n = args.length
884
- if n == 1 and args.first.is_a?( Token ) then create_with_payload!( args[ 0 ] )
884
+ if n == 1 and args.first.is_a?( Token ) then create_with_payload( args[ 0 ] )
885
885
  elsif n == 2 and Integer === args.first and String === args[ 1 ]
886
- create_from_type!( *args )
886
+ create_from_type( *args )
887
887
  elsif n >= 2 and Integer === args.first
888
- create_from_token!( *args )
888
+ create_from_token( *args )
889
889
  else
890
890
  sig = args.map { |f| f.class }.join( ', ' )
891
891
  raise TypeError, "No create method with this signature found: (#{ sig })"
@@ -1008,9 +1008,9 @@ class CommonTreeNodeStream
1008
1008
  end
1009
1009
  @adaptor ||= options.fetch( :adaptor ) { CommonTreeAdaptor.new }
1010
1010
  @token_stream ||= options[ :token_stream ]
1011
- @down ||= options.fetch( :down ) { @adaptor.create_from_type!( DOWN, 'DOWN' ) }
1012
- @up ||= options.fetch( :up ) { @adaptor.create_from_type!( UP, 'UP' ) }
1013
- @eof ||= options.fetch( :eof ) { @adaptor.create_from_type!( EOF, 'EOF' ) }
1011
+ @down ||= options.fetch( :down ) { @adaptor.create_from_type( DOWN, 'DOWN' ) }
1012
+ @up ||= options.fetch( :up ) { @adaptor.create_from_type( UP, 'UP' ) }
1013
+ @eof ||= options.fetch( :eof ) { @adaptor.create_from_type( EOF, 'EOF' ) }
1014
1014
  @nodes ||= []
1015
1015
 
1016
1016
  @unique_navigation_nodes = options.fetch( :unique_navigation_nodes, false )
@@ -1039,9 +1039,9 @@ class CommonTreeNodeStream
1039
1039
  navigation_node =
1040
1040
  case type
1041
1041
  when DOWN
1042
- has_unique_navigation_nodes? ? @adaptor.create_from_type!( DOWN, 'DOWN' ) : @down
1042
+ has_unique_navigation_nodes? ? @adaptor.create_from_type( DOWN, 'DOWN' ) : @down
1043
1043
  else
1044
- has_unique_navigation_nodes? ? @adaptor.create_from_type!( UP, 'UP' ) : @up
1044
+ has_unique_navigation_nodes? ? @adaptor.create_from_type( UP, 'UP' ) : @up
1045
1045
  end
1046
1046
  @nodes << navigation_node
1047
1047
  end
@@ -1089,7 +1089,9 @@ class CommonTreeNodeStream
1089
1089
 
1090
1090
  def consume
1091
1091
  @position == -1 and fill_buffer
1092
+ node = @nodes.fetch( @position, @eof )
1092
1093
  @position += 1
1094
+ return( node )
1093
1095
  end
1094
1096
 
1095
1097
  def peek( i = 1 )
@@ -1329,7 +1331,7 @@ rewriting parsers.
1329
1331
  =end
1330
1332
  class RewriteRuleTokenStream < RewriteRuleElementStream
1331
1333
  def next_node
1332
- return @adaptor.create_with_payload!( __next__ )
1334
+ return @adaptor.create_with_payload( __next__ )
1333
1335
  end
1334
1336
 
1335
1337
  alias :next :__next__
@@ -18,25 +18,25 @@ module TreeAdaptor
18
18
 
19
19
  attr_accessor :debug_listener
20
20
 
21
- def create_with_payload!(payload)
21
+ def create_with_payload(payload)
22
22
  node = super
23
23
  @debug_listener.create_node(node, payload)
24
24
  return node
25
25
  end
26
26
 
27
- def create_from_token!(token_type, from_token, text = nil)
27
+ def create_from_token(token_type, from_token, text = nil)
28
28
  node = super
29
29
  @debug_listener.create_node(node)
30
30
  return node
31
31
  end
32
32
 
33
- def create_from_type!(token_type, text)
33
+ def create_from_type(token_type, text)
34
34
  node = super
35
35
  @debug_listener.create_node(node)
36
36
  return node
37
37
  end
38
38
 
39
- def create_error_node!(input, start, stop, exc)
39
+ def create_error_node(input, start, stop, exc)
40
40
  node = super
41
41
  node.nil? or @debug_listener.error_node(node)
42
42
  return node
@@ -63,7 +63,7 @@ module TreeAdaptor
63
63
  return duplicate
64
64
  end
65
65
 
66
- def create_flat_list!
66
+ def create_flat_list
67
67
  node = super
68
68
  @debug_listener.flat_node(node)
69
69
  return node
@@ -72,7 +72,7 @@ module TreeAdaptor
72
72
  def add_child(tree, child)
73
73
  case child
74
74
  when Token
75
- node = create_with_payload!(child)
75
+ node = create_with_payload(child)
76
76
  add_child(tree, node)
77
77
  else
78
78
  tree.nil? || child.nil? and return
@@ -84,7 +84,7 @@ module TreeAdaptor
84
84
  def become_root(new_root, old_root)
85
85
  case new_root
86
86
  when Token
87
- n = create_with_payload!(new_root)
87
+ n = create_with_payload(new_root)
88
88
  super(n, old_root)
89
89
  else
90
90
  n = super(new_root, old_root)
@@ -251,7 +251,7 @@ from a tokenized tree pattern
251
251
  @token_type == :identifier or return nil
252
252
  token_name = @tokenizer.text
253
253
  @token_type = @tokenizer.next_token
254
- token_name == 'nil' and return @adaptor.create_flat_list!
254
+ token_name == 'nil' and return @adaptor.create_flat_list
255
255
 
256
256
  text = token_name
257
257
  arg = nil
@@ -262,7 +262,7 @@ from a tokenized tree pattern
262
262
  end
263
263
 
264
264
  node_type = @token_scheme[ token_name ] || INVALID_TOKEN_TYPE
265
- node = @adaptor.create_from_type!( node_type, text )
265
+ node = @adaptor.create_from_type( node_type, text )
266
266
 
267
267
  if Pattern === node
268
268
  node.label, node.has_text_arg = label, arg
@@ -318,7 +318,7 @@ A customized TreeAdaptor used by AST::Wizards to build tree patterns.
318
318
  =end
319
319
 
320
320
  class PatternAdaptor < CommonTreeAdaptor
321
- def create_with_payload!( payload )
321
+ def create_with_payload( payload )
322
322
  return Pattern.new( payload )
323
323
  end
324
324
  end
@@ -19,8 +19,8 @@ module ANTLR3
19
19
  # The version data for the current state the library itself
20
20
  #
21
21
  MAJOR_VERSION = 1
22
- MINOR_VERSION = 6
23
- PATCH_VERSION = 3
22
+ MINOR_VERSION = 7
23
+ PATCH_VERSION = 2
24
24
  VERSION = [ MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION ]
25
25
  VERSION_STRING = VERSION.join( '.' ).freeze
26
26
 
@@ -78,15 +78,6 @@ tokens {
78
78
  LIST_LABEL_ASSIGN='+=';
79
79
  }
80
80
 
81
- /* action -> @parser::header
82
- {
83
- package org.antlr.grammar.v3;
84
- } */
85
- /* action -> @lexer::header
86
- {
87
- package org.antlr.grammar.v3;
88
- } */
89
-
90
81
  @members {
91
82
  attr_reader :grammar_type
92
83
  }
@@ -25,22 +25,22 @@ ruleLabelDefs() ::= <<
25
25
  <[ruleDescriptor.tokenLabels,ruleDescriptor.wildcardTreeLabels,ruleDescriptor.wildcardTreeListLabels,ruleDescriptor.tokenListLabels]
26
26
  :{tree_for_<it.label.text> = nil}; separator="\n">
27
27
  <ruleDescriptor.allTokenRefsInAltsWithRewrites
28
- :{stream_<it> = ANTLR3::AST::RewriteRule<rewriteElementType>Stream.new(@adaptor, "token <it>")}; separator="\n">
28
+ :{stream_<it> = ANTLR3::AST::RewriteRule<rewriteElementType>Stream.new( @adaptor, "token <it>" )}; separator="\n">
29
29
  <ruleDescriptor.allRuleRefsInAltsWithRewrites
30
- :{stream_<it> = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, "rule <it>")}; separator="\n">
30
+ :{stream_<it> = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule <it>" )}; separator="\n">
31
31
  >>
32
32
 
33
33
  alt(elements,altNum,description,autoAST,outerAlt,treeLevel,rew) ::= <<
34
34
  <if(autoAST)><if(outerAlt)><if(!rewriteMode)>
35
- root_0 = @adaptor.create_flat_list!<\n><\n>
35
+ root_0 = @adaptor.create_flat_list<\n><\n>
36
36
  <endif><endif><endif>
37
37
  # at line <description>
38
38
  <elements:element()><rew>
39
39
  >>
40
40
 
41
41
  tokenRefTrack(token,label,elementIndex,hetero) ::= <<
42
- <tokenRefBang(...)> <! Track implies no auto AST construction!>
43
- <gatedAction({stream_<token>.add(<label; format="label">)})>
42
+ <tokenRefBang(...)>
43
+ <gatedAction({stream_<token>.add( <label; format="label"> )})>
44
44
  >>
45
45
 
46
46
  tokenRefTrackAndListLabel(token,label,elementIndex,hetero) ::= <<
@@ -50,7 +50,7 @@ tokenRefTrackAndListLabel(token,label,elementIndex,hetero) ::= <<
50
50
 
51
51
  tokenRefRuleRootTrack(token,label,elementIndex,hetero) ::= <<
52
52
  <tokenRefBang(...)>
53
- <gatedAction({stream_<token>.add(<label; format="label">)})>
53
+ <gatedAction({stream_<token>.add( <label; format="label"> )})>
54
54
  >>
55
55
 
56
56
  tokenRefRuleRootTrackAndListLabel(token,label,elementIndex,hetero) ::= <<
@@ -60,7 +60,7 @@ tokenRefRuleRootTrackAndListLabel(token,label,elementIndex,hetero) ::= <<
60
60
 
61
61
  ruleRefTrack(rule,label,elementIndex,args,scope) ::= <<
62
62
  <super.ruleRef(...)>
63
- <gatedAction({stream_<rule.name>.add(<label; format="label">.tree)})>
63
+ <gatedAction({stream_<rule.name>.add( <label; format="label">.tree )})>
64
64
  >>
65
65
 
66
66
  ruleRefTrackAndListLabel(rule,label,elementIndex,args,scope) ::= <<
@@ -69,7 +69,7 @@ ruleRefTrackAndListLabel(rule,label,elementIndex,args,scope) ::= <<
69
69
  >>
70
70
  ruleRefRuleRootTrack(rule,label,elementIndex,args,scope) ::= <<
71
71
  <ruleRefRuleRoot(...)>
72
- <gatedAction({stream_<rule.name>.add(<label; format="label">.tree)})>
72
+ <gatedAction({stream_<rule.name>.add( <label; format="label">.tree )})>
73
73
  >>
74
74
 
75
75
  ruleRefRuleRootTrackAndListLabel(rule,label,elementIndex,args,scope) ::= <<
@@ -98,7 +98,7 @@ rewriteCode(alts, description,
98
98
  <gatedAction({
99
99
  <prevRuleRootRef(); format="label">.tree = root_0
100
100
  <rewriteCodeLabels()>
101
- root_0 = @adaptor.create_flat_list!
101
+ root_0 = @adaptor.create_flat_list
102
102
  <first(alts):rewriteAltFirst(); anchor>
103
103
 
104
104
  <rest(alts):{a| els<rewriteAltRest(a)>}; anchor, separator="\n\n">
@@ -106,11 +106,11 @@ root_0 = @adaptor.create_flat_list!
106
106
  <! if tree parser and rewrite=true !>
107
107
  <if(TREE_PARSER)>
108
108
  <if(rewriteMode)>
109
- <prevRuleRootRef(); format="label">.tree = @adaptor.rule_post_processing(root_0)
109
+ <prevRuleRootRef(); format="label">.tree = @adaptor.rule_post_processing( root_0 )
110
110
  @input.replace_children(
111
- @adaptor.parent(return_value.start),
112
- @adaptor.child_index(return_value.start),
113
- @adaptor.child_index(_last),
111
+ @adaptor.parent( return_value.start ),
112
+ @adaptor.child_index( return_value.start ),
113
+ @adaptor.child_index( _last ),
114
114
  return_value.tree
115
115
  )<\n>
116
116
  <endif>
@@ -129,22 +129,22 @@ root_0 = @adaptor.create_flat_list!
129
129
 
130
130
  rewriteCodeLabels() ::= <<
131
131
  <referencedTokenLabels:
132
- {stream_<it> = <rewriteElementType; format="snakecase">_stream("token <it>", <it; format="label">)};
132
+ {stream_<it> = <rewriteElementType; format="snakecase">_stream( "token <it>", <it; format="label"> )};
133
133
  separator="\n">
134
134
  <referencedTokenListLabels:
135
- {stream_<it> = <rewriteElementType; format="snakecase">_stream("token <it>", list_of_<it; format="label">)};
135
+ {stream_<it> = <rewriteElementType; format="snakecase">_stream( "token <it>", list_of_<it; format="label"> )};
136
136
  separator="\n">
137
137
  <referencedWildcardLabels:
138
- {stream_<it> = subtree_stream("wildcard <it>", <it; format="label">)};
138
+ {stream_<it> = subtree_stream( "wildcard <it>", <it; format="label"> )};
139
139
  separator="\n">
140
140
  <referencedWildcardListLabels:
141
- {stream_<it> = subtree_stream("wildcard <it>", list_of_<it; format="label">)};
141
+ {stream_<it> = subtree_stream( "wildcard <it>", list_of_<it; format="label"> )};
142
142
  separator="\n">
143
143
  <referencedRuleLabels:
144
- {stream_<it> = <it; format="label"> ? subtree_stream("rule <it>", <it; format="label">.tree) : subtree_stream("token <it>")};
144
+ {stream_<it> = <it; format="label"> ? subtree_stream( "rule <it>", <it; format="label">.tree ) : subtree_stream( "token <it>" )};
145
145
  separator="\n">
146
146
  <referencedRuleListLabels:
147
- {stream_<it> = subtree_stream("token <it>", list_of_<it; format="label">)};
147
+ {stream_<it> = subtree_stream( "token <it>", list_of_<it; format="label"> )};
148
148
  separator="\n">
149
149
  >>
150
150
 
@@ -155,11 +155,11 @@ rewriteOptionalBlock(
155
155
  description) ::=
156
156
  <<
157
157
  # at line <description>
158
- if <referencedElementsDeep:{el | stream_<el>.has_next?}; separator=" || ">
158
+ if <referencedElementsDeep:{el|stream_<el>.has_next?}; separator=" || ">
159
159
  <alt>
160
160
  end
161
161
 
162
- <referencedElementsDeep:{el | stream_<el>.reset();<\n>}>
162
+ <referencedElementsDeep:{el|stream_<el>.reset();<\n>}>
163
163
  >>
164
164
 
165
165
  rewriteClosureBlock(
@@ -169,11 +169,11 @@ rewriteClosureBlock(
169
169
  description) ::=
170
170
  <<
171
171
  # at line <description>
172
- while <referencedElements:{el | stream_<el>.has_next?}; separator=" || ">
172
+ while <referencedElements:{el|stream_<el>.has_next?}; separator=" || ">
173
173
  <alt>
174
174
  end
175
175
 
176
- <referencedElements:{el | stream_<el>.reset();<\n>}>
176
+ <referencedElements:{el|stream_<el>.reset();<\n>}>
177
177
  >>
178
178
 
179
179
  rewritePositiveClosureBlock(
@@ -183,15 +183,12 @@ rewritePositiveClosureBlock(
183
183
  description) ::=
184
184
  <<
185
185
  # at line <description>
186
- unless <referencedElements:{el | stream_<el>.has_next?}; separator=" || ">
187
- raise ANTLR3::RewriteEarlyExit
188
- end
186
+ <referencedElements:{el|stream_<el>.has_next?}; separator=" || "> or raise ANTLR3::RewriteEarlyExit
189
187
 
190
- while <referencedElements:{el | stream_<el>.has_next?}; separator=" || ">
188
+ while <referencedElements:{el|stream_<el>.has_next?}; separator=" || ">
191
189
  <alt>
192
190
  end
193
-
194
- <referencedElements:{el | stream_<el>.reset<\n>}>
191
+ <referencedElements:{el|stream_<el>.reset<\n>}>
195
192
  >>
196
193
 
197
194
  rewriteAltRest(a) ::= <<
@@ -200,7 +197,7 @@ if <a.pred>
200
197
  # <a.description>
201
198
  <a.alt>
202
199
  <else>
203
- e <! little hack to get if .. elsif .. else block right !>
200
+ e
204
201
  # <a.description>
205
202
  <a.alt>
206
203
  end
@@ -222,10 +219,10 @@ rewriteEmptyAlt() ::= "root_0 = nil"
222
219
 
223
220
  rewriteTree(root,children,description,enclosingTreeLevel,treeLevel) ::= <<
224
221
  # at line <description>
225
- root_<treeLevel> = @adaptor.create_flat_list!
222
+ root_<treeLevel> = @adaptor.create_flat_list
226
223
  <root:rewriteElement()>
227
224
  <children:rewriteElement()>
228
- @adaptor.add_child(root_<enclosingTreeLevel>, root_<treeLevel>)<\n>
225
+ @adaptor.add_child( root_<enclosingTreeLevel>, root_<treeLevel> )<\n>
229
226
  >>
230
227
 
231
228
  rewriteElementList(elements) ::= "<elements:rewriteElement()>"
@@ -235,33 +232,33 @@ rewriteElement(e) ::= <<
235
232
  >>
236
233
 
237
234
  rewriteTokenRef(token,elementIndex,hetero,args) ::= <<
238
- @adaptor.add_child(root_<treeLevel>, <createRewriteNodeFromElement(...)>)<\n>
235
+ @adaptor.add_child( root_<treeLevel>, <createRewriteNodeFromElement(...)> )<\n>
239
236
  >>
240
237
 
241
238
  rewriteTokenLabelRef(label,elementIndex) ::= <<
242
- @adaptor.add_child(root_<treeLevel>, stream_<label>.next_node)<\n>
239
+ @adaptor.add_child( root_<treeLevel>, stream_<label>.next_node )<\n>
243
240
  >>
244
241
 
245
242
  rewriteTokenListLabelRef(label,elementIndex) ::= <<
246
- @adaptor.add_child(root_<treeLevel>, stream_<label>.next_node)<\n>
243
+ @adaptor.add_child( root_<treeLevel>, stream_<label>.next_node )<\n>
247
244
  >>
248
245
 
249
246
  rewriteTokenLabelRefRoot(label,elementIndex) ::= <<
250
- root_<treeLevel> = @adaptor.become_root(stream_<label>.next_node, root_<treeLevel>)<\n>
247
+ root_<treeLevel> = @adaptor.become_root( stream_<label>.next_node, root_<treeLevel> )<\n>
251
248
  >>
252
249
 
253
250
  rewriteTokenListLabelRefRoot ::= rewriteTokenLabelRefRoot
254
251
 
255
252
  rewriteTokenRefRoot(token,elementIndex,hetero,args) ::= <<
256
- root_<treeLevel> = @adaptor.become_root(<createRewriteNodeFromElement(...)>, root_<treeLevel>)<\n>
253
+ root_<treeLevel> = @adaptor.become_root( <createRewriteNodeFromElement(...)>, root_<treeLevel> )<\n>
257
254
  >>
258
255
 
259
256
  rewriteImaginaryTokenRef(args,token,hetero,elementIndex) ::= <<
260
- @adaptor.add_child(root_<treeLevel>, <createImaginaryNode(tokenType=token, ...)>)<\n>
257
+ @adaptor.add_child( root_<treeLevel>, <createImaginaryNode(tokenType=token, ...)> )<\n>
261
258
  >>
262
259
 
263
260
  rewriteImaginaryTokenRefRoot(args,token,hetero,elementIndex) ::= <<
264
- root_<treeLevel> = @adaptor.become_root(<createImaginaryNode(tokenType=token, ...)>, root_<treeLevel>)<\n>
261
+ root_<treeLevel> = @adaptor.become_root( <createImaginaryNode(tokenType=token, ...)>, root_<treeLevel> )<\n>
265
262
  >>
266
263
 
267
264
  rewriteAction(action) ::= <<
@@ -271,61 +268,58 @@ root_0 = ( <action> )<\n>
271
268
  prevRuleRootRef() ::= "return_value"
272
269
 
273
270
  rewriteRuleRef(rule) ::= <<
274
- @adaptor.add_child(root_<treeLevel>, stream_<rule>.next_tree)<\n>
271
+ @adaptor.add_child( root_<treeLevel>, stream_<rule>.next_tree )<\n>
275
272
  >>
276
273
 
277
274
  rewriteRuleRefRoot(rule) ::= <<
278
- root_<treeLevel> = @adaptor.become_root(stream_<rule>.next_node(), root_<treeLevel>)<\n>
275
+ root_<treeLevel> = @adaptor.become_root( stream_<rule>.next_node, root_<treeLevel> )<\n>
279
276
  >>
280
277
 
281
278
  rewriteNodeAction(action) ::= <<
282
- @adaptor.add_child(root_<treeLevel>, <action>)<\n>
279
+ @adaptor.add_child( root_<treeLevel>, ( <action> ) )<\n>
283
280
  >>
284
281
 
285
282
  rewriteNodeActionRoot(action) ::= <<
286
- root_<treeLevel> = @adaptor.become_root(<action>, root_<treeLevel>)<\n>
283
+ root_<treeLevel> = @adaptor.become_root( ( <action> ), root_<treeLevel> )<\n>
287
284
  >>
288
285
 
289
286
  rewriteRuleLabelRef(label) ::= <<
290
- @adaptor.add_child(root_<treeLevel>, stream_<label>.next_tree)<\n>
287
+ @adaptor.add_child( root_<treeLevel>, stream_<label>.next_tree )<\n>
291
288
  >>
292
289
 
293
290
  rewriteRuleListLabelRef(label) ::= <<
294
- @adaptor.add_child(root_<treeLevel>, stream_<label>.next_tree)<\n>
291
+ @adaptor.add_child( root_<treeLevel>, stream_<label>.next_tree )<\n>
295
292
  >>
296
293
 
297
294
  rewriteRuleLabelRefRoot(label) ::= <<
298
- root_<treeLevel> = @adaptor.become_root(stream_<label>.next_node, root_<treeLevel>)<\n>
295
+ root_<treeLevel> = @adaptor.become_root( stream_<label>.next_node, root_<treeLevel> )<\n>
299
296
  >>
300
297
 
301
298
  rewriteRuleListLabelRefRoot(label) ::= <<
302
- root_<treeLevel> = @adaptor.become_root(stream_<label>.next_node(), root_<treeLevel>)<\n>
299
+ root_<treeLevel> = @adaptor.become_root( stream_<label>.next_node, root_<treeLevel> )<\n>
303
300
  >>
304
301
 
305
302
  rewriteWildcardLabelRef(label) ::= <<
306
- @adaptor.add_child(root_<treeLevel>, stream_<label>.next_tree)<\n>
303
+ @adaptor.add_child( root_<treeLevel>, stream_<label>.next_tree )<\n>
307
304
  >>
308
305
 
309
306
  createImaginaryNode(tokenType,hetero,args) ::= <<
310
307
  <if(hetero)>
311
- <hetero; format="constantPath">.new(create_token(<tokenType>)<if(args)>, <args; separator=", "><endif>)
308
+ <hetero; format="constantPath">.new( create_token( <tokenType> )<if(args)>, <args; separator=", "><endif> )
312
309
  <else>
313
- <if(!args)>@adaptor.create_from_type!(<tokenType>, "<tokenType>")
314
- <else>@adaptor.create!(<tokenType>, <args; separator=", ">)
310
+ <if(!args)>@adaptor.create_from_type( <tokenType>, "<tokenType>" )
311
+ <else>@adaptor.create( <tokenType>, <args; separator=", "> )
315
312
  <endif>
316
313
  <endif>
317
314
  >>
318
315
 
319
316
  createRewriteNodeFromElement(token,hetero,args) ::= <<
320
317
  <if(hetero)>
321
- <hetero; format="constantPath">.new(stream_<token>.next<if(args)>, <args; separator=", "><endif>)
318
+ <hetero; format="constantPath">.new( stream_<token>.next<if(args)>, <args; separator=", "><endif> )
322
319
  <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>
320
+ <if(args)>
321
+ <if(!rest(args))>@adaptor.create_from_token( <token>, <first(args)> )
322
+ <else><if(!rest(rest(args)))>@adaptor.create_from_token( <token>, <first(args)>, <first(rest(args))> )
329
323
  <endif>
330
324
  <endif>
331
325
  <else>