Package com.sonar.sslr.api
Class LexerOutput
- java.lang.Object
-
- com.sonar.sslr.api.LexerOutput
-
public class LexerOutput extends Object
-
-
Constructor Summary
Constructors Constructor Description LexerOutput(Preprocessor2... preprocessors)LexerOutput(List<Token> tokens)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAllTokens(List<Token> allNewtokens)Add a list of tokens to the list without notifying preprocessors.voidaddToken(Token token)Add a token to the list without notifying preprocessors.voidaddTokenAndProcess(TokenType tokenType, String value, int linePosition, int columnPosition)Add a new token and notify the preprocessorsvoidaddTokenAndProcess(TokenType tokenType, String value, String originalValue, int linePosition, int columnPosition)Add a new token and notify the preprocessorsvoidaddTrivia(Trivia trivia)Tokenget(int i)CommentsgetComments()CommentsgetComments(CommentAnalyser commentAnalyser)Collection<Token>getCommentTokens()FilegetFile()StringgetFileAbsolutePath()StringgetFileName()TokengetFirstToken()TokengetLastToken()List<Token>getTokens()voidpushBackTokenAndProcess(Token token, Preprocessor2 preprocessorToExclude)This method must be called by a preprocessor when a token has been temporary consumed by this preprocessor but finally must be pushed back to the LexerOutput.voidpushBackTokensAndProcess(List<Token> tokens, Preprocessor2 preprocessorToExclude)This method must be called by a preprocessor when some tokens have been temporary consumed by this preprocessor but finally must be pushed back to the LexerOutput.voidremoveLastTokens(int numberOfTokensToRemove)voidsetFile(File file)voidsetTokens(List<Token> tokens)intsize()StringtoString()
-
-
-
Constructor Detail
-
LexerOutput
public LexerOutput(Preprocessor2... preprocessors)
-
-
Method Detail
-
getLastToken
public Token getLastToken()
-
getFirstToken
public Token getFirstToken()
-
removeLastTokens
public void removeLastTokens(int numberOfTokensToRemove)
-
addTokenAndProcess
public void addTokenAndProcess(TokenType tokenType, String value, int linePosition, int columnPosition)
Add a new token and notify the preprocessors- Parameters:
tokenType-value-linePosition-columnPosition-
-
addTokenAndProcess
public void addTokenAndProcess(TokenType tokenType, String value, String originalValue, int linePosition, int columnPosition)
Add a new token and notify the preprocessors- Parameters:
tokenType-value-originalValue-linePosition-columnPosition-
-
pushBackTokenAndProcess
public void pushBackTokenAndProcess(Token token, Preprocessor2 preprocessorToExclude)
This method must be called by a preprocessor when a token has been temporary consumed by this preprocessor but finally must be pushed back to the LexerOutput. With this method all other preprocessors will be notified to optionally consumed this token.
-
pushBackTokensAndProcess
public void pushBackTokensAndProcess(List<Token> tokens, Preprocessor2 preprocessorToExclude)
This method must be called by a preprocessor when some tokens have been temporary consumed by this preprocessor but finally must be pushed back to the LexerOutput. With this method all other preprocessors will be notified to optionally consumed those tokens.
-
addTrivia
public void addTrivia(Trivia trivia)
-
addToken
public void addToken(Token token)
Add a token to the list without notifying preprocessors.- Parameters:
token-
-
addAllTokens
public void addAllTokens(List<Token> allNewtokens)
Add a list of tokens to the list without notifying preprocessors.- Parameters:
token-
-
setFile
public void setFile(File file)
-
getFile
public File getFile()
-
getFileName
public String getFileName()
-
getFileAbsolutePath
public String getFileAbsolutePath()
-
size
public int size()
-
getComments
public Comments getComments()
-
getComments
public Comments getComments(CommentAnalyser commentAnalyser)
-
getCommentTokens
public Collection<Token> getCommentTokens()
-
get
public Token get(int i)
-
-