Class Token
java.lang.Object
org.tweetyproject.preferences.io.Token
-
Field Summary
FieldsModifier and TypeFieldDescriptionintThe column number of the first character of this token.intThe line number of the first character of this token.intThe column number of the last character of this token.intThe line number of the last character of this token.The string image of the token.intAn integer that describes the kind of this token.A reference to the next regular (non-special) token in the input stream.A reference to special tokens that occur before this token but after the immediately preceding regular (non-special) token. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
kind
public int kindAn integer that describes the kind of this token. This is typically set by the parser. -
beginLine
public int beginLineThe line number of the first character of this token. -
beginColumn
public int beginColumnThe column number of the first character of this token. -
endLine
public int endLineThe line number of the last character of this token. -
endColumn
public int endColumnThe column number of the last character of this token. -
image
The string image of the token. -
next
A reference to the next regular (non-special) token in the input stream. This field is set to null if this is the last token or if the token manager has not read tokens beyond this one. -
specialToken
A reference to special tokens that occur before this token but after the immediately preceding regular (non-special) token. Special tokens are used for syntactic sugar and are not part of the main token stream.
-
-
Constructor Details
-
Token
public Token()No-argument constructor forToken. -
Token
public Token(int kind) Constructs a new token for the specified kind.- Parameters:
kind- the kind of the token.
-
Token
Constructs a new token for the specified kind and image.- Parameters:
kind- the kind of the token.image- the image of the token.
-
-
Method Details
-
getValue
An optional attribute value of the Token. Tokens that are not used as syntactic sugar will often contain meaningful values that will be used later on by the compiler or interpreter. This attribute value is often different from the image.- Returns:
- the attribute value of the token, or
nullif not applicable.
-
toString
-
newToken
Returns a newTokenobject. This method can be overridden to create instances of subclasses based on the value ofofKind.By default, this method returns a
Tokeninstance. Subclasses can be created by adding cases to the switch statement for specific token kinds.- Parameters:
ofKind- the kind of token to create.image- the image of the token.- Returns:
- a new
Tokeninstance.
-
newToken
Returns a newTokenobject with the specified kind.- Parameters:
ofKind- the kind of token to create.- Returns:
- a new
Tokeninstance.
-