abc.parser
Class InvalidTokenEvent

java.lang.Object
  extended byjava.util.EventObject
      extended byscanner.TokenEvent
          extended byabc.parser.InvalidTokenEvent
All Implemented Interfaces:
PositionableInCharStream, java.io.Serializable

public class InvalidTokenEvent
extends TokenEvent

Event generated when an invalid token is encountered by a parser.

See Also:
Serialized Form

Constructor Summary
InvalidTokenEvent(java.lang.Object source, CharStreamPosition position, TokenType expectedTokenType)
          Creates a new event.
InvalidTokenEvent(java.lang.Object source, Token token, TokenType expectedTokenType)
          Creates a new event
 
Method Summary
 TokenType getExpectedTokenType()
          Returns the type of the token that was expected.
 int getLength()
          Returns the length of this positionable object.
 CharStreamPosition getPosition()
          Returns the place where this event occured.
 java.lang.String toString()
          Returns a String representation of this event.
 
Methods inherited from class scanner.TokenEvent
getToken
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InvalidTokenEvent

public InvalidTokenEvent(java.lang.Object source,
                         Token token,
                         TokenType expectedTokenType)
Creates a new event

Parameters:
source - The source that generates the event.
token - The encountered invalid token.
expectedTokenType - The type of token that was expected.

InvalidTokenEvent

public InvalidTokenEvent(java.lang.Object source,
                         CharStreamPosition position,
                         TokenType expectedTokenType)
Creates a new event.

Parameters:
source - The source that generates the event.
position - The place where the event occured.
expectedTokenType - The type of token that was expected.
Method Detail

getExpectedTokenType

public TokenType getExpectedTokenType()
Returns the type of the token that was expected.

Returns:
The type of the token that was expected. The place where this token was expected in the position returned by getPosition().
See Also:
getPosition()

getPosition

public CharStreamPosition getPosition()
Returns the place where this event occured.

Specified by:
getPosition in interface PositionableInCharStream
Overrides:
getPosition in class TokenEvent
Returns:
The place where this event occured.

getLength

public int getLength()
Description copied from interface: PositionableInCharStream
Returns the length of this positionable object.

Specified by:
getLength in interface PositionableInCharStream
Overrides:
getLength in class TokenEvent

toString

public java.lang.String toString()
Returns a String representation of this event.

Overrides:
toString in class TokenEvent
Returns:
a String representation of this event.