Method: ANTLR3::Parser#missing_symbol

Defined in:
lib/antlr3/recognizers.rb

#missing_symbol(error, expected_type, follow) ⇒ Object



1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
# File 'lib/antlr3/recognizers.rb', line 1284

def missing_symbol( error, expected_type, follow )
  current = @input.look
  current = @input.look( -1 ) if current == ANTLR3::EOF_TOKEN
  t =
    case
    when current && current != ANTLR3::EOF_TOKEN then current.clone
    when @input.token_class then @input.token_class.new
    else ( create_token rescue CommonToken.new )
    end
  
  t.type = expected_type
  name = t.name.gsub( /(^<)|(>$)/,'' )
  t.text = "<missing #{ name }>"
  t.channel = DEFAULT_CHANNEL
  return( t )
end