antlr3 1.8.5 → 1.8.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +120 -118
- data/java/antlr-full-3.2.1.jar +0 -0
- data/lib/antlr3/debug/socket.rb +2 -1
- data/lib/antlr3/dot.rb +25 -30
- data/lib/antlr3/streams/unicode.rb +80 -0
- data/lib/antlr3/version.rb +1 -1
- data/rakefile +28 -27
- data/templates/Ruby.stg +1 -1
- data/test/unit/test-streams.rb +3 -53
- data/test/unit/test-unicode-stream.rb +186 -0
- metadata +153 -155
data/Manifest.txt
CHANGED
@@ -1,167 +1,169 @@
|
|
1
1
|
bin/antlr4ruby
|
2
|
-
lib/antlr3
|
3
|
-
lib/antlr3/
|
4
|
-
lib/antlr3/
|
5
|
-
lib/antlr3/
|
6
|
-
lib/antlr3/streams/rewrite.rb
|
7
|
-
lib/antlr3/streams/interactive.rb
|
8
|
-
lib/antlr3/debug.rb
|
9
|
-
lib/antlr3/dot.rb
|
10
|
-
lib/antlr3/streams.rb
|
11
|
-
lib/antlr3/debug/record-event-listener.rb
|
12
|
-
lib/antlr3/debug/rule-tracer.rb
|
13
|
-
lib/antlr3/debug/socket.rb
|
14
|
-
lib/antlr3/debug/trace-event-listener.rb
|
15
|
-
lib/antlr3/debug/event-hub.rb
|
16
|
-
lib/antlr3/version.rb
|
17
|
-
lib/antlr3/error.rb
|
18
|
-
lib/antlr3/tree.rb
|
2
|
+
lib/antlr3.rb
|
3
|
+
lib/antlr3/constants.rb
|
4
|
+
lib/antlr3/test/core-extensions.rb
|
5
|
+
lib/antlr3/test/grammar.rb
|
19
6
|
lib/antlr3/test/functional.rb
|
20
7
|
lib/antlr3/test/call-stack.rb
|
21
|
-
lib/antlr3/
|
22
|
-
lib/antlr3/
|
23
|
-
lib/antlr3/
|
24
|
-
lib/antlr3/
|
25
|
-
lib/antlr3/
|
26
|
-
lib/antlr3/template/
|
8
|
+
lib/antlr3/debug/socket.rb
|
9
|
+
lib/antlr3/debug/event-hub.rb
|
10
|
+
lib/antlr3/debug/trace-event-listener.rb
|
11
|
+
lib/antlr3/debug/rule-tracer.rb
|
12
|
+
lib/antlr3/debug/record-event-listener.rb
|
13
|
+
lib/antlr3/template/group-file-lexer.rb
|
27
14
|
lib/antlr3/template/group-file.rb
|
15
|
+
lib/antlr3/template/parameter.rb
|
28
16
|
lib/antlr3/template/group-file-parser.rb
|
29
|
-
lib/antlr3/template
|
30
|
-
lib/antlr3/tree/visitor.rb
|
31
|
-
lib/antlr3/tree/debug.rb
|
17
|
+
lib/antlr3/template.rb
|
32
18
|
lib/antlr3/tree/wizard.rb
|
19
|
+
lib/antlr3/tree/debug.rb
|
20
|
+
lib/antlr3/tree/visitor.rb
|
21
|
+
lib/antlr3/modes/ast-builder.rb
|
22
|
+
lib/antlr3/modes/filter.rb
|
23
|
+
lib/antlr3/debug.rb
|
24
|
+
lib/antlr3/main.rb
|
25
|
+
lib/antlr3/util.rb
|
33
26
|
lib/antlr3/token.rb
|
27
|
+
lib/antlr3/dfa.rb
|
28
|
+
lib/antlr3/streams.rb
|
29
|
+
lib/antlr3/error.rb
|
30
|
+
lib/antlr3/version.rb
|
31
|
+
lib/antlr3/recognizers.rb
|
32
|
+
lib/antlr3/dot.rb
|
33
|
+
lib/antlr3/profile.rb
|
34
|
+
lib/antlr3/tree.rb
|
35
|
+
lib/antlr3/streams/interactive.rb
|
36
|
+
lib/antlr3/streams/rewrite.rb
|
37
|
+
lib/antlr3/streams/unicode.rb
|
34
38
|
lib/antlr3/task.rb
|
35
|
-
|
36
|
-
|
37
|
-
|
39
|
+
test/unit/test-streams.rb
|
40
|
+
test/unit/test-template.rb
|
41
|
+
test/unit/test-unicode-stream.rb
|
38
42
|
test/unit/test-dfa.rb
|
43
|
+
test/unit/test-exceptions.rb
|
44
|
+
test/unit/test-scheme.rb
|
45
|
+
test/unit/test-tree-wizard.rb
|
46
|
+
test/unit/sample-input/teststreams.input2
|
39
47
|
test/unit/sample-input/file-stream-1
|
40
48
|
test/unit/sample-input/template-group
|
41
|
-
test/unit/sample-input/teststreams.input2
|
42
|
-
test/unit/test-tree-wizard.rb
|
43
|
-
test/unit/test-streams.rb
|
44
|
-
test/unit/test-recognizers.rb
|
45
49
|
test/unit/test-trees.rb
|
46
|
-
test/unit/test-
|
50
|
+
test/unit/test-recognizers.rb
|
47
51
|
test/unit/test-scope.rb
|
48
|
-
test/
|
49
|
-
test/
|
50
|
-
test/functional/
|
51
|
-
test/functional/lexer/xml.rb
|
52
|
+
test/functional/main/main-scripts.rb
|
53
|
+
test/functional/template-output/template-output.rb
|
54
|
+
test/functional/tree-parser/basic.rb
|
52
55
|
test/functional/lexer/properties.rb
|
53
|
-
test/functional/lexer/nuances.rb
|
54
|
-
test/functional/lexer/basic.rb
|
55
56
|
test/functional/lexer/filter-mode.rb
|
56
57
|
test/functional/lexer/syn-pred.rb
|
57
|
-
test/functional/
|
58
|
-
test/functional/
|
59
|
-
test/functional/
|
60
|
-
test/functional/
|
61
|
-
test/functional/
|
62
|
-
test/functional/
|
63
|
-
test/functional/
|
64
|
-
test/functional/ast-output/auto-ast.rb
|
65
|
-
test/functional/main/main-scripts.rb
|
66
|
-
test/functional/tree-parser/basic.rb
|
58
|
+
test/functional/lexer/basic.rb
|
59
|
+
test/functional/lexer/nuances.rb
|
60
|
+
test/functional/lexer/xml.rb
|
61
|
+
test/functional/delegation/import.rb
|
62
|
+
test/functional/parser/scopes.rb
|
63
|
+
test/functional/parser/properties.rb
|
64
|
+
test/functional/parser/basic.rb
|
67
65
|
test/functional/parser/predicates.rb
|
66
|
+
test/functional/parser/ll-star.rb
|
68
67
|
test/functional/parser/backtracking.rb
|
69
|
-
test/functional/parser/
|
68
|
+
test/functional/parser/calc.rb
|
70
69
|
test/functional/parser/nuances.rb
|
71
|
-
test/functional/parser/rule-methods.rb
|
72
|
-
test/functional/parser/basic.rb
|
73
70
|
test/functional/parser/actions.rb
|
74
|
-
test/functional/parser/
|
75
|
-
test/functional/
|
76
|
-
test/functional/
|
77
|
-
test/functional/
|
78
|
-
test/functional/token-rewrite/via-parser.rb
|
71
|
+
test/functional/parser/rule-methods.rb
|
72
|
+
test/functional/debugging/debug-mode.rb
|
73
|
+
test/functional/debugging/profile-mode.rb
|
74
|
+
test/functional/debugging/rule-tracing.rb
|
79
75
|
test/functional/token-rewrite/basic.rb
|
76
|
+
test/functional/token-rewrite/via-parser.rb
|
77
|
+
test/functional/ast-output/tree-rewrite.rb
|
78
|
+
test/functional/ast-output/construction.rb
|
79
|
+
test/functional/ast-output/rewrites.rb
|
80
|
+
test/functional/ast-output/hetero-nodes.rb
|
81
|
+
test/functional/ast-output/auto-ast.rb
|
82
|
+
templates/Ruby.stg
|
80
83
|
templates/ASTDbg.stg
|
81
84
|
templates/AST.stg
|
82
|
-
templates/Ruby.stg
|
83
85
|
templates/ST.stg
|
84
86
|
templates/Dbg.stg
|
85
|
-
templates/ASTParser.stg
|
86
87
|
templates/Support.stg
|
87
88
|
templates/ASTTreeParser.stg
|
89
|
+
templates/ASTParser.stg
|
88
90
|
samples/CPP.g
|
89
91
|
samples/ANTLRv3Grammar.g
|
90
92
|
samples/JavaScript.g
|
91
|
-
samples/standard/
|
92
|
-
samples/standard/
|
93
|
-
samples/standard/
|
94
|
-
samples/standard/
|
95
|
-
samples/standard/
|
96
|
-
samples/standard/
|
97
|
-
samples/standard/tweak/input
|
98
|
-
samples/standard/tweak/output
|
99
|
-
samples/standard/tweak/Tweak.g
|
100
|
-
samples/standard/scopes/input
|
93
|
+
samples/standard/fuzzy/FuzzyJava.g
|
94
|
+
samples/standard/fuzzy/output
|
95
|
+
samples/standard/fuzzy/input
|
96
|
+
samples/standard/fuzzy/fuzzy.rb
|
97
|
+
samples/standard/fuzzy/fuzzy.py
|
98
|
+
samples/standard/scopes/scopes.rb
|
101
99
|
samples/standard/scopes/output
|
100
|
+
samples/standard/scopes/input
|
102
101
|
samples/standard/scopes/SymbolTable.g
|
103
|
-
samples/standard/
|
102
|
+
samples/standard/LL-star/LLStar.g
|
103
|
+
samples/standard/LL-star/ll-star.rb
|
104
|
+
samples/standard/LL-star/output
|
105
|
+
samples/standard/LL-star/input
|
104
106
|
samples/standard/dynamic-scope/DynamicScopes.g
|
105
107
|
samples/standard/dynamic-scope/dynamic-scopes.rb
|
106
|
-
samples/standard/dynamic-scope/input
|
107
108
|
samples/standard/dynamic-scope/output
|
108
|
-
samples/standard/
|
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
|
109
|
+
samples/standard/dynamic-scope/input
|
127
110
|
samples/standard/java/java.rb
|
128
|
-
samples/standard/java/
|
111
|
+
samples/standard/java/Java.g
|
129
112
|
samples/standard/java/output
|
130
|
-
samples/standard/
|
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
|
113
|
+
samples/standard/java/input
|
139
114
|
samples/standard/C/C.g
|
140
|
-
samples/standard/C/c.rb
|
141
115
|
samples/standard/C/C__testrig.st
|
142
|
-
samples/standard/C/
|
143
|
-
samples/standard/C/output
|
116
|
+
samples/standard/C/c.rb
|
144
117
|
samples/standard/C/C.tokens
|
145
|
-
samples/standard/
|
146
|
-
samples/standard/
|
147
|
-
samples/standard/
|
148
|
-
samples/standard/
|
118
|
+
samples/standard/C/output
|
119
|
+
samples/standard/C/input
|
120
|
+
samples/standard/python/PythonTokenSource.rb
|
121
|
+
samples/standard/python/Python.g
|
122
|
+
samples/standard/python/output
|
123
|
+
samples/standard/python/input
|
124
|
+
samples/standard/python/python.rb
|
125
|
+
samples/standard/treeparser/Lang.g
|
126
|
+
samples/standard/treeparser/LangDumpDecl.g
|
127
|
+
samples/standard/treeparser/treeparser.rb
|
128
|
+
samples/standard/treeparser/output
|
129
|
+
samples/standard/treeparser/input
|
130
|
+
samples/standard/cminus/java.group
|
149
131
|
samples/standard/cminus/python.group
|
150
132
|
samples/standard/cminus/output
|
151
|
-
samples/standard/cminus/
|
152
|
-
samples/standard/
|
133
|
+
samples/standard/cminus/input
|
134
|
+
samples/standard/cminus/CMinus.g
|
135
|
+
samples/standard/cminus/bytecode.group
|
136
|
+
samples/standard/cminus/cminus.rb
|
137
|
+
samples/standard/calc/Calculator.rb
|
138
|
+
samples/standard/calc/Calculator.py
|
139
|
+
samples/standard/calc/Calculator.g
|
140
|
+
samples/standard/xml/README
|
141
|
+
samples/standard/xml/output
|
142
|
+
samples/standard/xml/input
|
143
|
+
samples/standard/xml/XML.g
|
144
|
+
samples/standard/xml/xml.rb
|
145
|
+
samples/standard/rakefile
|
146
|
+
samples/standard/simplecTreeParser/simplec.rb
|
153
147
|
samples/standard/simplecTreeParser/SimpleCWalker.g
|
154
|
-
samples/standard/simplecTreeParser/input
|
155
148
|
samples/standard/simplecTreeParser/output
|
156
|
-
samples/standard/simplecTreeParser/
|
157
|
-
samples/standard/
|
158
|
-
samples/standard/
|
159
|
-
samples/standard/
|
160
|
-
samples/standard/
|
161
|
-
samples/standard/
|
162
|
-
|
149
|
+
samples/standard/simplecTreeParser/input
|
150
|
+
samples/standard/simplecTreeParser/SimpleC.g
|
151
|
+
samples/standard/island-grammar/Simple.g
|
152
|
+
samples/standard/island-grammar/output
|
153
|
+
samples/standard/island-grammar/input
|
154
|
+
samples/standard/island-grammar/Javadoc.g
|
155
|
+
samples/standard/island-grammar/island.rb
|
156
|
+
samples/standard/tweak/tweak.rb
|
157
|
+
samples/standard/tweak/output
|
158
|
+
samples/standard/tweak/input
|
159
|
+
samples/standard/tweak/Tweak.g
|
160
|
+
samples/standard/hoisted-predicates/HoistedPredicates.g
|
161
|
+
samples/standard/hoisted-predicates/hoisted-predicates.rb
|
162
|
+
samples/standard/hoisted-predicates/output
|
163
|
+
samples/standard/hoisted-predicates/input
|
163
164
|
ANTLR-LICENSE.txt
|
164
165
|
History.txt
|
166
|
+
README.txt
|
165
167
|
java/antlr-full-3.2.1.jar
|
166
168
|
java/RubyTarget.java
|
167
169
|
rakefile
|
data/java/antlr-full-3.2.1.jar
CHANGED
Binary file
|
data/lib/antlr3/debug/socket.rb
CHANGED
@@ -48,7 +48,8 @@ class EventSocketProxy
|
|
48
48
|
port, host = Socket.unpack_sockaddr_in( addr )
|
49
49
|
log!( "Accepted connection from %s:%s\n", host, port )
|
50
50
|
|
51
|
-
|
51
|
+
proto_number = ( Socket::SOL_TCP rescue 6 )
|
52
|
+
@connection.setsockopt( proto_number, Socket::TCP_NODELAY, 1 )
|
52
53
|
|
53
54
|
write( 'ANTLR %s', PROTOCOL_VERSION )
|
54
55
|
write( 'grammar %p', @grammar_file_name )
|
data/lib/antlr3/dot.rb
CHANGED
@@ -67,8 +67,9 @@ module DOT
|
|
67
67
|
@__template__.result( binding )
|
68
68
|
end
|
69
69
|
end
|
70
|
+
|
70
71
|
class TreeGenerator
|
71
|
-
TREE_TEMPLATE = ERB.new( Util.tidy( <<-END ) )
|
72
|
+
TREE_TEMPLATE = ERB.new( Util.tidy( <<-END ).chomp )
|
72
73
|
| digraph {
|
73
74
|
| ordering=out;
|
74
75
|
| ranksep=.4;
|
@@ -80,11 +81,11 @@ module DOT
|
|
80
81
|
| }
|
81
82
|
END
|
82
83
|
|
83
|
-
NODE_TEMPLATE = ERB.new( Util.tidy( <<-END ) )
|
84
|
+
NODE_TEMPLATE = ERB.new( Util.tidy( <<-END ).chomp )
|
84
85
|
| <%= @name %> [label="<%= @text %>"];
|
85
86
|
END
|
86
87
|
|
87
|
-
EDGE_TEMPLATE = ERB.new( Util.tidy( <<-END ) )
|
88
|
+
EDGE_TEMPLATE = ERB.new( Util.tidy( <<-END ).chomp )
|
88
89
|
| <%= @parent %> -> <%= @child %>; // "<%= @parent_text %>" -> "<%= @child_text %>"
|
89
90
|
END
|
90
91
|
|
@@ -94,22 +95,19 @@ module DOT
|
|
94
95
|
end
|
95
96
|
|
96
97
|
def initialize
|
97
|
-
@
|
98
|
-
|
99
|
-
map[ node ] = @node_number
|
100
|
-
@node_number += 1
|
101
|
-
@node_number - 1
|
98
|
+
@node_registry = Hash.new do |map, id|
|
99
|
+
map[ id ] = map.length
|
102
100
|
end
|
103
101
|
end
|
104
102
|
|
105
103
|
def to_dot( tree, adaptor = nil, tree_template = TREE_TEMPLATE,
|
106
104
|
edge_template = EDGE_TEMPLATE )
|
107
105
|
adaptor ||= AST::CommonTreeAdaptor.new
|
108
|
-
@
|
106
|
+
@node_registry.clear
|
109
107
|
tree_template = Context.new( tree_template, :nodes => [], :edges => [] )
|
110
108
|
define_nodes( tree, adaptor, tree_template )
|
111
109
|
|
112
|
-
@
|
110
|
+
@node_registry.clear
|
113
111
|
define_edges( tree, adaptor, tree_template, edge_template )
|
114
112
|
return tree_template.to_s
|
115
113
|
end
|
@@ -117,45 +115,42 @@ module DOT
|
|
117
115
|
def define_nodes( tree, adaptor, tree_template, known_nodes = nil )
|
118
116
|
known_nodes ||= Set.new
|
119
117
|
tree.nil? and return
|
120
|
-
|
121
|
-
|
122
|
-
|
118
|
+
|
119
|
+
adaptor.empty?( tree ) and return
|
120
|
+
|
121
|
+
number = @node_registry[ tree.__id__ ]
|
123
122
|
unless known_nodes.include?( number )
|
124
|
-
parent_node_template = node_template_for( adaptor,
|
123
|
+
parent_node_template = node_template_for( adaptor, tree )
|
125
124
|
tree_template[ :nodes ] << parent_node_template
|
126
125
|
known_nodes.add( number )
|
127
126
|
end
|
128
127
|
|
129
|
-
|
130
|
-
|
131
|
-
number = @node_to_number_map[ child ]
|
128
|
+
adaptor.each_child( tree ) do | child |
|
129
|
+
number = @node_registry[ child.__id__ ]
|
132
130
|
unless known_nodes.include?( number )
|
133
131
|
node_template = node_template_for( adaptor, child )
|
134
132
|
tree_template[ :nodes ] << node_template
|
135
133
|
known_nodes.add( number )
|
136
134
|
end
|
137
|
-
|
138
|
-
define_nodes( child, adaptor, tree_template, edge_template )
|
135
|
+
define_nodes( child, adaptor, tree_template, known_nodes )
|
139
136
|
end
|
140
137
|
end
|
141
138
|
|
142
139
|
def define_edges( tree, adaptor, tree_template, edge_template )
|
143
|
-
tree.nil? or return
|
140
|
+
tree.nil? or adaptor.empty?( tree ) and return
|
144
141
|
|
145
|
-
|
146
|
-
n == 0 and return
|
147
|
-
|
148
|
-
parent_name = 'n%i' % @node_to_number_map[ tree ]
|
142
|
+
parent_name = 'n%i' % @node_registry[ tree.__id__ ]
|
149
143
|
parent_text = adaptor.text_of( tree )
|
150
|
-
|
151
|
-
|
144
|
+
|
145
|
+
adaptor.each_child( tree ) do | child |
|
152
146
|
child_text = adaptor.text_of( child )
|
153
|
-
child_name = 'n%i' % @
|
154
|
-
|
147
|
+
child_name = 'n%i' % @node_registry[ child.__id__ ]
|
148
|
+
|
149
|
+
edge = Context.new( edge_template,
|
155
150
|
:parent => parent_name, :child => child_name,
|
156
151
|
:parent_text => parent_text, :child_text => child_text
|
157
152
|
)
|
158
|
-
tree_template[ :edges ] <<
|
153
|
+
tree_template[ :edges ] << edge
|
159
154
|
define_edges( child, adaptor, tree_template, edge_template )
|
160
155
|
end
|
161
156
|
end
|
@@ -163,7 +158,7 @@ module DOT
|
|
163
158
|
def node_template_for( adaptor, tree )
|
164
159
|
text = adaptor.text_of( tree )
|
165
160
|
node_template = Context.new( NODE_TEMPLATE )
|
166
|
-
unique_name = 'n%i' % @
|
161
|
+
unique_name = 'n%i' % @node_registry[ tree.__id__ ]
|
167
162
|
node_template[ :name ] = unique_name
|
168
163
|
text and text = text.gsub( /"/, '\\"' )
|
169
164
|
node_template[ :text ] = text
|
@@ -0,0 +1,80 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
=begin ::about::
|
5
|
+
author: Kyle Yetter <kcy5b@yahoo.com>
|
6
|
+
created on: October 22, 2010
|
7
|
+
purpose: (program | library | utility script | ?)
|
8
|
+
summary:
|
9
|
+
loads: files required by this
|
10
|
+
autoloads: autoload entries in this (e.g. YAML(yaml))
|
11
|
+
=end
|
12
|
+
|
13
|
+
module ANTLR3
|
14
|
+
|
15
|
+
class UnicodeStream < StringStream
|
16
|
+
PACK_MASK = 'U*'.freeze
|
17
|
+
|
18
|
+
# creates a new StringStream object where +data+ is the string data to stream.
|
19
|
+
# accepts the following options in a symbol-to-value hash:
|
20
|
+
#
|
21
|
+
# [:file or :name] the (file) name to associate with the stream; default: <tt>'(string)'</tt>
|
22
|
+
# [:line] the initial line number; default: +1+
|
23
|
+
# [:column] the initial column number; default: +0+
|
24
|
+
#
|
25
|
+
def initialize( data, options = {} ) # for 1.8
|
26
|
+
@string = data.to_s
|
27
|
+
@string.equal?( data ) and @string = @string.clone
|
28
|
+
@string.freeze
|
29
|
+
@data = @string.unpack( PACK_MASK )
|
30
|
+
@position = options.fetch :position, 0
|
31
|
+
@line = options.fetch :line, 1
|
32
|
+
@column = options.fetch :column, 0
|
33
|
+
@markers = []
|
34
|
+
@name ||= options[ :file ] || options[ :name ] # || '(string)'
|
35
|
+
mark
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# identical to #peek, except it returns the character value as a String
|
40
|
+
#
|
41
|
+
def look( k = 1 ) # for 1.8
|
42
|
+
k == 0 and return nil
|
43
|
+
k += 1 if k < 0
|
44
|
+
|
45
|
+
index = @position + k - 1
|
46
|
+
index.between?( 0, @data.length - 1) or return nil
|
47
|
+
|
48
|
+
@data[ index, 1 ].pack( PACK_MASK )
|
49
|
+
end
|
50
|
+
|
51
|
+
#
|
52
|
+
# return a substring around the stream cursor at a distance +k+
|
53
|
+
# if <tt>k >= 0</tt>, return the next k characters
|
54
|
+
# if <tt>k < 0</tt>, return the previous <tt>|k|</tt> characters
|
55
|
+
#
|
56
|
+
def through( k )
|
57
|
+
if k >= 0 then @data[ @position, k ].pack( PACK_MASK ) else
|
58
|
+
start = ( @position + k ).at_least( 0 ) # start cannot be negative or index will wrap around
|
59
|
+
@data[ start ... @position ].pack( PACK_MASK )
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# return the string slice between position +start+ and +stop+
|
65
|
+
#
|
66
|
+
def substring( start, stop )
|
67
|
+
@data[ start, stop - start + 1 ].pack( PACK_MASK )
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
#
|
72
|
+
# identical to String#[]
|
73
|
+
#
|
74
|
+
def []( start, *args )
|
75
|
+
@data[ start, *args ].pack( PACK_MASK )
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
data/lib/antlr3/version.rb
CHANGED
data/rakefile
CHANGED
@@ -15,45 +15,46 @@ Hoe.spec "antlr3" do
|
|
15
15
|
)
|
16
16
|
|
17
17
|
self.test_globs = [
|
18
|
+
"test/unit/test-streams.rb",
|
19
|
+
"test/unit/test-template.rb",
|
20
|
+
"test/unit/test-unicode-stream.rb",
|
18
21
|
"test/unit/test-dfa.rb",
|
22
|
+
"test/unit/test-exceptions.rb",
|
23
|
+
"test/unit/test-scheme.rb",
|
19
24
|
"test/unit/test-tree-wizard.rb",
|
20
|
-
"test/unit/test-streams.rb",
|
21
|
-
"test/unit/test-recognizers.rb",
|
22
25
|
"test/unit/test-trees.rb",
|
23
|
-
"test/unit/test-
|
26
|
+
"test/unit/test-recognizers.rb",
|
24
27
|
"test/unit/test-scope.rb",
|
25
|
-
"test/
|
26
|
-
"test/
|
27
|
-
"test/functional/
|
28
|
-
"test/functional/lexer/xml.rb",
|
28
|
+
"test/functional/main/main-scripts.rb",
|
29
|
+
"test/functional/template-output/template-output.rb",
|
30
|
+
"test/functional/tree-parser/basic.rb",
|
29
31
|
"test/functional/lexer/properties.rb",
|
30
|
-
"test/functional/lexer/nuances.rb",
|
31
|
-
"test/functional/lexer/basic.rb",
|
32
32
|
"test/functional/lexer/filter-mode.rb",
|
33
33
|
"test/functional/lexer/syn-pred.rb",
|
34
|
-
"test/functional/
|
35
|
-
"test/functional/
|
36
|
-
"test/functional/
|
37
|
-
"test/functional/
|
38
|
-
"test/functional/
|
39
|
-
"test/functional/
|
40
|
-
"test/functional/
|
41
|
-
"test/functional/ast-output/auto-ast.rb",
|
42
|
-
"test/functional/main/main-scripts.rb",
|
43
|
-
"test/functional/tree-parser/basic.rb",
|
34
|
+
"test/functional/lexer/basic.rb",
|
35
|
+
"test/functional/lexer/nuances.rb",
|
36
|
+
"test/functional/lexer/xml.rb",
|
37
|
+
"test/functional/delegation/import.rb",
|
38
|
+
"test/functional/parser/scopes.rb",
|
39
|
+
"test/functional/parser/properties.rb",
|
40
|
+
"test/functional/parser/basic.rb",
|
44
41
|
"test/functional/parser/predicates.rb",
|
42
|
+
"test/functional/parser/ll-star.rb",
|
45
43
|
"test/functional/parser/backtracking.rb",
|
46
|
-
"test/functional/parser/
|
44
|
+
"test/functional/parser/calc.rb",
|
47
45
|
"test/functional/parser/nuances.rb",
|
48
|
-
"test/functional/parser/rule-methods.rb",
|
49
|
-
"test/functional/parser/basic.rb",
|
50
46
|
"test/functional/parser/actions.rb",
|
51
|
-
"test/functional/parser/
|
52
|
-
"test/functional/
|
53
|
-
"test/functional/
|
54
|
-
"test/functional/
|
47
|
+
"test/functional/parser/rule-methods.rb",
|
48
|
+
"test/functional/debugging/debug-mode.rb",
|
49
|
+
"test/functional/debugging/profile-mode.rb",
|
50
|
+
"test/functional/debugging/rule-tracing.rb",
|
51
|
+
"test/functional/token-rewrite/basic.rb",
|
55
52
|
"test/functional/token-rewrite/via-parser.rb",
|
56
|
-
"test/functional/
|
53
|
+
"test/functional/ast-output/tree-rewrite.rb",
|
54
|
+
"test/functional/ast-output/construction.rb",
|
55
|
+
"test/functional/ast-output/rewrites.rb",
|
56
|
+
"test/functional/ast-output/hetero-nodes.rb",
|
57
|
+
"test/functional/ast-output/auto-ast.rb"
|
57
58
|
]
|
58
59
|
|
59
60
|
end
|
data/templates/Ruby.stg
CHANGED
data/test/unit/test-streams.rb
CHANGED
@@ -199,8 +199,6 @@ class TestStringStream < Test::Unit::TestCase
|
|
199
199
|
end
|
200
200
|
|
201
201
|
class TestFileStream < Test::Unit::TestCase
|
202
|
-
|
203
|
-
|
204
202
|
def test_no_encoding
|
205
203
|
|
206
204
|
path = File.join(File.dirname(__FILE__), 'sample-input/file-stream-1')
|
@@ -224,20 +222,11 @@ class TestFileStream < Test::Unit::TestCase
|
|
224
222
|
@stream.peek(1).should == ?a.ord
|
225
223
|
end
|
226
224
|
|
227
|
-
def test_encoded
|
228
|
-
|
229
|
-
end
|
230
225
|
end
|
231
226
|
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
end
|
236
|
-
|
237
|
-
def test_encoded
|
238
|
-
|
239
|
-
end
|
240
|
-
end
|
227
|
+
|
228
|
+
|
229
|
+
|
241
230
|
|
242
231
|
class TestCommonTokenStream < Test::Unit::TestCase
|
243
232
|
class MockSource
|
@@ -418,43 +407,4 @@ class TestCommonTokenStream < Test::Unit::TestCase
|
|
418
407
|
end
|
419
408
|
|
420
409
|
|
421
|
-
__END__
|
422
|
-
teststreams.py | LN | STATUS
|
423
|
-
----------------------------------------------+-----+--------------
|
424
|
-
class TestStringStream(unittest.TestCase) | 009 | [x]
|
425
|
-
def testSize(self) | 012 | [x]
|
426
|
-
def testIndex(self) | 020 | [x]
|
427
|
-
def testConsume(self) | 028 | [x]
|
428
|
-
def testReset(self) | 079 | [x]
|
429
|
-
def testLA(self) | 094 | [x]
|
430
|
-
def testSubstring(self) | 111 | [x]
|
431
|
-
def testSeekForward(self) | 122 | [x]
|
432
|
-
def testMark(self) | 150 | [x]
|
433
|
-
def testReleaseLast(self) | 167 | [x]
|
434
|
-
def testReleaseNested(self) | 186 | [x]
|
435
|
-
def testRewindLast(self) | 204 | [x]
|
436
|
-
def testRewindNested(self) | 223 | [x]
|
437
|
-
class TestFileStream(unittest.TestCase) | 245 | [o]
|
438
|
-
def testNoEncoding(self) | 249 | [x]
|
439
|
-
def testEncoded(self) | 272 | [ ]
|
440
|
-
class TestInputStream(unittest.TestCase) | 296 | [ ]
|
441
|
-
def testNoEncoding(self) | 299 | [ ]
|
442
|
-
def testEncoded(self) | 322 | [ ]
|
443
|
-
class TestCommonTokenStream(unittest.TestCase)| 345 | [ ]
|
444
|
-
def setUp(self) | 348 | [x]
|
445
|
-
def testInit(self) | 369 | [x]
|
446
|
-
def testSetTokenSource(self) | 376 | [x]
|
447
|
-
def testLTEmptySource(self) | 385 | [x]
|
448
|
-
def testLT1(self) | 394 | [x]
|
449
|
-
def testLT1WithHidden(self) | 407 | [x]
|
450
|
-
def testLT2BeyondEnd(self) | 424 | [x]
|
451
|
-
def testLTNegative(self) | 442 | [x]
|
452
|
-
def testLB1(self) | 461 | [x]
|
453
|
-
def testLTZero(self) | 479 | [x]
|
454
|
-
def testLBBeyondBegin(self) | 496 | [x]
|
455
|
-
def testFillBuffer(self) | 523 | [x]
|
456
|
-
def testConsume(self) | 551 | [x]
|
457
|
-
def testSeek(self) | 579 | [x]
|
458
|
-
def testMarkRewind(self) | 604 | [x]
|
459
|
-
def testToString(self) | 631 | [x]
|
460
410
|
|
@@ -0,0 +1,186 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'antlr3'
|
5
|
+
require 'antlr3/streams/unicode'
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
require 'spec'
|
9
|
+
|
10
|
+
|
11
|
+
include ANTLR3
|
12
|
+
|
13
|
+
class TestUnicodeStream < Test::Unit::TestCase
|
14
|
+
def setup
|
15
|
+
# « a » \n 9 8 ° \n
|
16
|
+
# [ 171, 97, 187, 10, 57, 56, 176, 10]
|
17
|
+
@stream = UnicodeStream.new( "«a»\n98°\n" )
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_size
|
21
|
+
@stream.size.should == 8
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_index
|
25
|
+
@stream.index.should == 0
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_consume
|
29
|
+
@stream.consume # «
|
30
|
+
@stream.index.should == 1
|
31
|
+
@stream.column.should == 1
|
32
|
+
@stream.line.should == 1
|
33
|
+
|
34
|
+
@stream.consume # a
|
35
|
+
@stream.index.should == 2
|
36
|
+
@stream.column.should == 2
|
37
|
+
@stream.line.should == 1
|
38
|
+
|
39
|
+
@stream.consume # »
|
40
|
+
@stream.index.should == 3
|
41
|
+
@stream.column.should == 3
|
42
|
+
@stream.line.should == 1
|
43
|
+
|
44
|
+
@stream.consume # \n
|
45
|
+
@stream.index.should == 4
|
46
|
+
@stream.column.should == 0
|
47
|
+
@stream.line.should == 2
|
48
|
+
|
49
|
+
@stream.consume # 9
|
50
|
+
@stream.index.should == 5
|
51
|
+
@stream.column.should == 1
|
52
|
+
@stream.line.should == 2
|
53
|
+
|
54
|
+
@stream.consume # 8
|
55
|
+
@stream.index.should == 6
|
56
|
+
@stream.column.should == 2
|
57
|
+
@stream.line.should == 2
|
58
|
+
|
59
|
+
@stream.consume # °
|
60
|
+
@stream.index.should == 7
|
61
|
+
@stream.column.should == 3
|
62
|
+
@stream.line.should == 2
|
63
|
+
|
64
|
+
@stream.consume # \n
|
65
|
+
@stream.index.should == 8
|
66
|
+
@stream.column.should == 0
|
67
|
+
@stream.line.should == 3
|
68
|
+
|
69
|
+
@stream.consume # EOF
|
70
|
+
@stream.index.should == 8
|
71
|
+
@stream.column.should == 0
|
72
|
+
@stream.line.should == 3
|
73
|
+
|
74
|
+
@stream.consume # EOF
|
75
|
+
@stream.index.should == 8
|
76
|
+
@stream.column.should == 0
|
77
|
+
@stream.line.should == 3
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_reset
|
81
|
+
2.times { @stream.consume }
|
82
|
+
@stream.reset
|
83
|
+
@stream.index.should == 0
|
84
|
+
@stream.line.should == 1
|
85
|
+
@stream.column.should == 0
|
86
|
+
@stream.peek(1).should == 171 # code point for «
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_look
|
90
|
+
@stream.look(1).should == '«'
|
91
|
+
@stream.look(2).should == 'a'
|
92
|
+
@stream.look(3).should == "»"
|
93
|
+
@stream.peek(1).should == 171
|
94
|
+
@stream.peek(2).should == 97
|
95
|
+
@stream.peek(3).should == 187
|
96
|
+
|
97
|
+
6.times { @stream.consume }
|
98
|
+
@stream.look(1).should == '°'
|
99
|
+
@stream.look(2).should == "\n"
|
100
|
+
@stream.look(3).should be_nil
|
101
|
+
@stream.peek(1).should == 176
|
102
|
+
@stream.peek(2).should == 10
|
103
|
+
@stream.peek(3).should == EOF
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_substring
|
107
|
+
@stream.substring(0,0).should == '«'
|
108
|
+
@stream.substring(0,1).should == '«a'
|
109
|
+
@stream.substring(0,10).should == "«a»\n98°\n"
|
110
|
+
@stream.substring(3,6).should == "\n98°"
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_seek_forward
|
114
|
+
@stream.seek(4)
|
115
|
+
@stream.index.should == 4
|
116
|
+
@stream.line.should == 2
|
117
|
+
@stream.column.should == 0
|
118
|
+
@stream.peek(1).should == 57
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_mark
|
122
|
+
@stream.seek(4)
|
123
|
+
marker = @stream.mark
|
124
|
+
marker.should == 1
|
125
|
+
|
126
|
+
2.times { @stream.consume }
|
127
|
+
marker = @stream.mark
|
128
|
+
|
129
|
+
marker.should == 2
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_release_last
|
133
|
+
@stream.seek(4)
|
134
|
+
marker1 = @stream.mark
|
135
|
+
|
136
|
+
2.times { @stream.consume }
|
137
|
+
marker2 = @stream.mark
|
138
|
+
|
139
|
+
@stream.release
|
140
|
+
@stream.mark_depth.should == 2
|
141
|
+
@stream.release
|
142
|
+
@stream.mark_depth.should == 1
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_release_nested
|
146
|
+
@stream.seek(4)
|
147
|
+
marker1 = @stream.mark()
|
148
|
+
|
149
|
+
@stream.consume()
|
150
|
+
marker2 = @stream.mark()
|
151
|
+
|
152
|
+
@stream.consume()
|
153
|
+
marker3 = @stream.mark()
|
154
|
+
|
155
|
+
@stream.release(marker2)
|
156
|
+
@stream.mark_depth.should == 2
|
157
|
+
|
158
|
+
end
|
159
|
+
|
160
|
+
def test_rewind_last
|
161
|
+
@stream.seek(4)
|
162
|
+
|
163
|
+
marker = @stream.mark
|
164
|
+
@stream.consume
|
165
|
+
@stream.consume
|
166
|
+
|
167
|
+
@stream.rewind
|
168
|
+
@stream.mark_depth.should == 1
|
169
|
+
@stream.index.should == 4
|
170
|
+
@stream.line.should == 2
|
171
|
+
@stream.column.should == 0
|
172
|
+
@stream.peek(1).should == 57
|
173
|
+
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_through
|
177
|
+
@stream.through( 2 ).should == '«a'
|
178
|
+
@stream.through( -2 ).should == ''
|
179
|
+
@stream.seek( 4 )
|
180
|
+
@stream.through( 0 ).should == ''
|
181
|
+
@stream.through( 1 ).should == '9'
|
182
|
+
@stream.through( -2 ).should == "»\n"
|
183
|
+
@stream.through( 5 ).should == "98°\n"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: antlr3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 61
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 1
|
8
7
|
- 8
|
9
|
-
-
|
10
|
-
version: 1.8.
|
8
|
+
- 8
|
9
|
+
version: 1.8.8
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Kyle Yetter
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date:
|
17
|
+
date: 2011-01-10 00:00:00 -05:00
|
19
18
|
default_executable:
|
20
19
|
dependencies: []
|
21
20
|
|
@@ -62,175 +61,177 @@ extra_rdoc_files: []
|
|
62
61
|
|
63
62
|
files:
|
64
63
|
- bin/antlr4ruby
|
65
|
-
- lib/antlr3
|
66
|
-
- lib/antlr3/
|
67
|
-
- lib/antlr3/
|
68
|
-
- lib/antlr3/
|
69
|
-
- lib/antlr3/streams/rewrite.rb
|
70
|
-
- lib/antlr3/streams/interactive.rb
|
71
|
-
- lib/antlr3/debug.rb
|
72
|
-
- lib/antlr3/dot.rb
|
73
|
-
- lib/antlr3/streams.rb
|
74
|
-
- lib/antlr3/debug/record-event-listener.rb
|
75
|
-
- lib/antlr3/debug/rule-tracer.rb
|
76
|
-
- lib/antlr3/debug/socket.rb
|
77
|
-
- lib/antlr3/debug/trace-event-listener.rb
|
78
|
-
- lib/antlr3/debug/event-hub.rb
|
79
|
-
- lib/antlr3/version.rb
|
80
|
-
- lib/antlr3/error.rb
|
81
|
-
- lib/antlr3/tree.rb
|
64
|
+
- lib/antlr3.rb
|
65
|
+
- lib/antlr3/constants.rb
|
66
|
+
- lib/antlr3/test/core-extensions.rb
|
67
|
+
- lib/antlr3/test/grammar.rb
|
82
68
|
- lib/antlr3/test/functional.rb
|
83
69
|
- lib/antlr3/test/call-stack.rb
|
84
|
-
- lib/antlr3/
|
85
|
-
- lib/antlr3/
|
86
|
-
- lib/antlr3/
|
87
|
-
- lib/antlr3/
|
88
|
-
- lib/antlr3/
|
89
|
-
- lib/antlr3/template/
|
70
|
+
- lib/antlr3/debug/socket.rb
|
71
|
+
- lib/antlr3/debug/event-hub.rb
|
72
|
+
- lib/antlr3/debug/trace-event-listener.rb
|
73
|
+
- lib/antlr3/debug/rule-tracer.rb
|
74
|
+
- lib/antlr3/debug/record-event-listener.rb
|
75
|
+
- lib/antlr3/template/group-file-lexer.rb
|
90
76
|
- lib/antlr3/template/group-file.rb
|
77
|
+
- lib/antlr3/template/parameter.rb
|
91
78
|
- lib/antlr3/template/group-file-parser.rb
|
92
|
-
- lib/antlr3/template
|
93
|
-
- lib/antlr3/tree/visitor.rb
|
94
|
-
- lib/antlr3/tree/debug.rb
|
79
|
+
- lib/antlr3/template.rb
|
95
80
|
- lib/antlr3/tree/wizard.rb
|
81
|
+
- lib/antlr3/tree/debug.rb
|
82
|
+
- lib/antlr3/tree/visitor.rb
|
83
|
+
- lib/antlr3/modes/ast-builder.rb
|
84
|
+
- lib/antlr3/modes/filter.rb
|
85
|
+
- lib/antlr3/debug.rb
|
86
|
+
- lib/antlr3/main.rb
|
87
|
+
- lib/antlr3/util.rb
|
96
88
|
- lib/antlr3/token.rb
|
89
|
+
- lib/antlr3/dfa.rb
|
90
|
+
- lib/antlr3/streams.rb
|
91
|
+
- lib/antlr3/error.rb
|
92
|
+
- lib/antlr3/version.rb
|
93
|
+
- lib/antlr3/recognizers.rb
|
94
|
+
- lib/antlr3/dot.rb
|
95
|
+
- lib/antlr3/profile.rb
|
96
|
+
- lib/antlr3/tree.rb
|
97
|
+
- lib/antlr3/streams/interactive.rb
|
98
|
+
- lib/antlr3/streams/rewrite.rb
|
99
|
+
- lib/antlr3/streams/unicode.rb
|
97
100
|
- lib/antlr3/task.rb
|
98
|
-
-
|
99
|
-
-
|
100
|
-
-
|
101
|
+
- test/unit/test-streams.rb
|
102
|
+
- test/unit/test-template.rb
|
103
|
+
- test/unit/test-unicode-stream.rb
|
101
104
|
- test/unit/test-dfa.rb
|
105
|
+
- test/unit/test-exceptions.rb
|
106
|
+
- test/unit/test-scheme.rb
|
107
|
+
- test/unit/test-tree-wizard.rb
|
108
|
+
- test/unit/sample-input/teststreams.input2
|
102
109
|
- test/unit/sample-input/file-stream-1
|
103
110
|
- test/unit/sample-input/template-group
|
104
|
-
- test/unit/sample-input/teststreams.input2
|
105
|
-
- test/unit/test-tree-wizard.rb
|
106
|
-
- test/unit/test-streams.rb
|
107
|
-
- test/unit/test-recognizers.rb
|
108
111
|
- test/unit/test-trees.rb
|
109
|
-
- test/unit/test-
|
112
|
+
- test/unit/test-recognizers.rb
|
110
113
|
- test/unit/test-scope.rb
|
111
|
-
- test/
|
112
|
-
- test/
|
113
|
-
- test/functional/
|
114
|
-
- test/functional/lexer/xml.rb
|
114
|
+
- test/functional/main/main-scripts.rb
|
115
|
+
- test/functional/template-output/template-output.rb
|
116
|
+
- test/functional/tree-parser/basic.rb
|
115
117
|
- test/functional/lexer/properties.rb
|
116
|
-
- test/functional/lexer/nuances.rb
|
117
|
-
- test/functional/lexer/basic.rb
|
118
118
|
- test/functional/lexer/filter-mode.rb
|
119
119
|
- test/functional/lexer/syn-pred.rb
|
120
|
-
- test/functional/
|
121
|
-
- test/functional/
|
122
|
-
- test/functional/
|
123
|
-
- test/functional/
|
124
|
-
- test/functional/
|
125
|
-
- test/functional/
|
126
|
-
- test/functional/
|
127
|
-
- test/functional/ast-output/auto-ast.rb
|
128
|
-
- test/functional/main/main-scripts.rb
|
129
|
-
- test/functional/tree-parser/basic.rb
|
120
|
+
- test/functional/lexer/basic.rb
|
121
|
+
- test/functional/lexer/nuances.rb
|
122
|
+
- test/functional/lexer/xml.rb
|
123
|
+
- test/functional/delegation/import.rb
|
124
|
+
- test/functional/parser/scopes.rb
|
125
|
+
- test/functional/parser/properties.rb
|
126
|
+
- test/functional/parser/basic.rb
|
130
127
|
- test/functional/parser/predicates.rb
|
128
|
+
- test/functional/parser/ll-star.rb
|
131
129
|
- test/functional/parser/backtracking.rb
|
132
|
-
- test/functional/parser/
|
130
|
+
- test/functional/parser/calc.rb
|
133
131
|
- test/functional/parser/nuances.rb
|
134
|
-
- test/functional/parser/rule-methods.rb
|
135
|
-
- test/functional/parser/basic.rb
|
136
132
|
- test/functional/parser/actions.rb
|
137
|
-
- test/functional/parser/
|
138
|
-
- test/functional/
|
139
|
-
- test/functional/
|
140
|
-
- test/functional/
|
141
|
-
- test/functional/token-rewrite/via-parser.rb
|
133
|
+
- test/functional/parser/rule-methods.rb
|
134
|
+
- test/functional/debugging/debug-mode.rb
|
135
|
+
- test/functional/debugging/profile-mode.rb
|
136
|
+
- test/functional/debugging/rule-tracing.rb
|
142
137
|
- test/functional/token-rewrite/basic.rb
|
138
|
+
- test/functional/token-rewrite/via-parser.rb
|
139
|
+
- test/functional/ast-output/tree-rewrite.rb
|
140
|
+
- test/functional/ast-output/construction.rb
|
141
|
+
- test/functional/ast-output/rewrites.rb
|
142
|
+
- test/functional/ast-output/hetero-nodes.rb
|
143
|
+
- test/functional/ast-output/auto-ast.rb
|
144
|
+
- templates/Ruby.stg
|
143
145
|
- templates/ASTDbg.stg
|
144
146
|
- templates/AST.stg
|
145
|
-
- templates/Ruby.stg
|
146
147
|
- templates/ST.stg
|
147
148
|
- templates/Dbg.stg
|
148
|
-
- templates/ASTParser.stg
|
149
149
|
- templates/Support.stg
|
150
150
|
- templates/ASTTreeParser.stg
|
151
|
+
- templates/ASTParser.stg
|
151
152
|
- samples/CPP.g
|
152
153
|
- samples/ANTLRv3Grammar.g
|
153
154
|
- samples/JavaScript.g
|
154
|
-
- samples/standard/
|
155
|
-
- samples/standard/
|
156
|
-
- samples/standard/
|
157
|
-
- samples/standard/
|
158
|
-
- samples/standard/
|
159
|
-
- samples/standard/
|
160
|
-
- samples/standard/tweak/input
|
161
|
-
- samples/standard/tweak/output
|
162
|
-
- samples/standard/tweak/Tweak.g
|
163
|
-
- samples/standard/scopes/input
|
155
|
+
- samples/standard/fuzzy/FuzzyJava.g
|
156
|
+
- samples/standard/fuzzy/output
|
157
|
+
- samples/standard/fuzzy/input
|
158
|
+
- samples/standard/fuzzy/fuzzy.rb
|
159
|
+
- samples/standard/fuzzy/fuzzy.py
|
160
|
+
- samples/standard/scopes/scopes.rb
|
164
161
|
- samples/standard/scopes/output
|
162
|
+
- samples/standard/scopes/input
|
165
163
|
- samples/standard/scopes/SymbolTable.g
|
166
|
-
- samples/standard/
|
164
|
+
- samples/standard/LL-star/LLStar.g
|
165
|
+
- samples/standard/LL-star/ll-star.rb
|
166
|
+
- samples/standard/LL-star/output
|
167
|
+
- samples/standard/LL-star/input
|
167
168
|
- samples/standard/dynamic-scope/DynamicScopes.g
|
168
169
|
- samples/standard/dynamic-scope/dynamic-scopes.rb
|
169
|
-
- samples/standard/dynamic-scope/input
|
170
170
|
- samples/standard/dynamic-scope/output
|
171
|
-
- samples/standard/
|
172
|
-
- samples/standard/hoisted-predicates/HoistedPredicates.g
|
173
|
-
- samples/standard/hoisted-predicates/input
|
174
|
-
- samples/standard/hoisted-predicates/output
|
175
|
-
- samples/standard/fuzzy/fuzzy.rb
|
176
|
-
- samples/standard/fuzzy/input
|
177
|
-
- samples/standard/fuzzy/output
|
178
|
-
- samples/standard/fuzzy/FuzzyJava.g
|
179
|
-
- samples/standard/fuzzy/fuzzy.py
|
180
|
-
- samples/standard/treeparser/LangDumpDecl.g
|
181
|
-
- samples/standard/treeparser/Lang.g
|
182
|
-
- samples/standard/treeparser/treeparser.rb
|
183
|
-
- samples/standard/treeparser/input
|
184
|
-
- samples/standard/treeparser/output
|
185
|
-
- samples/standard/LL-star/LLStar.g
|
186
|
-
- samples/standard/LL-star/input
|
187
|
-
- samples/standard/LL-star/output
|
188
|
-
- samples/standard/LL-star/ll-star.rb
|
189
|
-
- samples/standard/java/Java.g
|
171
|
+
- samples/standard/dynamic-scope/input
|
190
172
|
- samples/standard/java/java.rb
|
191
|
-
- samples/standard/java/
|
173
|
+
- samples/standard/java/Java.g
|
192
174
|
- samples/standard/java/output
|
193
|
-
- samples/standard/
|
194
|
-
- samples/standard/xml/README
|
195
|
-
- samples/standard/xml/xml.rb
|
196
|
-
- samples/standard/xml/XML.g
|
197
|
-
- samples/standard/xml/input
|
198
|
-
- samples/standard/xml/output
|
199
|
-
- samples/standard/calc/Calculator.g
|
200
|
-
- samples/standard/calc/Calculator.py
|
201
|
-
- samples/standard/calc/Calculator.rb
|
175
|
+
- samples/standard/java/input
|
202
176
|
- samples/standard/C/C.g
|
203
|
-
- samples/standard/C/c.rb
|
204
177
|
- samples/standard/C/C__testrig.st
|
205
|
-
- samples/standard/C/
|
206
|
-
- samples/standard/C/output
|
178
|
+
- samples/standard/C/c.rb
|
207
179
|
- samples/standard/C/C.tokens
|
208
|
-
- samples/standard/
|
209
|
-
- samples/standard/
|
210
|
-
- samples/standard/
|
211
|
-
- samples/standard/
|
180
|
+
- samples/standard/C/output
|
181
|
+
- samples/standard/C/input
|
182
|
+
- samples/standard/python/PythonTokenSource.rb
|
183
|
+
- samples/standard/python/Python.g
|
184
|
+
- samples/standard/python/output
|
185
|
+
- samples/standard/python/input
|
186
|
+
- samples/standard/python/python.rb
|
187
|
+
- samples/standard/treeparser/Lang.g
|
188
|
+
- samples/standard/treeparser/LangDumpDecl.g
|
189
|
+
- samples/standard/treeparser/treeparser.rb
|
190
|
+
- samples/standard/treeparser/output
|
191
|
+
- samples/standard/treeparser/input
|
192
|
+
- samples/standard/cminus/java.group
|
212
193
|
- samples/standard/cminus/python.group
|
213
194
|
- samples/standard/cminus/output
|
214
|
-
- samples/standard/cminus/
|
215
|
-
- samples/standard/
|
195
|
+
- samples/standard/cminus/input
|
196
|
+
- samples/standard/cminus/CMinus.g
|
197
|
+
- samples/standard/cminus/bytecode.group
|
198
|
+
- samples/standard/cminus/cminus.rb
|
199
|
+
- samples/standard/calc/Calculator.rb
|
200
|
+
- samples/standard/calc/Calculator.py
|
201
|
+
- samples/standard/calc/Calculator.g
|
202
|
+
- samples/standard/xml/README
|
203
|
+
- samples/standard/xml/output
|
204
|
+
- samples/standard/xml/input
|
205
|
+
- samples/standard/xml/XML.g
|
206
|
+
- samples/standard/xml/xml.rb
|
207
|
+
- samples/standard/rakefile
|
208
|
+
- samples/standard/simplecTreeParser/simplec.rb
|
216
209
|
- samples/standard/simplecTreeParser/SimpleCWalker.g
|
217
|
-
- samples/standard/simplecTreeParser/input
|
218
210
|
- samples/standard/simplecTreeParser/output
|
219
|
-
- samples/standard/simplecTreeParser/
|
220
|
-
- samples/standard/
|
221
|
-
- samples/standard/
|
222
|
-
- samples/standard/
|
223
|
-
- samples/standard/
|
224
|
-
- samples/standard/
|
225
|
-
-
|
211
|
+
- samples/standard/simplecTreeParser/input
|
212
|
+
- samples/standard/simplecTreeParser/SimpleC.g
|
213
|
+
- samples/standard/island-grammar/Simple.g
|
214
|
+
- samples/standard/island-grammar/output
|
215
|
+
- samples/standard/island-grammar/input
|
216
|
+
- samples/standard/island-grammar/Javadoc.g
|
217
|
+
- samples/standard/island-grammar/island.rb
|
218
|
+
- samples/standard/tweak/tweak.rb
|
219
|
+
- samples/standard/tweak/output
|
220
|
+
- samples/standard/tweak/input
|
221
|
+
- samples/standard/tweak/Tweak.g
|
222
|
+
- samples/standard/hoisted-predicates/HoistedPredicates.g
|
223
|
+
- samples/standard/hoisted-predicates/hoisted-predicates.rb
|
224
|
+
- samples/standard/hoisted-predicates/output
|
225
|
+
- samples/standard/hoisted-predicates/input
|
226
226
|
- ANTLR-LICENSE.txt
|
227
227
|
- History.txt
|
228
|
+
- README.txt
|
228
229
|
- java/antlr-full-3.2.1.jar
|
229
230
|
- java/RubyTarget.java
|
230
231
|
- rakefile
|
231
232
|
- Manifest.txt
|
232
233
|
has_rdoc: true
|
233
|
-
homepage: http://
|
234
|
+
homepage: http://antlr.ohboyohboyohboy.org/
|
234
235
|
licenses: []
|
235
236
|
|
236
237
|
post_install_message:
|
@@ -239,69 +240,66 @@ rdoc_options: []
|
|
239
240
|
require_paths:
|
240
241
|
- lib
|
241
242
|
required_ruby_version: !ruby/object:Gem::Requirement
|
242
|
-
none: false
|
243
243
|
requirements:
|
244
244
|
- - ">="
|
245
245
|
- !ruby/object:Gem::Version
|
246
|
-
hash: 57
|
247
246
|
segments:
|
248
247
|
- 1
|
249
248
|
- 8
|
250
249
|
- 7
|
251
250
|
version: 1.8.7
|
252
251
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
253
|
-
none: false
|
254
252
|
requirements:
|
255
253
|
- - ">="
|
256
254
|
- !ruby/object:Gem::Version
|
257
|
-
hash: 3
|
258
255
|
segments:
|
259
256
|
- 0
|
260
257
|
version: "0"
|
261
258
|
requirements:
|
262
259
|
- java
|
263
260
|
rubyforge_project: antlr3
|
264
|
-
rubygems_version: 1.3.
|
261
|
+
rubygems_version: 1.3.6
|
265
262
|
signing_key:
|
266
263
|
specification_version: 3
|
267
264
|
summary: Fully-featured ruby parser generation for ANTLR version 3.
|
268
265
|
test_files:
|
266
|
+
- test/unit/test-streams.rb
|
267
|
+
- test/unit/test-template.rb
|
268
|
+
- test/unit/test-unicode-stream.rb
|
269
269
|
- test/unit/test-dfa.rb
|
270
|
+
- test/unit/test-exceptions.rb
|
271
|
+
- test/unit/test-scheme.rb
|
270
272
|
- test/unit/test-tree-wizard.rb
|
271
|
-
- test/unit/test-streams.rb
|
272
|
-
- test/unit/test-recognizers.rb
|
273
273
|
- test/unit/test-trees.rb
|
274
|
-
- test/unit/test-
|
274
|
+
- test/unit/test-recognizers.rb
|
275
275
|
- test/unit/test-scope.rb
|
276
|
-
- test/
|
277
|
-
- test/
|
278
|
-
- test/functional/
|
279
|
-
- test/functional/lexer/xml.rb
|
276
|
+
- test/functional/main/main-scripts.rb
|
277
|
+
- test/functional/template-output/template-output.rb
|
278
|
+
- test/functional/tree-parser/basic.rb
|
280
279
|
- test/functional/lexer/properties.rb
|
281
|
-
- test/functional/lexer/nuances.rb
|
282
|
-
- test/functional/lexer/basic.rb
|
283
280
|
- test/functional/lexer/filter-mode.rb
|
284
281
|
- test/functional/lexer/syn-pred.rb
|
285
|
-
- test/functional/
|
286
|
-
- test/functional/
|
287
|
-
- test/functional/
|
288
|
-
- test/functional/
|
289
|
-
- test/functional/
|
290
|
-
- test/functional/
|
291
|
-
- test/functional/
|
292
|
-
- test/functional/ast-output/auto-ast.rb
|
293
|
-
- test/functional/main/main-scripts.rb
|
294
|
-
- test/functional/tree-parser/basic.rb
|
282
|
+
- test/functional/lexer/basic.rb
|
283
|
+
- test/functional/lexer/nuances.rb
|
284
|
+
- test/functional/lexer/xml.rb
|
285
|
+
- test/functional/delegation/import.rb
|
286
|
+
- test/functional/parser/scopes.rb
|
287
|
+
- test/functional/parser/properties.rb
|
288
|
+
- test/functional/parser/basic.rb
|
295
289
|
- test/functional/parser/predicates.rb
|
290
|
+
- test/functional/parser/ll-star.rb
|
296
291
|
- test/functional/parser/backtracking.rb
|
297
|
-
- test/functional/parser/
|
292
|
+
- test/functional/parser/calc.rb
|
298
293
|
- test/functional/parser/nuances.rb
|
299
|
-
- test/functional/parser/rule-methods.rb
|
300
|
-
- test/functional/parser/basic.rb
|
301
294
|
- test/functional/parser/actions.rb
|
302
|
-
- test/functional/parser/
|
303
|
-
- test/functional/
|
304
|
-
- test/functional/
|
305
|
-
- test/functional/
|
306
|
-
- test/functional/token-rewrite/via-parser.rb
|
295
|
+
- test/functional/parser/rule-methods.rb
|
296
|
+
- test/functional/debugging/debug-mode.rb
|
297
|
+
- test/functional/debugging/profile-mode.rb
|
298
|
+
- test/functional/debugging/rule-tracing.rb
|
307
299
|
- test/functional/token-rewrite/basic.rb
|
300
|
+
- test/functional/token-rewrite/via-parser.rb
|
301
|
+
- test/functional/ast-output/tree-rewrite.rb
|
302
|
+
- test/functional/ast-output/construction.rb
|
303
|
+
- test/functional/ast-output/rewrites.rb
|
304
|
+
- test/functional/ast-output/hetero-nodes.rb
|
305
|
+
- test/functional/ast-output/auto-ast.rb
|