C# 클래스 kompiler.Symbols

파일 보기 프로젝트 열기: jakl/hacks 1 사용 예제들

공개 메소드들

메소드 설명
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