Package org.tweetyproject.preferences.io
Class Token
java.lang.Object
org.tweetyproject.preferences.io.Token
-
Field Summary
Modifier and TypeFieldDescriptionint
The column number of the first character of this token.int
The line number of the first character of this token.int
The column number of the last character of this token.int
The line number of the last character of this token.The string image of the token.int
An 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
-
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
null
if not applicable.
-
toString
-
newToken
Returns a newToken
object. This method can be overridden to create instances of subclasses based on the value ofofKind
.By default, this method returns a
Token
instance. 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
Token
instance.
-
newToken
Returns a newToken
object with the specified kind.- Parameters:
ofKind
- the kind of token to create.- Returns:
- a new
Token
instance.
-