AST 節點類型對照表


 

 

 

                  AST 節點類型對照表

序號 類型原名稱 中文名稱 描述
1 Program 程序主體 整段代碼的主體
2 VariableDeclaration 變量聲明 聲明一個變量,例如 var let const
3 FunctionDeclaration 函數聲明 聲明一個函數,例如 function
4 ExpressionStatement 表達式語句 通常是調用一個函數,例如 console.log()
5 BlockStatement 塊語句 包裹在 {} 塊內的代碼,例如 if (condition){var a = 1;}
6 BreakStatement 中斷語句 通常指 break
7 ContinueStatement 持續語句 通常指 continue
8 ReturnStatement 返回語句 通常指 return
9 SwitchStatement Switch 語句 通常指 Switch Case 語句中的 Switch
10 IfStatement If 控制流語句 控制流語句,通常指 if(condition){}else{}
11 Identifier 標識符 標識,例如聲明變量時 var identi = 5 中的 identi
12 CallExpression 調用表達式 通常指調用一個函數,例如 console.log()
13 BinaryExpression 二進制表達式 通常指運算,例如 1+2
14 MemberExpression 成員表達式 通常指調用對象的成員,例如 console 對象的 log 成員
15 ArrayExpression 數組表達式 通常指一個數組,例如 [1, 3, 5]
16 NewExpression New 表達式 通常指使用 New 關鍵詞
17 AssignmentExpression 賦值表達式 通常指將函數的返回值賦值給變量
18 UpdateExpression 更新表達式 通常指更新成員值,例如 i++
19 Literal 字面量 字面量
20 BooleanLiteral 布爾型字面量 布爾值,例如 true false
21 NumericLiteral 數字型字面量 數字,例如 100
22 StringLiteral 字符型字面量 字符串,例如 vansenb
23 SwitchCase Case 語句 通常指 Switch 語句中的 Case


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM