marf.nlp.Parsing
Class SymTabEntry

java.lang.Object
  extended by marf.nlp.Parsing.SymTabEntry
Direct Known Subclasses:
ClassSymTabEntry, FuncSymTabEntry, VarSymTabEntry

public class SymTabEntry
extends java.lang.Object

This class denotes one entry per user-defined symbol in the Symbol Table.

$Id: SymTabEntry.java,v 1.13 2008/01/03 03:21:57 mokhov Exp $

Since:
0.3.0.2
Version:
$Revision: 1.13 $
Author:
Serguei Mokhov

Field Summary
protected  boolean bDeclared
          A flag indicating that the symbol was (true) or was not (false) resolved.
protected  boolean bMultilplyDefined
          A flag indicating that the symbol was (true) or was not (false) multiply defined.
protected  boolean bReserved
          A flag indicating that the symbol was (true) or was not (false) reserved.
static int CLASS
          Class Entry Type.
static int FUNCTION
          Function entry type.
 int iEntryType
          Current Entry type.
protected  int iID
          Numeric ID of the entry.
protected  SymDataType oDataType
          Data type of this symbol (e.g.
protected  java.util.Vector oGenCodeLocations
          Locations in generated code (point, x - base, y - offset).
protected  SymbolTable oLocalSymTab
          Local scope symbol table (if applicable).
protected  java.util.Vector oLocationsList
          List of locations where the given ID appears in the source code.
protected  Token oUID
          Entry symbol, encapsulated as Token.
protected  java.lang.String strName
          Name of the symbol table entry, must be unique.
static int VARIABLE
          Variable entry type.
 
Constructor Summary
SymTabEntry()
          Default Constructor.
SymTabEntry(java.lang.String pstrName)
          Constructs object with the name of the symbol table entry.
SymTabEntry(Token poUID)
          Constructs object with the entry symbol, encapsulated as Token.
SymTabEntry(Token poUID, boolean pbDeclared)
          Constructs object with the entry symbol, encapsulated as Token, and a flag to indicate whether the symbol was resolved.
SymTabEntry(Token poUID, SymDataType poSymDataType)
          Constructs object with the entry symbol, encapsulated as Token, and entry symbol's data type; set the symbol as resolved.
 
Method Summary
 void addLocation(java.awt.Point poPosition)
          Adds location to every occurrence of a token in the source code.
 SymDataType getDataType()
          Allows querying current data type of the entry.
 int getID()
          Gets Numeric ID of the entry.
 SymbolTable getLocalSymTab()
          Allows querying for the local scope symbol table (if applicable).
 java.util.Vector getLocationsList()
          Get list of occurrences of this token entry.
static java.lang.String getMARFSourceCodeRevision()
          Retrieves class' revision.
 Token getUID()
          Returns UID.
 boolean isDeclared()
          Determines if the resolved property is true.
 boolean isMultiplyDefined()
          Determines if the MultiplyDefined property is true.
 void setDeclared(boolean pbDeclared)
          Sets the value of the declared property.
 void setID(int piID)
          Sets numeric ID of the entry.
 void setMultiplyDefined()
          Sets the value of the MultilplyDefined property as true.
 void setMultiplyDefined(boolean pbFlag)
          Sets the value of the MultilplyDefined property.
 void setUID(Token poToken)
          Sets UID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VARIABLE

public static final int VARIABLE
Variable entry type.

See Also:
Constant Field Values

FUNCTION

public static final int FUNCTION
Function entry type.

See Also:
Constant Field Values

CLASS

public static final int CLASS
Class Entry Type.

See Also:
Constant Field Values

iID

protected int iID
Numeric ID of the entry. Not really used.

Since:
September 2001

bDeclared

protected boolean bDeclared
A flag indicating that the symbol was (true) or was not (false) resolved.

Since:
September 2001

bReserved

protected boolean bReserved
A flag indicating that the symbol was (true) or was not (false) reserved.

Since:
September 2001

bMultilplyDefined

protected boolean bMultilplyDefined
A flag indicating that the symbol was (true) or was not (false) multiply defined.

Since:
December 21, 2001

oUID

protected Token oUID
Entry symbol, encapsulated as Token.


oDataType

protected SymDataType oDataType
Data type of this symbol (e.g. integer, real, class).

Since:
September 2001

oLocationsList

protected java.util.Vector oLocationsList
List of locations where the given ID appears in the source code.

Since:
September 2001

oGenCodeLocations

protected java.util.Vector oGenCodeLocations
Locations in generated code (point, x - base, y - offset).


oLocalSymTab

protected SymbolTable oLocalSymTab
Local scope symbol table (if applicable).


iEntryType

public int iEntryType
Current Entry type.


strName

protected java.lang.String strName
Name of the symbol table entry, must be unique.

Constructor Detail

SymTabEntry

public SymTabEntry()
Default Constructor.


SymTabEntry

public SymTabEntry(java.lang.String pstrName)
Constructs object with the name of the symbol table entry.

Parameters:
pstrName - name of the scope

SymTabEntry

public SymTabEntry(Token poUID)
Constructs object with the entry symbol, encapsulated as Token.

Parameters:
poUID - entry symbol, encapsulated as Token

SymTabEntry

public SymTabEntry(Token poUID,
                   boolean pbDeclared)
Constructs object with the entry symbol, encapsulated as Token, and a flag to indicate whether the symbol was resolved.

Parameters:
poUID - entry symbol, encapsulated as Token
pbDeclared - a flag indicating whether the symbol was resolved.

SymTabEntry

public SymTabEntry(Token poUID,
                   SymDataType poSymDataType)
Constructs object with the entry symbol, encapsulated as Token, and entry symbol's data type; set the symbol as resolved.

Parameters:
poUID - entry symbol, encapsulated as Token
poSymDataType - data type of the symbol.
Method Detail

getDataType

public SymDataType getDataType()
Allows querying current data type of the entry.

Returns:
the data type of the current symbol.

addLocation

public void addLocation(java.awt.Point poPosition)
Adds location to every occurrence of a token in the source code.

Parameters:
poPosition - position (line and column) of the symbol's occurence

getLocationsList

public java.util.Vector getLocationsList()
Get list of occurrences of this token entry.

Returns:
the locations list

getUID

public Token getUID()
Returns UID.

Returns:
Entry symbol, encapsulated as Token

setUID

public void setUID(Token poToken)
Sets UID.

Parameters:
poToken - entry symbol encapsulated as Token

isDeclared

public boolean isDeclared()
Determines if the resolved property is true.

Returns:
true if the Resolved property is true

setDeclared

public void setDeclared(boolean pbDeclared)
Sets the value of the declared property.

Parameters:
pbDeclared - the new value of the Declared property

isMultiplyDefined

public boolean isMultiplyDefined()
Determines if the MultiplyDefined property is true.

Returns:
true if the MultilplyDefined property is true

setMultiplyDefined

public void setMultiplyDefined(boolean pbFlag)
Sets the value of the MultilplyDefined property.

Parameters:
pbFlag - the new value of the MultilplyDefined property

setMultiplyDefined

public void setMultiplyDefined()
Sets the value of the MultilplyDefined property as true.


getLocalSymTab

public SymbolTable getLocalSymTab()
Allows querying for the local scope symbol table (if applicable).

Returns:
the local scope symbol table.

getID

public int getID()
Gets Numeric ID of the entry.

Returns:
numeric ID of the entry

setID

public void setID(int piID)
Sets numeric ID of the entry.

Parameters:
piID - the new value of the symbol table entry's ID

getMARFSourceCodeRevision

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

Returns:
revision string


SourceForge Logo