Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStatementType ¶ added in v1.2.4
func GetStatementType(st interface{}) string
func NewJavaScriptWalker ¶
func Walk ¶ added in v1.3.2
Walk traverses an AST in depth-first order: It starts by calling v.Enter(node); node must not be nil. If the visitor v returned by v.Enter(node) is not nil, Walk is invoked recursively with visitor v for each of the non-nil children of node, followed by a call of v.Exit(node).
Types ¶
type ASTWalkerResult ¶
type ASTWalkerResult struct { StringLiteral []string Int64Literal []int64 Float64Literal []float64 Identifies []string BadSyntax []string }
func BasicJavaScriptASTWalker ¶
func BasicJavaScriptASTWalker(code string) (*ASTWalkerResult, error)
ASTWalk 对传入的JS代码进行AST遍历,返回遍历后的结果(包含字面量,标识符,语法错误)和错误 Example: ``` code = `function add(a, b) { return a + b; }` res = javascript.ASTWalk(code)~ dump(res) ```
Click to show internal directories.
Click to hide internal directories.