Package com.scriptbasic.interfaces
Interface LexicalElementAnalyzer
- All Known Implementing Classes:
AbstractElementAnalyzer,BasicString,ConstAwareIdentifier,Decimal,Identifier,MultiCharacter,OneCharacter
public interface LexicalElementAnalyzer
A 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 method
read() returns with null.
There are implementation of this interface to recognize string, symbol, identifier, decimal number.
- Author:
- Peter Verhas
-
Method Summary
-
Method Details
-
read
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
-