antlr3 1.8.0 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +35 -0
- data/Manifest.txt +73 -0
- data/README.txt +6 -13
- data/java/RubyTarget.java +43 -19
- data/java/antlr-full-3.2.1.jar +0 -0
- data/lib/antlr3/debug.rb +2 -0
- data/lib/antlr3/debug/event-hub.rb +55 -55
- data/lib/antlr3/debug/record-event-listener.rb +2 -2
- data/lib/antlr3/debug/rule-tracer.rb +14 -14
- data/lib/antlr3/debug/socket.rb +47 -47
- data/lib/antlr3/debug/trace-event-listener.rb +8 -8
- data/lib/antlr3/main.rb +29 -9
- data/lib/antlr3/modes/ast-builder.rb +7 -7
- data/lib/antlr3/modes/filter.rb +19 -17
- data/lib/antlr3/profile.rb +34 -6
- data/lib/antlr3/recognizers.rb +50 -1
- data/lib/antlr3/streams.rb +19 -15
- data/lib/antlr3/streams/rewrite.rb +241 -229
- data/lib/antlr3/template/group-file-lexer.rb +6 -8
- data/lib/antlr3/template/group-file-parser.rb +16 -16
- data/lib/antlr3/template/group-file.rb +1 -1
- data/lib/antlr3/test/call-stack.rb +13 -13
- data/lib/antlr3/test/core-extensions.rb +69 -69
- data/lib/antlr3/test/functional.rb +0 -4
- data/lib/antlr3/test/grammar.rb +70 -70
- data/lib/antlr3/token.rb +41 -17
- data/lib/antlr3/tree.rb +11 -14
- data/lib/antlr3/tree/debug.rb +53 -53
- data/lib/antlr3/tree/visitor.rb +11 -11
- data/lib/antlr3/tree/wizard.rb +35 -35
- data/lib/antlr3/util.rb +18 -0
- data/lib/antlr3/version.rb +1 -1
- data/rakefile +1 -0
- data/samples/ANTLRv3Grammar.g +3 -3
- data/samples/JavaScript.g +702 -0
- data/samples/standard/C/C.g +543 -0
- data/samples/standard/C/C.tokens +175 -0
- data/samples/standard/C/C__testrig.st +0 -0
- data/samples/standard/C/c.rb +12 -0
- data/samples/standard/C/input +3479 -0
- data/samples/standard/C/output +171 -0
- data/samples/standard/LL-star/LLStar.g +101 -0
- data/samples/standard/LL-star/input +12 -0
- data/samples/standard/LL-star/ll-star.rb +12 -0
- data/samples/standard/LL-star/output +2 -0
- data/samples/standard/calc/Calculator.g +47 -0
- data/samples/standard/calc/Calculator.py +16 -0
- data/samples/standard/calc/Calculator.rb +28 -0
- data/samples/standard/cminus/CMinus.g +141 -0
- data/samples/standard/cminus/bytecode.group +80 -0
- data/samples/standard/cminus/cminus.rb +16 -0
- data/samples/standard/cminus/input +9 -0
- data/samples/standard/cminus/java.group +91 -0
- data/samples/standard/cminus/output +11 -0
- data/samples/standard/cminus/python.group +48 -0
- data/samples/standard/dynamic-scope/DynamicScopes.g +50 -0
- data/samples/standard/dynamic-scope/dynamic-scopes.rb +12 -0
- data/samples/standard/dynamic-scope/input +7 -0
- data/samples/standard/dynamic-scope/output +4 -0
- data/samples/standard/fuzzy/FuzzyJava.g +89 -0
- data/samples/standard/fuzzy/fuzzy.py +11 -0
- data/samples/standard/fuzzy/fuzzy.rb +9 -0
- data/samples/standard/fuzzy/input +13 -0
- data/samples/standard/fuzzy/output +12 -0
- data/samples/standard/hoisted-predicates/HoistedPredicates.g +40 -0
- data/samples/standard/hoisted-predicates/hoisted-predicates.rb +13 -0
- data/samples/standard/hoisted-predicates/input +1 -0
- data/samples/standard/hoisted-predicates/output +1 -0
- data/samples/standard/island-grammar/Javadoc.g +46 -0
- data/samples/standard/island-grammar/Simple.g +104 -0
- data/samples/standard/island-grammar/input +11 -0
- data/samples/standard/island-grammar/island.rb +12 -0
- data/samples/standard/island-grammar/output +16 -0
- data/samples/standard/java/Java.g +827 -0
- data/samples/standard/java/input +80 -0
- data/samples/standard/java/java.rb +13 -0
- data/samples/standard/java/output +1 -0
- data/samples/standard/python/Python.g +718 -0
- data/samples/standard/python/PythonTokenSource.rb +107 -0
- data/samples/standard/python/input +210 -0
- data/samples/standard/python/output +24 -0
- data/samples/standard/python/python.rb +14 -0
- data/samples/standard/rakefile +18 -0
- data/samples/standard/scopes/SymbolTable.g +66 -0
- data/samples/standard/scopes/input +12 -0
- data/samples/standard/scopes/output +3 -0
- data/samples/standard/scopes/scopes.rb +12 -0
- data/samples/standard/simplecTreeParser/SimpleC.g +113 -0
- data/samples/standard/simplecTreeParser/SimpleCWalker.g +64 -0
- data/samples/standard/simplecTreeParser/input +12 -0
- data/samples/standard/simplecTreeParser/output +1 -0
- data/samples/standard/simplecTreeParser/simplec.rb +18 -0
- data/samples/standard/treeparser/Lang.g +24 -0
- data/samples/standard/treeparser/LangDumpDecl.g +17 -0
- data/samples/standard/treeparser/input +1 -0
- data/samples/standard/treeparser/output +2 -0
- data/samples/standard/treeparser/treeparser.rb +18 -0
- data/samples/standard/tweak/Tweak.g +68 -0
- data/samples/standard/tweak/input +9 -0
- data/samples/standard/tweak/output +16 -0
- data/samples/standard/tweak/tweak.rb +13 -0
- data/samples/standard/xml/README +16 -0
- data/samples/standard/xml/XML.g +123 -0
- data/samples/standard/xml/input +21 -0
- data/samples/standard/xml/output +39 -0
- data/samples/standard/xml/xml.rb +9 -0
- data/templates/Ruby.stg +4 -4
- data/test/functional/ast-output/auto-ast.rb +0 -5
- data/test/functional/ast-output/rewrites.rb +4 -4
- data/test/unit/test-scope.rb +45 -0
- metadata +96 -8
data/History.txt
CHANGED
@@ -1,3 +1,38 @@
|
|
1
|
+
=== 1.8.2 / 10-02-10
|
2
|
+
|
3
|
+
* Bug Fix: removed references to Parser#token_stream
|
4
|
+
- changed references to Parser#token_stream to Parser#input in `antlr3/profile.rb' to
|
5
|
+
avoid "private method token_stream called" errors in profile mode
|
6
|
+
|
7
|
+
* Minor Enhancement: new samples included with the distribution
|
8
|
+
- added a newly developed `samples/JavaScript.g' file for parsing JavaScript.
|
9
|
+
While not entirely complete and flawless, it does a pretty good job
|
10
|
+
of parsing JavaScript up through Firefox's 1.6 version of the language.
|
11
|
+
- included the `samples/standard' directory with the package distribution,
|
12
|
+
which has been in the development repository for a while, but I never
|
13
|
+
updated the package spec to include these files.
|
14
|
+
|
15
|
+
=== 1.8.0 / 07-03-10
|
16
|
+
|
17
|
+
* Bug Fix / Major Enhancement: made antlr3 compatible with ruby 1.9
|
18
|
+
- altered ANTLR3::StringStream to always have #peek return an integer in both
|
19
|
+
Ruby 1.8 and 1.9. In 1.9, @data is now an array of code point values and
|
20
|
+
the new instance variable @string contains the actual string. In Ruby 1.8,
|
21
|
+
both @data and @string contain the string value.
|
22
|
+
- lexer code is no longer generated using '?c' character syntax; characters
|
23
|
+
are now represented as hexadecimal integers to make the code compatible
|
24
|
+
with Ruby 1.9
|
25
|
+
|
26
|
+
=== 1.7.5 / 06-18-10
|
27
|
+
|
28
|
+
* Minor Enhancements
|
29
|
+
- added #compile! and #clobber! methods to directly invoke the 'compile'
|
30
|
+
and 'clobber' tasks respectively
|
31
|
+
|
32
|
+
* Bug Fixes
|
33
|
+
- removed special ruby-stylistic formatting on syntactic predicate method names to
|
34
|
+
fix a bad bug in code-generation that cropped up in more complex grammars
|
35
|
+
|
1
36
|
=== 1.7.2 / 05-16-10
|
2
37
|
|
3
38
|
* Minor Enhancements
|
data/Manifest.txt
CHANGED
@@ -44,6 +44,7 @@ test/unit/test-streams.rb
|
|
44
44
|
test/unit/test-recognizers.rb
|
45
45
|
test/unit/test-trees.rb
|
46
46
|
test/unit/test-exceptions.rb
|
47
|
+
test/unit/test-scope.rb
|
47
48
|
test/unit/test-scheme.rb
|
48
49
|
test/unit/test-template.rb
|
49
50
|
test/functional/delegation/import.rb
|
@@ -86,6 +87,78 @@ templates/Support.stg
|
|
86
87
|
templates/ASTTreeParser.stg
|
87
88
|
samples/CPP.g
|
88
89
|
samples/ANTLRv3Grammar.g
|
90
|
+
samples/JavaScript.g
|
91
|
+
samples/standard/island-grammar/island.rb
|
92
|
+
samples/standard/island-grammar/Simple.g
|
93
|
+
samples/standard/island-grammar/Javadoc.g
|
94
|
+
samples/standard/island-grammar/input
|
95
|
+
samples/standard/island-grammar/output
|
96
|
+
samples/standard/tweak/tweak.rb
|
97
|
+
samples/standard/tweak/input
|
98
|
+
samples/standard/tweak/output
|
99
|
+
samples/standard/tweak/Tweak.g
|
100
|
+
samples/standard/scopes/input
|
101
|
+
samples/standard/scopes/output
|
102
|
+
samples/standard/scopes/SymbolTable.g
|
103
|
+
samples/standard/scopes/scopes.rb
|
104
|
+
samples/standard/dynamic-scope/DynamicScopes.g
|
105
|
+
samples/standard/dynamic-scope/dynamic-scopes.rb
|
106
|
+
samples/standard/dynamic-scope/input
|
107
|
+
samples/standard/dynamic-scope/output
|
108
|
+
samples/standard/hoisted-predicates/hoisted-predicates.rb
|
109
|
+
samples/standard/hoisted-predicates/HoistedPredicates.g
|
110
|
+
samples/standard/hoisted-predicates/input
|
111
|
+
samples/standard/hoisted-predicates/output
|
112
|
+
samples/standard/fuzzy/fuzzy.rb
|
113
|
+
samples/standard/fuzzy/input
|
114
|
+
samples/standard/fuzzy/output
|
115
|
+
samples/standard/fuzzy/FuzzyJava.g
|
116
|
+
samples/standard/fuzzy/fuzzy.py
|
117
|
+
samples/standard/treeparser/LangDumpDecl.g
|
118
|
+
samples/standard/treeparser/Lang.g
|
119
|
+
samples/standard/treeparser/treeparser.rb
|
120
|
+
samples/standard/treeparser/input
|
121
|
+
samples/standard/treeparser/output
|
122
|
+
samples/standard/LL-star/LLStar.g
|
123
|
+
samples/standard/LL-star/input
|
124
|
+
samples/standard/LL-star/output
|
125
|
+
samples/standard/LL-star/ll-star.rb
|
126
|
+
samples/standard/java/Java.g
|
127
|
+
samples/standard/java/java.rb
|
128
|
+
samples/standard/java/input
|
129
|
+
samples/standard/java/output
|
130
|
+
samples/standard/rakefile
|
131
|
+
samples/standard/xml/README
|
132
|
+
samples/standard/xml/xml.rb
|
133
|
+
samples/standard/xml/XML.g
|
134
|
+
samples/standard/xml/input
|
135
|
+
samples/standard/xml/output
|
136
|
+
samples/standard/calc/Calculator.g
|
137
|
+
samples/standard/calc/Calculator.py
|
138
|
+
samples/standard/calc/Calculator.rb
|
139
|
+
samples/standard/C/C.g
|
140
|
+
samples/standard/C/c.rb
|
141
|
+
samples/standard/C/C__testrig.st
|
142
|
+
samples/standard/C/input
|
143
|
+
samples/standard/C/output
|
144
|
+
samples/standard/C/C.tokens
|
145
|
+
samples/standard/cminus/bytecode.group
|
146
|
+
samples/standard/cminus/CMinus.g
|
147
|
+
samples/standard/cminus/cminus.rb
|
148
|
+
samples/standard/cminus/input
|
149
|
+
samples/standard/cminus/python.group
|
150
|
+
samples/standard/cminus/output
|
151
|
+
samples/standard/cminus/java.group
|
152
|
+
samples/standard/simplecTreeParser/SimpleC.g
|
153
|
+
samples/standard/simplecTreeParser/SimpleCWalker.g
|
154
|
+
samples/standard/simplecTreeParser/input
|
155
|
+
samples/standard/simplecTreeParser/output
|
156
|
+
samples/standard/simplecTreeParser/simplec.rb
|
157
|
+
samples/standard/python/PythonTokenSource.rb
|
158
|
+
samples/standard/python/python.rb
|
159
|
+
samples/standard/python/Python.g
|
160
|
+
samples/standard/python/input
|
161
|
+
samples/standard/python/output
|
89
162
|
README.txt
|
90
163
|
ANTLR-LICENSE.txt
|
91
164
|
History.txt
|
data/README.txt
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
ANTLR 3 for Ruby
|
2
2
|
by Kyle Yetter (kcy5b@yahoo.com)
|
3
|
-
http://
|
3
|
+
http://antlr.ohboyohboyohboy.org
|
4
|
+
http://github.com/ohboyohboyohboy/antlr3
|
4
5
|
|
5
6
|
== DESCRIPTION:
|
6
7
|
|
@@ -9,7 +10,7 @@ Fully-featured ANTLR 3 parser generation for Ruby.
|
|
9
10
|
ANTLR (ANother Tool for Language Recognition) is a tool that is used to generate
|
10
11
|
code for performing a variety of language recognition tasks: lexing, parsing,
|
11
12
|
abstract syntax tree construction and manipulation, tree structure recognition,
|
12
|
-
and input translation. The tool operates
|
13
|
+
and input translation. The tool operates similarly to other parser generators,
|
13
14
|
taking in a grammar specification written in the special ANTLR metalanguage and
|
14
15
|
producing source code that implements the recognition functionality.
|
15
16
|
|
@@ -32,11 +33,11 @@ ANTLR provides for other language targets, such as Java and Python. It contains:
|
|
32
33
|
java code and templates for producing fully featured language recognition
|
33
34
|
in ruby code
|
34
35
|
|
35
|
-
* a ruby
|
36
|
+
* a ruby run-time library that collects classes used throughout the code that
|
36
37
|
ANTLR generates
|
37
38
|
|
38
39
|
* a wrapper script, `antlr4ruby', which executes the ANTLR command line tool
|
39
|
-
after ensuring the ANTLR jar is
|
40
|
+
after ensuring the ANTLR jar is Java's class path
|
40
41
|
|
41
42
|
== FEATURES
|
42
43
|
|
@@ -96,21 +97,13 @@ ANTLR provides for other language targets, such as Java and Python. It contains:
|
|
96
97
|
from the conventions and examples covered in the ANTLR standard documentation.
|
97
98
|
I am still working on documenting these details.
|
98
99
|
|
99
|
-
* While the target is intended to be complete, I do not provide any
|
100
|
-
implementation of the template-construction mode available for Java and Python
|
101
|
-
targets. While I'm interested in having this capability, I have not implemented
|
102
|
-
it yet because ANTLR forces you to use its StringTemplate templating language.
|
103
|
-
Thus, I would have to port the StringTemplate library to Ruby and write a target
|
104
|
-
for ST parser generation. I would prefer to permit template generation that uses
|
105
|
-
ruby's standard ERB templating library.
|
106
|
-
|
107
100
|
* So far, this has only been tested on Linux with ruby 1.8.7 and ruby 1.9.1.
|
108
101
|
I'm currently working on verifying behavior on other systems and with
|
109
102
|
slightly older versions of ruby.
|
110
103
|
|
111
104
|
== LICENSE
|
112
105
|
|
113
|
-
[The "BSD
|
106
|
+
[The "BSD license"]
|
114
107
|
Copyright (c) 2009-2010 Kyle Yetter
|
115
108
|
All rights reserved.
|
116
109
|
|
data/java/RubyTarget.java
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
[The "BSD licence"]
|
3
|
-
Copyright (c) 2010
|
3
|
+
Copyright (c) 2010 Kyle Yetter
|
4
4
|
All rights reserved.
|
5
5
|
|
6
6
|
Redistribution and use in source and binary forms, with or without
|
@@ -35,8 +35,7 @@ import org.antlr.Tool;
|
|
35
35
|
import org.antlr.stringtemplate.*;
|
36
36
|
import org.antlr.tool.Grammar;
|
37
37
|
|
38
|
-
public class RubyTarget
|
39
|
-
extends Target
|
38
|
+
public class RubyTarget extends Target
|
40
39
|
{
|
41
40
|
/** A set of ruby keywords which are used to escape labels and method names
|
42
41
|
* which will cause parse errors in the ruby source
|
@@ -62,9 +61,33 @@ public class RubyTarget
|
|
62
61
|
|
63
62
|
public static HashMap sharedActionBlocks = new HashMap();
|
64
63
|
|
65
|
-
public class RubyRenderer
|
66
|
-
implements AttributeRenderer
|
64
|
+
public class RubyRenderer implements AttributeRenderer
|
67
65
|
{
|
66
|
+
protected String[] rubyCharValueEscape = new String[256];
|
67
|
+
|
68
|
+
public RubyRenderer() {
|
69
|
+
for ( int i = 0; i < 16; i++ ) {
|
70
|
+
rubyCharValueEscape[ i ] = "\\x0" + Integer.toHexString( i );
|
71
|
+
}
|
72
|
+
for ( int i = 16; i < 32; i++ ) {
|
73
|
+
rubyCharValueEscape[ i ] = "\\x" + Integer.toHexString( i );
|
74
|
+
}
|
75
|
+
for ( char i = 32; i < 127; i++ ) {
|
76
|
+
rubyCharValueEscape[ i ] = Character.toString( i );
|
77
|
+
}
|
78
|
+
for ( int i = 127; i < 256; i++ ) {
|
79
|
+
rubyCharValueEscape[ i ] = "\\x" + Integer.toHexString( i );
|
80
|
+
}
|
81
|
+
|
82
|
+
rubyCharValueEscape['\n'] = "\\n";
|
83
|
+
rubyCharValueEscape['\r'] = "\\r";
|
84
|
+
rubyCharValueEscape['\t'] = "\\t";
|
85
|
+
rubyCharValueEscape['\b'] = "\\b";
|
86
|
+
rubyCharValueEscape['\f'] = "\\f";
|
87
|
+
rubyCharValueEscape['\\'] = "\\\\";
|
88
|
+
rubyCharValueEscape['"'] = "\\\"";
|
89
|
+
}
|
90
|
+
|
68
91
|
public String toString( Object o ) {
|
69
92
|
return o.toString();
|
70
93
|
}
|
@@ -87,7 +110,9 @@ public class RubyTarget
|
|
87
110
|
} else if ( formatName.equals( "lexerRule" ) ) {
|
88
111
|
return lexerRule( idString );
|
89
112
|
} else if ( formatName.equals( "constantPath" ) ) {
|
90
|
-
|
113
|
+
return constantPath( idString );
|
114
|
+
} else if ( formatName.equals( "rubyString" ) ) {
|
115
|
+
return rubyString( idString );
|
91
116
|
} else if ( formatName.equals( "label" ) ) {
|
92
117
|
return label( idString );
|
93
118
|
} else if ( formatName.equals( "symbol" ) ) {
|
@@ -198,6 +223,18 @@ public class RubyTarget
|
|
198
223
|
private String constantPath( String value ) {
|
199
224
|
return value.replaceAll( "\\.", "::" );
|
200
225
|
}
|
226
|
+
|
227
|
+
private String rubyString( String value ) {
|
228
|
+
StringBuilder output_buffer = new StringBuilder();
|
229
|
+
int len = value.length();
|
230
|
+
|
231
|
+
output_buffer.append( '"' );
|
232
|
+
for ( int i = 0; i < len; i++ ) {
|
233
|
+
output_buffer.append( rubyCharValueEscape[ value.charAt( i ) ] );
|
234
|
+
}
|
235
|
+
output_buffer.append( '"' );
|
236
|
+
return output_buffer.toString();
|
237
|
+
}
|
201
238
|
|
202
239
|
private String camelcase( String value ) {
|
203
240
|
StringBuilder output_buffer = new StringBuilder();
|
@@ -369,19 +406,6 @@ public class RubyTarget
|
|
369
406
|
}
|
370
407
|
|
371
408
|
return ( "0x" + Integer.toHexString( code_point ) );
|
372
|
-
|
373
|
-
//if ( literal.equals( "\\" ) ) {
|
374
|
-
// result += "\\\\";
|
375
|
-
//}
|
376
|
-
//else if ( literal.equals( " " ) ) {
|
377
|
-
// result += "\\s";
|
378
|
-
//}
|
379
|
-
//else if ( literal.startsWith( "\\u" ) ) {
|
380
|
-
// result = "0x" + literal.substring( 2 );
|
381
|
-
//}
|
382
|
-
//else {
|
383
|
-
// result += literal;
|
384
|
-
//}
|
385
409
|
}
|
386
410
|
|
387
411
|
public int getMaxCharValue( CodeGenerator generator )
|
data/java/antlr-full-3.2.1.jar
CHANGED
Binary file
|
data/lib/antlr3/debug.rb
CHANGED
@@ -15,36 +15,36 @@ class EventHub
|
|
15
15
|
include ANTLR3::Debug::EventListener
|
16
16
|
attr_reader :listeners
|
17
17
|
|
18
|
-
def initialize(*listeners)
|
19
|
-
@listeners = [listeners].flatten!
|
18
|
+
def initialize( *listeners )
|
19
|
+
@listeners = [ listeners ].flatten!
|
20
20
|
@listeners.compact!
|
21
21
|
end
|
22
22
|
|
23
|
-
def add(*listeners)
|
24
|
-
@listeners.push(*listeners)
|
23
|
+
def add( *listeners )
|
24
|
+
@listeners.push( *listeners )
|
25
25
|
end
|
26
26
|
|
27
|
-
def add_child(root, child)
|
27
|
+
def add_child( root, child )
|
28
28
|
for listener in @listeners
|
29
|
-
listener.add_child(root, child)
|
29
|
+
listener.add_child( root, child )
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def backtrack(level)
|
33
|
+
def backtrack( level )
|
34
34
|
for listener in @listeners
|
35
|
-
listener.backtrack(level)
|
35
|
+
listener.backtrack( level )
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
def become_root(new_root, old_root)
|
39
|
+
def become_root( new_root, old_root )
|
40
40
|
for listener in @listeners
|
41
|
-
listener.become_root(new_root, old_root)
|
41
|
+
listener.become_root( new_root, old_root )
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
def begin_backtrack(level)
|
45
|
+
def begin_backtrack( level )
|
46
46
|
for listener in @listeners
|
47
|
-
listener.begin_backtrack(level)
|
47
|
+
listener.begin_backtrack( level )
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -60,33 +60,33 @@ class EventHub
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
def consume_hidden_token(tree)
|
63
|
+
def consume_hidden_token( tree )
|
64
64
|
for listener in @listeners
|
65
|
-
listener.consume_hidden_token(tree)
|
65
|
+
listener.consume_hidden_token( tree )
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
def consume_node(tree)
|
69
|
+
def consume_node( tree )
|
70
70
|
for listener in @listeners
|
71
|
-
listener.consume_node(tree)
|
71
|
+
listener.consume_node( tree )
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
def consume_token(tree)
|
75
|
+
def consume_token( tree )
|
76
76
|
for listener in @listeners
|
77
|
-
listener.consume_token(tree)
|
77
|
+
listener.consume_token( tree )
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
def create_node(node, token)
|
81
|
+
def create_node( node, token )
|
82
82
|
for listener in @listeners
|
83
|
-
listener.create_node(node, token)
|
83
|
+
listener.create_node( node, token )
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
def end_backtrack(level, successful)
|
87
|
+
def end_backtrack( level, successful )
|
88
88
|
for listener in @listeners
|
89
|
-
listener.end_backtrack(level, successful)
|
89
|
+
listener.end_backtrack( level, successful )
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -96,81 +96,81 @@ class EventHub
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
def enter_alternative(alt)
|
99
|
+
def enter_alternative( alt )
|
100
100
|
for listener in @listeners
|
101
|
-
listener.enter_alternative(alt)
|
101
|
+
listener.enter_alternative( alt )
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
-
def enter_decision(decision_number)
|
105
|
+
def enter_decision( decision_number )
|
106
106
|
for listener in @listeners
|
107
|
-
listener.enter_decision(decision_number)
|
107
|
+
listener.enter_decision( decision_number )
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
-
def enter_rule(grammar_file_name, rule_name)
|
111
|
+
def enter_rule( grammar_file_name, rule_name )
|
112
112
|
for listener in @listeners
|
113
|
-
listener.enter_rule(grammar_file_name, rule_name)
|
113
|
+
listener.enter_rule( grammar_file_name, rule_name )
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
-
def enter_sub_rule(decision_number)
|
117
|
+
def enter_sub_rule( decision_number )
|
118
118
|
for listener in @listeners
|
119
|
-
listener.enter_sub_rule(decision_number)
|
119
|
+
listener.enter_sub_rule( decision_number )
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
|
-
def error_node(tree)
|
123
|
+
def error_node( tree )
|
124
124
|
for listener in @listeners
|
125
|
-
listener.error_node(tree)
|
125
|
+
listener.error_node( tree )
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
def exit_decision(decision_number)
|
129
|
+
def exit_decision( decision_number )
|
130
130
|
for listener in @listeners
|
131
|
-
listener.exit_decision(decision_number)
|
131
|
+
listener.exit_decision( decision_number )
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
-
def exit_rule(grammar_file_name, rule_name)
|
135
|
+
def exit_rule( grammar_file_name, rule_name )
|
136
136
|
for listener in @listeners
|
137
|
-
listener.exit_rule(grammar_file_name, rule_name)
|
137
|
+
listener.exit_rule( grammar_file_name, rule_name )
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
-
def exit_sub_rule(decision_number)
|
141
|
+
def exit_sub_rule( decision_number )
|
142
142
|
for listener in @listeners
|
143
|
-
listener.exit_sub_rule(decision_number)
|
143
|
+
listener.exit_sub_rule( decision_number )
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
-
def flat_node(tree)
|
147
|
+
def flat_node( tree )
|
148
148
|
for listener in @listeners
|
149
|
-
listener.flat_node(tree)
|
149
|
+
listener.flat_node( tree )
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
153
|
-
def location(line, position)
|
153
|
+
def location( line, position )
|
154
154
|
for listener in @listeners
|
155
|
-
listener.location(line, position)
|
155
|
+
listener.location( line, position )
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
|
-
def look(i, tree)
|
159
|
+
def look( i, tree )
|
160
160
|
for listener in @listeners
|
161
|
-
listener.look(i, tree)
|
161
|
+
listener.look( i, tree )
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
165
|
-
def mark(marker)
|
165
|
+
def mark( marker )
|
166
166
|
for listener in @listeners
|
167
|
-
listener.mark(marker)
|
167
|
+
listener.mark( marker )
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
171
|
-
def recognition_exception(exception)
|
171
|
+
def recognition_exception( exception )
|
172
172
|
for listener in @listeners
|
173
|
-
listener.recognition_exception(exception)
|
173
|
+
listener.recognition_exception( exception )
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
@@ -180,21 +180,21 @@ class EventHub
|
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
|
-
def rewind(marker)
|
183
|
+
def rewind( marker )
|
184
184
|
for listener in @listeners
|
185
|
-
listener.rewind(marker)
|
185
|
+
listener.rewind( marker )
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
189
|
-
def semantic_predicate(result, predicate)
|
189
|
+
def semantic_predicate( result, predicate )
|
190
190
|
for listener in @listeners
|
191
|
-
listener.semantic_predicate(result, predicate)
|
191
|
+
listener.semantic_predicate( result, predicate )
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
195
|
-
def set_token_boundaries(tree, token_start_index, token_stop_index)
|
195
|
+
def set_token_boundaries( tree, token_start_index, token_stop_index )
|
196
196
|
for listener in @listeners
|
197
|
-
listener.set_token_boundaries(tree, token_start_index, token_stop_index)
|
197
|
+
listener.set_token_boundaries( tree, token_start_index, token_stop_index )
|
198
198
|
end
|
199
199
|
end
|
200
200
|
|
@@ -207,4 +207,4 @@ class EventHub
|
|
207
207
|
end
|
208
208
|
|
209
209
|
end
|
210
|
-
end
|
210
|
+
end
|