khepri-ast
Advanced tools
Comparing version 3.2.0 to 3.2.1
# ChangeLog # | ||
# 3.2.1 - January 26, 2014 | ||
* Fixed paths. | ||
# 3.2.0 - January 22, 2014 | ||
@@ -4,0 +7,0 @@ * Renamed `ArgumentsPattern` to `SubPattern`. |
"use strict"; | ||
var __o = require("khepri_ast/node"), | ||
var __o = require("./node"), | ||
defineNode = __o["defineNode"], | ||
@@ -9,10 +9,12 @@ Node = __o["Node"], | ||
(SwitchCase = defineNode(Clause, "SwitchCase", ["test", "consequent"], [], (function(loc, test, consequent) { | ||
Node.call(this, loc); | ||
(this.test = (test || null)); | ||
(this.consequent = consequent); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.test = (test || null)); | ||
(self.consequent = consequent); | ||
}))); | ||
(CatchClause = defineNode(Clause, "CatchClause", ["param", "body"], [], (function(loc, param, body) { | ||
Node.call(this, loc); | ||
(this.param = param); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.param = param); | ||
(self.body = body); | ||
}))); | ||
@@ -19,0 +21,0 @@ (exports.Clause = Clause); |
"use strict"; | ||
var __o = require("khepri_ast/node"), | ||
var __o = require("./node"), | ||
defineNode = __o["defineNode"], | ||
@@ -9,23 +9,28 @@ Node = __o["Node"], | ||
(VariableDeclaration = defineNode(Declaration, "VariableDeclaration", ["declarations"], [], (function(loc, declarations) { | ||
Node.call(this, loc); | ||
(this.declarations = declarations); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.declarations = declarations); | ||
}))); | ||
(VariableDeclarator = defineNode(Declaration, "VariableDeclarator", ["id", "init"], [], (function(loc, id, init) { | ||
Node.call(this, loc); | ||
(this.id = id); | ||
(this.init = (init || null)); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.id = id); | ||
(self.init = (init || null)); | ||
}))); | ||
(Binding = defineNode(Declaration, "Binding", ["pattern", "value"], [], (function(loc, pattern, value) { | ||
Node.call(this, loc); | ||
(this.pattern = pattern); | ||
(this.value = value); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.pattern = pattern); | ||
(self.value = value); | ||
}))); | ||
(StaticDeclaration = defineNode(Declaration, "StaticDeclaration", ["declarations"], [], (function(loc, declarations) { | ||
Node.call(this, loc); | ||
(this.declarations = declarations); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.declarations = declarations); | ||
}))); | ||
(StaticDeclarator = defineNode(Declaration, "StaticDeclarator", ["id", "init"], [], (function(loc, id, init) { | ||
Node.call(this, loc); | ||
(this.id = id); | ||
(this.init = init); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.id = id); | ||
(self.init = init); | ||
}))); | ||
@@ -32,0 +37,0 @@ (exports.Declaration = Declaration); |
"use strict"; | ||
var __o = require("khepri_ast/node"), | ||
var __o = require("./node"), | ||
defineNode = __o["defineNode"], | ||
@@ -9,94 +9,113 @@ Node = __o["Node"], | ||
TernaryOperatorExpression; | ||
(Expression = (function() {})); | ||
(Expression = (function() { | ||
var self = this; | ||
})); | ||
(Expression.prototype = new(Node)()); | ||
(ThisExpression = defineNode(Expression, "ThisExpression", [], [], (function(loc) { | ||
Node.call(this, loc); | ||
var self = this; | ||
Node.call(self, loc); | ||
}))); | ||
(UnaryExpression = defineNode(Expression, "UnaryExpression", ["argument"], ["operator"], (function(loc, operator, | ||
argument) { | ||
Node.call(this, loc); | ||
(this.operator = operator); | ||
(this.argument = argument); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.operator = operator); | ||
(self.argument = argument); | ||
}))); | ||
(BinaryExpression = defineNode(Expression, "BinaryExpression", ["left", "right"], ["operator"], (function(loc, operator, | ||
left, right) { | ||
Node.call(this, loc); | ||
(this.operator = operator); | ||
(this.left = left); | ||
(this.right = right); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.operator = operator); | ||
(self.left = left); | ||
(self.right = right); | ||
}))); | ||
(AssignmentExpression = defineNode(Expression, "AssignmentExpression", ["left", "right"], ["operator"], (function(loc, | ||
operator, left, right) { | ||
Node.call(this, loc); | ||
(this.operator = operator); | ||
(this.left = left); | ||
(this.right = right); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.operator = operator); | ||
(self.left = left); | ||
(self.right = right); | ||
}))); | ||
(LogicalExpression = defineNode(Expression, "LogicalExpression", ["left", "right"], ["operator"], (function(loc, | ||
operator, left, right) { | ||
Node.call(this, loc); | ||
(this.operator = operator); | ||
(this.left = left); | ||
(this.right = right); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.operator = operator); | ||
(self.left = left); | ||
(self.right = right); | ||
}))); | ||
(ConditionalExpression = defineNode(Expression, "ConditionalExpression", ["test", "consequent", "alternate"], [], ( | ||
function(loc, test, consequent, alternate) { | ||
Node.call(this, loc); | ||
(this.test = test); | ||
(this.consequent = consequent); | ||
(this.alternate = alternate); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.test = test); | ||
(self.consequent = consequent); | ||
(self.alternate = alternate); | ||
}))); | ||
(NewExpression = defineNode(Expression, "NewExpression", ["callee", "args"], [], (function(loc, callee, args) { | ||
Node.call(this, loc); | ||
(this.callee = callee); | ||
(this.args = args); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.callee = callee); | ||
(self.args = args); | ||
}))); | ||
(CallExpression = defineNode(Expression, "CallExpression", ["callee", "args"], [], (function(loc, callee, args) { | ||
Node.call(this, loc); | ||
(this.callee = callee); | ||
(this.args = args); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.callee = callee); | ||
(self.args = args); | ||
}))); | ||
(MemberExpression = defineNode(Expression, "MemberExpression", ["object", "property"], ["computed"], (function(loc, | ||
object, property, computed) { | ||
Node.call(this, loc); | ||
(this.object = object); | ||
(this.property = property); | ||
(this.computed = computed); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.object = object); | ||
(self.property = property); | ||
(self.computed = computed); | ||
}))); | ||
(FunctionExpression = defineNode(Expression, "FunctionExpression", ["id", "params", "body"], [], (function(loc, id, | ||
params, body) { | ||
Node.call(this, loc); | ||
(this.id = (id || null)); | ||
(this.params = params); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.id = (id || null)); | ||
(self.params = params); | ||
(self.body = body); | ||
}))); | ||
(ArrayExpression = defineNode(Expression, "ArrayExpression", ["elements"], [], (function(loc, elements) { | ||
Node.call(this, loc); | ||
(this.elements = elements); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.elements = elements); | ||
}))); | ||
(ObjectExpression = defineNode(Expression, "ObjectExpression", ["properties"], [], (function(loc, properties) { | ||
Node.call(this, loc); | ||
(this.properties = properties); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.properties = properties); | ||
}))); | ||
(LetExpression = defineNode(Expression, "LetExpression", ["bindings", "body"], [], (function(loc, bindings, body) { | ||
Node.call(this, loc); | ||
(this.bindings = bindings); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.bindings = bindings); | ||
(self.body = body); | ||
}))); | ||
(CurryExpression = defineNode(Expression, "CurryExpression", ["base", "args"], [], (function(loc, base, args) { | ||
Node.call(this, loc); | ||
(this.base = base); | ||
(this.args = args); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.base = base); | ||
(self.args = args); | ||
}))); | ||
(UnaryOperatorExpression = defineNode(Expression, "UnaryOperatorExpression", [], ["op"], (function(loc, op) { | ||
Node.call(this, loc); | ||
(this.op = op); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.op = op); | ||
}))); | ||
(BinaryOperatorExpression = defineNode(Expression, "BinaryOperatorExpression", [], ["op"], (function(loc, op) { | ||
Node.call(this, loc); | ||
(this.op = op); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.op = op); | ||
}))); | ||
(TernaryOperatorExpression = defineNode(Expression, "TernaryOperatorExpression", [], ["op"], (function(loc, op) { | ||
Node.call(this, loc); | ||
(this.op = op); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.op = op); | ||
}))); | ||
@@ -103,0 +122,0 @@ (exports.Expression = Expression); |
"use strict"; | ||
var __o = require("khepri_ast/serialization"), | ||
var __o = require("./serialization"), | ||
registerNode = __o["registerNode"], | ||
@@ -12,4 +12,3 @@ Node, construct, reconstruct, modify, setLoc, setUserData, getData, modifyData, setData, defineNode, concatArgs = ( | ||
}); | ||
}) | ||
.call(this), | ||
})(), | ||
keys = Object.keys, | ||
@@ -22,2 +21,3 @@ map = Function.prototype.call.bind(Array.prototype.map), | ||
.forEach((function(i) { | ||
var self = this; | ||
(out[i] = obj[i]); | ||
@@ -31,3 +31,4 @@ })); | ||
(Node = (function(loc, ud) { | ||
Object.defineProperties(this, ({ | ||
var self = this; | ||
Object.defineProperties(self, ({ | ||
"loc": ({ | ||
@@ -62,2 +63,3 @@ "value": loc, | ||
.forEach((function(key) { | ||
var self = this; | ||
(properties[key] = ({ | ||
@@ -88,3 +90,3 @@ "value": attributes[key], | ||
})); | ||
Object.keys(children) | ||
if (children) Object.keys(children) | ||
.forEach((function(key) { | ||
@@ -96,3 +98,3 @@ (allChildren[key] = children[key]); | ||
})); | ||
Object.keys(attributes) | ||
if (attributes) Object.keys(attributes) | ||
.forEach((function(key) { | ||
@@ -99,0 +101,0 @@ (allAttributes[key] = attributes[key]); |
"use strict"; | ||
var __o = require("khepri_ast/node"), | ||
var __o = require("./node"), | ||
defineNode = __o["defineNode"], | ||
@@ -7,14 +7,17 @@ Node = __o["Node"], | ||
(PackageExport = defineNode(Node, "PackageExport", ["id", "alias"], [], (function(loc, id, alias) { | ||
Node.call(this, loc); | ||
(this.id = id); | ||
(this.alias = alias); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.id = id); | ||
(self.alias = alias); | ||
}))); | ||
(PackageExports = defineNode(Node, "PackageExports", ["exports"], [], (function(loc, exports) { | ||
Node.call(this, loc); | ||
(this.exports = exports); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.exports = exports); | ||
}))); | ||
(Package = defineNode(Node, "Package", ["exports", "body"], [], (function(loc, exports, body) { | ||
Node.call(this, loc); | ||
(this.exports = exports); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.exports = exports); | ||
(self.body = body); | ||
}))); | ||
@@ -21,0 +24,0 @@ (exports.Package = Package); |
"use strict"; | ||
var __o = require("khepri_ast/node"), | ||
var __o = require("./node"), | ||
defineNode = __o["defineNode"], | ||
@@ -8,50 +8,61 @@ Node = __o["Node"], | ||
(Pattern = (function(loc) { | ||
Node.call(this, loc); | ||
var self = this; | ||
Node.call(self, loc); | ||
})); | ||
(Pattern.prototype = new(Node)()); | ||
(IdentifierPattern = defineNode(Pattern, "IdentifierPattern", ["id"], [], (function(loc, id) { | ||
Pattern.call(this, loc); | ||
(this.id = id); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
(self.id = id); | ||
}))); | ||
(EllipsisPattern = defineNode(Pattern, "EllipsisPattern", [], ["id"], (function(loc, id) { | ||
Pattern.call(this, loc); | ||
(this.id = (id || null)); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
(self.id = (id || null)); | ||
}))); | ||
(SinkPattern = defineNode(Pattern, "SinkPattern", [], [], (function(loc) { | ||
Pattern.call(this, loc); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
}))); | ||
(ImportPattern = defineNode(Node, "ImportPattern", ["from", "pattern"], [], (function(loc, from, pattern) { | ||
Node.call(this, loc); | ||
(this.from = from); | ||
(this.pattern = pattern); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.from = from); | ||
(self.pattern = pattern); | ||
}))); | ||
(ArrayPattern = defineNode(Pattern, "ArrayPattern", ["elements"], [], (function(loc, elements) { | ||
Pattern.call(this, loc); | ||
(this.elements = elements); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
(self.elements = elements); | ||
}))); | ||
(ObjectPatternElement = defineNode(Pattern, "ObjectPatternElement", ["key", "target"], [], (function(loc, key, target) { | ||
Pattern.call(this, loc); | ||
(this.key = key); | ||
(this.target = (target || null)); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
(self.key = key); | ||
(self.target = (target || null)); | ||
}))); | ||
(ObjectPattern = defineNode(Pattern, "ObjectPattern", ["elements"], [], (function(loc, elements) { | ||
Pattern.call(this, loc); | ||
(this.elements = elements); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
(self.elements = elements); | ||
}))); | ||
(AsPattern = defineNode(Pattern, "AsPattern", ["id", "target"], [], (function(loc, id, target) { | ||
Pattern.call(this, loc); | ||
(this.id = id); | ||
(this.target = target); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
(self.id = id); | ||
(self.target = target); | ||
}))); | ||
(SubPattern = defineNode(Pattern, "SubPattern", ["id", "elements"], [], (function(loc, id, elements) { | ||
Pattern.call(this, loc); | ||
(this.id = id); | ||
(this.elements = elements); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
(self.id = id); | ||
(self.elements = elements); | ||
}))); | ||
(ArgumentsPattern = defineNode(Pattern, "ArgumentsPattern", ["id", "elements", "self"], [], (function(loc, id, elements, | ||
self) { | ||
Pattern.call(this, loc); | ||
(this.id = id); | ||
(this.elements = elements); | ||
(this.self = self); | ||
var T = this; | ||
Pattern.call(T, loc); | ||
(T.id = id); | ||
(T.elements = elements); | ||
(T.self = self); | ||
}))); | ||
@@ -58,0 +69,0 @@ (exports.Pattern = Pattern); |
"use strict"; | ||
var __o = require("khepri_ast/node"), | ||
var __o = require("./node"), | ||
defineNode = __o["defineNode"], | ||
@@ -7,5 +7,6 @@ Node = __o["Node"], | ||
(Program = defineNode(Node, "Program", ["body"], [], (function(loc, body) { | ||
Node.call(this, loc); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.body = body); | ||
}))); | ||
(exports.Program = Program); |
"use strict"; | ||
var khepri_node = require("khepri_ast/node"), | ||
var khepri_node = require("./node"), | ||
registerNode, serialize, unserialize, keys = Object.keys, | ||
@@ -4,0 +4,0 @@ map = Function.prototype.call.bind(Array.prototype.map), |
"use strict"; | ||
var __o = require("khepri_ast/node"), | ||
var __o = require("./node"), | ||
defineNode = __o["defineNode"], | ||
@@ -8,74 +8,91 @@ Node = __o["Node"], | ||
WhileStatement, DoWhileStatement, ForStatement; | ||
(Statement = (function() {})); | ||
(Statement = (function() { | ||
var self = this; | ||
})); | ||
(Statement.prototype = new(Node)()); | ||
(EmptyStatement = defineNode(Statement, "EmptyStatement", [], [], (function(loc) { | ||
Node.call(this, loc); | ||
var self = this; | ||
Node.call(self, loc); | ||
}))); | ||
(DebuggerStatement = defineNode(Statement, "DebuggerStatement", [], [], (function(loc) { | ||
Node.call(this, loc); | ||
var self = this; | ||
Node.call(self, loc); | ||
}))); | ||
(BlockStatement = defineNode(Statement, "BlockStatement", ["body"], [], (function(loc, body) { | ||
Node.call(this, loc); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.body = body); | ||
}))); | ||
(ExpressionStatement = defineNode(Statement, "ExpressionStatement", ["expression"], [], (function(loc, expression) { | ||
Node.call(this, loc); | ||
(this.expression = expression); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.expression = expression); | ||
}))); | ||
(IfStatement = defineNode(Statement, "IfStatement", ["test", "consequent", "alternate"], [], (function(loc, test, | ||
consequent, alternate) { | ||
Node.call(this, loc); | ||
(this.test = test); | ||
(this.consequent = consequent); | ||
(this.alternate = (alternate || null)); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.test = test); | ||
(self.consequent = consequent); | ||
(self.alternate = (alternate || null)); | ||
}))); | ||
(WithStatement = defineNode(Statement, "WithStatement", ["bindings", "body"], [], (function(loc, bindings, body) { | ||
Node.call(this, loc); | ||
(this.bindings = bindings); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.bindings = bindings); | ||
(self.body = body); | ||
}))); | ||
(BreakStatement = defineNode(Statement, "BreakStatement", [], [], (function(loc) { | ||
Node.call(this, loc); | ||
var self = this; | ||
Node.call(self, loc); | ||
}))); | ||
(ContinueStatement = defineNode(Statement, "ContinueStatement", [], [], (function(loc) { | ||
Node.call(this, loc); | ||
var self = this; | ||
Node.call(self, loc); | ||
}))); | ||
(SwitchStatement = defineNode(Statement, "SwitchStatement", ["discriminant", "cases"], [], (function(loc, discriminant, | ||
cases) { | ||
Node.call(this, loc); | ||
(this.discriminant = discriminant); | ||
(this.cases = cases); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.discriminant = discriminant); | ||
(self.cases = cases); | ||
}))); | ||
(ReturnStatement = defineNode(Statement, "ReturnStatement", ["argument"], [], (function(loc, argument) { | ||
Node.call(this, loc); | ||
(this.argument = (argument || null)); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.argument = (argument || null)); | ||
}))); | ||
(ThrowStatement = defineNode(Statement, "ThrowStatement", ["argument"], [], (function(loc, argument) { | ||
Node.call(this, loc); | ||
(this.argument = argument); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.argument = argument); | ||
}))); | ||
(TryStatement = defineNode(Statement, "TryStatement", ["block", "handler", "finalizer"], [], (function(loc, block, | ||
handler, finalizer) { | ||
Node.call(this, loc); | ||
(this.block = block); | ||
(this.handler = handler); | ||
(this.finalizer = finalizer); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.block = block); | ||
(self.handler = handler); | ||
(self.finalizer = finalizer); | ||
}))); | ||
(WhileStatement = defineNode(Statement, "WhileStatement", ["test", "body"], [], (function(loc, test, body) { | ||
Node.call(this, loc); | ||
(this.test = test); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.test = test); | ||
(self.body = body); | ||
}))); | ||
(DoWhileStatement = defineNode(Statement, "DoWhileStatement", ["body", "test"], [], (function(loc, body, test) { | ||
Node.call(this, loc); | ||
(this.test = test); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.test = test); | ||
(self.body = body); | ||
}))); | ||
(ForStatement = defineNode(Statement, "ForStatement", ["init", "test", "update", "body"], [], (function(loc, init, test, | ||
update, body) { | ||
Node.call(this, loc); | ||
(this.init = (init || null)); | ||
(this.test = (test || null)); | ||
(this.update = (update || null)); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.init = (init || null)); | ||
(self.test = (test || null)); | ||
(self.update = (update || null)); | ||
(self.body = body); | ||
}))); | ||
@@ -82,0 +99,0 @@ (exports.Statement = Statement); |
"use strict"; | ||
var __o = require("khepri_ast/node"), | ||
var __o = require("./node"), | ||
defineNode = __o["defineNode"], | ||
@@ -8,41 +8,53 @@ Node = __o["Node"], | ||
(Token = (function(loc, value) { | ||
Node.call(this, loc); | ||
(this.value = value); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.value = value); | ||
})); | ||
(Token.prototype = new(Node)()); | ||
(StringToken = defineNode(Token, "String", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(NumberToken = defineNode(Token, "Number", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(RegularExpressionToken = defineNode(Token, "RegularExpression", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(BooleanToken = defineNode(Token, "Boolean", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(NullToken = defineNode(Token, "Null", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(IdentifierToken = defineNode(Token, "Identifier", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(KeywordToken = defineNode(Token, "Keyword", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(PunctuatorToken = defineNode(Token, "Punctuator", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(CommentToken = defineNode(Token, "Comment", [], ["value", "multiline", "linebreak"], (function(loc, value, multiline, | ||
linebreak) { | ||
Token.call(this, loc, value); | ||
(this.multiline = !!multiline); | ||
(this.linebreak = !!linebreak); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
(self.multiline = !!multiline); | ||
(self.linebreak = !!linebreak); | ||
}))); | ||
(WhitespaceToken = defineNode(Token, "Whitespace", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(LineTerminatorToken = defineNode(Token, "LineTerminator", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
@@ -49,0 +61,0 @@ (exports.Token = Token); |
"use strict"; | ||
var __o = require("khepri_ast/node"), | ||
var __o = require("./node"), | ||
defineNode = __o["defineNode"], | ||
@@ -7,14 +7,17 @@ Node = __o["Node"], | ||
(Identifier = defineNode(Node, "Identifier", [], ["name"], (function(loc, name) { | ||
Node.call(this, loc); | ||
(this.name = name); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.name = name); | ||
}))); | ||
(Literal = defineNode(Node, "Literal", [], ["kind", "value"], (function(loc, kind, value) { | ||
Node.call(this, loc); | ||
(this.kind = kind); | ||
(this.value = value); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.kind = kind); | ||
(self.value = value); | ||
}))); | ||
(ObjectValue = defineNode(Node, "ObjectValue", ["key", "value"], [], (function(loc, key, value) { | ||
Node.call(this, loc); | ||
(this.key = key); | ||
(this.value = value); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.key = key); | ||
(self.value = value); | ||
}))); | ||
@@ -21,0 +24,0 @@ (exports.Identifier = Identifier); |
@@ -1,22 +0,19 @@ | ||
/* | ||
* THIS FILE IS AUTO GENERATED from 'lib/clause.kep' | ||
* DO NOT EDIT | ||
*/ | ||
define(["require", "exports", "khepri_ast/node"], (function(require, exports, __o) { | ||
define(["require", "exports", "./node"], (function(require, exports, __o) { | ||
"use strict"; | ||
var Clause, SwitchCase, CatchClause; | ||
var __o = __o, | ||
defineNode = __o["defineNode"], | ||
Node = __o["Node"]; | ||
var defineNode = __o["defineNode"], | ||
Node = __o["Node"], | ||
Clause, SwitchCase, CatchClause; | ||
(Clause = (function() {})); | ||
(Clause.prototype = new(Node)()); | ||
(SwitchCase = defineNode(Clause, "SwitchCase", ["test", "consequent"], [], (function(loc, test, consequent) { | ||
Node.call(this, loc); | ||
(this.test = (test || null)); | ||
(this.consequent = consequent); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.test = (test || null)); | ||
(self.consequent = consequent); | ||
}))); | ||
(CatchClause = defineNode(Clause, "CatchClause", ["param", "body"], [], (function(loc, param, body) { | ||
Node.call(this, loc); | ||
(this.param = param); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.param = param); | ||
(self.body = body); | ||
}))); | ||
@@ -26,2 +23,2 @@ (exports.Clause = Clause); | ||
(exports.CatchClause = CatchClause); | ||
})) | ||
})); |
@@ -1,11 +0,6 @@ | ||
/* | ||
* THIS FILE IS AUTO GENERATED from 'lib/declaration.kep' | ||
* DO NOT EDIT | ||
*/ | ||
define(["require", "exports", "khepri_ast/node"], (function(require, exports, __o) { | ||
define(["require", "exports", "./node"], (function(require, exports, __o) { | ||
"use strict"; | ||
var Declaration, VariableDeclaration, VariableDeclarator, Binding, StaticDeclaration, StaticDeclarator; | ||
var __o = __o, | ||
defineNode = __o["defineNode"], | ||
Node = __o["Node"]; | ||
var defineNode = __o["defineNode"], | ||
Node = __o["Node"], | ||
Declaration, VariableDeclaration, VariableDeclarator, Binding, StaticDeclaration, StaticDeclarator; | ||
(Declaration = (function() {})); | ||
@@ -15,25 +10,30 @@ (Declaration.prototype = new(Node)()); | ||
declarations) { | ||
Node.call(this, loc); | ||
(this.declarations = declarations); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.declarations = declarations); | ||
}))); | ||
(VariableDeclarator = defineNode(Declaration, "VariableDeclarator", ["id", "init"], [], (function(loc, id, | ||
init) { | ||
Node.call(this, loc); | ||
(this.id = id); | ||
(this.init = (init || null)); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.id = id); | ||
(self.init = (init || null)); | ||
}))); | ||
(Binding = defineNode(Declaration, "Binding", ["pattern", "value"], [], (function(loc, pattern, value) { | ||
Node.call(this, loc); | ||
(this.pattern = pattern); | ||
(this.value = value); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.pattern = pattern); | ||
(self.value = value); | ||
}))); | ||
(StaticDeclaration = defineNode(Declaration, "StaticDeclaration", ["declarations"], [], (function(loc, | ||
declarations) { | ||
Node.call(this, loc); | ||
(this.declarations = declarations); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.declarations = declarations); | ||
}))); | ||
(StaticDeclarator = defineNode(Declaration, "StaticDeclarator", ["id", "init"], [], (function(loc, id, init) { | ||
Node.call(this, loc); | ||
(this.id = id); | ||
(this.init = init); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.id = id); | ||
(self.init = init); | ||
}))); | ||
@@ -46,2 +46,2 @@ (exports.Declaration = Declaration); | ||
(exports.StaticDeclarator = StaticDeclarator); | ||
})) | ||
})); |
@@ -1,113 +0,127 @@ | ||
/* | ||
* THIS FILE IS AUTO GENERATED from 'lib/expression.kep' | ||
* DO NOT EDIT | ||
*/ | ||
define(["require", "exports", "khepri_ast/node"], (function(require, exports, __o) { | ||
define(["require", "exports", "./node"], (function(require, exports, __o) { | ||
"use strict"; | ||
var Expression, ThisExpression, UnaryExpression, BinaryExpression, AssignmentExpression, LogicalExpression, | ||
var defineNode = __o["defineNode"], | ||
Node = __o["Node"], | ||
Expression, ThisExpression, UnaryExpression, BinaryExpression, AssignmentExpression, LogicalExpression, | ||
ConditionalExpression, NewExpression, CallExpression, MemberExpression, FunctionExpression, | ||
ArrayExpression, ObjectExpression, LetExpression, CurryExpression, UnaryOperatorExpression, | ||
BinaryOperatorExpression, TernaryOperatorExpression; | ||
var __o = __o, | ||
defineNode = __o["defineNode"], | ||
Node = __o["Node"]; | ||
(Expression = (function() {})); | ||
(Expression = (function() { | ||
var self = this; | ||
})); | ||
(Expression.prototype = new(Node)()); | ||
(ThisExpression = defineNode(Expression, "ThisExpression", [], [], (function(loc) { | ||
Node.call(this, loc); | ||
var self = this; | ||
Node.call(self, loc); | ||
}))); | ||
(UnaryExpression = defineNode(Expression, "UnaryExpression", ["argument"], ["operator"], (function(loc, | ||
operator, argument) { | ||
Node.call(this, loc); | ||
(this.operator = operator); | ||
(this.argument = argument); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.operator = operator); | ||
(self.argument = argument); | ||
}))); | ||
(BinaryExpression = defineNode(Expression, "BinaryExpression", ["left", "right"], ["operator"], (function( | ||
loc, operator, left, right) { | ||
Node.call(this, loc); | ||
(this.operator = operator); | ||
(this.left = left); | ||
(this.right = right); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.operator = operator); | ||
(self.left = left); | ||
(self.right = right); | ||
}))); | ||
(AssignmentExpression = defineNode(Expression, "AssignmentExpression", ["left", "right"], ["operator"], ( | ||
function(loc, operator, left, right) { | ||
Node.call(this, loc); | ||
(this.operator = operator); | ||
(this.left = left); | ||
(this.right = right); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.operator = operator); | ||
(self.left = left); | ||
(self.right = right); | ||
}))); | ||
(LogicalExpression = defineNode(Expression, "LogicalExpression", ["left", "right"], ["operator"], (function( | ||
loc, operator, left, right) { | ||
Node.call(this, loc); | ||
(this.operator = operator); | ||
(this.left = left); | ||
(this.right = right); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.operator = operator); | ||
(self.left = left); | ||
(self.right = right); | ||
}))); | ||
(ConditionalExpression = defineNode(Expression, "ConditionalExpression", ["test", "consequent", "alternate"], [], ( | ||
function(loc, test, consequent, alternate) { | ||
Node.call(this, loc); | ||
(this.test = test); | ||
(this.consequent = consequent); | ||
(this.alternate = alternate); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.test = test); | ||
(self.consequent = consequent); | ||
(self.alternate = alternate); | ||
}))); | ||
(NewExpression = defineNode(Expression, "NewExpression", ["callee", "args"], [], (function(loc, callee, | ||
args) { | ||
Node.call(this, loc); | ||
(this.callee = callee); | ||
(this.args = args); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.callee = callee); | ||
(self.args = args); | ||
}))); | ||
(CallExpression = defineNode(Expression, "CallExpression", ["callee", "args"], [], (function(loc, callee, | ||
args) { | ||
Node.call(this, loc); | ||
(this.callee = callee); | ||
(this.args = args); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.callee = callee); | ||
(self.args = args); | ||
}))); | ||
(MemberExpression = defineNode(Expression, "MemberExpression", ["object", "property"], ["computed"], ( | ||
function(loc, object, property, computed) { | ||
Node.call(this, loc); | ||
(this.object = object); | ||
(this.property = property); | ||
(this.computed = computed); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.object = object); | ||
(self.property = property); | ||
(self.computed = computed); | ||
}))); | ||
(FunctionExpression = defineNode(Expression, "FunctionExpression", ["id", "params", "body"], [], (function( | ||
loc, id, params, body) { | ||
Node.call(this, loc); | ||
(this.id = (id || null)); | ||
(this.params = params); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.id = (id || null)); | ||
(self.params = params); | ||
(self.body = body); | ||
}))); | ||
(ArrayExpression = defineNode(Expression, "ArrayExpression", ["elements"], [], (function(loc, elements) { | ||
Node.call(this, loc); | ||
(this.elements = elements); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.elements = elements); | ||
}))); | ||
(ObjectExpression = defineNode(Expression, "ObjectExpression", ["properties"], [], (function(loc, | ||
properties) { | ||
Node.call(this, loc); | ||
(this.properties = properties); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.properties = properties); | ||
}))); | ||
(LetExpression = defineNode(Expression, "LetExpression", ["bindings", "body"], [], (function(loc, bindings, | ||
body) { | ||
Node.call(this, loc); | ||
(this.bindings = bindings); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.bindings = bindings); | ||
(self.body = body); | ||
}))); | ||
(CurryExpression = defineNode(Expression, "CurryExpression", ["base", "args"], [], (function(loc, base, | ||
args) { | ||
Node.call(this, loc); | ||
(this.base = base); | ||
(this.args = args); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.base = base); | ||
(self.args = args); | ||
}))); | ||
(UnaryOperatorExpression = defineNode(Expression, "UnaryOperatorExpression", [], ["op"], (function(loc, op) { | ||
Node.call(this, loc); | ||
(this.op = op); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.op = op); | ||
}))); | ||
(BinaryOperatorExpression = defineNode(Expression, "BinaryOperatorExpression", [], ["op"], (function(loc, | ||
op) { | ||
Node.call(this, loc); | ||
(this.op = op); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.op = op); | ||
}))); | ||
(TernaryOperatorExpression = defineNode(Expression, "TernaryOperatorExpression", [], ["op"], (function(loc, | ||
op) { | ||
Node.call(this, loc); | ||
(this.op = op); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.op = op); | ||
}))); | ||
@@ -132,2 +146,2 @@ (exports.Expression = Expression); | ||
(exports.TernaryOperatorExpression = TernaryOperatorExpression); | ||
})) | ||
})); |
@@ -1,35 +0,31 @@ | ||
/* | ||
* THIS FILE IS AUTO GENERATED from 'lib/node.kep' | ||
* DO NOT EDIT | ||
*/ | ||
define(["require", "exports", "khepri_ast/serialization"], (function(require, exports, __o) { | ||
define(["require", "exports", "./serialization"], (function(require, exports, __o) { | ||
"use strict"; | ||
var Node, construct, reconstruct, modify, setLoc, setUserData, getData, modifyData, setData, defineNode; | ||
var __o = __o, | ||
registerNode = __o["registerNode"]; | ||
var concatArgs = (function() { | ||
var id = (function(x) { | ||
return x; | ||
var registerNode = __o["registerNode"], | ||
Node, construct, reconstruct, modify, setLoc, setUserData, getData, modifyData, setData, defineNode, | ||
concatArgs = (function() { | ||
var id = (function(x) { | ||
return x; | ||
}); | ||
return (function(arr, args) { | ||
return arr.concat([].map.call(args, id)); | ||
}); | ||
})(), | ||
keys = Object.keys, | ||
map = Function.prototype.call.bind(Array.prototype.map), | ||
reduce = Function.prototype.call.bind(Array.prototype.reduce), | ||
copy = (function(obj) { | ||
var out = Object.create(Object.getPrototypeOf(obj)); | ||
Object.getOwnPropertyNames(obj) | ||
.forEach((function(i) { | ||
var self = this; | ||
(out[i] = obj[i]); | ||
})); | ||
return out; | ||
}), | ||
defineProperty = (function(obj, prop, descriptor) { | ||
return Object.defineProperty(copy(obj), prop, descriptor); | ||
}); | ||
return (function(arr, args) { | ||
return arr.concat([].map.call(args, id)); | ||
}); | ||
}) | ||
.call(this); | ||
var keys = Object.keys; | ||
var map = Function.prototype.call.bind(Array.prototype.map); | ||
var reduce = Function.prototype.call.bind(Array.prototype.reduce); | ||
var copy = (function(obj) { | ||
var out = Object.create(Object.getPrototypeOf(obj)); | ||
Object.getOwnPropertyNames(obj) | ||
.forEach((function(i) { | ||
(out[i] = obj[i]); | ||
})); | ||
return out; | ||
}); | ||
var defineProperty = (function(obj, prop, descriptor) { | ||
return Object.defineProperty(copy(obj), prop, descriptor); | ||
}); | ||
(Node = (function(loc, ud) { | ||
Object.defineProperties(this, ({ | ||
var self = this; | ||
Object.defineProperties(self, ({ | ||
"loc": ({ | ||
@@ -64,2 +60,3 @@ "value": loc, | ||
.forEach((function(key) { | ||
var self = this; | ||
(properties[key] = ({ | ||
@@ -90,3 +87,3 @@ "value": attributes[key], | ||
})); | ||
Object.keys(children) | ||
if (children) Object.keys(children) | ||
.forEach((function(key) { | ||
@@ -98,3 +95,3 @@ (allChildren[key] = children[key]); | ||
})); | ||
Object.keys(attributes) | ||
if (attributes) Object.keys(attributes) | ||
.forEach((function(key) { | ||
@@ -163,2 +160,2 @@ (allAttributes[key] = attributes[key]); | ||
(exports.defineNode = defineNode); | ||
})) | ||
})); |
@@ -1,24 +0,22 @@ | ||
/* | ||
* THIS FILE IS AUTO GENERATED from 'lib/package.kep' | ||
* DO NOT EDIT | ||
*/ | ||
define(["require", "exports", "khepri_ast/node"], (function(require, exports, __o) { | ||
define(["require", "exports", "./node"], (function(require, exports, __o) { | ||
"use strict"; | ||
var Package, PackageExport, PackageExports; | ||
var __o = __o, | ||
defineNode = __o["defineNode"], | ||
Node = __o["Node"]; | ||
var defineNode = __o["defineNode"], | ||
Node = __o["Node"], | ||
Package, PackageExport, PackageExports; | ||
(PackageExport = defineNode(Node, "PackageExport", ["id", "alias"], [], (function(loc, id, alias) { | ||
Node.call(this, loc); | ||
(this.id = id); | ||
(this.alias = alias); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.id = id); | ||
(self.alias = alias); | ||
}))); | ||
(PackageExports = defineNode(Node, "PackageExports", ["exports"], [], (function(loc, exports) { | ||
Node.call(this, loc); | ||
(this.exports = exports); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.exports = exports); | ||
}))); | ||
(Package = defineNode(Node, "Package", ["exports", "body"], [], (function(loc, exports, body) { | ||
Node.call(this, loc); | ||
(this.exports = exports); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.exports = exports); | ||
(self.body = body); | ||
}))); | ||
@@ -28,2 +26,2 @@ (exports.Package = Package); | ||
(exports.PackageExports = PackageExports); | ||
})) | ||
})); |
@@ -1,62 +0,68 @@ | ||
/* | ||
* THIS FILE IS AUTO GENERATED from 'lib/pattern.kep' | ||
* DO NOT EDIT | ||
*/ | ||
define(["require", "exports", "khepri_ast/node"], (function(require, exports, __o) { | ||
define(["require", "exports", "./node"], (function(require, exports, __o) { | ||
"use strict"; | ||
var Pattern, IdentifierPattern, EllipsisPattern, SinkPattern, ImportPattern, ArrayPattern, | ||
var defineNode = __o["defineNode"], | ||
Node = __o["Node"], | ||
Pattern, IdentifierPattern, EllipsisPattern, SinkPattern, ImportPattern, ArrayPattern, | ||
ObjectPatternElement, ObjectPattern, ArgumentsPattern, SubPattern, AsPattern; | ||
var __o = __o, | ||
defineNode = __o["defineNode"], | ||
Node = __o["Node"]; | ||
(Pattern = (function(loc) { | ||
Node.call(this, loc); | ||
var self = this; | ||
Node.call(self, loc); | ||
})); | ||
(Pattern.prototype = new(Node)()); | ||
(IdentifierPattern = defineNode(Pattern, "IdentifierPattern", ["id"], [], (function(loc, id) { | ||
Pattern.call(this, loc); | ||
(this.id = id); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
(self.id = id); | ||
}))); | ||
(EllipsisPattern = defineNode(Pattern, "EllipsisPattern", [], ["id"], (function(loc, id) { | ||
Pattern.call(this, loc); | ||
(this.id = (id || null)); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
(self.id = (id || null)); | ||
}))); | ||
(SinkPattern = defineNode(Pattern, "SinkPattern", [], [], (function(loc) { | ||
Pattern.call(this, loc); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
}))); | ||
(ImportPattern = defineNode(Node, "ImportPattern", ["from", "pattern"], [], (function(loc, from, pattern) { | ||
Node.call(this, loc); | ||
(this.from = from); | ||
(this.pattern = pattern); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.from = from); | ||
(self.pattern = pattern); | ||
}))); | ||
(ArrayPattern = defineNode(Pattern, "ArrayPattern", ["elements"], [], (function(loc, elements) { | ||
Pattern.call(this, loc); | ||
(this.elements = elements); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
(self.elements = elements); | ||
}))); | ||
(ObjectPatternElement = defineNode(Pattern, "ObjectPatternElement", ["key", "target"], [], (function(loc, | ||
key, target) { | ||
Pattern.call(this, loc); | ||
(this.key = key); | ||
(this.target = (target || null)); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
(self.key = key); | ||
(self.target = (target || null)); | ||
}))); | ||
(ObjectPattern = defineNode(Pattern, "ObjectPattern", ["elements"], [], (function(loc, elements) { | ||
Pattern.call(this, loc); | ||
(this.elements = elements); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
(self.elements = elements); | ||
}))); | ||
(AsPattern = defineNode(Pattern, "AsPattern", ["id", "target"], [], (function(loc, id, target) { | ||
Pattern.call(this, loc); | ||
(this.id = id); | ||
(this.target = target); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
(self.id = id); | ||
(self.target = target); | ||
}))); | ||
(SubPattern = defineNode(Pattern, "SubPattern", ["id", "elements"], [], (function(loc, id, elements) { | ||
Pattern.call(this, loc); | ||
(this.id = id); | ||
(this.elements = elements); | ||
var self = this; | ||
Pattern.call(self, loc); | ||
(self.id = id); | ||
(self.elements = elements); | ||
}))); | ||
(ArgumentsPattern = defineNode(Pattern, "ArgumentsPattern", ["id", "elements", "self"], [], (function(loc, | ||
id, elements, self) { | ||
Pattern.call(this, loc); | ||
(this.id = id); | ||
(this.elements = elements); | ||
(this.self = self); | ||
var T = this; | ||
Pattern.call(T, loc); | ||
(T.id = id); | ||
(T.elements = elements); | ||
(T.self = self); | ||
}))); | ||
@@ -74,2 +80,2 @@ (exports.Pattern = Pattern); | ||
(exports.AsPattern = AsPattern); | ||
})) | ||
})); |
@@ -1,16 +0,12 @@ | ||
/* | ||
* THIS FILE IS AUTO GENERATED from 'lib/program.kep' | ||
* DO NOT EDIT | ||
*/ | ||
define(["require", "exports", "khepri_ast/node"], (function(require, exports, __o) { | ||
define(["require", "exports", "./node"], (function(require, exports, __o) { | ||
"use strict"; | ||
var Program; | ||
var __o = __o, | ||
defineNode = __o["defineNode"], | ||
Node = __o["Node"]; | ||
var defineNode = __o["defineNode"], | ||
Node = __o["Node"], | ||
Program; | ||
(Program = defineNode(Node, "Program", ["body"], [], (function(loc, body) { | ||
Node.call(this, loc); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.body = body); | ||
}))); | ||
(exports.Program = Program); | ||
})) | ||
})); |
@@ -1,79 +0,66 @@ | ||
/* | ||
* THIS FILE IS AUTO GENERATED from 'lib/serialization.kep' | ||
* DO NOT EDIT | ||
*/ | ||
define(["require", "exports", "khepri_ast/node"], (function(require, exports, khepri_node) { | ||
define(["require", "exports", "./node"], (function(require, exports, khepri_node) { | ||
"use strict"; | ||
var registerNode, serialize, unserialize; | ||
var khepri_node = khepri_node; | ||
var keys = Object.keys; | ||
var map = Function.prototype.call.bind(Array.prototype.map); | ||
var reduce = Function.prototype.call.bind(Array.prototype.reduce); | ||
var id = (function(x) { | ||
return x; | ||
}); | ||
var typeMap = ({}); | ||
var registerNode, serialize, unserialize, keys = Object.keys, | ||
map = Function.prototype.call.bind(Array.prototype.map), | ||
reduce = Function.prototype.call.bind(Array.prototype.reduce), | ||
id = (function(x) { | ||
return x; | ||
}), | ||
typeMap = ({}); | ||
(registerNode = (function(type, ctor) { | ||
(typeMap[type] = ctor); | ||
})); | ||
(serialize = (function() { | ||
var _serialize = (function(node, locSerializer, udSerializer) { | ||
if (!node) return node; | ||
if (Array.isArray(node)) return map(node, (function(x) { | ||
return _serialize(x, locSerializer, udSerializer); | ||
})); | ||
if (!(node instanceof khepri_node.Node)) return node; | ||
return ({ | ||
"type": node.type, | ||
"loc": locSerializer(node.loc), | ||
"ud": udSerializer(node.ud), | ||
"children": reduce(node.children, (function(o, childKey) { | ||
(o[childKey] = _serialize(node[childKey], locSerializer, | ||
udSerializer)); | ||
return o; | ||
}), ({})), | ||
"attributes": reduce(node.attributes, (function(o, key) { | ||
(o[key] = node[key]); | ||
return o; | ||
}), ({})) | ||
}); | ||
}); | ||
return (function(node, locSerializer, udSerializer) { | ||
var program = _serialize(node, (locSerializer || id), (udSerializer || id)); | ||
return ({ | ||
"version": "2.1.0", | ||
"kind": "ecma", | ||
"program": program | ||
}); | ||
}); | ||
}) | ||
.call(this)); | ||
(unserialize = (function() { | ||
var _unserialize = (function(data, locUnserializer, udUnserializer) { | ||
if (!data) return data; | ||
if (Array.isArray(data)) return map(data, (function(x) { | ||
return _unserialize(x, locUnserializer, udUnserializer); | ||
})); | ||
var ctor = typeMap[data.type]; | ||
if (!ctor) return data; | ||
var loc = locUnserializer(data.loc), | ||
ud = udUnserializer(data.ud); | ||
var children = reduce(keys(data.children), (function(o, c) { | ||
(o[c] = _unserialize(data.children[c], locUnserializer, udUnserializer)); | ||
return o; | ||
}), ({})); | ||
var attributes = reduce(keys(data.attributes), (function(o, c) { | ||
(o[c] = data.attributes[c]); | ||
return o; | ||
}), ({})); | ||
return khepri_node.construct(ctor.prototype, loc, ud, children, attributes); | ||
}); | ||
return (function(data, locSerializer, udSerializer) { | ||
return _unserialize(data.program, (locSerializer || id), (udSerializer || id)); | ||
}); | ||
}) | ||
.call(this)); | ||
var _serialize = (function(node, locSerializer, udSerializer) { | ||
if (!node) return node; | ||
if (Array.isArray(node)) return map(node, (function(x) { | ||
return _serialize(x, locSerializer, udSerializer); | ||
})); | ||
if (!(node instanceof khepri_node.Node)) return node; | ||
return ({ | ||
"type": node.type, | ||
"loc": locSerializer(node.loc), | ||
"ud": udSerializer(node.ud), | ||
"children": reduce(node.children, (function(o, childKey) { | ||
(o[childKey] = _serialize(node[childKey], locSerializer, udSerializer)); | ||
return o; | ||
}), ({})), | ||
"attributes": reduce(node.attributes, (function(o, key) { | ||
(o[key] = node[key]); | ||
return o; | ||
}), ({})) | ||
}); | ||
}); | ||
(serialize = (function(node, locSerializer, udSerializer) { | ||
var program = _serialize(node, (locSerializer || id), (udSerializer || id)); | ||
return ({ | ||
"version": "2.1.0", | ||
"kind": "ecma", | ||
"program": program | ||
}); | ||
})); | ||
var _unserialize = (function(data, locUnserializer, udUnserializer) { | ||
if (!data) return data; | ||
if (Array.isArray(data)) return map(data, (function(x) { | ||
return _unserialize(x, locUnserializer, udUnserializer); | ||
})); | ||
var ctor = typeMap[data.type]; | ||
if (!ctor) return data; | ||
var loc = locUnserializer(data.loc), | ||
ud = udUnserializer(data.ud), | ||
children = reduce(keys(data.children), (function(o, c) { | ||
(o[c] = _unserialize(data.children[c], locUnserializer, udUnserializer)); | ||
return o; | ||
}), ({})), | ||
attributes = reduce(keys(data.attributes), (function(o, c) { | ||
(o[c] = data.attributes[c]); | ||
return o; | ||
}), ({})); | ||
return khepri_node.construct(ctor.prototype, loc, ud, children, attributes); | ||
}); | ||
(unserialize = (function(data, locSerializer, udSerializer) { | ||
return _unserialize(data.program, (locSerializer || id), (udSerializer || id)); | ||
})); | ||
(exports.registerNode = registerNode); | ||
(exports.serialize = serialize); | ||
(exports.unserialize = unserialize); | ||
})) | ||
})); |
@@ -1,88 +0,100 @@ | ||
/* | ||
* THIS FILE IS AUTO GENERATED from 'lib/statement.kep' | ||
* DO NOT EDIT | ||
*/ | ||
define(["require", "exports", "khepri_ast/node"], (function(require, exports, __o) { | ||
define(["require", "exports", "./node"], (function(require, exports, __o) { | ||
"use strict"; | ||
var Statement, EmptyStatement, DebuggerStatement, WithStatement, BlockStatement, ExpressionStatement, | ||
var defineNode = __o["defineNode"], | ||
Node = __o["Node"], | ||
Statement, EmptyStatement, DebuggerStatement, WithStatement, BlockStatement, ExpressionStatement, | ||
IfStatement, BreakStatement, ContinueStatement, SwitchStatement, ReturnStatement, ThrowStatement, | ||
TryStatement, WhileStatement, DoWhileStatement, ForStatement; | ||
var __o = __o, | ||
defineNode = __o["defineNode"], | ||
Node = __o["Node"]; | ||
(Statement = (function() {})); | ||
(Statement = (function() { | ||
var self = this; | ||
})); | ||
(Statement.prototype = new(Node)()); | ||
(EmptyStatement = defineNode(Statement, "EmptyStatement", [], [], (function(loc) { | ||
Node.call(this, loc); | ||
var self = this; | ||
Node.call(self, loc); | ||
}))); | ||
(DebuggerStatement = defineNode(Statement, "DebuggerStatement", [], [], (function(loc) { | ||
Node.call(this, loc); | ||
var self = this; | ||
Node.call(self, loc); | ||
}))); | ||
(BlockStatement = defineNode(Statement, "BlockStatement", ["body"], [], (function(loc, body) { | ||
Node.call(this, loc); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.body = body); | ||
}))); | ||
(ExpressionStatement = defineNode(Statement, "ExpressionStatement", ["expression"], [], (function(loc, | ||
expression) { | ||
Node.call(this, loc); | ||
(this.expression = expression); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.expression = expression); | ||
}))); | ||
(IfStatement = defineNode(Statement, "IfStatement", ["test", "consequent", "alternate"], [], (function(loc, | ||
test, consequent, alternate) { | ||
Node.call(this, loc); | ||
(this.test = test); | ||
(this.consequent = consequent); | ||
(this.alternate = (alternate || null)); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.test = test); | ||
(self.consequent = consequent); | ||
(self.alternate = (alternate || null)); | ||
}))); | ||
(WithStatement = defineNode(Statement, "WithStatement", ["bindings", "body"], [], (function(loc, bindings, | ||
body) { | ||
Node.call(this, loc); | ||
(this.bindings = bindings); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.bindings = bindings); | ||
(self.body = body); | ||
}))); | ||
(BreakStatement = defineNode(Statement, "BreakStatement", [], [], (function(loc) { | ||
Node.call(this, loc); | ||
var self = this; | ||
Node.call(self, loc); | ||
}))); | ||
(ContinueStatement = defineNode(Statement, "ContinueStatement", [], [], (function(loc) { | ||
Node.call(this, loc); | ||
var self = this; | ||
Node.call(self, loc); | ||
}))); | ||
(SwitchStatement = defineNode(Statement, "SwitchStatement", ["discriminant", "cases"], [], (function(loc, | ||
discriminant, cases) { | ||
Node.call(this, loc); | ||
(this.discriminant = discriminant); | ||
(this.cases = cases); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.discriminant = discriminant); | ||
(self.cases = cases); | ||
}))); | ||
(ReturnStatement = defineNode(Statement, "ReturnStatement", ["argument"], [], (function(loc, argument) { | ||
Node.call(this, loc); | ||
(this.argument = (argument || null)); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.argument = (argument || null)); | ||
}))); | ||
(ThrowStatement = defineNode(Statement, "ThrowStatement", ["argument"], [], (function(loc, argument) { | ||
Node.call(this, loc); | ||
(this.argument = argument); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.argument = argument); | ||
}))); | ||
(TryStatement = defineNode(Statement, "TryStatement", ["block", "handler", "finalizer"], [], (function(loc, | ||
block, handler, finalizer) { | ||
Node.call(this, loc); | ||
(this.block = block); | ||
(this.handler = handler); | ||
(this.finalizer = finalizer); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.block = block); | ||
(self.handler = handler); | ||
(self.finalizer = finalizer); | ||
}))); | ||
(WhileStatement = defineNode(Statement, "WhileStatement", ["test", "body"], [], (function(loc, test, body) { | ||
Node.call(this, loc); | ||
(this.test = test); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.test = test); | ||
(self.body = body); | ||
}))); | ||
(DoWhileStatement = defineNode(Statement, "DoWhileStatement", ["body", "test"], [], (function(loc, body, | ||
test) { | ||
Node.call(this, loc); | ||
(this.test = test); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.test = test); | ||
(self.body = body); | ||
}))); | ||
(ForStatement = defineNode(Statement, "ForStatement", ["init", "test", "update", "body"], [], (function(loc, | ||
init, test, update, body) { | ||
Node.call(this, loc); | ||
(this.init = (init || null)); | ||
(this.test = (test || null)); | ||
(this.update = (update || null)); | ||
(this.body = body); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.init = (init || null)); | ||
(self.test = (test || null)); | ||
(self.update = (update || null)); | ||
(self.body = body); | ||
}))); | ||
@@ -105,2 +117,2 @@ (exports.Statement = Statement); | ||
(exports.ForStatement = ForStatement); | ||
})) | ||
})); |
@@ -1,52 +0,59 @@ | ||
/* | ||
* THIS FILE IS AUTO GENERATED from 'lib/token.kep' | ||
* DO NOT EDIT | ||
*/ | ||
define(["require", "exports", "khepri_ast/node"], (function(require, exports, __o) { | ||
define(["require", "exports", "./node"], (function(require, exports, __o) { | ||
"use strict"; | ||
var Token, StringToken, NumberToken, RegularExpressionToken, BooleanToken, NullToken, IdentifierToken, | ||
var defineNode = __o["defineNode"], | ||
Node = __o["Node"], | ||
Token, StringToken, NumberToken, RegularExpressionToken, BooleanToken, NullToken, IdentifierToken, | ||
KeywordToken, PunctuatorToken, CommentToken, WhitespaceToken, LineTerminatorToken; | ||
var __o = __o, | ||
defineNode = __o["defineNode"], | ||
Node = __o["Node"]; | ||
(Token = (function(loc, value) { | ||
Node.call(this, loc); | ||
(this.value = value); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.value = value); | ||
})); | ||
(Token.prototype = new(Node)()); | ||
(StringToken = defineNode(Token, "String", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(NumberToken = defineNode(Token, "Number", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(RegularExpressionToken = defineNode(Token, "RegularExpression", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(BooleanToken = defineNode(Token, "Boolean", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(NullToken = defineNode(Token, "Null", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(IdentifierToken = defineNode(Token, "Identifier", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(KeywordToken = defineNode(Token, "Keyword", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(PunctuatorToken = defineNode(Token, "Punctuator", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(CommentToken = defineNode(Token, "Comment", [], ["value", "multiline", "linebreak"], (function(loc, value, | ||
multiline, linebreak) { | ||
Token.call(this, loc, value); | ||
(this.multiline = !!multiline); | ||
(this.linebreak = !!linebreak); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
(self.multiline = !!multiline); | ||
(self.linebreak = !!linebreak); | ||
}))); | ||
(WhitespaceToken = defineNode(Token, "Whitespace", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
(LineTerminatorToken = defineNode(Token, "LineTerminator", [], ["value"], (function(loc, value) { | ||
Token.call(this, loc, value); | ||
var self = this; | ||
Token.call(self, loc, value); | ||
}))); | ||
@@ -65,2 +72,2 @@ (exports.Token = Token); | ||
(exports.LineTerminatorToken = LineTerminatorToken); | ||
})) | ||
})); |
@@ -1,24 +0,22 @@ | ||
/* | ||
* THIS FILE IS AUTO GENERATED from 'lib/value.kep' | ||
* DO NOT EDIT | ||
*/ | ||
define(["require", "exports", "khepri_ast/node"], (function(require, exports, __o) { | ||
define(["require", "exports", "./node"], (function(require, exports, __o) { | ||
"use strict"; | ||
var Identifier, Literal, ObjectValue; | ||
var __o = __o, | ||
defineNode = __o["defineNode"], | ||
Node = __o["Node"]; | ||
var defineNode = __o["defineNode"], | ||
Node = __o["Node"], | ||
Identifier, Literal, ObjectValue; | ||
(Identifier = defineNode(Node, "Identifier", [], ["name"], (function(loc, name) { | ||
Node.call(this, loc); | ||
(this.name = name); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.name = name); | ||
}))); | ||
(Literal = defineNode(Node, "Literal", [], ["kind", "value"], (function(loc, kind, value) { | ||
Node.call(this, loc); | ||
(this.kind = kind); | ||
(this.value = value); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.kind = kind); | ||
(self.value = value); | ||
}))); | ||
(ObjectValue = defineNode(Node, "ObjectValue", ["key", "value"], [], (function(loc, key, value) { | ||
Node.call(this, loc); | ||
(this.key = key); | ||
(this.value = value); | ||
var self = this; | ||
Node.call(self, loc); | ||
(self.key = key); | ||
(self.value = value); | ||
}))); | ||
@@ -28,2 +26,2 @@ (exports.Identifier = Identifier); | ||
(exports.ObjectValue = ObjectValue); | ||
})) | ||
})); |
{ | ||
"name": "khepri-ast", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "Khepri AST Nodes", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
90586
1503