removing yytext mentions for real this time.
This commit is contained in:
parent
bc0ec9dc07
commit
49824ce1a6
|
@ -66,9 +66,9 @@
|
|||
Line: [o("Expression"), o("Statement")],
|
||||
// Pure statements which cannot be expressions.
|
||||
Statement: [o("Return"), o("Throw"), o("BREAK", function() {
|
||||
return new LiteralNode(yytext);
|
||||
return new LiteralNode($1);
|
||||
}), o("CONTINUE", function() {
|
||||
return new LiteralNode(yytext);
|
||||
return new LiteralNode($1);
|
||||
})
|
||||
],
|
||||
// All the different types of expressions in our language. The basic unit of
|
||||
|
@ -89,23 +89,23 @@
|
|||
],
|
||||
// A literal identifier, a variable name or property.
|
||||
Identifier: [o("IDENTIFIER", function() {
|
||||
return new LiteralNode(yytext);
|
||||
return new LiteralNode($1);
|
||||
})
|
||||
],
|
||||
// Alphanumerics are separated from the other **Literal** matchers because
|
||||
// they can also serve as keys in object literals.
|
||||
AlphaNumeric: [o("NUMBER", function() {
|
||||
return new LiteralNode(yytext);
|
||||
return new LiteralNode($1);
|
||||
}), o("STRING", function() {
|
||||
return new LiteralNode(yytext);
|
||||
return new LiteralNode($1);
|
||||
})
|
||||
],
|
||||
// All of our immediate values. These can (in general), be passed straight
|
||||
// through and printed to JavaScript.
|
||||
Literal: [o("AlphaNumeric"), o("JS", function() {
|
||||
return new LiteralNode(yytext);
|
||||
return new LiteralNode($1);
|
||||
}), o("REGEX", function() {
|
||||
return new LiteralNode(yytext);
|
||||
return new LiteralNode($1);
|
||||
}), o("TRUE", function() {
|
||||
return new LiteralNode(true);
|
||||
}), o("FALSE", function() {
|
||||
|
@ -144,7 +144,7 @@
|
|||
// have to parse comments like any other construct, and identify all of the
|
||||
// positions in which they can occur in the grammar.
|
||||
Comment: [o("COMMENT", function() {
|
||||
return new CommentNode(yytext);
|
||||
return new CommentNode($1);
|
||||
})
|
||||
],
|
||||
// [The existential operator](http://jashkenas.github.com/coffee-script/#existence).
|
||||
|
@ -181,7 +181,7 @@
|
|||
// A single parameter in a function definition can be ordinary, or a splat
|
||||
// that hoovers up the remaining arguments.
|
||||
Param: [o("PARAM", function() {
|
||||
return new LiteralNode(yytext);
|
||||
return new LiteralNode($1);
|
||||
}), o("Param . . .", function() {
|
||||
return new SplatNode($1);
|
||||
})
|
||||
|
@ -430,10 +430,7 @@
|
|||
],
|
||||
// A language extension to CoffeeScript from the outside. We simply pass
|
||||
// it through unaltered.
|
||||
Extension: [o("EXTENSION", function() {
|
||||
return yytext;
|
||||
})
|
||||
],
|
||||
Extension: [o("EXTENSION")],
|
||||
// The condition portion of a while loop.
|
||||
WhileSource: [o("WHILE Expression", function() {
|
||||
return new WhileNode($2);
|
||||
|
|
|
@ -31,9 +31,9 @@ case 10:this.$ = $$[$0-1+1-1];
|
|||
break;
|
||||
case 11:this.$ = $$[$0-1+1-1];
|
||||
break;
|
||||
case 12:this.$ = new LiteralNode(yytext);
|
||||
case 12:this.$ = new LiteralNode($$[$0-1+1-1]);
|
||||
break;
|
||||
case 13:this.$ = new LiteralNode(yytext);
|
||||
case 13:this.$ = new LiteralNode($$[$0-1+1-1]);
|
||||
break;
|
||||
case 14:this.$ = $$[$0-1+1-1];
|
||||
break;
|
||||
|
@ -75,17 +75,17 @@ case 32:this.$ = new Expressions();
|
|||
break;
|
||||
case 33:this.$ = Expressions.wrap([$$[$0-2+2-1]]);
|
||||
break;
|
||||
case 34:this.$ = new LiteralNode(yytext);
|
||||
case 34:this.$ = new LiteralNode($$[$0-1+1-1]);
|
||||
break;
|
||||
case 35:this.$ = new LiteralNode(yytext);
|
||||
case 35:this.$ = new LiteralNode($$[$0-1+1-1]);
|
||||
break;
|
||||
case 36:this.$ = new LiteralNode(yytext);
|
||||
case 36:this.$ = new LiteralNode($$[$0-1+1-1]);
|
||||
break;
|
||||
case 37:this.$ = $$[$0-1+1-1];
|
||||
break;
|
||||
case 38:this.$ = new LiteralNode(yytext);
|
||||
case 38:this.$ = new LiteralNode($$[$0-1+1-1]);
|
||||
break;
|
||||
case 39:this.$ = new LiteralNode(yytext);
|
||||
case 39:this.$ = new LiteralNode($$[$0-1+1-1]);
|
||||
break;
|
||||
case 40:this.$ = new LiteralNode(true);
|
||||
break;
|
||||
|
@ -111,7 +111,7 @@ case 50:this.$ = new ReturnNode($$[$0-2+2-1]);
|
|||
break;
|
||||
case 51:this.$ = new ReturnNode(new ValueNode(new LiteralNode('null')));
|
||||
break;
|
||||
case 52:this.$ = new CommentNode(yytext);
|
||||
case 52:this.$ = new CommentNode($$[$0-1+1-1]);
|
||||
break;
|
||||
case 53:this.$ = new ExistenceNode($$[$0-2+1-1]);
|
||||
break;
|
||||
|
@ -129,7 +129,7 @@ case 59:this.$ = [$$[$0-1+1-1]];
|
|||
break;
|
||||
case 60:this.$ = $$[$0-3+1-1].concat([$$[$0-3+3-1]]);
|
||||
break;
|
||||
case 61:this.$ = new LiteralNode(yytext);
|
||||
case 61:this.$ = new LiteralNode($$[$0-1+1-1]);
|
||||
break;
|
||||
case 62:this.$ = new SplatNode($$[$0-4+1-1]);
|
||||
break;
|
||||
|
@ -297,7 +297,7 @@ case 140:this.$ = new ThrowNode($$[$0-2+2-1]);
|
|||
break;
|
||||
case 141:this.$ = new ParentheticalNode($$[$0-3+2-1]);
|
||||
break;
|
||||
case 142:this.$ = yytext;
|
||||
case 142:this.$ = $$[$0-1+1-1];
|
||||
break;
|
||||
case 143:this.$ = new WhileNode($$[$0-2+2-1]);
|
||||
break;
|
||||
|
|
|
@ -65,19 +65,19 @@ grammar: {
|
|||
o "Body TERMINATOR Line", -> $1.push $3
|
||||
o "Body TERMINATOR"
|
||||
]
|
||||
|
||||
|
||||
# Expressions and statements, which make up a line in a body.
|
||||
Line: [
|
||||
o "Expression"
|
||||
o "Statement"
|
||||
]
|
||||
|
||||
|
||||
# Pure statements which cannot be expressions.
|
||||
Statement: [
|
||||
o "Return"
|
||||
o "Throw"
|
||||
o "BREAK", -> new LiteralNode yytext
|
||||
o "CONTINUE", -> new LiteralNode yytext
|
||||
o "BREAK", -> new LiteralNode $1
|
||||
o "CONTINUE", -> new LiteralNode $1
|
||||
]
|
||||
|
||||
# All the different types of expressions in our language. The basic unit of
|
||||
|
@ -115,22 +115,22 @@ grammar: {
|
|||
|
||||
# A literal identifier, a variable name or property.
|
||||
Identifier: [
|
||||
o "IDENTIFIER", -> new LiteralNode yytext
|
||||
o "IDENTIFIER", -> new LiteralNode $1
|
||||
]
|
||||
|
||||
# Alphanumerics are separated from the other **Literal** matchers because
|
||||
# they can also serve as keys in object literals.
|
||||
AlphaNumeric: [
|
||||
o "NUMBER", -> new LiteralNode yytext
|
||||
o "STRING", -> new LiteralNode yytext
|
||||
o "NUMBER", -> new LiteralNode $1
|
||||
o "STRING", -> new LiteralNode $1
|
||||
]
|
||||
|
||||
# All of our immediate values. These can (in general), be passed straight
|
||||
# through and printed to JavaScript.
|
||||
Literal: [
|
||||
o "AlphaNumeric"
|
||||
o "JS", -> new LiteralNode yytext
|
||||
o "REGEX", -> new LiteralNode yytext
|
||||
o "JS", -> new LiteralNode $1
|
||||
o "REGEX", -> new LiteralNode $1
|
||||
o "TRUE", -> new LiteralNode true
|
||||
o "FALSE", -> new LiteralNode false
|
||||
o "YES", -> new LiteralNode true
|
||||
|
@ -162,7 +162,7 @@ grammar: {
|
|||
# have to parse comments like any other construct, and identify all of the
|
||||
# positions in which they can occur in the grammar.
|
||||
Comment: [
|
||||
o "COMMENT", -> new CommentNode yytext
|
||||
o "COMMENT", -> new CommentNode $1
|
||||
]
|
||||
|
||||
# [The existential operator](http://jashkenas.github.com/coffee-script/#existence).
|
||||
|
@ -195,7 +195,7 @@ grammar: {
|
|||
# A single parameter in a function definition can be ordinary, or a splat
|
||||
# that hoovers up the remaining arguments.
|
||||
Param: [
|
||||
o "PARAM", -> new LiteralNode yytext
|
||||
o "PARAM", -> new LiteralNode $1
|
||||
o "Param . . .", -> new SplatNode $1
|
||||
]
|
||||
|
||||
|
@ -411,7 +411,7 @@ grammar: {
|
|||
# A language extension to CoffeeScript from the outside. We simply pass
|
||||
# it through unaltered.
|
||||
Extension: [
|
||||
o "EXTENSION", -> yytext
|
||||
o "EXTENSION"
|
||||
]
|
||||
|
||||
# The condition portion of a while loop.
|
||||
|
|
Loading…
Reference in New Issue