Documentation
¶
Index ¶
- Constants
- type CompilerLanguage
- type ErrorListener
- type ErrorStrategy
- type LuaError
- type LuaMergeError
- type LuaTranslator
- func (l *LuaTranslator) GetCodeIndex() int
- func (l *LuaTranslator) GetCompileErrors() LuaMergeError
- func (l *LuaTranslator) GetConstError(e constError) string
- func (l *LuaTranslator) GetErrors() LuaMergeError
- func (l *LuaTranslator) GetLexerErrors() LuaMergeError
- func (l *LuaTranslator) GetNextCodeIndex() int
- func (l *LuaTranslator) GetOpcodes() []*yakvm.Code
- func (l *LuaTranslator) GetParserErrors() LuaMergeError
- func (l *LuaTranslator) GetRootSymTable() *yakvm.SymbolTable
- func (l *LuaTranslator) Init(lexer *lua.LuaLexer, parser *lua.LuaParser)
- func (l *LuaTranslator) NowInFor() bool
- func (l *LuaTranslator) NowInRepeat() bool
- func (l *LuaTranslator) NowInWhile() bool
- func (l *LuaTranslator) SetCurrentSymTable(tbl *yakvm.SymbolTable)
- func (l *LuaTranslator) SetRootSymTable(tbl *yakvm.SymbolTable)
- func (l *LuaTranslator) SwitchCodes() func()
- func (l *LuaTranslator) SwitchSymbolTable(name ...string) func()
- func (l *LuaTranslator) SwitchSymbolTableInNewScope(name ...string) func()
- func (l *LuaTranslator) Translate(code string) bool
- func (l *LuaTranslator) VisitArgs(raw lua.IArgsContext) interface{}
- func (l *LuaTranslator) VisitArgsWhenMemberCall(raw lua.IArgsContext) interface{}
- func (l *LuaTranslator) VisitBlock(raw lua.IBlockContext) interface{}
- func (l *LuaTranslator) VisitChunk(raw lua.IChunkContext) interface{}
- func (l *LuaTranslator) VisitExp(raw lua.IExpContext) interface{}
- func (l *LuaTranslator) VisitExpList(raw lua.IExplistContext) interface{}
- func (l *LuaTranslator) VisitExpListWithoutLen(raw lua.IExplistContext) interface{}
- func (l *LuaTranslator) VisitField(raw lua.IFieldContext, indexCounter *int) interface{}
- func (l *LuaTranslator) VisitFieldList(raw lua.IFieldlistContext) interface{}
- func (l *LuaTranslator) VisitFuncNameAndBody(name lua.IFuncnameContext, body lua.IFuncbodyContext) interface{}
- func (l *LuaTranslator) VisitFunctionCall(raw lua.IFunctioncallContext) interface{}
- func (l *LuaTranslator) VisitFunctionDef(def lua.IFunctiondefContext) interface{}
- func (l *LuaTranslator) VisitGoto(labelName string) interface{}
- func (l *LuaTranslator) VisitLabel(raw lua.ILabelContext) interface{}
- func (l *LuaTranslator) VisitLastStat(raw lua.ILaststatContext) interface{}
- func (l *LuaTranslator) VisitLocalFuncNameAndBody(name string, body lua.IFuncbodyContext) interface{}
- func (l *LuaTranslator) VisitLocalVarWithName(isAssign bool, name string, attrib lua.IAttribContext) interface{}
- func (l *LuaTranslator) VisitNameAndArgs(raw lua.INameAndArgsContext) interface{}
- func (l *LuaTranslator) VisitNumber(raw lua.INumberContext) interface{}
- func (l *LuaTranslator) VisitParList(parlist lua.IParlistContext) ([]int, bool)
- func (l *LuaTranslator) VisitPrefixExp(raw lua.IPrefixexpContext) interface{}
- func (l *LuaTranslator) VisitStat(raw lua.IStatContext) interface{}
- func (l *LuaTranslator) VisitString(raw lua.IStringContext) interface{}
- func (l *LuaTranslator) VisitTableConstructor(raw lua.ITableconstructorContext) interface{}
- func (l *LuaTranslator) VisitVar(isAssign bool, raw lua.IVarContext) interface{}
- func (l *LuaTranslator) VisitVarList(isAssign bool, raw lua.IVarlistContext) interface{}
- func (l *LuaTranslator) VisitVarOrExp(isAssign bool, raw lua.IVarOrExpContext) interface{}
- func (l *LuaTranslator) VisitVarSuffix(raw lua.IVarSuffixContext, isAssign bool, isInitialized bool) interface{}
- func (l *LuaTranslator) VisitVariadicEllipsis(isAssign bool) interface{}
- func (l *LuaTranslator) VisitVariadicEllipsisForTblConstruct(isAssign bool) interface{}
- func (l *LuaTranslator) VisitVariadicField() interface{}
- type Position
Constants ¶
View Source
const (
CreateSymbolError = "SymbolTable cannot create build-in symbol[%s]"
)
View Source
const GLOBAL_ASSIGN_UNARY = 0
View Source
const LOCAL_ASSIGN_UNARY = 1
View Source
const OBJECT_METHOD = 0 // include self
View Source
const STATIC_METHOD = 1
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompilerLanguage ¶
type CompilerLanguage string
type ErrorListener ¶
type ErrorListener struct { antlr.DefaultErrorListener // contains filtered or unexported fields }
func NewErrorListener ¶
func NewErrorListener(handler func(msg string, start, end Position)) *ErrorListener
func (*ErrorListener) SyntaxError ¶
func (el *ErrorListener) SyntaxError(recognizer antlr.Recognizer, offendingSymbol interface{}, line, column int, msg string, e antlr.RecognitionException)
type ErrorStrategy ¶
type ErrorStrategy struct {
antlr.DefaultErrorStrategy
}
func NewErrorStrategy ¶
func NewErrorStrategy() *ErrorStrategy
func (*ErrorStrategy) ReportNoViableAlternative ¶
func (e *ErrorStrategy) ReportNoViableAlternative(recognizer antlr.Parser, n *antlr.NoViableAltException)
type LuaError ¶
func NewErrorWithPostion ¶
type LuaMergeError ¶
type LuaMergeError []*LuaError
func NewYakMergeError ¶
func NewYakMergeError(mergeErrors ...LuaMergeError) *LuaMergeError
func (LuaMergeError) Error ¶
func (y LuaMergeError) Error() string
func (*LuaMergeError) Merge ¶
func (y *LuaMergeError) Merge(mergeErrors ...LuaMergeError)
func (*LuaMergeError) Push ¶
func (y *LuaMergeError) Push(e *LuaError)
type LuaTranslator ¶
type LuaTranslator struct { lua.BaseLuaParserVisitor AntlrTokenStream antlr.TokenStream // contains filtered or unexported fields }
func NewLuaTranslator ¶
func NewLuaTranslator() *LuaTranslator
func NewLuaTranslatorWithTable ¶
func NewLuaTranslatorWithTable(rootSymbol *yakvm.SymbolTable, rootLabel *infrastructure.LabelTable) *LuaTranslator
func NewLuaTranslatorWithTableWithCode ¶ added in v1.2.3
func NewLuaTranslatorWithTableWithCode(code string, rootSymbol *yakvm.SymbolTable, rootLabel *infrastructure.LabelTable) *LuaTranslator
func (*LuaTranslator) GetCodeIndex ¶
func (l *LuaTranslator) GetCodeIndex() int
func (*LuaTranslator) GetCompileErrors ¶
func (l *LuaTranslator) GetCompileErrors() LuaMergeError
func (*LuaTranslator) GetConstError ¶
func (l *LuaTranslator) GetConstError(e constError) string
func (*LuaTranslator) GetErrors ¶
func (l *LuaTranslator) GetErrors() LuaMergeError
func (*LuaTranslator) GetLexerErrors ¶
func (l *LuaTranslator) GetLexerErrors() LuaMergeError
func (*LuaTranslator) GetNextCodeIndex ¶
func (l *LuaTranslator) GetNextCodeIndex() int
func (*LuaTranslator) GetOpcodes ¶
func (l *LuaTranslator) GetOpcodes() []*yakvm.Code
func (*LuaTranslator) GetParserErrors ¶
func (l *LuaTranslator) GetParserErrors() LuaMergeError
func (*LuaTranslator) GetRootSymTable ¶
func (l *LuaTranslator) GetRootSymTable() *yakvm.SymbolTable
func (*LuaTranslator) Init ¶
func (l *LuaTranslator) Init(lexer *lua.LuaLexer, parser *lua.LuaParser)
func (*LuaTranslator) NowInFor ¶
func (l *LuaTranslator) NowInFor() bool
func (*LuaTranslator) NowInRepeat ¶
func (l *LuaTranslator) NowInRepeat() bool
func (*LuaTranslator) NowInWhile ¶
func (l *LuaTranslator) NowInWhile() bool
func (*LuaTranslator) SetCurrentSymTable ¶
func (l *LuaTranslator) SetCurrentSymTable(tbl *yakvm.SymbolTable)
func (*LuaTranslator) SetRootSymTable ¶
func (l *LuaTranslator) SetRootSymTable(tbl *yakvm.SymbolTable)
func (*LuaTranslator) SwitchCodes ¶
func (l *LuaTranslator) SwitchCodes() func()
func (*LuaTranslator) SwitchSymbolTable ¶
func (l *LuaTranslator) SwitchSymbolTable(name ...string) func()
func (*LuaTranslator) SwitchSymbolTableInNewScope ¶
func (l *LuaTranslator) SwitchSymbolTableInNewScope(name ...string) func()
func (*LuaTranslator) Translate ¶
func (l *LuaTranslator) Translate(code string) bool
func (*LuaTranslator) VisitArgs ¶
func (l *LuaTranslator) VisitArgs(raw lua.IArgsContext) interface{}
func (*LuaTranslator) VisitArgsWhenMemberCall ¶
func (l *LuaTranslator) VisitArgsWhenMemberCall(raw lua.IArgsContext) interface{}
func (*LuaTranslator) VisitBlock ¶
func (l *LuaTranslator) VisitBlock(raw lua.IBlockContext) interface{}
func (*LuaTranslator) VisitChunk ¶
func (l *LuaTranslator) VisitChunk(raw lua.IChunkContext) interface{}
func (*LuaTranslator) VisitExp ¶
func (l *LuaTranslator) VisitExp(raw lua.IExpContext) interface{}
func (*LuaTranslator) VisitExpList ¶
func (l *LuaTranslator) VisitExpList(raw lua.IExplistContext) interface{}
func (*LuaTranslator) VisitExpListWithoutLen ¶
func (l *LuaTranslator) VisitExpListWithoutLen(raw lua.IExplistContext) interface{}
func (*LuaTranslator) VisitField ¶
func (l *LuaTranslator) VisitField(raw lua.IFieldContext, indexCounter *int) interface{}
func (*LuaTranslator) VisitFieldList ¶
func (l *LuaTranslator) VisitFieldList(raw lua.IFieldlistContext) interface{}
func (*LuaTranslator) VisitFuncNameAndBody ¶
func (l *LuaTranslator) VisitFuncNameAndBody(name lua.IFuncnameContext, body lua.IFuncbodyContext) interface{}
VisitFuncNameAndBody is used to visit vanilla named function declaration
func (*LuaTranslator) VisitFunctionCall ¶
func (l *LuaTranslator) VisitFunctionCall(raw lua.IFunctioncallContext) interface{}
func (*LuaTranslator) VisitFunctionDef ¶
func (l *LuaTranslator) VisitFunctionDef(def lua.IFunctiondefContext) interface{}
VisitFunctionDef is used to visit closure function declaration
func (*LuaTranslator) VisitGoto ¶
func (l *LuaTranslator) VisitGoto(labelName string) interface{}
VisitGoto jmp to label which is nop
func (*LuaTranslator) VisitLabel ¶
func (l *LuaTranslator) VisitLabel(raw lua.ILabelContext) interface{}
VisitLabel save label to a dedicated label table just like symbolTable with no op
func (*LuaTranslator) VisitLastStat ¶
func (l *LuaTranslator) VisitLastStat(raw lua.ILaststatContext) interface{}
func (*LuaTranslator) VisitLocalFuncNameAndBody ¶
func (l *LuaTranslator) VisitLocalFuncNameAndBody(name string, body lua.IFuncbodyContext) interface{}
VisitLocalFuncNameAndBody is used to visit vanilla named local function declaration
func (*LuaTranslator) VisitLocalVarWithName ¶
func (l *LuaTranslator) VisitLocalVarWithName(isAssign bool, name string, attrib lua.IAttribContext) interface{}
func (*LuaTranslator) VisitNameAndArgs ¶
func (l *LuaTranslator) VisitNameAndArgs(raw lua.INameAndArgsContext) interface{}
func (*LuaTranslator) VisitNumber ¶
func (l *LuaTranslator) VisitNumber(raw lua.INumberContext) interface{}
func (*LuaTranslator) VisitParList ¶
func (l *LuaTranslator) VisitParList(parlist lua.IParlistContext) ([]int, bool)
func (*LuaTranslator) VisitPrefixExp ¶
func (l *LuaTranslator) VisitPrefixExp(raw lua.IPrefixexpContext) interface{}
func (*LuaTranslator) VisitStat ¶
func (l *LuaTranslator) VisitStat(raw lua.IStatContext) interface{}
func (*LuaTranslator) VisitString ¶
func (l *LuaTranslator) VisitString(raw lua.IStringContext) interface{}
func (*LuaTranslator) VisitTableConstructor ¶
func (l *LuaTranslator) VisitTableConstructor(raw lua.ITableconstructorContext) interface{}
func (*LuaTranslator) VisitVar ¶
func (l *LuaTranslator) VisitVar(isAssign bool, raw lua.IVarContext) interface{}
func (*LuaTranslator) VisitVarList ¶
func (l *LuaTranslator) VisitVarList(isAssign bool, raw lua.IVarlistContext) interface{}
func (*LuaTranslator) VisitVarOrExp ¶
func (l *LuaTranslator) VisitVarOrExp(isAssign bool, raw lua.IVarOrExpContext) interface{}
func (*LuaTranslator) VisitVarSuffix ¶
func (l *LuaTranslator) VisitVarSuffix(raw lua.IVarSuffixContext, isAssign bool, isInitialized bool) interface{}
func (*LuaTranslator) VisitVariadicEllipsis ¶
func (l *LuaTranslator) VisitVariadicEllipsis(isAssign bool) interface{}
func (*LuaTranslator) VisitVariadicEllipsisForTblConstruct ¶
func (l *LuaTranslator) VisitVariadicEllipsisForTblConstruct(isAssign bool) interface{}
func (*LuaTranslator) VisitVariadicField ¶
func (l *LuaTranslator) VisitVariadicField() interface{}
Click to show internal directories.
Click to hide internal directories.