diff options
Diffstat (limited to 'lib/ast.js')
-rw-r--r-- | lib/ast.js | 27 |
1 files changed, 10 insertions, 17 deletions
@@ -9,7 +9,7 @@ function DEFNODE(type, props, methods, base) { code += "this." + props[i] + " = props." + props[i] + ";"; } if (methods && methods.initialize) - code += "this.initialize();" + code += "this.initialize();"; code += " } }"; var ctor = new Function(code)(); if (base) { @@ -36,7 +36,7 @@ var AST_Token = DEFNODE("Token", "type value line col pos endpos nlb comments_be var AST_Node = DEFNODE("Node", "start end", { clone: function() { return new this.CTOR(this); - }, + } }, null); var AST_Directive = DEFNODE("Directive", "value", { @@ -47,16 +47,6 @@ var AST_Debugger = DEFNODE("Debugger", null, { }); -var AST_Parenthesized = DEFNODE("Parenthesized", "expression", { - $documentation: "Represents an expression which is always parenthesized. Used for the \ -conditions in IF/WHILE/DO and expression in SWITCH/WITH.", -}); - -var AST_Bracketed = DEFNODE("Bracketed", "body", { - $documentation: "Represents a block of statements that are always included in brackets. \ -Used for bodies of FUNCTION/TRY/CATCH/THROW/SWITCH.", -}); - /* -----[ loops ]----- */ var AST_LabeledStatement = DEFNODE("LabeledStatement", "label statement", { @@ -78,11 +68,14 @@ var AST_EmptyStatement = DEFNODE("EmptyStatement", null, { }, AST_Statement); -var AST_Do = DEFNODE("Do", "condition", { +var AST_DWLoop = DEFNODE("DWLoop", "condition", { }, AST_Statement); -var AST_While = DEFNODE("While", "condition", { -}, AST_Statement); +var AST_Do = DEFNODE("Do", null, { +}, AST_DWLoop); + +var AST_While = DEFNODE("While", null, { +}, AST_DWLoop); var AST_For = DEFNODE("For", "init condition step", { }, AST_Statement); @@ -152,7 +145,7 @@ var AST_Switch = DEFNODE("Switch", "expression", { }, AST_Statement); var AST_SwitchBlock = DEFNODE("SwitchBlock", null, { -}, AST_Bracketed); +}, AST_BlockStatement); var AST_SwitchBranch = DEFNODE("SwitchBranch", "body", { }); @@ -177,7 +170,7 @@ var AST_Finally = DEFNODE("Finally", "body", { /* -----[ VAR/CONST ]----- */ -var AST_Definitions = DEFNODE("Definitions", "definitions inline", { +var AST_Definitions = DEFNODE("Definitions", "definitions", { }); var AST_Var = DEFNODE("Var", null, { |