|
@@ -1,5 +1,5 @@
|
|
-define("amber_vm/parser", ["./smalltalk", "./nil"], function(smalltalk, nil) {
|
|
|
|
-smalltalk.parser = (function() {
|
|
|
|
|
|
+define("amber_vm/parser", ["./globals", "./nil"], function(globals, nil) {
|
|
|
|
+globals.SmalltalkParser = (function() {
|
|
/*
|
|
/*
|
|
* Generated by PEG.js 0.8.0.
|
|
* Generated by PEG.js 0.8.0.
|
|
*
|
|
*
|
|
@@ -61,7 +61,7 @@ smalltalk.parser = (function() {
|
|
peg$c25 = /^[^']/,
|
|
peg$c25 = /^[^']/,
|
|
peg$c26 = { type: "class", value: "[^']", description: "[^']" },
|
|
peg$c26 = { type: "class", value: "[^']", description: "[^']" },
|
|
peg$c27 = function(val) {
|
|
peg$c27 = function(val) {
|
|
- return smalltalk.ValueNode._new()
|
|
|
|
|
|
+ return globals.ValueNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._value_(val.join("").replace(/\"/ig, '"'));
|
|
._value_(val.join("").replace(/\"/ig, '"'));
|
|
@@ -71,13 +71,13 @@ smalltalk.parser = (function() {
|
|
peg$c30 = function(rest) {return rest;},
|
|
peg$c30 = function(rest) {return rest;},
|
|
peg$c31 = function(node) {return node._value();},
|
|
peg$c31 = function(node) {return node._value();},
|
|
peg$c32 = function(val) {
|
|
peg$c32 = function(val) {
|
|
- return smalltalk.ValueNode._new()
|
|
|
|
|
|
+ return globals.ValueNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._value_(val);
|
|
._value_(val);
|
|
},
|
|
},
|
|
peg$c33 = function(n) {
|
|
peg$c33 = function(n) {
|
|
- return smalltalk.ValueNode._new()
|
|
|
|
|
|
+ return globals.ValueNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._value_(n);
|
|
._value_(n);
|
|
@@ -107,7 +107,7 @@ smalltalk.parser = (function() {
|
|
peg$c56 = ")",
|
|
peg$c56 = ")",
|
|
peg$c57 = { type: "literal", value: ")", description: "\")\"" },
|
|
peg$c57 = { type: "literal", value: ")", description: "\")\"" },
|
|
peg$c58 = function(lits) {
|
|
peg$c58 = function(lits) {
|
|
- return smalltalk.ValueNode._new()
|
|
|
|
|
|
+ return globals.ValueNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._value_(lits);
|
|
._value_(lits);
|
|
@@ -117,7 +117,7 @@ smalltalk.parser = (function() {
|
|
peg$c61 = "}",
|
|
peg$c61 = "}",
|
|
peg$c62 = { type: "literal", value: "}", description: "\"}\"" },
|
|
peg$c62 = { type: "literal", value: "}", description: "\"}\"" },
|
|
peg$c63 = function(expressions) {
|
|
peg$c63 = function(expressions) {
|
|
- return smalltalk.DynamicArrayNode._new()
|
|
|
|
|
|
+ return globals.DynamicArrayNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._nodes_(expressions || []);
|
|
._nodes_(expressions || []);
|
|
@@ -125,7 +125,7 @@ smalltalk.parser = (function() {
|
|
peg$c64 = "#{",
|
|
peg$c64 = "#{",
|
|
peg$c65 = { type: "literal", value: "#{", description: "\"#{\"" },
|
|
peg$c65 = { type: "literal", value: "#{", description: "\"#{\"" },
|
|
peg$c66 = function(expressions) {
|
|
peg$c66 = function(expressions) {
|
|
- return smalltalk.DynamicDictionaryNode._new()
|
|
|
|
|
|
+ return globals.DynamicDictionaryNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._nodes_(expressions || []);
|
|
._nodes_(expressions || []);
|
|
@@ -140,13 +140,13 @@ smalltalk.parser = (function() {
|
|
peg$c74 = { type: "literal", value: "nil", description: "\"nil\"" },
|
|
peg$c74 = { type: "literal", value: "nil", description: "\"nil\"" },
|
|
peg$c75 = function() {return nil;},
|
|
peg$c75 = function() {return nil;},
|
|
peg$c76 = function(val) {
|
|
peg$c76 = function(val) {
|
|
- return smalltalk.ValueNode._new()
|
|
|
|
|
|
+ return globals.ValueNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._value_(val);
|
|
._value_(val);
|
|
},
|
|
},
|
|
peg$c77 = function(identifier) {
|
|
peg$c77 = function(identifier) {
|
|
- return smalltalk.VariableNode._new()
|
|
|
|
|
|
+ return globals.VariableNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._value_(identifier);
|
|
._value_(identifier);
|
|
@@ -180,7 +180,7 @@ smalltalk.parser = (function() {
|
|
peg$c87 = ":=",
|
|
peg$c87 = ":=",
|
|
peg$c88 = { type: "literal", value: ":=", description: "\":=\"" },
|
|
peg$c88 = { type: "literal", value: ":=", description: "\":=\"" },
|
|
peg$c89 = function(variable, expression) {
|
|
peg$c89 = function(variable, expression) {
|
|
- return smalltalk.AssignmentNode._new()
|
|
|
|
|
|
+ return globals.AssignmentNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._left_(variable)
|
|
._left_(variable)
|
|
@@ -189,7 +189,7 @@ smalltalk.parser = (function() {
|
|
peg$c90 = "^",
|
|
peg$c90 = "^",
|
|
peg$c91 = { type: "literal", value: "^", description: "\"^\"" },
|
|
peg$c91 = { type: "literal", value: "^", description: "\"^\"" },
|
|
peg$c92 = function(expression) {
|
|
peg$c92 = function(expression) {
|
|
- return smalltalk.ReturnNode._new()
|
|
|
|
|
|
+ return globals.ReturnNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._nodes_([expression]);
|
|
._nodes_([expression]);
|
|
@@ -214,7 +214,7 @@ smalltalk.parser = (function() {
|
|
return expressions || [];
|
|
return expressions || [];
|
|
},
|
|
},
|
|
peg$c106 = function(temps, statements) {
|
|
peg$c106 = function(temps, statements) {
|
|
- return smalltalk.SequenceNode._new()
|
|
|
|
|
|
+ return globals.SequenceNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._temps_(temps || [])
|
|
._temps_(temps || [])
|
|
@@ -225,7 +225,7 @@ smalltalk.parser = (function() {
|
|
peg$c109 = "]",
|
|
peg$c109 = "]",
|
|
peg$c110 = { type: "literal", value: "]", description: "\"]\"" },
|
|
peg$c110 = { type: "literal", value: "]", description: "\"]\"" },
|
|
peg$c111 = function(params, sequence) {
|
|
peg$c111 = function(params, sequence) {
|
|
- return smalltalk.BlockNode._new()
|
|
|
|
|
|
+ return globals.BlockNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._parameters_(params || [])
|
|
._parameters_(params || [])
|
|
@@ -233,7 +233,7 @@ smalltalk.parser = (function() {
|
|
},
|
|
},
|
|
peg$c112 = void 0,
|
|
peg$c112 = void 0,
|
|
peg$c113 = function(selector) {
|
|
peg$c113 = function(selector) {
|
|
- return smalltalk.SendNode._new()
|
|
|
|
|
|
+ return globals.SendNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._selector_(selector);
|
|
._selector_(selector);
|
|
@@ -255,7 +255,7 @@ smalltalk.parser = (function() {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
peg$c116 = function(selector, arg) {
|
|
peg$c116 = function(selector, arg) {
|
|
- return smalltalk.SendNode._new()
|
|
|
|
|
|
+ return globals.SendNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._selector_(selector)
|
|
._selector_(selector)
|
|
@@ -277,7 +277,7 @@ smalltalk.parser = (function() {
|
|
selector.push(pairs[i].key);
|
|
selector.push(pairs[i].key);
|
|
args.push(pairs[i].arg);
|
|
args.push(pairs[i].arg);
|
|
}
|
|
}
|
|
- return smalltalk.SendNode._new()
|
|
|
|
|
|
+ return globals.SendNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._selector_(selector.join(""))
|
|
._selector_(selector.join(""))
|
|
@@ -295,7 +295,7 @@ smalltalk.parser = (function() {
|
|
for(var i = 0; i < messages.length; i++) {
|
|
for(var i = 0; i < messages.length; i++) {
|
|
cascade.push(messages[i]);
|
|
cascade.push(messages[i]);
|
|
}
|
|
}
|
|
- return smalltalk.CascadeNode._new()
|
|
|
|
|
|
+ return globals.CascadeNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._receiver_(send._receiver())
|
|
._receiver_(send._receiver())
|
|
@@ -311,12 +311,12 @@ smalltalk.parser = (function() {
|
|
peg$c132 = ">",
|
|
peg$c132 = ">",
|
|
peg$c133 = { type: "literal", value: ">", description: "\">\"" },
|
|
peg$c133 = { type: "literal", value: ">", description: "\">\"" },
|
|
peg$c134 = function(val) {
|
|
peg$c134 = function(val) {
|
|
- return smalltalk.JSStatementNode._new()
|
|
|
|
|
|
+ return globals.JSStatementNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(val.join(""))
|
|
._source_(val.join(""))
|
|
},
|
|
},
|
|
peg$c135 = function(pattern, sequence) {
|
|
peg$c135 = function(pattern, sequence) {
|
|
- return smalltalk.MethodNode._new()
|
|
|
|
|
|
+ return globals.MethodNode._new()
|
|
._position_((line()).__at(column()))
|
|
._position_((line()).__at(column()))
|
|
._source_(text())
|
|
._source_(text())
|
|
._selector_(pattern[0])
|
|
._selector_(pattern[0])
|