antlr3 1.7.5 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/java/RubyTarget.java +50 -16
  2. data/java/antlr-full-3.2.1.jar +0 -0
  3. data/lib/antlr3/streams.rb +82 -41
  4. data/lib/antlr3/template/group-file-lexer.rb +59 -59
  5. data/lib/antlr3/template/group-file-parser.rb +6 -6
  6. data/lib/antlr3/test/functional.rb +64 -36
  7. data/lib/antlr3/version.rb +2 -2
  8. data/templates/Ruby.stg +1 -1
  9. data/test/functional/ast-output/auto-ast.rb +86 -86
  10. data/test/functional/ast-output/construction.rb +14 -15
  11. data/test/functional/ast-output/hetero-nodes.rb +63 -66
  12. data/test/functional/ast-output/rewrites.rb +119 -120
  13. data/test/functional/ast-output/tree-rewrite.rb +96 -96
  14. data/test/functional/debugging/debug-mode.rb +379 -379
  15. data/test/functional/debugging/profile-mode.rb +6 -6
  16. data/test/functional/debugging/rule-tracing.rb +4 -5
  17. data/test/functional/delegation/import.rb +32 -32
  18. data/test/functional/lexer/basic.rb +27 -27
  19. data/test/functional/lexer/filter-mode.rb +6 -7
  20. data/test/functional/lexer/nuances.rb +2 -3
  21. data/test/functional/lexer/properties.rb +7 -8
  22. data/test/functional/lexer/syn-pred.rb +1 -2
  23. data/test/functional/lexer/xml.rb +3 -3
  24. data/test/functional/main/main-scripts.rb +37 -37
  25. data/test/functional/parser/actions.rb +8 -8
  26. data/test/functional/parser/backtracking.rb +1 -2
  27. data/test/functional/parser/basic.rb +10 -10
  28. data/test/functional/parser/calc.rb +9 -9
  29. data/test/functional/parser/ll-star.rb +3 -3
  30. data/test/functional/parser/nuances.rb +4 -5
  31. data/test/functional/parser/predicates.rb +3 -4
  32. data/test/functional/parser/properties.rb +14 -14
  33. data/test/functional/parser/rule-methods.rb +8 -7
  34. data/test/functional/parser/scopes.rb +15 -16
  35. data/test/functional/template-output/template-output.rb +1 -1
  36. data/test/functional/token-rewrite/basic.rb +60 -61
  37. data/test/functional/token-rewrite/via-parser.rb +3 -4
  38. data/test/functional/tree-parser/basic.rb +30 -31
  39. data/test/unit/test-streams.rb +10 -10
  40. data/test/unit/test-template.rb +1 -1
  41. metadata +2 -2
@@ -11,36 +11,36 @@ class ANTLRDebugger < Thread
11
11
  attr_accessor :events, :success, :port
12
12
  include Timeout
13
13
 
14
- def initialize(port)
14
+ def initialize( port )
15
15
  @events = []
16
16
  @success = false
17
17
  @port = port
18
18
 
19
19
  super do
20
- timeout(2) do
20
+ timeout( 2 ) do
21
21
  begin
22
- @socket = TCPSocket.open('localhost', @port)
22
+ @socket = TCPSocket.open( 'localhost', @port )
23
23
  #Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
24
24
  #@socket.connect( Socket.pack_sockaddr_in(@port, '127.0.0.1') )
25
25
  rescue Errno::ECONNREFUSED => error
26
26
  if $VERBOSE
27
- $stderr.printf(
27
+ $stderr.printf(
28
28
  "%s:%s received connection refuse error: %p\n",
29
29
  __FILE__, __LINE__, error
30
30
  )
31
- $stderr.puts("sleeping for 0.1 seconds before retrying")
31
+ $stderr.puts( "sleeping for 0.1 seconds before retrying" )
32
32
  end
33
- sleep(0.01)
33
+ sleep( 0.01 )
34
34
  retry
35
35
  end
36
36
  end
37
37
 
38
38
  @socket.readline.strip.should == 'ANTLR 2'
39
- @socket.readline.strip.start_with?('grammar "').should == true
39
+ @socket.readline.strip.start_with?( 'grammar "' ).should == true
40
40
  ack
41
41
  loop do
42
42
  event = @socket.readline.strip
43
- @events << event.split("\t")
43
+ @events << event.split( "\t" )
44
44
  ack
45
45
  break if event == 'terminate'
46
46
  end
@@ -52,7 +52,7 @@ class ANTLRDebugger < Thread
52
52
  end
53
53
 
54
54
  def ack
55
- @socket.write("ACK\n")
55
+ @socket.write( "ACK\n" )
56
56
  @socket.flush
57
57
  end
58
58
 
@@ -63,26 +63,26 @@ class TestDebugGrammars < ANTLR3::Test::Functional
63
63
 
64
64
  #include ANTLR3::Test::Diff
65
65
 
66
- def parse(grammar, rule, input, options = {})
67
- @grammar = inline_grammar(grammar)
66
+ def parse( grammar, rule, input, options = {} )
67
+ @grammar = inline_grammar( grammar )
68
68
  @grammar.compile( self.class.compile_options )
69
- @grammar_path = File.expand_path(@grammar.path)
69
+ @grammar_path = File.expand_path( @grammar.path )
70
70
  for output_file in @grammar.target_files
71
71
  self.class.import( output_file )
72
72
  end
73
- grammar_module = self.class.const_get(@grammar.name)
74
- listener = options[:listener] or debugger = ANTLRDebugger.new(port = 49100)
73
+ grammar_module = self.class.const_get( @grammar.name )
74
+ listener = options[ :listener ] or debugger = ANTLRDebugger.new( port = 49100 )
75
75
 
76
76
  begin
77
- lexer = grammar_module::Lexer.new(input)
78
- tokens = ANTLR3::CommonTokenStream.new(lexer)
79
- options[:debug_listener] = listener
80
- parser = grammar_module::Parser.new(tokens, options)
81
- parser.send(rule)
77
+ lexer = grammar_module::Lexer.new( input )
78
+ tokens = ANTLR3::CommonTokenStream.new( lexer )
79
+ options[ :debug_listener ] = listener
80
+ parser = grammar_module::Parser.new( tokens, options )
81
+ parser.send( rule )
82
82
  ensure
83
83
  if listener.nil?
84
84
  debugger.join
85
- return(debugger)
85
+ return( debugger )
86
86
  end
87
87
  end
88
88
  end
@@ -96,17 +96,17 @@ class TestDebugGrammars < ANTLR3::Test::Functional
96
96
  WS : (' '|'\n') {$channel=HIDDEN;} ;
97
97
  >
98
98
  listener = ANTLR3::Debug::RecordEventListener.new
99
- parse(grammar, :a, 'a', :listener => listener)
100
- lt_events, found = listener.events.partition { |event| event.start_with?("(look): ") }
99
+ parse( grammar, :a, 'a', :listener => listener )
100
+ lt_events, found = listener.events.partition { |event| event.start_with?( "(look): " ) }
101
101
  lt_events.should_not be_empty
102
102
 
103
- expected = ["(enter_rule): rule=a",
103
+ expected = [ "(enter_rule): rule=a",
104
104
  "(location): line=3 position=1",
105
105
  "(enter_alternative): number=1",
106
106
  "(location): line=3 position=5",
107
107
  "(location): line=3 position=8",
108
108
  "(location): line=3 position=11",
109
- "(exit_rule): rule=a"]
109
+ "(exit_rule): rule=a" ]
110
110
  found.should == expected
111
111
  end
112
112
 
@@ -118,23 +118,23 @@ class TestDebugGrammars < ANTLR3::Test::Functional
118
118
  ID : 'a'..'z'+ ; // line 4
119
119
  WS : (' '|'\n') {$channel=HIDDEN;} ;
120
120
  >
121
- debugger = parse(grammar, :a, 'a')
121
+ debugger = parse( grammar, :a, 'a' )
122
122
  debugger.success.should be_true
123
- expected = [
124
- ['enter_rule', @grammar_path, 'a'],
125
- ['location', '3', '1'],
126
- ['enter_alternative', '1'],
127
- ['location', '3', '5'],
128
- ['look', '1', '0', '4', 'default', '1', '0', '"a"'],
129
- ['look', '1', '0', '4', 'default', '1', '0', '"a"'],
130
- ['consume_token', '0', '4', 'default', '1', '0', '"a"'],
131
- ['location', '3', '8'],
132
- ['look', '1', '-1', '-1', 'default', '0', '-1', 'nil'],
133
- ['look', '1', '-1', '-1', 'default', '0', '-1', 'nil'],
134
- ['consume_token', '-1', '-1', 'default', '0', '-1', 'nil'],
135
- ['location', '3', '11'],
136
- ['exit_rule', @grammar_path, 'a'],
137
- ['terminate']
123
+ expected = [
124
+ [ 'enter_rule', @grammar_path, 'a' ],
125
+ [ 'location', '3', '1' ],
126
+ [ 'enter_alternative', '1' ],
127
+ [ 'location', '3', '5' ],
128
+ [ 'look', '1', '0', '4', 'default', '1', '0', '"a"' ],
129
+ [ 'look', '1', '0', '4', 'default', '1', '0', '"a"' ],
130
+ [ 'consume_token', '0', '4', 'default', '1', '0', '"a"' ],
131
+ [ 'location', '3', '8' ],
132
+ [ 'look', '1', '-1', '-1', 'default', '0', '-1', 'nil' ],
133
+ [ 'look', '1', '-1', '-1', 'default', '0', '-1', 'nil' ],
134
+ [ 'consume_token', '-1', '-1', 'default', '0', '-1', 'nil' ],
135
+ [ 'location', '3', '11' ],
136
+ [ 'exit_rule', @grammar_path, 'a' ],
137
+ [ 'terminate' ]
138
138
  ]
139
139
 
140
140
  debugger.events.should == expected
@@ -148,31 +148,31 @@ class TestDebugGrammars < ANTLR3::Test::Functional
148
148
  ID : 'a'..'z'+ ;
149
149
  WS : (' '|'\n') {$channel=HIDDEN;} ;
150
150
  >
151
- debugger = parse(grammar, :a, "a b")
151
+ debugger = parse( grammar, :a, "a b" )
152
152
  debugger.success.should be_true
153
153
 
154
- expected = [
155
- ["enter_rule", @grammar_path, "a"],
156
- ["location", "3", "1"],
157
- ["enter_alternative", "1"],
158
- ["location", "3", "5"],
159
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
160
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
161
- ["consume_token", "0", "4", "default", "1", "0", "\"a\""],
162
- ["consume_hidden_token", "1", "5", "hidden", "1", "1", '" "'],
163
- ["location", "3", "8"],
164
- ["look", "1", "2", "4", "default", "1", "2", "\"b\""],
165
- ["look", "1", "2", "4", "default", "1", "2", "\"b\""],
166
- ["look", "2", "-1", "-1", "default", "0", "-1", "nil"],
167
- ["look", "1", "2", "4", "default", "1", "2", "\"b\""],
168
- ["begin_resync"],
169
- ["consume_token", "2", "4", "default", "1", "2", "\"b\""],
170
- ["end_resync"],
171
- ["recognition_exception", "ANTLR3::Error::UnwantedToken", "2", "1", "2"],
172
- ["consume_token", "-1", "-1", "default", "0", "-1", "nil"],
173
- ["location", "3", "11"],
174
- ["exit_rule", @grammar_path, "a"],
175
- ["terminate"]
154
+ expected = [
155
+ [ "enter_rule", @grammar_path, "a" ],
156
+ [ "location", "3", "1" ],
157
+ [ "enter_alternative", "1" ],
158
+ [ "location", "3", "5" ],
159
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
160
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
161
+ [ "consume_token", "0", "4", "default", "1", "0", "\"a\"" ],
162
+ [ "consume_hidden_token", "1", "5", "hidden", "1", "1", '" "' ],
163
+ [ "location", "3", "8" ],
164
+ [ "look", "1", "2", "4", "default", "1", "2", "\"b\"" ],
165
+ [ "look", "1", "2", "4", "default", "1", "2", "\"b\"" ],
166
+ [ "look", "2", "-1", "-1", "default", "0", "-1", "nil" ],
167
+ [ "look", "1", "2", "4", "default", "1", "2", "\"b\"" ],
168
+ [ "begin_resync" ],
169
+ [ "consume_token", "2", "4", "default", "1", "2", "\"b\"" ],
170
+ [ "end_resync" ],
171
+ [ "recognition_exception", "ANTLR3::Error::UnwantedToken", "2", "1", "2" ],
172
+ [ "consume_token", "-1", "-1", "default", "0", "-1", "nil" ],
173
+ [ "location", "3", "11" ],
174
+ [ "exit_rule", @grammar_path, "a" ],
175
+ [ "terminate" ]
176
176
  ]
177
177
  debugger.events.should == expected
178
178
  end
@@ -186,26 +186,26 @@ class TestDebugGrammars < ANTLR3::Test::Functional
186
186
  WS : (' '|'\n') {$channel=HIDDEN;} ;
187
187
  >
188
188
 
189
- debugger = parse(grammar, :a, "a")
189
+ debugger = parse( grammar, :a, "a" )
190
190
  debugger.success.should be_true
191
191
 
192
- expected = [
193
- ["enter_rule", @grammar_path, "a"],
194
- ["location", "3", "1"],
195
- ["enter_alternative", "1"],
196
- ["location", "3", "5"],
197
- ["semantic_predicate", "true", '"true"'],
198
- ["location", "3", "13"],
199
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
200
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
201
- ["consume_token", "0", "4", "default", "1", "0", "\"a\""],
202
- ["location", "3", "16"],
203
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
204
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
205
- ["consume_token", "-1", "-1", "default", "0", "-1", "nil"],
206
- ["location", "3", "19"],
207
- ["exit_rule", @grammar_path, "a"],
208
- ["terminate"]
192
+ expected = [
193
+ [ "enter_rule", @grammar_path, "a" ],
194
+ [ "location", "3", "1" ],
195
+ [ "enter_alternative", "1" ],
196
+ [ "location", "3", "5" ],
197
+ [ "semantic_predicate", "true", '"true"' ],
198
+ [ "location", "3", "13" ],
199
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
200
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
201
+ [ "consume_token", "0", "4", "default", "1", "0", "\"a\"" ],
202
+ [ "location", "3", "16" ],
203
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
204
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
205
+ [ "consume_token", "-1", "-1", "default", "0", "-1", "nil" ],
206
+ [ "location", "3", "19" ],
207
+ [ "exit_rule", @grammar_path, "a" ],
208
+ [ "terminate" ]
209
209
  ]
210
210
  debugger.events.should == expected
211
211
  end
@@ -220,62 +220,62 @@ class TestDebugGrammars < ANTLR3::Test::Functional
220
220
  WS : (' '|'\n') {$channel=HIDDEN;} ;
221
221
  >
222
222
 
223
- debugger = parse(grammar, :a, "a 1 b c 3")
223
+ debugger = parse( grammar, :a, "a 1 b c 3" )
224
224
  debugger.success.should be_true
225
225
 
226
- expected = [
227
- ["enter_rule", @grammar_path, "a"],
228
- ["location", "3", "1"],
229
- ["enter_alternative", "1"],
230
- ["location", "3", "5"],
231
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
232
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
233
- ["consume_token", "0", "4", "default", "1", "0", "\"a\""],
234
- ["consume_hidden_token", "1", "6", "hidden", "1", "1", '" "'],
235
- ["location", "3", "8"],
236
- ["enter_subrule", "1"],
237
- ["enter_decision", "1"],
238
- ["look", "1", "2", "5", "default", "1", "2", "\"1\""],
239
- ["exit_decision", "1"],
240
- ["enter_alternative", "1"],
241
- ["location", "3", "8"],
242
- ["look", "1", "2", "5", "default", "1", "2", "\"1\""],
243
- ["consume_token", "2", "5", "default", "1", "2", "\"1\""],
244
- ["consume_hidden_token", "3", "6", "hidden", "1", "3", '" "'],
245
- ["enter_decision", "1"],
246
- ["look", "1", "4", "4", "default", "1", "4", "\"b\""],
247
- ["exit_decision", "1"],
248
- ["enter_alternative", "1"],
249
- ["location", "3", "8"],
250
- ["look", "1", "4", "4", "default", "1", "4", "\"b\""],
251
- ["consume_token", "4", "4", "default", "1", "4", "\"b\""],
252
- ["consume_hidden_token", "5", "6", "hidden", "1", "5", '" "'],
253
- ["enter_decision", "1"],
254
- ["look", "1", "6", "4", "default", "1", "6", "\"c\""],
255
- ["exit_decision", "1"],
256
- ["enter_alternative", "1"],
257
- ["location", "3", "8"],
258
- ["look", "1", "6", "4", "default", "1", "6", "\"c\""],
259
- ["consume_token", "6", "4", "default", "1", "6", "\"c\""],
260
- ["consume_hidden_token", "7", "6", "hidden", "1", "7", '" "'],
261
- ["enter_decision", "1"],
262
- ["look", "1", "8", "5", "default", "1", "8", "\"3\""],
263
- ["exit_decision", "1"],
264
- ["enter_alternative", "1"],
265
- ["location", "3", "8"],
266
- ["look", "1", "8", "5", "default", "1", "8", "\"3\""],
267
- ["consume_token", "8", "5", "default", "1", "8", "\"3\""],
268
- ["enter_decision", "1"],
269
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
270
- ["exit_decision", "1"],
271
- ["exit_subrule", "1"],
272
- ["location", "3", "22"],
273
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
274
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
275
- ["consume_token", "-1", "-1", "default", "0", "-1", "nil"],
276
- ["location", "3", "25"],
277
- ["exit_rule", @grammar_path, "a"],
278
- ["terminate"]
226
+ expected = [
227
+ [ "enter_rule", @grammar_path, "a" ],
228
+ [ "location", "3", "1" ],
229
+ [ "enter_alternative", "1" ],
230
+ [ "location", "3", "5" ],
231
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
232
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
233
+ [ "consume_token", "0", "4", "default", "1", "0", "\"a\"" ],
234
+ [ "consume_hidden_token", "1", "6", "hidden", "1", "1", '" "' ],
235
+ [ "location", "3", "8" ],
236
+ [ "enter_subrule", "1" ],
237
+ [ "enter_decision", "1" ],
238
+ [ "look", "1", "2", "5", "default", "1", "2", "\"1\"" ],
239
+ [ "exit_decision", "1" ],
240
+ [ "enter_alternative", "1" ],
241
+ [ "location", "3", "8" ],
242
+ [ "look", "1", "2", "5", "default", "1", "2", "\"1\"" ],
243
+ [ "consume_token", "2", "5", "default", "1", "2", "\"1\"" ],
244
+ [ "consume_hidden_token", "3", "6", "hidden", "1", "3", '" "' ],
245
+ [ "enter_decision", "1" ],
246
+ [ "look", "1", "4", "4", "default", "1", "4", "\"b\"" ],
247
+ [ "exit_decision", "1" ],
248
+ [ "enter_alternative", "1" ],
249
+ [ "location", "3", "8" ],
250
+ [ "look", "1", "4", "4", "default", "1", "4", "\"b\"" ],
251
+ [ "consume_token", "4", "4", "default", "1", "4", "\"b\"" ],
252
+ [ "consume_hidden_token", "5", "6", "hidden", "1", "5", '" "' ],
253
+ [ "enter_decision", "1" ],
254
+ [ "look", "1", "6", "4", "default", "1", "6", "\"c\"" ],
255
+ [ "exit_decision", "1" ],
256
+ [ "enter_alternative", "1" ],
257
+ [ "location", "3", "8" ],
258
+ [ "look", "1", "6", "4", "default", "1", "6", "\"c\"" ],
259
+ [ "consume_token", "6", "4", "default", "1", "6", "\"c\"" ],
260
+ [ "consume_hidden_token", "7", "6", "hidden", "1", "7", '" "' ],
261
+ [ "enter_decision", "1" ],
262
+ [ "look", "1", "8", "5", "default", "1", "8", "\"3\"" ],
263
+ [ "exit_decision", "1" ],
264
+ [ "enter_alternative", "1" ],
265
+ [ "location", "3", "8" ],
266
+ [ "look", "1", "8", "5", "default", "1", "8", "\"3\"" ],
267
+ [ "consume_token", "8", "5", "default", "1", "8", "\"3\"" ],
268
+ [ "enter_decision", "1" ],
269
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
270
+ [ "exit_decision", "1" ],
271
+ [ "exit_subrule", "1" ],
272
+ [ "location", "3", "22" ],
273
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
274
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
275
+ [ "consume_token", "-1", "-1", "default", "0", "-1", "nil" ],
276
+ [ "location", "3", "25" ],
277
+ [ "exit_rule", @grammar_path, "a" ],
278
+ [ "terminate" ]
279
279
  ]
280
280
 
281
281
  debugger.events.should == expected
@@ -291,62 +291,62 @@ class TestDebugGrammars < ANTLR3::Test::Functional
291
291
  WS : (' '|'\n') {$channel=HIDDEN;} ;
292
292
  >
293
293
 
294
- debugger = parse(grammar, :a, "a 1 b c 3")
294
+ debugger = parse( grammar, :a, "a 1 b c 3" )
295
295
  debugger.success.should be_true
296
296
 
297
- expected = [
298
- ["enter_rule", @grammar_path, "a"],
299
- ["location", "3", "1"],
300
- ["enter_alternative", "1"],
301
- ["location", "3", "5"],
302
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
303
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
304
- ["consume_token", "0", "4", "default", "1", "0", "\"a\""],
305
- ["consume_hidden_token", "1", "6", "hidden", "1", "1", '" "'],
306
- ["location", "3", "8"],
307
- ["enter_subrule", "1"],
308
- ["enter_decision", "1"],
309
- ["look", "1", "2", "5", "default", "1", "2", "\"1\""],
310
- ["exit_decision", "1"],
311
- ["enter_alternative", "1"],
312
- ["location", "3", "8"],
313
- ["look", "1", "2", "5", "default", "1", "2", "\"1\""],
314
- ["consume_token", "2", "5", "default", "1", "2", "\"1\""],
315
- ["consume_hidden_token", "3", "6", "hidden", "1", "3", '" "'],
316
- ["enter_decision", "1"],
317
- ["look", "1", "4", "4", "default", "1", "4", "\"b\""],
318
- ["exit_decision", "1"],
319
- ["enter_alternative", "1"],
320
- ["location", "3", "8"],
321
- ["look", "1", "4", "4", "default", "1", "4", "\"b\""],
322
- ["consume_token", "4", "4", "default", "1", "4", "\"b\""],
323
- ["consume_hidden_token", "5", "6", "hidden", "1", "5", '" "'],
324
- ["enter_decision", "1"],
325
- ["look", "1", "6", "4", "default", "1", "6", "\"c\""],
326
- ["exit_decision", "1"],
327
- ["enter_alternative", "1"],
328
- ["location", "3", "8"],
329
- ["look", "1", "6", "4", "default", "1", "6", "\"c\""],
330
- ["consume_token", "6", "4", "default", "1", "6", "\"c\""],
331
- ["consume_hidden_token", "7", "6", "hidden", "1", "7", '" "'],
332
- ["enter_decision", "1"],
333
- ["look", "1", "8", "5", "default", "1", "8", "\"3\""],
334
- ["exit_decision", "1"],
335
- ["enter_alternative", "1"],
336
- ["location", "3", "8"],
337
- ["look", "1", "8", "5", "default", "1", "8", "\"3\""],
338
- ["consume_token", "8", "5", "default", "1", "8", "\"3\""],
339
- ["enter_decision", "1"],
340
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
341
- ["exit_decision", "1"],
342
- ["exit_subrule", "1"],
343
- ["location", "3", "22"],
344
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
345
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
346
- ["consume_token", "-1", "-1", "default", "0", "-1", "nil"],
347
- ["location", "3", "25"],
348
- ["exit_rule", @grammar_path, "a"],
349
- ["terminate"]
297
+ expected = [
298
+ [ "enter_rule", @grammar_path, "a" ],
299
+ [ "location", "3", "1" ],
300
+ [ "enter_alternative", "1" ],
301
+ [ "location", "3", "5" ],
302
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
303
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
304
+ [ "consume_token", "0", "4", "default", "1", "0", "\"a\"" ],
305
+ [ "consume_hidden_token", "1", "6", "hidden", "1", "1", '" "' ],
306
+ [ "location", "3", "8" ],
307
+ [ "enter_subrule", "1" ],
308
+ [ "enter_decision", "1" ],
309
+ [ "look", "1", "2", "5", "default", "1", "2", "\"1\"" ],
310
+ [ "exit_decision", "1" ],
311
+ [ "enter_alternative", "1" ],
312
+ [ "location", "3", "8" ],
313
+ [ "look", "1", "2", "5", "default", "1", "2", "\"1\"" ],
314
+ [ "consume_token", "2", "5", "default", "1", "2", "\"1\"" ],
315
+ [ "consume_hidden_token", "3", "6", "hidden", "1", "3", '" "' ],
316
+ [ "enter_decision", "1" ],
317
+ [ "look", "1", "4", "4", "default", "1", "4", "\"b\"" ],
318
+ [ "exit_decision", "1" ],
319
+ [ "enter_alternative", "1" ],
320
+ [ "location", "3", "8" ],
321
+ [ "look", "1", "4", "4", "default", "1", "4", "\"b\"" ],
322
+ [ "consume_token", "4", "4", "default", "1", "4", "\"b\"" ],
323
+ [ "consume_hidden_token", "5", "6", "hidden", "1", "5", '" "' ],
324
+ [ "enter_decision", "1" ],
325
+ [ "look", "1", "6", "4", "default", "1", "6", "\"c\"" ],
326
+ [ "exit_decision", "1" ],
327
+ [ "enter_alternative", "1" ],
328
+ [ "location", "3", "8" ],
329
+ [ "look", "1", "6", "4", "default", "1", "6", "\"c\"" ],
330
+ [ "consume_token", "6", "4", "default", "1", "6", "\"c\"" ],
331
+ [ "consume_hidden_token", "7", "6", "hidden", "1", "7", '" "' ],
332
+ [ "enter_decision", "1" ],
333
+ [ "look", "1", "8", "5", "default", "1", "8", "\"3\"" ],
334
+ [ "exit_decision", "1" ],
335
+ [ "enter_alternative", "1" ],
336
+ [ "location", "3", "8" ],
337
+ [ "look", "1", "8", "5", "default", "1", "8", "\"3\"" ],
338
+ [ "consume_token", "8", "5", "default", "1", "8", "\"3\"" ],
339
+ [ "enter_decision", "1" ],
340
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
341
+ [ "exit_decision", "1" ],
342
+ [ "exit_subrule", "1" ],
343
+ [ "location", "3", "22" ],
344
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
345
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
346
+ [ "consume_token", "-1", "-1", "default", "0", "-1", "nil" ],
347
+ [ "location", "3", "25" ],
348
+ [ "exit_rule", @grammar_path, "a" ],
349
+ [ "terminate" ]
350
350
  ]
351
351
  debugger.events.should == expected
352
352
  end
@@ -361,28 +361,28 @@ class TestDebugGrammars < ANTLR3::Test::Functional
361
361
  WS : (' '|'\n') {$channel=HIDDEN;} ;
362
362
  >
363
363
 
364
- debugger = parse(grammar, :a, "a")
364
+ debugger = parse( grammar, :a, "a" )
365
365
  debugger.success.should be_true
366
366
 
367
- expected = [
368
- ["enter_rule", @grammar_path, "a"],
369
- ["location", "3", "1"],
370
- ["enter_alternative", "1"],
371
- ["location", "3", "5"],
372
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
373
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
374
- ["consume_token", "0", "4", "default", "1", "0", "\"a\""],
375
- ["location", "3", "8"],
376
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
377
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
378
- ["recognition_exception", "ANTLR3::Error::MismatchedSet", "1", "0", "-1"],
379
- ["recognition_exception", "ANTLR3::Error::MismatchedSet", "1", "0", "-1"],
380
- ["begin_resync"],
381
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
382
- ["end_resync"],
383
- ["location", "3", "24"],
384
- ["exit_rule", @grammar_path, "a"],
385
- ["terminate"]
367
+ expected = [
368
+ [ "enter_rule", @grammar_path, "a" ],
369
+ [ "location", "3", "1" ],
370
+ [ "enter_alternative", "1" ],
371
+ [ "location", "3", "5" ],
372
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
373
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
374
+ [ "consume_token", "0", "4", "default", "1", "0", "\"a\"" ],
375
+ [ "location", "3", "8" ],
376
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
377
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
378
+ [ "recognition_exception", "ANTLR3::Error::MismatchedSet", "1", "0", "-1" ],
379
+ [ "recognition_exception", "ANTLR3::Error::MismatchedSet", "1", "0", "-1" ],
380
+ [ "begin_resync" ],
381
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
382
+ [ "end_resync" ],
383
+ [ "location", "3", "24" ],
384
+ [ "exit_rule", @grammar_path, "a" ],
385
+ [ "terminate" ]
386
386
  ]
387
387
 
388
388
  debugger.events.should == expected
@@ -400,42 +400,42 @@ class TestDebugGrammars < ANTLR3::Test::Functional
400
400
  WS : (' '|'\n') {$channel=HIDDEN;} ;
401
401
  >
402
402
 
403
- debugger = parse(grammar, :a, "a 1")
403
+ debugger = parse( grammar, :a, "a 1" )
404
404
  debugger.success.should be_true
405
405
 
406
- expected = [
407
- ["enter_rule", @grammar_path, "a"],
408
- ["location", "3", "1"],
409
- ["enter_alternative", "1"],
410
- ["location", "3", "5"],
411
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
412
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
413
- ["consume_token", "0", "4", "default", "1", "0", "\"a\""],
414
- ["consume_hidden_token", "1", "6", "hidden", "1", "1", '" "'],
415
- ["location", "3", "8"],
416
- ["enter_subrule", "1"],
417
- ["enter_decision", "1"],
418
- ["look", "1", "2", "5", "default", "1", "2", "\"1\""],
419
- ["exit_decision", "1"],
420
- ["enter_alternative", "2"],
421
- ["location", "3", "14"],
422
- ["enter_rule", @grammar_path, "c"],
423
- ["location", "5", "1"],
424
- ["enter_alternative", "1"],
425
- ["location", "5", "5"],
426
- ["look", "1", "2", "5", "default", "1", "2", "\"1\""],
427
- ["look", "1", "2", "5", "default", "1", "2", "\"1\""],
428
- ["consume_token", "2", "5", "default", "1", "2", "\"1\""],
429
- ["location", "5", "8"],
430
- ["exit_rule", @grammar_path, "c"],
431
- ["exit_subrule", "1"],
432
- ["location", "3", "18"],
433
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
434
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
435
- ["consume_token", "-1", "-1", "default", "0", "-1", "nil"],
436
- ["location", "3", "21"],
437
- ["exit_rule", @grammar_path, "a"],
438
- ["terminate"]
406
+ expected = [
407
+ [ "enter_rule", @grammar_path, "a" ],
408
+ [ "location", "3", "1" ],
409
+ [ "enter_alternative", "1" ],
410
+ [ "location", "3", "5" ],
411
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
412
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
413
+ [ "consume_token", "0", "4", "default", "1", "0", "\"a\"" ],
414
+ [ "consume_hidden_token", "1", "6", "hidden", "1", "1", '" "' ],
415
+ [ "location", "3", "8" ],
416
+ [ "enter_subrule", "1" ],
417
+ [ "enter_decision", "1" ],
418
+ [ "look", "1", "2", "5", "default", "1", "2", "\"1\"" ],
419
+ [ "exit_decision", "1" ],
420
+ [ "enter_alternative", "2" ],
421
+ [ "location", "3", "14" ],
422
+ [ "enter_rule", @grammar_path, "c" ],
423
+ [ "location", "5", "1" ],
424
+ [ "enter_alternative", "1" ],
425
+ [ "location", "5", "5" ],
426
+ [ "look", "1", "2", "5", "default", "1", "2", "\"1\"" ],
427
+ [ "look", "1", "2", "5", "default", "1", "2", "\"1\"" ],
428
+ [ "consume_token", "2", "5", "default", "1", "2", "\"1\"" ],
429
+ [ "location", "5", "8" ],
430
+ [ "exit_rule", @grammar_path, "c" ],
431
+ [ "exit_subrule", "1" ],
432
+ [ "location", "3", "18" ],
433
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
434
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
435
+ [ "consume_token", "-1", "-1", "default", "0", "-1", "nil" ],
436
+ [ "location", "3", "21" ],
437
+ [ "exit_rule", @grammar_path, "a" ],
438
+ [ "terminate" ]
439
439
  ]
440
440
  debugger.events.should == expected
441
441
  end
@@ -453,35 +453,35 @@ class TestDebugGrammars < ANTLR3::Test::Functional
453
453
  WS : (' '|'\n') {$channel=HIDDEN;} ;
454
454
  >
455
455
 
456
- debugger = parse(grammar, :a, "a !")
456
+ debugger = parse( grammar, :a, "a !" )
457
457
  debugger.success.should be_true
458
458
 
459
- expected = [
460
- ["enter_rule", @grammar_path, "a"],
461
- ["location", "3", "1"],
462
- ["enter_alternative", "1"],
463
- ["location", "3", "5"],
464
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
465
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
466
- ["consume_token", "0", "4", "default", "1", "0", "\"a\""],
467
- ["consume_hidden_token", "1", "7", "hidden", "1", "1", '" "'],
468
- ["location", "3", "8"],
469
- ["enter_subrule", "1"],
470
- ["enter_decision", "1"],
471
- ["look", "1", "2", "6", "default", "1", "2", "\"!\""],
472
- ["look", "1", "2", "6", "default", "1", "2", "\"!\""],
473
- ["recognition_exception", "ANTLR3::Error::NoViableAlternative", "2", "1", "2"],
474
- ["exit_decision", "1"],
475
- ["exit_subrule", "1"],
476
- ["recognition_exception", "ANTLR3::Error::NoViableAlternative", "2", "1", "2"],
477
- ["begin_resync"],
478
- ["look", "1", "2", "6", "default", "1", "2", "\"!\""],
479
- ["consume_token", "2", "6", "default", "1", "2", "\"!\""],
480
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
481
- ["end_resync"],
482
- ["location", "3", "21"],
483
- ["exit_rule", @grammar_path, "a"],
484
- ["terminate"]
459
+ expected = [
460
+ [ "enter_rule", @grammar_path, "a" ],
461
+ [ "location", "3", "1" ],
462
+ [ "enter_alternative", "1" ],
463
+ [ "location", "3", "5" ],
464
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
465
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
466
+ [ "consume_token", "0", "4", "default", "1", "0", "\"a\"" ],
467
+ [ "consume_hidden_token", "1", "7", "hidden", "1", "1", '" "' ],
468
+ [ "location", "3", "8" ],
469
+ [ "enter_subrule", "1" ],
470
+ [ "enter_decision", "1" ],
471
+ [ "look", "1", "2", "6", "default", "1", "2", "\"!\"" ],
472
+ [ "look", "1", "2", "6", "default", "1", "2", "\"!\"" ],
473
+ [ "recognition_exception", "ANTLR3::Error::NoViableAlternative", "2", "1", "2" ],
474
+ [ "exit_decision", "1" ],
475
+ [ "exit_subrule", "1" ],
476
+ [ "recognition_exception", "ANTLR3::Error::NoViableAlternative", "2", "1", "2" ],
477
+ [ "begin_resync" ],
478
+ [ "look", "1", "2", "6", "default", "1", "2", "\"!\"" ],
479
+ [ "consume_token", "2", "6", "default", "1", "2", "\"!\"" ],
480
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
481
+ [ "end_resync" ],
482
+ [ "location", "3", "21" ],
483
+ [ "exit_rule", @grammar_path, "a" ],
484
+ [ "terminate" ]
485
485
  ]
486
486
  debugger.events.should == expected
487
487
  end
@@ -498,29 +498,29 @@ class TestDebugGrammars < ANTLR3::Test::Functional
498
498
  WS : (' '|'\n') {$channel=HIDDEN;} ;
499
499
  >
500
500
 
501
- debugger = parse(grammar, :a, "1")
501
+ debugger = parse( grammar, :a, "1" )
502
502
  debugger.success.should be_true
503
503
 
504
- expected = [
505
- ["enter_rule", @grammar_path, "a"],
506
- ["location", "3", "1"],
507
- ["enter_decision", "1"],
508
- ["look", "1", "0", "5", "default", "1", "0", "\"1\""],
509
- ["exit_decision", "1"],
510
- ["enter_alternative", "2"],
511
- ["location", "3", "9"],
512
- ["enter_rule", @grammar_path, "c"],
513
- ["location", "5", "1"],
514
- ["enter_alternative", "1"],
515
- ["location", "5", "5"],
516
- ["look", "1", "0", "5", "default", "1", "0", "\"1\""],
517
- ["look", "1", "0", "5", "default", "1", "0", "\"1\""],
518
- ["consume_token", "0", "5", "default", "1", "0", "\"1\""],
519
- ["location", "5", "8"],
520
- ["exit_rule", @grammar_path, "c"],
521
- ["location", "3", "10"],
522
- ["exit_rule", @grammar_path, "a"],
523
- ["terminate"]
504
+ expected = [
505
+ [ "enter_rule", @grammar_path, "a" ],
506
+ [ "location", "3", "1" ],
507
+ [ "enter_decision", "1" ],
508
+ [ "look", "1", "0", "5", "default", "1", "0", "\"1\"" ],
509
+ [ "exit_decision", "1" ],
510
+ [ "enter_alternative", "2" ],
511
+ [ "location", "3", "9" ],
512
+ [ "enter_rule", @grammar_path, "c" ],
513
+ [ "location", "5", "1" ],
514
+ [ "enter_alternative", "1" ],
515
+ [ "location", "5", "5" ],
516
+ [ "look", "1", "0", "5", "default", "1", "0", "\"1\"" ],
517
+ [ "look", "1", "0", "5", "default", "1", "0", "\"1\"" ],
518
+ [ "consume_token", "0", "5", "default", "1", "0", "\"1\"" ],
519
+ [ "location", "5", "8" ],
520
+ [ "exit_rule", @grammar_path, "c" ],
521
+ [ "location", "3", "10" ],
522
+ [ "exit_rule", @grammar_path, "a" ],
523
+ [ "terminate" ]
524
524
  ]
525
525
 
526
526
  debugger.events.should == expected
@@ -537,26 +537,26 @@ class TestDebugGrammars < ANTLR3::Test::Functional
537
537
  WS : (' '|'\n') {$channel=HIDDEN;} ;
538
538
  >
539
539
 
540
- debugger = parse(grammar, :a, "a")
540
+ debugger = parse( grammar, :a, "a" )
541
541
  debugger.success.should be_true
542
542
 
543
- expected = [
544
- ["enter_rule", @grammar_path, "a"],
545
- ["location", "3", "1"],
546
- ["enter_alternative", "1"],
547
- ["location", "3", "5"],
548
- ["enter_rule", @grammar_path, "b"],
549
- ["location", "4", "1"],
550
- ["enter_alternative", "1"],
551
- ["location", "4", "5"],
552
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
553
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
554
- ["consume_token", "0", "4", "default", "1", "0", "\"a\""],
555
- ["location", "4", "7"],
556
- ["exit_rule", @grammar_path, "b"],
557
- ["location", "3", "6"],
558
- ["exit_rule", @grammar_path, "a"],
559
- ["terminate"]
543
+ expected = [
544
+ [ "enter_rule", @grammar_path, "a" ],
545
+ [ "location", "3", "1" ],
546
+ [ "enter_alternative", "1" ],
547
+ [ "location", "3", "5" ],
548
+ [ "enter_rule", @grammar_path, "b" ],
549
+ [ "location", "4", "1" ],
550
+ [ "enter_alternative", "1" ],
551
+ [ "location", "4", "5" ],
552
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
553
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
554
+ [ "consume_token", "0", "4", "default", "1", "0", "\"a\"" ],
555
+ [ "location", "4", "7" ],
556
+ [ "exit_rule", @grammar_path, "b" ],
557
+ [ "location", "3", "6" ],
558
+ [ "exit_rule", @grammar_path, "a" ],
559
+ [ "terminate" ]
560
560
  ]
561
561
 
562
562
  debugger.events.should == expected
@@ -573,28 +573,28 @@ class TestDebugGrammars < ANTLR3::Test::Functional
573
573
  WS : (' '|'\n') {$channel=HIDDEN;} ;
574
574
  >
575
575
 
576
- debugger = parse(grammar, :a, "a")
576
+ debugger = parse( grammar, :a, "a" )
577
577
  debugger.success.should be_true
578
578
 
579
- expected = [
580
- ["enter_rule", @grammar_path, "a"],
581
- ["location", "3", "1"],
582
- ["enter_alternative", "1"],
583
- ["location", "3", "5"],
584
- ["enter_alternative", "1"],
585
- ["location", "3", "7"],
586
- ["enter_rule", @grammar_path, "b"],
587
- ["location", "4", "1"],
588
- ["enter_alternative", "1"],
589
- ["location", "4", "5"],
590
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
591
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
592
- ["consume_token", "0", "4", "default", "1", "0", "\"a\""],
593
- ["location", "4", "7"],
594
- ["exit_rule", @grammar_path, "b"],
595
- ["location", "3", "10"],
596
- ["exit_rule", @grammar_path, "a"],
597
- ["terminate"]
579
+ expected = [
580
+ [ "enter_rule", @grammar_path, "a" ],
581
+ [ "location", "3", "1" ],
582
+ [ "enter_alternative", "1" ],
583
+ [ "location", "3", "5" ],
584
+ [ "enter_alternative", "1" ],
585
+ [ "location", "3", "7" ],
586
+ [ "enter_rule", @grammar_path, "b" ],
587
+ [ "location", "4", "1" ],
588
+ [ "enter_alternative", "1" ],
589
+ [ "location", "4", "5" ],
590
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
591
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
592
+ [ "consume_token", "0", "4", "default", "1", "0", "\"a\"" ],
593
+ [ "location", "4", "7" ],
594
+ [ "exit_rule", @grammar_path, "b" ],
595
+ [ "location", "3", "10" ],
596
+ [ "exit_rule", @grammar_path, "a" ],
597
+ [ "terminate" ]
598
598
  ]
599
599
  debugger.events.should == expected
600
600
  end
@@ -612,56 +612,56 @@ class TestDebugGrammars < ANTLR3::Test::Functional
612
612
  WS : (' '|'\n') {$channel=HIDDEN;} ;
613
613
  >
614
614
 
615
- debugger = parse(grammar, :a, "a!")
615
+ debugger = parse( grammar, :a, "a!" )
616
616
  debugger.success.should be_true
617
617
 
618
- expected = [
619
- ["enter_rule", @grammar_path, "a"],
620
- ["location", "3", "1"],
621
- ["enter_alternative", "1"],
622
- ["location", "3", "5"],
623
- ["enter_subrule", "1"],
624
- ["enter_decision", "1"],
625
- ["mark", "0"],
626
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
627
- ["consume_token", "0", "4", "default", "1", "0", "\"a\""],
628
- ["look", "1", "1", "6", "default", "1", "1", "\"!\""],
629
- ["consume_token", "1", "6", "default", "1", "1", "\"!\""],
630
- ["rewind", "0"],
631
- ["exit_decision", "1"],
632
- ["enter_alternative", "2"],
633
- ["location", "3", "11"],
634
- ["enter_rule", @grammar_path, "c"],
635
- ["location", "5", "1"],
636
- ["enter_alternative", "1"],
637
- ["location", "5", "5"],
638
- ["enter_subrule", "3"],
639
- ["enter_decision", "3"],
640
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
641
- ["exit_decision", "3"],
642
- ["enter_alternative", "1"],
643
- ["location", "5", "5"],
644
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
645
- ["look", "1", "0", "4", "default", "1", "0", "\"a\""],
646
- ["consume_token", "0", "4", "default", "1", "0", "\"a\""],
647
- ["enter_decision", "3"],
648
- ["look", "1", "1", "6", "default", "1", "1", "\"!\""],
649
- ["exit_decision", "3"],
650
- ["exit_subrule", "3"],
651
- ["location", "5", "9"],
652
- ["look", "1", "1", "6", "default", "1", "1", "\"!\""],
653
- ["look", "1", "1", "6", "default", "1", "1", "\"!\""],
654
- ["consume_token", "1", "6", "default", "1", "1", "\"!\""],
655
- ["location", "5", "13"],
656
- ["exit_rule", @grammar_path, "c"],
657
- ["exit_subrule", "1"],
658
- ["location", "3", "15"],
659
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
660
- ["look", "1", "-1", "-1", "default", "0", "-1", "nil"],
661
- ["consume_token", "-1", "-1", "default", "0", "-1", "nil"],
662
- ["location", "3", "18"],
663
- ["exit_rule", @grammar_path, "a"],
664
- ["terminate"]
618
+ expected = [
619
+ [ "enter_rule", @grammar_path, "a" ],
620
+ [ "location", "3", "1" ],
621
+ [ "enter_alternative", "1" ],
622
+ [ "location", "3", "5" ],
623
+ [ "enter_subrule", "1" ],
624
+ [ "enter_decision", "1" ],
625
+ [ "mark", "0" ],
626
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
627
+ [ "consume_token", "0", "4", "default", "1", "0", "\"a\"" ],
628
+ [ "look", "1", "1", "6", "default", "1", "1", "\"!\"" ],
629
+ [ "consume_token", "1", "6", "default", "1", "1", "\"!\"" ],
630
+ [ "rewind", "0" ],
631
+ [ "exit_decision", "1" ],
632
+ [ "enter_alternative", "2" ],
633
+ [ "location", "3", "11" ],
634
+ [ "enter_rule", @grammar_path, "c" ],
635
+ [ "location", "5", "1" ],
636
+ [ "enter_alternative", "1" ],
637
+ [ "location", "5", "5" ],
638
+ [ "enter_subrule", "3" ],
639
+ [ "enter_decision", "3" ],
640
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
641
+ [ "exit_decision", "3" ],
642
+ [ "enter_alternative", "1" ],
643
+ [ "location", "5", "5" ],
644
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
645
+ [ "look", "1", "0", "4", "default", "1", "0", "\"a\"" ],
646
+ [ "consume_token", "0", "4", "default", "1", "0", "\"a\"" ],
647
+ [ "enter_decision", "3" ],
648
+ [ "look", "1", "1", "6", "default", "1", "1", "\"!\"" ],
649
+ [ "exit_decision", "3" ],
650
+ [ "exit_subrule", "3" ],
651
+ [ "location", "5", "9" ],
652
+ [ "look", "1", "1", "6", "default", "1", "1", "\"!\"" ],
653
+ [ "look", "1", "1", "6", "default", "1", "1", "\"!\"" ],
654
+ [ "consume_token", "1", "6", "default", "1", "1", "\"!\"" ],
655
+ [ "location", "5", "13" ],
656
+ [ "exit_rule", @grammar_path, "c" ],
657
+ [ "exit_subrule", "1" ],
658
+ [ "location", "3", "15" ],
659
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
660
+ [ "look", "1", "-1", "-1", "default", "0", "-1", "nil" ],
661
+ [ "consume_token", "-1", "-1", "default", "0", "-1", "nil" ],
662
+ [ "location", "3", "18" ],
663
+ [ "exit_rule", @grammar_path, "a" ],
664
+ [ "terminate" ]
665
665
  ]
666
666
  debugger.events.should == expected
667
667
  end
@@ -682,7 +682,7 @@ class TestDebugGrammars < ANTLR3::Test::Functional
682
682
  WS : (' '|'\n') {$channel=HIDDEN;} ;
683
683
  /
684
684
  listener = ANTLR3::Debug::RecordEventListener.new
685
- parse(grammar, :a, "a!", :listener => listener)
685
+ parse( grammar, :a, "a!", :listener => listener )
686
686
  end
687
687
 
688
- end
688
+ end