Rename the |action| property of action AST nodes to |code|

redux
David Majda 15 years ago
parent c0f0d56975
commit 718bcf5f87

@ -743,12 +743,12 @@ PEG.Compiler = {
return PEG.Compiler.formatCode(
"${expressionCode}",
"var ${resultVar} = ${expressionResultVar} !== null",
" ? (function(${formalParams}) {${action}})(${actualParams})",
" ? (function(${formalParams}) {${actionCode}})(${actualParams})",
" : null;",
{
expressionCode: PEG.Compiler.compileNode(node.expression, expressionResultVar),
expressionResultVar: expressionResultVar,
action: node.action,
actionCode: node.code,
formalParams: formalParams.join(", "),
actualParams: actualParams.join(", "),
resultVar: resultVar

@ -298,7 +298,7 @@ PEG.grammarParser = (function(){
pos = savedPos4;
}
var result26 = result27 !== null
? (function(elements, action) {
? (function(elements, code) {
var expression = elements.length != 1
? {
type: "sequence",
@ -308,7 +308,7 @@ PEG.grammarParser = (function(){
return {
type: "action",
expression: expression,
action: action
code: code
};
})(result27[0], result27[1])
: null;

@ -35,7 +35,7 @@ choice
}
sequence
= elements:labeled* action:action {
= elements:labeled* code:action {
var expression = elements.length != 1
? {
type: "sequence",
@ -45,7 +45,7 @@ sequence
return {
type: "action",
expression: expression,
action: action
code: code
};
}
/ elements:labeled* {

@ -67,11 +67,11 @@ var optional = nodeWithExpressionConstructor("optional");
var zeroOrMore = nodeWithExpressionConstructor("zero_or_more");
var oneOrMore = nodeWithExpressionConstructor("one_or_more");
function action(expression, action) {
function action(expression, code) {
return {
type: "action",
expression: expression,
action: action
code: code
};
};

Loading…
Cancel
Save