Package codeanalysis.syntax
Class Lexer
java.lang.Object
codeanalysis.syntax.Lexer
The
Lexer class is responsible for lexical analysis of a given text, producing tokens that represent different elements of the text.
It scans the text character by character and generates tokens based on specific rules.- Version:
- 1.0
- Author:
- Siyabend Urun
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLexer(SourceText text) Initializes a new instance of theLexerclass with the specified text to analyze. -
Method Summary
Modifier and TypeMethodDescriptioncharGets the current character being analyzed by the lexer.Gets an iterator over the diagnostic messages generated during lexical analysis.Retrieves the next token from the text being analyzed.intGets the current position of the lexer in the text.
-
Constructor Details
-
Lexer
Initializes a new instance of theLexerclass with the specified text to analyze.- Parameters:
text- The text to analyze.
-
-
Method Details
-
getPosition
public int getPosition()Gets the current position of the lexer in the text.- Returns:
- The current position of the lexer.
-
currentChar
public char currentChar()Gets the current character being analyzed by the lexer.- Returns:
- The current character being analyzed.
-
diagnostics
Gets an iterator over the diagnostic messages generated during lexical analysis.- Returns:
- An iterator over the diagnostic messages.
-
getNextToken
Retrieves the next token from the text being analyzed. This method scans the text character by character and generates tokens based on specific rules.- Returns:
- The next token in the text.
-