org.prorefactor.treeparser
Class Symbol

java.lang.Object
  extended by org.prorefactor.treeparser.Symbol
All Implemented Interfaces:
Xferable, SymbolI
Direct Known Subclasses:
Dataset, Datasource, FieldBuffer, Query, Routine, Stream, TableBuffer, Variable, Widget

public abstract class Symbol
extends java.lang.Object
implements SymbolI

Base class for any type of symbol which needs to be kept track of when parsing a 4gl compile unit's AST.


Field Summary
 
Fields inherited from interface org.prorefactor.treeparser.SymbolI
NAME_ORDER
 
Constructor Summary
protected Symbol()
          Only to be used for persistence/serialization.
protected Symbol(int allRefsCount, JPNode asNode, JPNode defNode, JPNode likeNode, java.lang.String name, int numReads, int numWrites, SymbolScope scope)
           
 
Method Summary
abstract  Symbol copyBare(SymbolScope intoScope)
          Generate a bare-bones copy of this symbol.
abstract  java.lang.String fullName()
          Get the "full" name for this symbol.
 int getAllRefsCount()
           
 JPNode getAsNode()
          If this was defined AS something, then we have an AS node
 JPNode getDefineNode()
          If this symbol was defined directly by a DEFINE syntax, then this returns the DEFINE node, otherwise null.
 JPNode getIndirectDefineIdNode()
          If this symbol was defined with syntax other than a direct DEFINE, then this returns the ID node, otherwise null.
 JPNode getLikeNode()
          If this was defined LIKE something, then we have a LIKE node
 java.lang.String getName()
           
 int getNumReads()
           
 int getNumWrites()
           
abstract  int getProgressType()
          From TokenTypes: VARIABLE, FRAME, MENU, MENUITEM, etc.
 SymbolScope getScope()
           
 boolean isExported()
          Is the symbol newly defined here and visible to other compile units? This includes PROTECTED members visible to subclasses.
 boolean isImported()
          Defined as SHARED?
 void noteReference(int contextQualifier)
          Take note of a symbol reference (read, write, reference by name).
 void setAsNode(JPNode asNode)
           
 void setDefOrIdNode(JPNode node)
          We store the DEFINE|FUNCTION|METHOD|PROCEDURE node if available and sensible.
 void setLikeNode(JPNode likeNode)
           
 void setName(java.lang.String name)
           
 java.lang.String toString()
           
 void writeXferBytes(DataXferStream out)
          Implement Xferable
 void writeXferSchema(DataXferStream out)
          Implement Xferable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Symbol

protected Symbol()
Only to be used for persistence/serialization.


Symbol

protected Symbol(int allRefsCount,
                 JPNode asNode,
                 JPNode defNode,
                 JPNode likeNode,
                 java.lang.String name,
                 int numReads,
                 int numWrites,
                 SymbolScope scope)
Method Detail

copyBare

public abstract Symbol copyBare(SymbolScope intoScope)
Generate a bare-bones copy of this symbol. Requires the scope to attach it to as the argument.


fullName

public abstract java.lang.String fullName()
Description copied from interface: SymbolI
Get the "full" name for this symbol. This is expected to be overridden in subclasses. For example, we might expect "database.buffer.field" to be the return for a field buffer.

Specified by:
fullName in interface SymbolI

getAllRefsCount

public int getAllRefsCount()
Specified by:
getAllRefsCount in interface SymbolI

getNumReads

public int getNumReads()
Specified by:
getNumReads in interface SymbolI

getNumWrites

public int getNumWrites()
Specified by:
getNumWrites in interface SymbolI

getAsNode

public JPNode getAsNode()
Description copied from interface: SymbolI
If this was defined AS something, then we have an AS node

Specified by:
getAsNode in interface SymbolI

getDefineNode

public JPNode getDefineNode()
Description copied from interface: SymbolI
If this symbol was defined directly by a DEFINE syntax, then this returns the DEFINE node, otherwise null.

Specified by:
getDefineNode in interface SymbolI

getIndirectDefineIdNode

public JPNode getIndirectDefineIdNode()
Description copied from interface: SymbolI
If this symbol was defined with syntax other than a direct DEFINE, then this returns the ID node, otherwise null.

Specified by:
getIndirectDefineIdNode in interface SymbolI

getLikeNode

public JPNode getLikeNode()
Description copied from interface: SymbolI
If this was defined LIKE something, then we have a LIKE node

Specified by:
getLikeNode in interface SymbolI

getName

public java.lang.String getName()
Specified by:
getName in interface SymbolI

getProgressType

public abstract int getProgressType()
Description copied from interface: SymbolI
From TokenTypes: VARIABLE, FRAME, MENU, MENUITEM, etc. A TableBuffer object always returns BUFFER, regardless of whether the object is a named buffer or a default buffer. A FieldBuffer object always returns FIELD.

Specified by:
getProgressType in interface SymbolI

getScope

public SymbolScope getScope()
Specified by:
getScope in interface SymbolI

isExported

public boolean isExported()
Description copied from interface: SymbolI
Is the symbol newly defined here and visible to other compile units? This includes PROTECTED members visible to subclasses.

Specified by:
isExported in interface SymbolI

isImported

public boolean isImported()
Description copied from interface: SymbolI
Defined as SHARED?

Specified by:
isImported in interface SymbolI

noteReference

public void noteReference(int contextQualifier)
Description copied from interface: SymbolI
Take note of a symbol reference (read, write, reference by name).

Specified by:
noteReference in interface SymbolI

setAsNode

public void setAsNode(JPNode asNode)
Specified by:
setAsNode in interface SymbolI
See Also:
SymbolI.getAsNode()

setDefOrIdNode

public void setDefOrIdNode(JPNode node)
Description copied from interface: SymbolI
We store the DEFINE|FUNCTION|METHOD|PROCEDURE node if available and sensible. If defined in a syntax where there is no DEFINE node briefly preceeding the ID node, then we store the ID node.

Specified by:
setDefOrIdNode in interface SymbolI

setLikeNode

public void setLikeNode(JPNode likeNode)
Specified by:
setLikeNode in interface SymbolI
See Also:
SymbolI.getLikeNode()

setName

public void setName(java.lang.String name)
Specified by:
setName in interface SymbolI

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

writeXferBytes

public void writeXferBytes(DataXferStream out)
                    throws java.io.IOException
Implement Xferable

Specified by:
writeXferBytes in interface Xferable
Throws:
java.io.IOException

writeXferSchema

public void writeXferSchema(DataXferStream out)
                     throws java.io.IOException
Implement Xferable

Specified by:
writeXferSchema in interface Xferable
Throws:
java.io.IOException


Copyright © 2008 Joanju Software. All Rights Reserved.