C# 클래스 WhiteCore.ScriptEngine.DotNetEngine.CompilerTools.CSCodeGenerator

상속: IDisposable
파일 보기 프로젝트 열기: WhiteCoreSim/WhiteCore-Dev

공개 프로퍼티들

프로퍼티 타입 설명
LocalMethodArguements ObjectList>.Dictionary
LocalMethods string>.Dictionary

공개 메소드들

메소드 설명
CSCodeGenerator ( WhiteCore.ScriptEngine.DotNetEngine.CompilerTools.Compiler compiler ) : System

Creates an 'empty' CSCodeGenerator instance.

Convert ( string script ) : string

Generate the code from the AST we have.

CreateCompilerScript ( WhiteCore.ScriptEngine.DotNetEngine.CompilerTools.Compiler compiler, List MethodsToAdd, string ScriptClass ) : string
Dispose ( ) : void
GetHeaderCount ( WhiteCore.ScriptEngine.DotNetEngine.CompilerTools.Compiler compiler ) : int

비공개 메소드들

메소드 설명
AddWarning ( string warning ) : void
CheckEvent ( string script, string state ) : void
CheckEventCasts ( string script ) : void

Checks the C# script for the correct casts in events This stops errors from misformed events ex. 'touch(vector3 position)' instead of 'touch(int touch)'

CheckFloatExponent ( string script ) : string
CheckForInlineVectors ( string script ) : string
CheckIfGlobalVariable ( string varName, string type, SYMBOL kid ) : string
CheckName ( string s ) : string

Returns the passed name with an underscore prepended if that name is a reserved word in C# and not reserved in LSL otherwise it just returns the passed name. This makes no attempt to cache the results to minimise future lookups. For a non trivial scripts the number of unique identifiers could easily grow to the size of the reserved word list so maintaining a list or dictionary and doing the lookup there firstwould probably not give any real speed advantage. I believe there is a class Microsoft.CSharp.CSharpCodeProvider that has a function CreateValidIdentifier(str) that will return either the value of str if it is not a C# key word or "_"+str if it is. But availability under Mono?

DumpAfterFunc ( bool marc ) : string
DumpFunc ( bool marc ) : string
FindLineNumbers ( string EventName, string Problem ) : void
FindWrongParameterCountLineNumbers ( string EventName, int correct, int i ) : void
FixAdditionalEvents ( string script ) : string
FuncCallsMarc ( ) : bool
Generate ( string s ) : string

Prints text.

Generate ( string s, SYMBOL sym ) : string

Prints text.

GenerateArgumentDeclarationList ( ScriptEngineParser.ArgumentDeclarationList adl ) : string

Generates the code for an ArgumentDeclarationList node.

GenerateArgumentList ( ScriptEngineParser.ArgumentList al ) : string

Generates the code for an ArgumentList node.

GenerateAssignment ( ScriptEngineParser.Assignment a ) : string

Generates the code for an Assignment node.

GenerateBinaryExpression ( ScriptEngineParser.BinaryExpression be, bool isUnaryExpression, string addition ) : string

Generates the code for a BinaryExpression node.

GenerateCompoundStatement ( ScriptEngineParser.CompoundStatement cs ) : string

Generates the code for a CompoundStatement node.

GenerateConstant ( ScriptEngineParser.Constant c ) : string

Generates the code for a Constant node.

GenerateDeclaration ( ScriptEngineParser.Declaration d ) : string

Generates the code for a Declaration node.

GenerateDoWhileStatement ( ScriptEngineParser.DoWhileStatement dws ) : string

Generates the code for a DoWhileStatement node.

GenerateFireEventMethod ( ) : string
GenerateForLoop ( ScriptEngineParser.ForLoop fl ) : string

Generates the code for a ForLoop node.

GenerateForLoopStatement ( ScriptEngineParser.ForLoopStatement fls ) : string

Generates the code for a ForLoopStatement node.

GenerateFunctionCall ( ScriptEngineParser.FunctionCall fc, bool NeedRetVal ) : string

Generates the code for a FunctionCall node.

GenerateGlobalFunctionDefinition ( ScriptEngineParser.GlobalFunctionDefinition gf ) : string

Generates the code for a GlobalFunctionDefinition node.

GenerateGlobalVariableDeclaration ( ScriptEngineParser.GlobalVariableDeclaration gv ) : string

Generates the code for a GlobalVariableDeclaration node.

GenerateIfStatement ( ScriptEngineParser.IfStatement ifs ) : string

Generates the code for an IfStatement node.

GenerateIncrementDecrementExpression ( ScriptEngineParser.IncrementDecrementExpression ide ) : string

Generates the code for a IncrementDecrementExpression node.

GenerateIndented ( string s, SYMBOL sym ) : string

Prints text correctly indented.

GenerateIndentedLine ( string s ) : string

Prints text correctly indented, followed by a newline.

GenerateIndentedLine ( string s, SYMBOL sym ) : string

Prints text correctly indented, followed by a newline.

GenerateJumpLabel ( ScriptEngineParser.JumpLabel jl ) : string

Generates the code for a JumpLabel node.

GenerateJumpStatement ( ScriptEngineParser.JumpStatement js ) : string

Generates the code for a JumpStatement node.

GenerateLine ( ) : string

Prints a newline.

GenerateLine ( string s ) : string

Prints text, followed by a newline.

GenerateLine ( string s, SYMBOL sym ) : string

Prints text, followed by a newline.

GenerateListConstant ( ScriptEngineParser.ListConstant lc ) : string

Generates the code for a ListConstant node.

GenerateNode ( SYMBOL s ) : string

Recursively called to generate each type of node. Will generate this node, then all it's children.

GenerateParenthesisExpression ( ScriptEngineParser.ParenthesisExpression pe ) : string

Generates the code for a ParenthesisExpression node.

GenerateReturnStatement ( ScriptEngineParser.ReturnStatement rs ) : string

Generates the code for a ReturnStatement node.

GenerateRotationConstant ( ScriptEngineParser.RotationConstant rc ) : string

Generates the code for a RotationConstant node.

GenerateState ( ScriptEngineParser.State s ) : string

Generates the code for a State node.

GenerateStateChange ( ScriptEngineParser.StateChange sc ) : string

Generates the code for a StateChange node.

GenerateStateEvent ( ScriptEngineParser.StateEvent se, string parentStateName ) : string

Generates the code for a StateEvent node.

GenerateStatement ( ScriptEngineParser.Statement s ) : string

Generates the code for a Statement node.

GenerateTypecastExpression ( ScriptEngineParser.TypecastExpression te ) : string

Generates the code for a TypecastExpression node.

GenerateUnaryExpression ( ScriptEngineParser.UnaryExpression ue ) : string

Generates the code for a UnaryExpression node.

GenerateVectorConstant ( ScriptEngineParser.VectorConstant vc ) : string

Generates the code for a VectorConstant node.

GenerateWhileStatement ( ScriptEngineParser.WhileStatement ws ) : string

Generates the code for a WhileStatement node.

GetLocalDeclarationKey ( ) : string
GetValue ( ScriptEngineParser.Constant identEx ) : string
Indent ( ) : string

Prints correct indentation.

ResetCounters ( ) : void

Resets various counters and metadata.

checkForMultipleAssignments ( List identifiers, SYMBOL s ) : void

메소드 상세

CSCodeGenerator() 공개 메소드

Creates an 'empty' CSCodeGenerator instance.
public CSCodeGenerator ( WhiteCore.ScriptEngine.DotNetEngine.CompilerTools.Compiler compiler ) : System
compiler WhiteCore.ScriptEngine.DotNetEngine.CompilerTools.Compiler
리턴 System

Convert() 공개 메소드

Generate the code from the AST we have.
public Convert ( string script ) : string
script string The LSL source as a string.
리턴 string

CreateCompilerScript() 공개 정적인 메소드

public static CreateCompilerScript ( WhiteCore.ScriptEngine.DotNetEngine.CompilerTools.Compiler compiler, List MethodsToAdd, string ScriptClass ) : string
compiler WhiteCore.ScriptEngine.DotNetEngine.CompilerTools.Compiler
MethodsToAdd List
ScriptClass string
리턴 string

Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void

GetHeaderCount() 공개 정적인 메소드

public static GetHeaderCount ( WhiteCore.ScriptEngine.DotNetEngine.CompilerTools.Compiler compiler ) : int
compiler WhiteCore.ScriptEngine.DotNetEngine.CompilerTools.Compiler
리턴 int

프로퍼티 상세

LocalMethodArguements 공개적으로 프로퍼티

public Dictionary LocalMethodArguements
리턴 ObjectList>.Dictionary

LocalMethods 공개적으로 프로퍼티

public Dictionary LocalMethods
리턴 string>.Dictionary