marf.nlp.Parsing
Class GenericLexicalAnalyzer

java.lang.Object
  |
  +--marf.nlp.Parsing.GenericLexicalAnalyzer
Direct Known Subclasses:
GrammarAnalyzer, LexicalAnalyzer

public abstract class GenericLexicalAnalyzer
extends java.lang.Object

GenericLexicalAnalyzer Class. (C) 2001-2005 Serguei Mokhov, $Id: GenericLexicalAnalyzer.java,v 1.7 2005/06/01 05:35:09 mokhov Exp $

Since:
0.3.0
Version:
$Revision: 1.7 $
Author:
Serguei Mokhov

Field Summary
protected  java.lang.String ErrorLogFilename
          File name of a file which serves as an lexical errors log.
protected  boolean ErrorsPresent
           
protected  java.util.Vector LexicalErrors
           
protected  java.io.FileReader oFileReader
           
protected  java.io.StreamTokenizer oStreamTokenizer
           
protected  marf.nlp.Parsing.Token oToken
           
protected  java.lang.String OutputFilename
          File name of a file which serves as an output of the Lexical Analyzer.
protected  java.lang.String SourceFilename
          File name of a file which serves as an input of the Lexical Analyzer.
protected  marf.nlp.Parsing.SymbolTable SymTab
           
protected  java.util.Vector TokenList
           
 
Constructor Summary
GenericLexicalAnalyzer(marf.nlp.Parsing.SymbolTable pSymTab)
          Constructor.
 
Method Summary
 marf.nlp.Parsing.Token createToken(java.lang.String strLexeme, marf.nlp.Parsing.TokenSubType oTokenSubType)
          createToken() creates an instance of a Token data structure provided its type and lexeme, and location is calculated dynamically by the StreamTokenyzer.
 java.lang.String getErrorLogFilename()
          Access method for the ErrorLogFilename property.
 boolean getErrorsPresent()
          Determines if the ErrorsPresent property is true.
abstract  marf.nlp.Parsing.Token getNextToken()
          Core method of the LexicalAnalyzer.
 java.lang.String getOutputFilename()
          Access method for the OutputFilename property.
static java.lang.String getRevision()
          Retrieves class' revision.
 java.lang.String getSourceFilename()
          Access method for the SourceFilename property.
 marf.nlp.Parsing.SymbolTable getSymTab()
          Access method for the SymTab property.
 java.util.Vector getTokenList()
          Access method for the TonkenList property.
 boolean init()
          Initialization routine.
 void scan()
          Scan for tokens through the input stream.
abstract  boolean serialize(int piOperation)
          Load/Save the contents of lists such as Token list and Error list.
 void setErrorLogFilename(java.lang.String aErrorLogFilename)
          Sets the value of the ErrorLogFilename property.
 void setOutputFilename(java.lang.String aOutputFilename)
          Sets the value of the OutputFilename property.
 void setSourceFilename(java.lang.String aSourceFilename)
          Sets the value of the SourceFilename property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oFileReader

protected java.io.FileReader oFileReader

oStreamTokenizer

protected java.io.StreamTokenizer oStreamTokenizer

SourceFilename

protected java.lang.String SourceFilename
File name of a file which serves as an input of the Lexical Analyzer.


OutputFilename

protected java.lang.String OutputFilename
File name of a file which serves as an output of the Lexical Analyzer.


ErrorLogFilename

protected java.lang.String ErrorLogFilename
File name of a file which serves as an lexical errors log.

Since:
September 2001

ErrorsPresent

protected boolean ErrorsPresent
Since:
October 2, 2001

TokenList

protected java.util.Vector TokenList

SymTab

protected marf.nlp.Parsing.SymbolTable SymTab

LexicalErrors

protected java.util.Vector LexicalErrors

oToken

protected marf.nlp.Parsing.Token oToken
Constructor Detail

GenericLexicalAnalyzer

public GenericLexicalAnalyzer(marf.nlp.Parsing.SymbolTable pSymTab)
Constructor.

Method Detail

init

public boolean init()
Initialization routine. Should be overridden by derivatives because it is language-specific, and default initialization will not always suffice.


scan

public void scan()
Scan for tokens through the input stream.


serialize

public abstract boolean serialize(int piOperation)
Load/Save the contents of lists such as Token list and Error list. 0 means load, 1 means save. Load currently is not implemented


getNextToken

public abstract marf.nlp.Parsing.Token getNextToken()
Core method of the LexicalAnalyzer.


createToken

public marf.nlp.Parsing.Token createToken(java.lang.String strLexeme,
                                          marf.nlp.Parsing.TokenSubType oTokenSubType)
createToken() creates an instance of a Token data structure provided its type and lexeme, and location is calculated dynamically by the StreamTokenyzer.


getSourceFilename

public java.lang.String getSourceFilename()
Access method for the SourceFilename property.

Returns:
the current value of the SourceFilename property

setSourceFilename

public void setSourceFilename(java.lang.String aSourceFilename)
Sets the value of the SourceFilename property.

Parameters:
aSourceFilename - the new value of the SourceFilename property

getOutputFilename

public java.lang.String getOutputFilename()
Access method for the OutputFilename property.

Returns:
the current value of the OutputFilename property

setOutputFilename

public void setOutputFilename(java.lang.String aOutputFilename)
Sets the value of the OutputFilename property.

Parameters:
aOutputFilename - the new value of the OutputFilename property

getErrorLogFilename

public java.lang.String getErrorLogFilename()
Access method for the ErrorLogFilename property.

Returns:
the current value of the ErrorLogFilename property

setErrorLogFilename

public void setErrorLogFilename(java.lang.String aErrorLogFilename)
Sets the value of the ErrorLogFilename property.

Parameters:
aErrorLogFilename - the new value of the ErrorLogFilename property

getErrorsPresent

public boolean getErrorsPresent()
Determines if the ErrorsPresent property is true.

Returns:
true if the ErrorsPresent property is true

getTokenList

public java.util.Vector getTokenList()
Access method for the TonkenList property.

Returns:
the current value of the TonkenList property

getSymTab

public marf.nlp.Parsing.SymbolTable getSymTab()
Access method for the SymTab property.

Returns:
the current value of the SymTab property

getRevision

public static java.lang.String getRevision()
Retrieves class' revision.

Returns:
revision string