Package jminusminus
Class TokenInfo
java.lang.Object
jminusminus.TokenInfo
A representation of tokens returned by the Scanner method getNextToken(). A token has a kind
identifying what kind of token it is, an image for providing any semantic text, and the line in
which it occurred in the source file.
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
TokenInfo
Constructs a TokenInfo object given its kind, the semantic text forming the token, and its line number.- Parameters:
kind
- the token's kind.image
- the semantic text forming the token.line
- the line in which the token occurs in the source file.
-
TokenInfo
Constructs a TokenInfo object given its kind and its line number. Its image is simply the token kind's string representation.- Parameters:
kind
- the token's identifying number.line
- the line in which the token occurs in the source file.
-
-
Method Details
-
kind
Returns the token's kind.- Returns:
- the token's kind.
-
line
public int line()Returns the line number associated with the token.- Returns:
- the line number associated with the token.
-
tokenRep
Returns the token's string representation.- Returns:
- the token's string representation.
-
image
Returns the token's image.- Returns:
- the token's image.
-