C# Класс kompiler.Symbols

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
GetSymbols ( ) : Symbols
ToString ( ) : string

Dump all the variables in all the scopes into a human readable string for debugging

add ( string name ) : void

Cache a variable's name, until the type is known, at which point call commit

add ( string name, int value ) : void

Cache a constant until a commit call to commit all cached constants

addType ( string name, int startIndex, int endIndex ) : void

Add an array type to the current scope, to be used as a possible type of future variables. Note: Not that great of an idea. This needs to be subclassed and organized so variables can have more dynamic types

commit ( ) : void

When finished declaring variable or constant integers, add them to the current scope Clear the cached variables afterwards

commitTypedVar ( AttrType type ) : void

When a type is declared after any number of variables have been added, set all cached variables to that type and add them to the current scope. The type is always an array. Clear the cached variables afterwards

get ( string name ) : Attribute

Get a non-var attribute, by name, in the nearest scope possible If no variable is named such, return null

getOffset ( string name ) : int

Get the Attribute for a variable, by name, in the nearest scope possible. If no variable is named such, return null. It may be nested, in which case the nestedOffset will have the proper offset to add to the normal variable's own offset within its own scope

init ( ) : void

Initialize symbol system for fresh use

nest ( ) : void

Create a new scope

setVal ( string name, int value ) : void

Set a variable's value, using the variable, by name, in the closest scope If no such named variable exists, nothing is changed

unnest ( ) : void

Destroy the latest scope

Приватные методы

Метод Описание
Symbols ( ) : System

Описание методов

GetSymbols() публичный статический Метод

public static GetSymbols ( ) : Symbols
Результат Symbols

ToString() публичный Метод

Dump all the variables in all the scopes into a human readable string for debugging
public ToString ( ) : string
Результат string

add() публичный Метод

Cache a variable's name, until the type is known, at which point call commit
public add ( string name ) : void
name string
Результат void

add() публичный Метод

Cache a constant until a commit call to commit all cached constants
public add ( string name, int value ) : void
name string
value int
Результат void

addType() публичный Метод

Add an array type to the current scope, to be used as a possible type of future variables. Note: Not that great of an idea. This needs to be subclassed and organized so variables can have more dynamic types
public addType ( string name, int startIndex, int endIndex ) : void
name string
startIndex int
endIndex int
Результат void

commit() публичный Метод

When finished declaring variable or constant integers, add them to the current scope Clear the cached variables afterwards
public commit ( ) : void
Результат void

commitTypedVar() публичный Метод

When a type is declared after any number of variables have been added, set all cached variables to that type and add them to the current scope. The type is always an array. Clear the cached variables afterwards
public commitTypedVar ( AttrType type ) : void
type AttrType
Результат void

get() публичный Метод

Get a non-var attribute, by name, in the nearest scope possible If no variable is named such, return null
public get ( string name ) : Attribute
name string
Результат Attribute

getOffset() публичный Метод

Get the Attribute for a variable, by name, in the nearest scope possible. If no variable is named such, return null. It may be nested, in which case the nestedOffset will have the proper offset to add to the normal variable's own offset within its own scope
public getOffset ( string name ) : int
name string
Результат int

init() публичный Метод

Initialize symbol system for fresh use
public init ( ) : void
Результат void

nest() публичный Метод

Create a new scope
public nest ( ) : void
Результат void

setVal() публичный Метод

Set a variable's value, using the variable, by name, in the closest scope If no such named variable exists, nothing is changed
public setVal ( string name, int value ) : void
name string
value int
Результат void

unnest() публичный Метод

Destroy the latest scope
public unnest ( ) : void
Результат void