class ANTLR3::AST::CommonErrorNode
Represents a series of erroneous tokens from a token stream input
Attributes
error[RW]
input[RW]
start[RW]
stop[RW]
Public Class Methods
new( input, start, stop, error )
click to toggle source
Calls superclass method
ANTLR3::AST::CommonTree::new
# File lib/antlr3/tree.rb, line 612 def initialize( input, start, stop, error ) super( nil ) stop = start if stop.nil? or ( stop.token_index < start.token_index and stop.type != EOF ) @input = input @start = start @stop = stop @error = error end
Public Instance Methods
flat_list?()
click to toggle source
# File lib/antlr3/tree.rb, line 622 def flat_list? return false end
text()
click to toggle source
# File lib/antlr3/tree.rb, line 630 def text case @start when Token i = @start.token_index j = ( @stop.type == EOF ) ? @input.size : @stop.token_index @input.to_s( i, j ) # <- the bad text when Tree @input.to_s( @start, @stop ) # <- the bad text else "<unknown>" end end
to_s()
click to toggle source
# File lib/antlr3/tree.rb, line 643 def to_s case @error when MissingToken "<missing type: #{ @error.missing_type }>" when UnwantedToken "<extraneous: #{ @error.token.inspect }, resync = #{ text }>" when MismatchedToken "<mismatched token: #{ @error.token.inspect }, resync = #{ text }>" when NoViableAlternative "<unexpected: #{ @error.token.inspect }, resync = #{ text }>" else "<error: #{ text }>" end end
type()
click to toggle source
# File lib/antlr3/tree.rb, line 626 def type INVALID_TOKEN_TYPE end