|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmarf.nlp.Parsing.GenericLexicalAnalyzer
marf.nlp.Parsing.LexicalAnalyzer
public class LexicalAnalyzer
LexicalAnalyzer class encapsulates the functionality required for lexical analysis of a MARF source program.
$Id: LexicalAnalyzer.java,v 1.21 2008/01/03 03:21:57 mokhov Exp $
| Field Summary | |
|---|---|
protected boolean |
bNumberMode
This flag is used for backtracking when recognizing numbers. |
protected boolean |
bOperatorMode
This flag is used for backtracking when recognizing 'ambiguous' operators such as '<>' and '<' and friends. |
protected static int |
NA
Just a constant used to return an error code "Not Applicable" when no error code applicable in a given situation. |
| Fields inherited from class marf.nlp.Parsing.GenericLexicalAnalyzer |
|---|
bErrorsPresent, DEFAULT_ERROR_FILE, DEFAULT_OUTPUT_FILE, oFileReader, oLexicalErrors, oStreamTokenizer, oSymTab, oToken, oTokenList, strErrorLogFilename, strOutputFilename, strSourceFilename |
| Constructor Summary | |
|---|---|
LexicalAnalyzer(SymbolTable poSymTab)
Constructor with the symbol table as a reference. |
|
| Method Summary | |
|---|---|
java.util.Vector |
getLexicalErrors()
Returns the list of lexical errors. |
static java.lang.String |
getMARFSourceCodeRevision()
Retrieves class' revision. |
Token |
getNextToken()
Core method of the MARF LexicalAnalyzer. |
boolean |
init()
Initialization routine. |
boolean |
serialize(int piOperation)
Load/Save the textual contents of such as Token list and Error list. |
protected int |
validNum(java.lang.String pstrNum)
Validates that an incoming string is a valid number or not. |
| Methods inherited from class marf.nlp.Parsing.GenericLexicalAnalyzer |
|---|
createToken, getErrorLogFilename, getErrorsPresent, getOutputFilename, getSourceFilename, getSymTab, getTokenList, scan, setErrorLogFilename, setOutputFilename, setSourceFilename |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int NA
protected boolean bNumberMode
protected boolean bOperatorMode
| Constructor Detail |
|---|
public LexicalAnalyzer(SymbolTable poSymTab)
poSymTab - the symbol table to construct this lexical analyzer| Method Detail |
|---|
public boolean init()
init in class GenericLexicalAnalyzertrue of initialization is successfulGenericLexicalAnalyzer.init()public boolean serialize(int piOperation)
serialize in class GenericLexicalAnalyzerpiOperation - 0 means load, 1 means save
true if the serialization was successfulGenericLexicalAnalyzer.serialize(int)
public Token getNextToken()
throws LexicalError
getNextToken in class GenericLexicalAnalyzerLexicalError - in case of invalid character stream (alphabet) entries foundGenericLexicalAnalyzer.getNextToken()protected int validNum(java.lang.String pstrNum)
pstrNum - a string containing valid numerical chars
public java.util.Vector getLexicalErrors()
getLexicalErrors in class GenericLexicalAnalyzerpublic static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||