Package net.sourceforge.pmd.lang.ast
Interface GenericToken
-
- All Known Implementing Classes:
AntlrToken
public interface GenericTokenRepresents a language-independent token such as constants, values language reserved keywords, or comments.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetBeginColumn()Gets the column offset from the start of the begin line where the token's region beginsintgetBeginLine()Gets the line where the token's region beginsintgetEndColumn()Gets the column offset from the start of the end line where the token's region endsintgetEndLine()Gets the line where the token's region endsStringgetImage()Gets the token's text.intgetKind()Gets a unique integer representing the kind of token this is.GenericTokengetNext()Obtain the next generic token according to the input stream which generated the instance of this token.GenericTokengetPreviousComment()Obtain a comment-type token which, according to the input stream which generated the instance of this token, precedes this instance token and succeeds the previous generic token (if there is any).
-
-
-
Method Detail
-
getNext
GenericToken getNext()
Obtain the next generic token according to the input stream which generated the instance of this token.- Returns:
- the next generic token if it exists; null if it does not exist
-
getPreviousComment
GenericToken getPreviousComment()
Obtain a comment-type token which, according to the input stream which generated the instance of this token, precedes this instance token and succeeds the previous generic token (if there is any).- Returns:
- the comment-type token if it exists; null if it does not exist
-
getImage
String getImage()
Gets the token's text.- Returns:
- the token's text
-
getBeginLine
int getBeginLine()
Gets the line where the token's region begins- Returns:
- a non-negative integer containing the begin line
-
getEndLine
int getEndLine()
Gets the line where the token's region ends- Returns:
- a non-negative integer containing the end line
-
getBeginColumn
int getBeginColumn()
Gets the column offset from the start of the begin line where the token's region begins- Returns:
- a non-negative integer containing the begin column
-
getEndColumn
int getEndColumn()
Gets the column offset from the start of the end line where the token's region ends- Returns:
- a non-negative integer containing the begin column
-
getKind
@Experimental int getKind()
Gets a unique integer representing the kind of token this is. The semantics of this kind depend on the language.Note: This is an experimental API.
The returned constants can be looked up in the language's "*ParserConstants", e.g. CppParserConstants or JavaParserConstants. These constants are considered internal API and may change at any time when the language's grammar is changed.
-
-