Package com.scriptbasic.interfaces
Interface LexicalElementAnalyzer
-
- All Known Implementing Classes:
AbstractElementAnalyzer,BasicString,ConstAwareIdentifier,Decimal,Identifier,MultiCharacter,OneCharacter
public interface LexicalElementAnalyzerA Lexical Element Analyzer analyzes the characters coming from a reader and create a LexicalElement from it. If it can not create a lexical element then it pushes back all characters read into the reader and the methodread()returns withnull.There are implementation of this interface to recognize string, symbol, identifier, decimal number.
- Author:
- Peter Verhas
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description LexicalElementread()Reads a lexeme and returns the created lexical element.
-
-
-
Method Detail
-
read
LexicalElement read() throws AnalysisException
Reads a lexeme and returns the created lexical element.If the characters read from the reader show that the lexeme is not the type that the class implementing this interface can handle then the characters are pushed back to he reader and
nullis returned.If the characters read from the reader show that the lexeme is the type that the class implementing this interface can handle, but is erroneous, then the method throws the exception.
- Returns:
- the created lexeme or
null - Throws:
AnalysisException- in case of exception
-
-