causerieIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers Classes hierarchy graph
|
Class ASymbol
Unit
parsing
Declaration
type ASymbol = class(AStringLeaf)
Description
This class represents a basic symbol, which may be an identifier (such as a variable or function name), a numeric constant, or a string literal. It indicates the symbol scope (the symbol table to which the symbol belongs), as well as the name of the source and line number where the symbol was declared.
You will likely not directly instantiate this class, as it is meant to serve as a template for more specific symbol types that may be required by a parser.
Hierarchy
Overview
Fields
Methods
Description
Fields
|
myScope: TSymbolScope; |
Refers to the symbol table to which the symbol belongs
|
|
myCategory: longword; |
Indicates how the symbol was defined
|
Methods
|
function init: boolean; override; |
Initializer
|
|
function reference: TSymbolReference; virtual; |
Retrieve a reference to the symbol, which contains the scope and index of the symbol.
The reference returned by this routine can be used to locate the symbol after it has been retrieved from an intermediate code stream. In a manner of speaking, this reference is the absolute address of the symbol, at which it can always be found (unless the source is modified).
|
|
function shallowCopyFrom(const Other: AnObject): boolean; override; |
Construct a shallow copy of the other object.
This method builds upon the behavior inherited from AStringLeaf.shallowCopyFrom. It calls that method, then checks to see whether Other is an instance of ASymbol. If so, it copies the values of
from Other to Self , overwriting the values in Self .
Note that this method does NOT copy the left and right subtree of Other and so does not place Self inside the same symbol table as Other , if any.
|
|
function selfStreamingLength: TStreamIOSize; override; |
Calculate the number of bytes required to stream the symbol.
This method builds upon the behavior inherited from AStringLeaf.selfStreamingLength: it calls the inherited routine first, then adds the number of bytes required to write the symbol category and symbol scope.
|
|
function toString: AnsiString; override; |
Construct a string representation of the object, suitable for output to a text-based device, such as a console.
This method overrides the behavior inherited from AStringLeaf. It returns a quoted form of the symbol name, as obtained by a call to Charstring.quote when applied to AStringLeaf.name. This behavior is designed to make it easy to output a symbol as part of a syntax error message, hint, or warning.
|
|
function scope: TSymbolScope; virtual; |
Retrieve the symbol's scope, which indicates the symbol table to which it belongs.
|
|
function category: longword; virtual; |
Get the symbol category, which indicates how it was defined.
The value returned by this routine will be one of the SYMCAT_ constants, such as SYMCAT_VARIABLE.
|
Generated by PasDoc 0.13.0 on 2015-01-10 17:13:18
|