Documentation
¶
Index ¶
- Constants
- func NewLuaDependencyAnalyzer() *luaDependencyAnalyzer
- type ArithmeticOpExpr
- type AssignStmt
- type AttrGetExpr
- type BreakStmt
- type Comma3Expr
- type CompileOpt
- type DecomposeOpt
- type DoBlockStmt
- type FalseExpr
- type FuncCallExpr
- type FuncCallStmt
- type FuncDefStmt
- type FunctionExpr
- type GenericForStmt
- type GotoStmt
- type IdentExpr
- type IfStmt
- type LabelStmt
- type LocalAssignStmt
- type LogicalOpExpr
- type LuaMethod
- type NilExpr
- type NilFrame
- type NumberExpr
- type NumberForStmt
- type RelationalOpExpr
- type RepeatStmt
- type ReturnStmt
- type StringConcatOpExpr
- type StringExpr
- type TableExpr
- type TrueExpr
- type UnaryLenOpExpr
- type UnaryMinusOpExpr
- type UnaryNotOpExpr
- type VisitExprHandle
- type VisitStmtHandle
- type WhileStmt
- type YockPack
- func (*YockPack[T]) BuildScript(stmts []ast.Stmt, filter map[int]bool) string
- func (yockp *YockPack[T]) CC(entry string, main string)
- func (yockpack *YockPack[T]) Compile(opt CompileOpt, file string) *lua.LFunction
- func (yockpack *YockPack[T]) Decompose(opt DecomposeOpt, stmts []ast.Stmt)
- func (yockpack *YockPack[T]) DumpFile(file string) string
- func (yockpack *YockPack[T]) DumpStr(str string) string
- func (*YockPack[T]) ParseFile(file string) []ast.Stmt
- func (*YockPack[T]) ParseStr(str string) []ast.Stmt
- func (yockpack *YockPack[T]) VisitExpr(exprs []ast.Expr, frame T, handle VisitExprHandle[T])
- func (yockpack *YockPack[T]) VisitFile(file string, frame T, handle VisitStmtHandle[T])
- func (yockpack *YockPack[T]) VisitStmt(stmts []ast.Stmt, frame T, handle VisitStmtHandle[T])
- func (yockpack *YockPack[T]) VisitStr(str string, frame T, handle VisitStmtHandle[T])
Constants ¶
const ( StmtAssign = iota StmtLocalAssign StmtFuncCall StmtDoBlock StmtWhile StmtRepeat StmtIf StmtNumbderFor StmtGenericFor StmtFuncDef StmtReturn StmtBreak StmtLabel StmtGoto ExprTrue ExprFalse ExprNil ExprNumber ExprString ExprComma3 ExprIdent ExprAttrGet ExprTable ExprFuncCall ExprLogicalOp ExprRelationalOp ExprStringConcatOp ExprArithmeticOp ExprUnaryMinus ExprUnaryNotOp ExprUnaryLenOp ExprFunciton HandleDefault )
Variables ¶
This section is empty.
Functions ¶
func NewLuaDependencyAnalyzer ¶
func NewLuaDependencyAnalyzer() *luaDependencyAnalyzer
Types ¶
type ArithmeticOpExpr ¶
type ArithmeticOpExpr = *ast.ArithmeticOpExpr
type AssignStmt ¶
type AssignStmt = *ast.AssignStmt
type AttrGetExpr ¶
type AttrGetExpr = *ast.AttrGetExpr
type Comma3Expr ¶
type Comma3Expr = *ast.Comma3Expr
type CompileOpt ¶
type CompileOpt struct { DisableAnalyse bool VM yocki.YockRuntime }
type DecomposeOpt ¶
type DecomposeOpt struct { // file to be decomposed File string // divide file into modes to be specified Modes []string // template file, is used to generate control script. Tpl string Prefix string }
DecomposeOpt indicates configuration of Decompose
type DoBlockStmt ¶
type DoBlockStmt = *ast.DoBlockStmt
type FuncCallExpr ¶
type FuncCallExpr = *ast.FuncCallExpr
type FuncCallStmt ¶
type FuncCallStmt = *ast.FuncCallStmt
type FuncDefStmt ¶
type FuncDefStmt = *ast.FuncDefStmt
type FunctionExpr ¶
type FunctionExpr = *ast.FunctionExpr
type GenericForStmt ¶
type GenericForStmt = *ast.GenericForStmt
type LocalAssignStmt ¶
type LocalAssignStmt = *ast.LocalAssignStmt
type LogicalOpExpr ¶
type LogicalOpExpr = *ast.LogicalOpExpr
type LuaMethod ¶
type LuaMethod struct { // Argc indicates the number of parameters Argc int `json:"argc"` // Argv collects the name of each parameter Argv []string `json:"argv"` // Pkg indicates the scope for current driver. // Generally speaking, it is the file name, // and the way pkg is introduced for standard library functions and strings is g(global). Pkg string `json:"pkg"` }
LuaMethod stores the metadata of the driver
type NumberExpr ¶
type NumberExpr = *ast.NumberExpr
type NumberForStmt ¶
type NumberForStmt = *ast.NumberForStmt
type RelationalOpExpr ¶
type RelationalOpExpr = *ast.RelationalOpExpr
type RepeatStmt ¶
type RepeatStmt = *ast.RepeatStmt
type ReturnStmt ¶
type ReturnStmt = *ast.ReturnStmt
type StringConcatOpExpr ¶
type StringConcatOpExpr = *ast.StringConcatOpExpr
type StringExpr ¶
type StringExpr = *ast.StringExpr
type UnaryLenOpExpr ¶
type UnaryLenOpExpr = *ast.UnaryLenOpExpr
type UnaryMinusOpExpr ¶
type UnaryMinusOpExpr = *ast.UnaryMinusOpExpr
type UnaryNotOpExpr ¶
type UnaryNotOpExpr = *ast.UnaryNotOpExpr
type VisitExprHandle ¶
type VisitStmtHandle ¶
type YockPack ¶
type YockPack[T any] struct{}
YockPack serves as yock's preprocessing tool for decomposing Lua source code and for dependency analysis when YPM is not introduced.
func (*YockPack[T]) BuildScript ¶
BuildScript restores a given lua statement to source code
func (*YockPack[T]) Compile ¶
func (yockpack *YockPack[T]) Compile(opt CompileOpt, file string) *lua.LFunction
Compile compiles the contents of the given file into functions that can be executed by the virtual machine.
func (*YockPack[T]) Decompose ¶
func (yockpack *YockPack[T]) Decompose(opt DecomposeOpt, stmts []ast.Stmt)
func (*YockPack[T]) DumpStr ¶
DumpStr prints out a syntax tree based on the given source code string
func (*YockPack[T]) ParseFile ¶
ParseFile parses the given file content into a lua statement structure
func (*YockPack[T]) VisitExpr ¶
VisitExpr recursively traverses the lua expression, and you can pass a callback function to handle the incoming expression.
func (*YockPack[T]) VisitFile ¶
func (yockpack *YockPack[T]) VisitFile(file string, frame T, handle VisitStmtHandle[T])
func (*YockPack[T]) VisitStmt ¶
func (yockpack *YockPack[T]) VisitStmt(stmts []ast.Stmt, frame T, handle VisitStmtHandle[T])
VisitStmt recursively traverses the lua statement, and you can pass a callback function to handle the incoming statement.
func (*YockPack[T]) VisitStr ¶
func (yockpack *YockPack[T]) VisitStr(str string, frame T, handle VisitStmtHandle[T])