antlr3 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ANTLR-LICENSE.txt +26 -0
- data/History.txt +66 -0
- data/README.txt +139 -0
- data/bin/antlr4ruby +33 -0
- data/java/RubyTarget.java +524 -0
- data/java/antlr-full-3.2.1.jar +0 -0
- data/lib/antlr3.rb +176 -0
- data/lib/antlr3/constants.rb +88 -0
- data/lib/antlr3/debug.rb +701 -0
- data/lib/antlr3/debug/event-hub.rb +210 -0
- data/lib/antlr3/debug/record-event-listener.rb +25 -0
- data/lib/antlr3/debug/rule-tracer.rb +55 -0
- data/lib/antlr3/debug/socket.rb +360 -0
- data/lib/antlr3/debug/trace-event-listener.rb +92 -0
- data/lib/antlr3/dfa.rb +247 -0
- data/lib/antlr3/dot.rb +174 -0
- data/lib/antlr3/error.rb +657 -0
- data/lib/antlr3/main.rb +561 -0
- data/lib/antlr3/modes/ast-builder.rb +41 -0
- data/lib/antlr3/modes/filter.rb +56 -0
- data/lib/antlr3/profile.rb +322 -0
- data/lib/antlr3/recognizers.rb +1280 -0
- data/lib/antlr3/streams.rb +985 -0
- data/lib/antlr3/streams/interactive.rb +91 -0
- data/lib/antlr3/streams/rewrite.rb +412 -0
- data/lib/antlr3/test/call-stack.rb +57 -0
- data/lib/antlr3/test/config.rb +23 -0
- data/lib/antlr3/test/core-extensions.rb +269 -0
- data/lib/antlr3/test/diff.rb +165 -0
- data/lib/antlr3/test/functional.rb +207 -0
- data/lib/antlr3/test/grammar.rb +371 -0
- data/lib/antlr3/token.rb +592 -0
- data/lib/antlr3/tree.rb +1415 -0
- data/lib/antlr3/tree/debug.rb +163 -0
- data/lib/antlr3/tree/visitor.rb +84 -0
- data/lib/antlr3/tree/wizard.rb +481 -0
- data/lib/antlr3/util.rb +149 -0
- data/lib/antlr3/version.rb +27 -0
- data/samples/ANTLRv3Grammar.g +621 -0
- data/samples/Cpp.g +749 -0
- data/templates/AST.stg +335 -0
- data/templates/ASTDbg.stg +40 -0
- data/templates/ASTParser.stg +153 -0
- data/templates/ASTTreeParser.stg +272 -0
- data/templates/Dbg.stg +192 -0
- data/templates/Ruby.stg +1514 -0
- data/test/functional/ast-output/auto-ast.rb +797 -0
- data/test/functional/ast-output/construction.rb +555 -0
- data/test/functional/ast-output/hetero-nodes.rb +753 -0
- data/test/functional/ast-output/rewrites.rb +1327 -0
- data/test/functional/ast-output/tree-rewrite.rb +1662 -0
- data/test/functional/debugging/debug-mode.rb +689 -0
- data/test/functional/debugging/profile-mode.rb +165 -0
- data/test/functional/debugging/rule-tracing.rb +74 -0
- data/test/functional/delegation/import.rb +379 -0
- data/test/functional/lexer/basic.rb +559 -0
- data/test/functional/lexer/filter-mode.rb +245 -0
- data/test/functional/lexer/nuances.rb +47 -0
- data/test/functional/lexer/properties.rb +104 -0
- data/test/functional/lexer/syn-pred.rb +32 -0
- data/test/functional/lexer/xml.rb +206 -0
- data/test/functional/main/main-scripts.rb +245 -0
- data/test/functional/parser/actions.rb +224 -0
- data/test/functional/parser/backtracking.rb +244 -0
- data/test/functional/parser/basic.rb +282 -0
- data/test/functional/parser/calc.rb +98 -0
- data/test/functional/parser/ll-star.rb +143 -0
- data/test/functional/parser/nuances.rb +165 -0
- data/test/functional/parser/predicates.rb +103 -0
- data/test/functional/parser/properties.rb +242 -0
- data/test/functional/parser/rule-methods.rb +132 -0
- data/test/functional/parser/scopes.rb +274 -0
- data/test/functional/token-rewrite/basic.rb +318 -0
- data/test/functional/token-rewrite/via-parser.rb +100 -0
- data/test/functional/tree-parser/basic.rb +750 -0
- data/test/unit/sample-input/file-stream-1 +2 -0
- data/test/unit/sample-input/teststreams.input2 +2 -0
- data/test/unit/test-dfa.rb +52 -0
- data/test/unit/test-exceptions.rb +44 -0
- data/test/unit/test-recognizers.rb +55 -0
- data/test/unit/test-scheme.rb +62 -0
- data/test/unit/test-streams.rb +459 -0
- data/test/unit/test-tree-wizard.rb +535 -0
- data/test/unit/test-trees.rb +854 -0
- metadata +205 -0
@@ -0,0 +1,272 @@
|
|
1
|
+
group ASTTreeParser;
|
2
|
+
gatedAction(block) ::= <<
|
3
|
+
<if(backtracking)>
|
4
|
+
if <actions.(actionScope).synpredgate>
|
5
|
+
<block>
|
6
|
+
end
|
7
|
+
<else>
|
8
|
+
<block>
|
9
|
+
<endif>
|
10
|
+
>>
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
ruleDeclarations() ::= <<
|
15
|
+
<super.ruleDeclarations()>
|
16
|
+
_first_0 = nil
|
17
|
+
_last = nil<\n>
|
18
|
+
>>
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
noRewrite(rewriteBlockLevel, treeLevel) ::= <<
|
23
|
+
<gatedAction({
|
24
|
+
<if(rewriteMode)>
|
25
|
+
return_value.tree = _first_0
|
26
|
+
if @adaptor.parent(return_value.tree) && @adaptor.flat_list?(@adaptor.parent(return_value.tree))
|
27
|
+
return_value.tree = @adaptor.parent(return_value.tree)
|
28
|
+
end
|
29
|
+
<endif>
|
30
|
+
})>
|
31
|
+
>>
|
32
|
+
|
33
|
+
tree(root, actionsAfterRoot, children, nullableChildList,
|
34
|
+
enclosingTreeLevel, treeLevel) ::= <<
|
35
|
+
_last = @input.look
|
36
|
+
_save_last_<treeLevel> = _last
|
37
|
+
_first_<treeLevel> = nil
|
38
|
+
<if(!rewriteMode)>
|
39
|
+
root_<treeLevel> = @adaptor.create_flat_list!<\n>
|
40
|
+
<endif>
|
41
|
+
<root:element()>
|
42
|
+
<if(rewriteMode)>
|
43
|
+
<gatedAction({
|
44
|
+
<if(root.el.rule)>
|
45
|
+
_first_<enclosingTreeLevel>.nil? and _first_<enclosingTreeLevel> = <root.el.label; format="label">.tree<\n>
|
46
|
+
<else>
|
47
|
+
_first_<enclosingTreeLevel>.nil? and _first_<enclosingTreeLevel> = <root.el.label; format="label"><\n>
|
48
|
+
<endif>
|
49
|
+
})>
|
50
|
+
<endif>
|
51
|
+
<actionsAfterRoot:element()>
|
52
|
+
<if(nullableChildList)>
|
53
|
+
if @input.peek == DOWN
|
54
|
+
match(DOWN, nil)
|
55
|
+
<children:element()>
|
56
|
+
match(UP, nil)
|
57
|
+
end
|
58
|
+
<else>
|
59
|
+
match(DOWN, nil)
|
60
|
+
<children:element()>
|
61
|
+
match(UP, nil)<\n>
|
62
|
+
<endif>
|
63
|
+
<if(!rewriteMode)>
|
64
|
+
@adaptor.add_child(root_<enclosingTreeLevel>, root_<treeLevel>)<\n>
|
65
|
+
<endif>
|
66
|
+
_last = _save_last_<treeLevel>
|
67
|
+
|
68
|
+
>>
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
tokenRefBang(token,label,elementIndex) ::= <<
|
73
|
+
_last = @input.look
|
74
|
+
<super.tokenRef(...)>
|
75
|
+
>>
|
76
|
+
|
77
|
+
tokenRef(token,label,elementIndex,hetero) ::= <<
|
78
|
+
_last = @input.look
|
79
|
+
<super.tokenRef(...)>
|
80
|
+
<if(!rewriteMode)>
|
81
|
+
<gatedAction({
|
82
|
+
<if(hetero)>
|
83
|
+
tree_for_<label> = <hetero; format="constantPath">.new(<label; format="label">)
|
84
|
+
<else>
|
85
|
+
tree_for_<label> = @adaptor.copy_node(<label; format="label">)
|
86
|
+
<endif><\n>
|
87
|
+
@adaptor.add_child(root_<treeLevel>, tree_for_<label>)
|
88
|
+
})>
|
89
|
+
<else> <! rewrite mode !>
|
90
|
+
<gatedAction({
|
91
|
+
_first_<treeLevel> ||= <label; format="label"><\n>
|
92
|
+
})>
|
93
|
+
<endif>
|
94
|
+
>>
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
tokenRefAndListLabel(token,label,elementIndex,hetero) ::= <<
|
99
|
+
<tokenRef(...)>
|
100
|
+
<addToList(elem={<label; format="label">},...)>
|
101
|
+
>>
|
102
|
+
|
103
|
+
tokenRefRuleRoot(token,label,elementIndex,hetero) ::= <<
|
104
|
+
_last = @input.look
|
105
|
+
<super.tokenRef(...)>
|
106
|
+
<if(!rewriteMode)>
|
107
|
+
<gatedAction({
|
108
|
+
<if(hetero)>
|
109
|
+
tree_for_<label> = <hetero; format="constantPath">.new(<label; format="label">)
|
110
|
+
<else>
|
111
|
+
tree_for_<label> = @adaptor.copy_node(<label; format="label">)
|
112
|
+
<endif><\n>
|
113
|
+
root_<treeLevel> = @adaptor.become_root(tree_for_<label>, root_<treeLevel>)
|
114
|
+
})>
|
115
|
+
<endif>
|
116
|
+
>>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
tokenRefRuleRootAndListLabel(token,label,elementIndex,hetero) ::= <<
|
121
|
+
<tokenRefRuleRoot(...)>
|
122
|
+
<addToList(elem={<label; format="label">},...)>
|
123
|
+
>>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
wildcard(token,label,elementIndex,hetero) ::= <<
|
128
|
+
_last = @input.look
|
129
|
+
<super.wildcard(...)>
|
130
|
+
<if(!rewriteMode)>
|
131
|
+
<gatedAction({
|
132
|
+
tree_for_<label> = @adaptor.copy_tree(<label; format="label">)
|
133
|
+
@adaptor.add_child(root_<treeLevel>, tree_for_<label>)
|
134
|
+
})>
|
135
|
+
<else> <! rewrite mode !>
|
136
|
+
<gatedAction({
|
137
|
+
_first_<treeLevel> and _first_<treeLevel> = <label; format="label">
|
138
|
+
})>
|
139
|
+
<endif>
|
140
|
+
>>
|
141
|
+
|
142
|
+
matchSet(s,label,hetero,elementIndex,postmatchCode) ::= <<
|
143
|
+
_last = @input.look
|
144
|
+
<super.matchSet(..., postmatchCode={
|
145
|
+
<if(!rewriteMode)>
|
146
|
+
<gatedAction({
|
147
|
+
<if(hetero)>
|
148
|
+
tree_for_<label> = <hetero; format="constantPath">.new(<label; format="label">)
|
149
|
+
<else>
|
150
|
+
tree_for_<label> = @adaptor.copy_node(<label; format="label">)
|
151
|
+
<endif><\n>
|
152
|
+
@adaptor.add_child(root_<treeLevel>, tree_for_<label>)
|
153
|
+
})>
|
154
|
+
<endif>
|
155
|
+
})>
|
156
|
+
>>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
matchRuleBlockSet(s,label,hetero,elementIndex,postmatchCode,treeLevel="0") ::= <<
|
161
|
+
<matchSet(...)>
|
162
|
+
<noRewrite()> <! set return tree !>
|
163
|
+
>>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
matchSetBang(s,label,elementIndex,postmatchCode) ::= <<
|
168
|
+
_last = @input.look
|
169
|
+
<super.matchSet(...)>
|
170
|
+
>>
|
171
|
+
|
172
|
+
matchSetRuleRoot(s,label,hetero,elementIndex,debug) ::= <<
|
173
|
+
<super.matchSet(..., postmatchCode={
|
174
|
+
<if(!rewriteMode)>
|
175
|
+
<gatedAction({
|
176
|
+
<if(hetero)>
|
177
|
+
tree_for_<label> = <hetero; format="constantPath">.new(<label; format="label">)
|
178
|
+
<else>
|
179
|
+
tree_for_<label> = @adaptor.copy_node(<label; format="label">)
|
180
|
+
<endif><\n>
|
181
|
+
root_<treeLevel> = @adaptor.become_root(tree_for_<label>, root_<treeLevel>)
|
182
|
+
})>
|
183
|
+
<endif>
|
184
|
+
})>
|
185
|
+
>>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
ruleRef(rule,label,elementIndex,args,scope) ::= <<
|
190
|
+
_last = @input.look
|
191
|
+
<super.ruleRef(...)>
|
192
|
+
<gatedAction({
|
193
|
+
<if(!rewriteMode)>
|
194
|
+
@adaptor.add_child(root_<treeLevel>, <label; format="label">.tree)
|
195
|
+
<else> <! rewrite mode !>
|
196
|
+
_first_<treeLevel>.nil? and _first_<treeLevel> = <label; format="label">.tree<\n>
|
197
|
+
<endif>
|
198
|
+
})>
|
199
|
+
>>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
ruleRefAndListLabel(rule,label,elementIndex,args,scope) ::= <<
|
204
|
+
<ruleRef(...)>
|
205
|
+
<addToList(elem={<label; format="label">.tree},...)>
|
206
|
+
>>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
ruleRefRuleRoot(rule,label,elementIndex,args,scope) ::= <<
|
211
|
+
_last = @input.look
|
212
|
+
<super.ruleRef(...)>
|
213
|
+
<if(!rewriteMode)>
|
214
|
+
<gatedAction({
|
215
|
+
root_<treeLevel> = @adaptor.become_root(<label; format="label">.tree, root_<treeLevel>)
|
216
|
+
})>
|
217
|
+
<endif>
|
218
|
+
>>
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
ruleRefRuleRootAndListLabel(rule,label,elementIndex,args,scope) ::= <<
|
223
|
+
<ruleRefRuleRoot(...)>
|
224
|
+
<addToList(elem={<label; format="label">.tree},...)>
|
225
|
+
>>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
ruleRefTrack(rule,label,elementIndex,args,scope) ::= <<
|
230
|
+
_last = @input.look
|
231
|
+
<super.ruleRefTrack(...)>
|
232
|
+
>>
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
ruleRefTrackAndListLabel(rule,label,elementIndex,args,scope) ::= <<
|
237
|
+
_last = @input.look
|
238
|
+
<super.ruleRefTrackAndListLabel(...)>
|
239
|
+
>>
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
ruleRefRuleRootTrack(rule,label,elementIndex,args,scope) ::= <<
|
244
|
+
_last = @input.look
|
245
|
+
<super.ruleRefRootTrack(...)>
|
246
|
+
>>
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
ruleRefRuleRootTrackAndListLabel(rule,label,elementIndex,args,scope) ::= <<
|
251
|
+
_last = @input.look
|
252
|
+
<super.ruleRefRuleRootTrackAndListLabel(...)>
|
253
|
+
>>
|
254
|
+
|
255
|
+
createRewriteNodeFromElement(token,hetero,scope) ::= <<
|
256
|
+
<if(hetero)>
|
257
|
+
<hetero; format="constantPath">.new(stream_<token>.next_node)
|
258
|
+
<else>
|
259
|
+
stream_<token>.next_node
|
260
|
+
<endif>
|
261
|
+
>>
|
262
|
+
|
263
|
+
ruleCleanUp() ::= <<
|
264
|
+
<super.ruleCleanUp()>
|
265
|
+
<if(!rewriteMode)>
|
266
|
+
<gatedAction({
|
267
|
+
return_value.tree = @adaptor.rule_post_processing(root_0)
|
268
|
+
})>
|
269
|
+
<endif>
|
270
|
+
>>
|
271
|
+
|
272
|
+
|
data/templates/Dbg.stg
ADDED
@@ -0,0 +1,192 @@
|
|
1
|
+
group Dbg;
|
2
|
+
|
3
|
+
/*
|
4
|
+
[The "BSD licence"]
|
5
|
+
Copyright (c) 2005-2009 Terence Parr
|
6
|
+
All rights reserved.
|
7
|
+
|
8
|
+
Redistribution and use in source and binary forms, with or without
|
9
|
+
modification, are permitted provided that the following conditions
|
10
|
+
are met:
|
11
|
+
1. Redistributions of source code must retain the above copyright
|
12
|
+
notice, this list of conditions and the following disclaimer.
|
13
|
+
2. Redistributions in binary form must reproduce the above copyright
|
14
|
+
notice, this list of conditions and the following disclaimer in the
|
15
|
+
documentation and/or other materials provided with the distribution.
|
16
|
+
3. The name of the author may not be used to endorse or promote products
|
17
|
+
derived from this software without specific prior written permission.
|
18
|
+
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
20
|
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
21
|
+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
22
|
+
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
23
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
24
|
+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
28
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
*/
|
30
|
+
|
31
|
+
@parserBody.mixins() ::= <<
|
32
|
+
include ANTLR3::<if(profile)>Profile<else>Debug<endif>::ParserEvents
|
33
|
+
>>
|
34
|
+
|
35
|
+
|
36
|
+
@parserBody.additionalMembers() ::= <<
|
37
|
+
<if(grammar.grammarIsRoot)>
|
38
|
+
RULE_NAMES = [
|
39
|
+
:invalid_rule, <grammar.allImportedRules:{rST|:<rST.name>}; wrap="\n ", separator=", ">
|
40
|
+
].freeze
|
41
|
+
<endif>
|
42
|
+
>>
|
43
|
+
|
44
|
+
|
45
|
+
@rule.body() ::= <<
|
46
|
+
in_rule(grammar_file_name, "<ruleName>") do
|
47
|
+
@debug_listener.location(<ruleDescriptor.tree.line>, <ruleDescriptor.tree.column>)
|
48
|
+
|
49
|
+
<@super.body()>
|
50
|
+
|
51
|
+
@debug_listener.location(<ruleDescriptor.EORNode.line>, <ruleDescriptor.EORNode.column>)
|
52
|
+
end
|
53
|
+
>>
|
54
|
+
|
55
|
+
|
56
|
+
// Common debug event triggers used by region overrides below
|
57
|
+
enterSubRule() ::= <<
|
58
|
+
in_subrule(<decisionNumber>) do<\n>
|
59
|
+
>>
|
60
|
+
|
61
|
+
|
62
|
+
exitSubRule() ::= <<
|
63
|
+
end<\n>
|
64
|
+
>>
|
65
|
+
|
66
|
+
|
67
|
+
enterDecision() ::= <<
|
68
|
+
in_decision(<decisionNumber>) do<\n>
|
69
|
+
>>
|
70
|
+
|
71
|
+
|
72
|
+
exitDecision() ::= <<
|
73
|
+
end<\n>
|
74
|
+
>>
|
75
|
+
|
76
|
+
|
77
|
+
enterAlt(n) ::= <<
|
78
|
+
in_alternative(<n>)<\n>
|
79
|
+
>>
|
80
|
+
|
81
|
+
|
82
|
+
// Region overrides that tell various constructs to add debugging triggers
|
83
|
+
@block.body() ::= <<
|
84
|
+
in_subrule(<decisionNumber>) do
|
85
|
+
<@super.body()>
|
86
|
+
end
|
87
|
+
>>
|
88
|
+
|
89
|
+
|
90
|
+
// @blockBody.predecision() ::= "<enterSubRule()>"
|
91
|
+
// @blockBody.postdecision() ::= "<exitDecision()>"
|
92
|
+
// @blockBody.postbranch() ::= "<exitSubRule()>"
|
93
|
+
@blockBody.decision() ::= <<
|
94
|
+
in_decision(<decisionNumber>) do
|
95
|
+
<@super.decision()>
|
96
|
+
end
|
97
|
+
>>
|
98
|
+
|
99
|
+
|
100
|
+
@ruleBlock.decision() ::= <<
|
101
|
+
in_decision(<decisionNumber>) do
|
102
|
+
<@super.decision()>
|
103
|
+
end<\n>
|
104
|
+
>>
|
105
|
+
|
106
|
+
|
107
|
+
@ruleBlockSingleAlt.prealt() ::= "<enterAlt(n={1})>"
|
108
|
+
|
109
|
+
|
110
|
+
@blockSingleAlt.prealt() ::= "<enterAlt(n={1})>"
|
111
|
+
|
112
|
+
|
113
|
+
@positiveClosureBlock.loopBody() ::= <<
|
114
|
+
in_subrule(<decisionNumber>) do
|
115
|
+
<@super.loopBody()>
|
116
|
+
end
|
117
|
+
>>
|
118
|
+
|
119
|
+
|
120
|
+
@positiveClosureBlockLoop.decisionBody() ::= <<
|
121
|
+
in_decision(<decisionNumber>) do
|
122
|
+
<@super.decisionBody()>
|
123
|
+
end
|
124
|
+
>>
|
125
|
+
|
126
|
+
|
127
|
+
@positiveClosureBlockLoop.earlyExitException() ::= <<
|
128
|
+
@debug_listener.recognition_exception(eee)
|
129
|
+
>>
|
130
|
+
|
131
|
+
|
132
|
+
@closureBlock.loopBody() ::= <<
|
133
|
+
in_subrule(<decisionNumber>) do
|
134
|
+
<@super.loopBody()>
|
135
|
+
end
|
136
|
+
>>
|
137
|
+
|
138
|
+
|
139
|
+
@closureBlockLoop.decisionBody() ::= <<
|
140
|
+
in_decision(<decisionNumber>) do
|
141
|
+
<@super.decisionBody()>
|
142
|
+
end
|
143
|
+
>>
|
144
|
+
|
145
|
+
|
146
|
+
@altSwitchCase.prealt() ::= "<enterAlt(n=i)>"
|
147
|
+
|
148
|
+
|
149
|
+
element() ::= <<
|
150
|
+
@debug_listener.location(<it.line>, <it.pos>)
|
151
|
+
<super.element()>
|
152
|
+
>>
|
153
|
+
|
154
|
+
|
155
|
+
@matchSet.mismatchedSetException() ::= "@debug_listener.recognition_exception(mse)"
|
156
|
+
|
157
|
+
|
158
|
+
@dfaState.noViableAltException() ::= <<
|
159
|
+
@debug_listener.recognition_exception(nvae)
|
160
|
+
raise(nvae)
|
161
|
+
>>
|
162
|
+
|
163
|
+
|
164
|
+
@dfaStateSwitch.noViableAltException() ::= <<
|
165
|
+
@debug_listener.recognition_exception nvae
|
166
|
+
raise nvae
|
167
|
+
>>
|
168
|
+
|
169
|
+
|
170
|
+
dfaDecision(decisionNumber,description) ::= <<
|
171
|
+
begin
|
172
|
+
@state.cyclic_decision = true
|
173
|
+
<super.dfaDecision(...)>
|
174
|
+
rescue ANTLR3::Error::NoViableAlternative => nvae
|
175
|
+
@debug_listener.recognition_exception(nvae)
|
176
|
+
raise
|
177
|
+
end
|
178
|
+
>>
|
179
|
+
|
180
|
+
|
181
|
+
@cyclicDFA.errorMethod() ::= <<
|
182
|
+
def error(nvae)
|
183
|
+
@recognizer.debug_listener.recognition_exception(nvae)
|
184
|
+
super
|
185
|
+
end
|
186
|
+
>>
|
187
|
+
/** Force predicate validation to trigger an event */
|
188
|
+
evalPredicate(pred,description) ::= <<
|
189
|
+
predicate?("<description>") { <pred> }
|
190
|
+
>>
|
191
|
+
|
192
|
+
|