Package com.javacc.preprocessor
Class PreprocessorLexer
- java.lang.Object
-
- com.javacc.preprocessor.PreprocessorLexer
-
- All Implemented Interfaces:
PreprocessorConstants
public class PreprocessorLexer extends Object implements PreprocessorConstants
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.javacc.preprocessor.PreprocessorConstants
PreprocessorConstants.LexicalState, PreprocessorConstants.TokenType
-
-
Field Summary
-
Fields inherited from interface com.javacc.preprocessor.PreprocessorConstants
BUF_SIZE
-
-
Constructor Summary
Constructors Constructor Description PreprocessorLexer(Reader reader)PreprocessorLexer(CharSequence input)PreprocessorLexer(String inputSource, Reader reader)PreprocessorLexer(String inputSource, Reader reader, PreprocessorConstants.LexicalState lexState, int line, int column)PreprocessorLexer(String inputSource, CharSequence input)PreprocessorLexer(String inputSource, CharSequence input, PreprocessorConstants.LexicalState lexState, int startingLine, int startingColumn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetInputSource()TokengetNextToken(int offset)A lower level method to tokenize, that takes the absolute offset into the content buffer as a parameterTokengetNextToken(Token tok)The public method for getting the next token.voidsetInputSource(String inputSource)voidsetParsedLines(BitSet parsedLines)This is used in conjunction with having a preprocessor.booleanswitchTo(PreprocessorConstants.LexicalState lexState)Switch to specified lexical state.
-
-
-
Constructor Detail
-
PreprocessorLexer
public PreprocessorLexer(CharSequence input)
-
PreprocessorLexer
public PreprocessorLexer(String inputSource, CharSequence input)
- Parameters:
inputSource- just the naem of the input source (typically the filename) that will be used in error messages and so on.input- the input
-
PreprocessorLexer
public PreprocessorLexer(String inputSource, CharSequence input, PreprocessorConstants.LexicalState lexState, int startingLine, int startingColumn)
- Parameters:
inputSource- just the name of the input source (typically the filename) that will be used in error messages and so on.input- the inputline- The line number at which we are starting for the purposes of location/error messages. In most normal usage, this is 1.column- number at which we are starting for the purposes of location/error messages. In most normal usages this is 1.
-
PreprocessorLexer
public PreprocessorLexer(Reader reader)
-
PreprocessorLexer
public PreprocessorLexer(String inputSource, Reader reader, PreprocessorConstants.LexicalState lexState, int line, int column)
-
-
Method Detail
-
getInputSource
public String getInputSource()
-
setInputSource
public void setInputSource(String inputSource)
-
getNextToken
public Token getNextToken(Token tok)
The public method for getting the next token. If the tok parameter is null, it just tokenizes starting at the internal bufferPosition Otherwise, it checks whether we have already cached the token after this one. If not, it finally goes to the NFA machinery
-
getNextToken
public Token getNextToken(int offset)
A lower level method to tokenize, that takes the absolute offset into the content buffer as a parameter- Parameters:
offset- where to start- Returns:
- the token that results from scanning from the given starting point
-
switchTo
public boolean switchTo(PreprocessorConstants.LexicalState lexState)
Switch to specified lexical state.- Parameters:
lexState- the lexical state to switch to- Returns:
- whether we switched (i.e. we weren't already in the desired lexical state)
-
setParsedLines
public void setParsedLines(BitSet parsedLines)
This is used in conjunction with having a preprocessor. We set which lines are actually parsed lines and the unset ones are ignored.- Parameters:
parsedLines- a #java.util.BitSet that holds which lines are parsed (i.e. not ignored)
-
-