Class Token
java.lang.Object
com.singularsys.jep.configurableparser.tokens.Token
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CommentToken,FunctionToken,IdentifierToken,MultiLineToken,NumberToken,OperatorToken,StringToken,SymbolToken,TerminatorToken,WhiteSpaceToken
Base class for tokens. Different token types should subclass this class.
- Author:
- Richard Morris
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanintintGets the length of the source text matched by this tokenintGets the source text matched by this tokeninthashCode()booleanisBinary()booleanbooleanbooleanbooleanWhether the token can appear on the right-hand side of implicit multiplication '2 x'.booleanisNumber()booleanbooleanisPrefix()booleanisString()booleanisSuffix()booleanisSymbol()booleanbooleanbooleanvoidsetPosition(int line, int column) Sets the position of the token.toString()
-
Constructor Details
-
Token
Create a token. Generally this method should not be used, but is does have application with theMultiLineMatcher.- Parameters:
source-
-
-
Method Details
-
getSource
Gets the source text matched by this token- Returns:
- the source text
-
getLength
public int getLength()Gets the length of the source text matched by this token- Returns:
- the length of the source
-
toString
-
isWhiteSpace
public boolean isWhiteSpace() -
isIdentifier
public boolean isIdentifier() -
isFunction
public boolean isFunction() -
isOperator
public boolean isOperator() -
isBinary
public boolean isBinary() -
isPrefix
public boolean isPrefix() -
isSuffix
public boolean isSuffix() -
isTernary
public boolean isTernary() -
isNumber
public boolean isNumber() -
isComment
public boolean isComment() -
isString
public boolean isString() -
isSymbol
public boolean isSymbol() -
isImplicitMulRhs
public boolean isImplicitMulRhs()Whether the token can appear on the right-hand side of implicit multiplication '2 x'.- Returns:
- boolean value corresponding to the result.
-
equals
-
hashCode
public int hashCode() -
isTerminal
public boolean isTerminal() -
setPosition
public void setPosition(int line, int column) Sets the position of the token. By convention numbering starts from line 1 column 1.- Parameters:
line- line numbercolumn- column number
-
getLineNumber
public int getLineNumber() -
getColumnNumber
public int getColumnNumber()
-