From 718bcf5f87b8779bebb16a795126968922730fd4 Mon Sep 17 00:00:00 2001 From: David Majda Date: Mon, 7 Jun 2010 16:47:17 +0200 Subject: [PATCH] Rename the |action| property of action AST nodes to |code| --- lib/compiler.js | 4 ++-- lib/metagrammar.js | 4 ++-- lib/metagrammar.pegjs | 4 ++-- test/metagrammar-test.js | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index f3d5b32..ec248e5 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -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 diff --git a/lib/metagrammar.js b/lib/metagrammar.js index faf04c3..c45a59e 100644 --- a/lib/metagrammar.js +++ b/lib/metagrammar.js @@ -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; diff --git a/lib/metagrammar.pegjs b/lib/metagrammar.pegjs index 7a4b675..46e3ee4 100644 --- a/lib/metagrammar.pegjs +++ b/lib/metagrammar.pegjs @@ -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* { diff --git a/test/metagrammar-test.js b/test/metagrammar-test.js index 0e2b4d2..2c0711f 100644 --- a/test/metagrammar-test.js +++ b/test/metagrammar-test.js @@ -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 }; };