1324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverheader {
2324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver/*
3324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver [The "BSD license"]
4324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver Copyright (c) 2005-2008 Terence Parr
5324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver All rights reserved.
6324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
7324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver Redistribution and use in source and binary forms, with or without
8324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver modification, are permitted provided that the following conditions
9324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver are met:
10324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver 1. Redistributions of source code must retain the above copyright
11324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    notice, this list of conditions and the following disclaimer.
12324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver 2. Redistributions in binary form must reproduce the above copyright
13324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    notice, this list of conditions and the following disclaimer in the
14324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    documentation and/or other materials provided with the distribution.
15324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver 3. The name of the author may not be used to endorse or promote products
16324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    derived from this software without specific prior written permission.
17324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
18324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver*/
29324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	package org.antlr.tool;
30324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	import java.util.*;
31324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	import org.antlr.analysis.*;
32324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	import org.antlr.misc.*;
33324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	import java.io.*;
34324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver}
35324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
36324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverclass SerializerWalker extends TreeParser;
37324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
38324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruveroptions {
39324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	importVocab = ANTLR;
40324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	ASTLabelType = "GrammarAST";
41324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    codeGenBitsetTestThreshold=999;
42324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver}
43324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
44324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver{
45324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    public void reportError(RecognitionException ex) {
46324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver		Token token = null;
47324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver		if ( ex instanceof MismatchedTokenException ) {
48324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver			token = ((MismatchedTokenException)ex).token;
49324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver		}
50324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver		else if ( ex instanceof NoViableAltException ) {
51324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver			token = ((NoViableAltException)ex).token;
52324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver		}
53324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver        ErrorManager.syntaxError(
54324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver            ErrorManager.MSG_SYNTAX_ERROR,
55324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver            grammar,
56324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver            token,
57324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver            "serialize: "+ex.toString(),
58324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver            ex);
59324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    }
60324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
61324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverprotected Grammar grammar;
62324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverprotected String currentRuleName;
63324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverprotected GrammarSerializer out;
64324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver}
65324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
66324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruvergrammar[GrammarSerializer out]
67324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver{
68324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	this.out = out;
69324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver}
70324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    :   #( LEXER_GRAMMAR 	grammarSpec[#grammar.getType()] )
71324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	|   #( PARSER_GRAMMAR   grammarSpec[#grammar.getType()] )
72324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	|   #( TREE_GRAMMAR     grammarSpec[#grammar.getType()] )
73324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	|   #( COMBINED_GRAMMAR grammarSpec[#grammar.getType()] )
74324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ;
75324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
76324c4644fee44b9898524c09511bd33c3f12e2dfBen GruvergrammarSpec[int gtokentype]
77324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	:	id:ID {out.grammar(gtokentype, #id.getText());}
78324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver		(cmt:DOC_COMMENT)?
79324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver		(optionsSpec)?
80324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver        (delegateGrammars)?
81324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver        (tokensSpec)?
82324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver        (attrScope)*
83324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver        (AMPERSAND)* // skip actions
84324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver        rules
85324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	;
86324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
87324c4644fee44b9898524c09511bd33c3f12e2dfBen GruverattrScope
88324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	:	#( "scope" ID ACTION )
89324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	;
90324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
91324c4644fee44b9898524c09511bd33c3f12e2dfBen GruveroptionsSpec
92324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    :   #( OPTIONS (option)+ )
93324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ;
94324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
95324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruveroption
96324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    :   #( ASSIGN ID optionValue )
97324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ;
98324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
99324c4644fee44b9898524c09511bd33c3f12e2dfBen GruveroptionValue
100324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    :   id:ID
101324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   s:STRING_LITERAL
102324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   c:CHAR_LITERAL
103324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   i:INT
104324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ;
105324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
106324c4644fee44b9898524c09511bd33c3f12e2dfBen GruvercharSet
107324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	:   #( CHARSET charSetElement )
108324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	;
109324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
110324c4644fee44b9898524c09511bd33c3f12e2dfBen GruvercharSetElement
111324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	:   c:CHAR_LITERAL
112324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	|   #( OR c1:CHAR_LITERAL c2:CHAR_LITERAL )
113324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	|   #( RANGE c3:CHAR_LITERAL c4:CHAR_LITERAL )
114324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	;
115324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
116324c4644fee44b9898524c09511bd33c3f12e2dfBen GruverdelegateGrammars
117324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	:	#( "import"
118324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver            (   #(ASSIGN ID ID)
119324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver            |   ID
120324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver            )+
121324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver        )
122324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	;
123324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
124324c4644fee44b9898524c09511bd33c3f12e2dfBen GruvertokensSpec
125324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	:	#( TOKENS ( tokenSpec )+ )
126324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	;
127324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
128324c4644fee44b9898524c09511bd33c3f12e2dfBen GruvertokenSpec
129324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	:	t:TOKEN_REF
130324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	|	#( ASSIGN
131324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver		   t2:TOKEN_REF
132324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver		   ( s:STRING_LITERAL
133324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver		   | c:CHAR_LITERAL
134324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver		   )
135324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver		 )
136324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	;
137324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
138324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverrules
139324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    :   ( rule )+
140324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ;
141324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
142324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverrule
143324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    :   #( RULE id:ID           {out.rule(#id.getText());}
144324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver           (m:modifier)?
145324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver           (ARG (ARG_ACTION)?)
146324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver           (RET (ARG_ACTION)?)
147324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver           (optionsSpec)?
148324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver           (ruleScopeSpec)?
149324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver       	   (AMPERSAND)*
150324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver           b:block
151324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver           (exceptionGroup)?
152324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver           EOR                  {out.endRule();}
153324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver         )
154324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ;
155324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
156324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruvermodifier
157324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	:	"protected"
158324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	|	"public"
159324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	|	"private"
160324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	|	"fragment"
161324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	;
162324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
163324c4644fee44b9898524c09511bd33c3f12e2dfBen GruverruleScopeSpec
164324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver 	:	#( "scope" (ACTION)? ( ID )* )
165324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver 	;
166324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
167324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverblock
168324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    :   #(  BLOCK {out.block(#BLOCK.getNumberOfChildrenWithType(ALT));}
169324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver            (optionsSpec)?
170324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver            ( alternative rewrite )+
171324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver            EOB
172324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver         )
173324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ;
174324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
175324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruveralternative
176324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    :   #( ALT {out.alt(#alternative);} (element)+ EOA {out.endAlt();} )
177324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ;
178324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
179324c4644fee44b9898524c09511bd33c3f12e2dfBen GruverexceptionGroup
180324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	:	( exceptionHandler )+ (finallyClause)?
181324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	|	finallyClause
182324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ;
183324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
184324c4644fee44b9898524c09511bd33c3f12e2dfBen GruverexceptionHandler
185324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    :    #("catch" ARG_ACTION ACTION)
186324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ;
187324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
188324c4644fee44b9898524c09511bd33c3f12e2dfBen GruverfinallyClause
189324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    :    #("finally" ACTION)
190324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ;
191324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
192324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverrewrite
193324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	:	( #( REWRITE (SEMPRED)? (ALT|TEMPLATE|ACTION|ETC) ) )*
194324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	;
195324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
196324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverelement
197324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    :   #(ROOT element)
198324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   #(BANG element)
199324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   atom
200324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   #(NOT {out.not();} element)
201324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   #(RANGE atom atom)
202324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   #(CHAR_RANGE {out.range();} atom atom)
203324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |	#(ASSIGN ID element)
204324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |	#(PLUS_ASSIGN ID element)
205324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   ebnf
206324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   tree
207324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   #( SYNPRED block )
208324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   FORCED_ACTION
209324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   ACTION
210324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   SEMPRED
211324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   SYN_SEMPRED
212324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   BACKTRACK_SEMPRED
213324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   GATED_SEMPRED
214324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   EPSILON
215324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ;
216324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
217324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverebnf:   block
218324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   #( OPTIONAL block )
219324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   #( CLOSURE block )
220324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   #( POSITIVE_CLOSURE block )
221324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ;
222324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
223324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruvertree:   #(TREE_BEGIN  element (element)*  )
224324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ;
225324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
226324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruveratom
227324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    :   #( rr:RULE_REF (rarg:ARG_ACTION)? )     {out.ruleRef(#rr);}
228324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   #( t:TOKEN_REF (targ:ARG_ACTION )? )    {out.token(#t);}
229324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   c:CHAR_LITERAL                          {out.charLiteral(#c);}
230324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   s:STRING_LITERAL                        {out.charLiteral(#s);}
231324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   WILDCARD                                {out.wildcard(#WILDCARD);}
232324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    |   #(DOT ID atom) // scope override on rule
233324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ;
234324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
235324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverast_suffix
236324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	:	ROOT
237324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	|	BANG
238324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver	;
239