|
@@ -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.7.0.
|
|
* Generated by PEG.js 0.7.0.
|
|
*
|
|
*
|
|
@@ -756,7 +756,7 @@ smalltalk.parser = (function(){
|
|
}
|
|
}
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, val) {
|
|
result0 = (function(offset, line, column, val) {
|
|
- return smalltalk.ValueNode._new()
|
|
|
|
|
|
+ return globals.ValueNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._value_(val.join("").replace(/\"/ig, '"'));
|
|
._value_(val.join("").replace(/\"/ig, '"'));
|
|
})(pos0.offset, pos0.line, pos0.column, result0[1]);
|
|
})(pos0.offset, pos0.line, pos0.column, result0[1]);
|
|
@@ -848,7 +848,7 @@ smalltalk.parser = (function(){
|
|
}
|
|
}
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, val) {
|
|
result0 = (function(offset, line, column, val) {
|
|
- return smalltalk.ValueNode._new()
|
|
|
|
|
|
+ return globals.ValueNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._value_(val);
|
|
._value_(val);
|
|
})(pos0.offset, pos0.line, pos0.column, result0);
|
|
})(pos0.offset, pos0.line, pos0.column, result0);
|
|
@@ -888,7 +888,7 @@ smalltalk.parser = (function(){
|
|
}
|
|
}
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, n) {
|
|
result0 = (function(offset, line, column, n) {
|
|
- return smalltalk.ValueNode._new()
|
|
|
|
|
|
+ return globals.ValueNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._value_(n);
|
|
._value_(n);
|
|
})(pos0.offset, pos0.line, pos0.column, result0);
|
|
})(pos0.offset, pos0.line, pos0.column, result0);
|
|
@@ -1443,7 +1443,7 @@ smalltalk.parser = (function(){
|
|
}
|
|
}
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, lits) {
|
|
result0 = (function(offset, line, column, lits) {
|
|
- return smalltalk.ValueNode._new()
|
|
|
|
|
|
+ return globals.ValueNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._value_(lits);
|
|
._value_(lits);
|
|
})(pos0.offset, pos0.line, pos0.column, result0[1]);
|
|
})(pos0.offset, pos0.line, pos0.column, result0[1]);
|
|
@@ -1537,7 +1537,7 @@ smalltalk.parser = (function(){
|
|
}
|
|
}
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, expressions) {
|
|
result0 = (function(offset, line, column, expressions) {
|
|
- return smalltalk.DynamicArrayNode._new()
|
|
|
|
|
|
+ return globals.DynamicArrayNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._nodes_(expressions);
|
|
._nodes_(expressions);
|
|
})(pos0.offset, pos0.line, pos0.column, result0[2]);
|
|
})(pos0.offset, pos0.line, pos0.column, result0[2]);
|
|
@@ -1616,7 +1616,7 @@ smalltalk.parser = (function(){
|
|
}
|
|
}
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, expressions) {
|
|
result0 = (function(offset, line, column, expressions) {
|
|
- return smalltalk.DynamicDictionaryNode._new()
|
|
|
|
|
|
+ return globals.DynamicDictionaryNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._nodes_(expressions);
|
|
._nodes_(expressions);
|
|
})(pos0.offset, pos0.line, pos0.column, result0[2]);
|
|
})(pos0.offset, pos0.line, pos0.column, result0[2]);
|
|
@@ -1698,7 +1698,7 @@ smalltalk.parser = (function(){
|
|
}
|
|
}
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, val) {
|
|
result0 = (function(offset, line, column, val) {
|
|
- return smalltalk.ValueNode._new()
|
|
|
|
|
|
+ return globals.ValueNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._value_(val);
|
|
._value_(val);
|
|
})(pos0.offset, pos0.line, pos0.column, result0);
|
|
})(pos0.offset, pos0.line, pos0.column, result0);
|
|
@@ -1807,7 +1807,7 @@ smalltalk.parser = (function(){
|
|
result0 = parse_identifier();
|
|
result0 = parse_identifier();
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, identifier) {
|
|
result0 = (function(offset, line, column, identifier) {
|
|
- return smalltalk.VariableNode._new()
|
|
|
|
|
|
+ return globals.VariableNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._value_(identifier);
|
|
._value_(identifier);
|
|
})(pos0.offset, pos0.line, pos0.column, result0);
|
|
})(pos0.offset, pos0.line, pos0.column, result0);
|
|
@@ -2323,7 +2323,7 @@ smalltalk.parser = (function(){
|
|
}
|
|
}
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, variable, expression) {
|
|
result0 = (function(offset, line, column, variable, expression) {
|
|
- return smalltalk.AssignmentNode._new()
|
|
|
|
|
|
+ return globals.AssignmentNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._left_(variable)
|
|
._left_(variable)
|
|
._right_(expression);
|
|
._right_(expression);
|
|
@@ -2403,7 +2403,7 @@ smalltalk.parser = (function(){
|
|
}
|
|
}
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, expression) {
|
|
result0 = (function(offset, line, column, expression) {
|
|
- return smalltalk.ReturnNode._new()
|
|
|
|
|
|
+ return globals.ReturnNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._nodes_([expression]);
|
|
._nodes_([expression]);
|
|
})(pos0.offset, pos0.line, pos0.column, result0[2]);
|
|
})(pos0.offset, pos0.line, pos0.column, result0[2]);
|
|
@@ -3024,7 +3024,7 @@ smalltalk.parser = (function(){
|
|
}
|
|
}
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, temps, statements) {
|
|
result0 = (function(offset, line, column, temps, statements) {
|
|
- return smalltalk.SequenceNode._new()
|
|
|
|
|
|
+ return globals.SequenceNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._temps_(temps || [])
|
|
._temps_(temps || [])
|
|
._nodes_(statements || []);
|
|
._nodes_(statements || []);
|
|
@@ -3117,7 +3117,7 @@ smalltalk.parser = (function(){
|
|
}
|
|
}
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, params, sequence) {
|
|
result0 = (function(offset, line, column, params, sequence) {
|
|
- return smalltalk.BlockNode._new()
|
|
|
|
|
|
+ return globals.BlockNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._parameters_(params || [])
|
|
._parameters_(params || [])
|
|
._nodes_([sequence._asBlockSequenceNode()]);
|
|
._nodes_([sequence._asBlockSequenceNode()]);
|
|
@@ -3210,7 +3210,7 @@ smalltalk.parser = (function(){
|
|
}
|
|
}
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, selector) {
|
|
result0 = (function(offset, line, column, selector) {
|
|
- return smalltalk.SendNode._new()
|
|
|
|
|
|
+ return globals.SendNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._selector_(selector);
|
|
._selector_(selector);
|
|
})(pos0.offset, pos0.line, pos0.column, result0[1]);
|
|
})(pos0.offset, pos0.line, pos0.column, result0[1]);
|
|
@@ -3383,7 +3383,7 @@ smalltalk.parser = (function(){
|
|
}
|
|
}
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, selector, arg) {
|
|
result0 = (function(offset, line, column, selector, arg) {
|
|
- return smalltalk.SendNode._new()
|
|
|
|
|
|
+ return globals.SendNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._selector_(selector)
|
|
._selector_(selector)
|
|
._arguments_([arg]);
|
|
._arguments_([arg]);
|
|
@@ -3579,7 +3579,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))
|
|
._selector_(selector.join(""))
|
|
._selector_(selector.join(""))
|
|
._arguments_(args);
|
|
._arguments_(args);
|
|
@@ -3806,7 +3806,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))
|
|
._receiver_(send._receiver())
|
|
._receiver_(send._receiver())
|
|
._nodes_(cascade);
|
|
._nodes_(cascade);
|
|
@@ -3930,7 +3930,7 @@ smalltalk.parser = (function(){
|
|
}
|
|
}
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, val) {
|
|
result0 = (function(offset, line, column, val) {
|
|
- return smalltalk.JSStatementNode._new()
|
|
|
|
|
|
+ return globals.JSStatementNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._source_(val.join(""));
|
|
._source_(val.join(""));
|
|
})(pos0.offset, pos0.line, pos0.column, result0[1]);
|
|
})(pos0.offset, pos0.line, pos0.column, result0[1]);
|
|
@@ -3999,7 +3999,7 @@ smalltalk.parser = (function(){
|
|
}
|
|
}
|
|
if (result0 !== null) {
|
|
if (result0 !== null) {
|
|
result0 = (function(offset, line, column, pattern, sequence) {
|
|
result0 = (function(offset, line, column, pattern, sequence) {
|
|
- return smalltalk.MethodNode._new()
|
|
|
|
|
|
+ return globals.MethodNode._new()
|
|
._position_((line).__at(column))
|
|
._position_((line).__at(column))
|
|
._selector_(pattern[0])
|
|
._selector_(pattern[0])
|
|
._arguments_(pattern[1])
|
|
._arguments_(pattern[1])
|