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