Rename the |action| property of action AST nodes to |code|
This commit is contained in:
parent
c0f0d56975
commit
718bcf5f87
|
@ -743,12 +743,12 @@ PEG.Compiler = {
|
||||||
return PEG.Compiler.formatCode(
|
return PEG.Compiler.formatCode(
|
||||||
"${expressionCode}",
|
"${expressionCode}",
|
||||||
"var ${resultVar} = ${expressionResultVar} !== null",
|
"var ${resultVar} = ${expressionResultVar} !== null",
|
||||||
" ? (function(${formalParams}) {${action}})(${actualParams})",
|
" ? (function(${formalParams}) {${actionCode}})(${actualParams})",
|
||||||
" : null;",
|
" : null;",
|
||||||
{
|
{
|
||||||
expressionCode: PEG.Compiler.compileNode(node.expression, expressionResultVar),
|
expressionCode: PEG.Compiler.compileNode(node.expression, expressionResultVar),
|
||||||
expressionResultVar: expressionResultVar,
|
expressionResultVar: expressionResultVar,
|
||||||
action: node.action,
|
actionCode: node.code,
|
||||||
formalParams: formalParams.join(", "),
|
formalParams: formalParams.join(", "),
|
||||||
actualParams: actualParams.join(", "),
|
actualParams: actualParams.join(", "),
|
||||||
resultVar: resultVar
|
resultVar: resultVar
|
||||||
|
|
|
@ -298,7 +298,7 @@ PEG.grammarParser = (function(){
|
||||||
pos = savedPos4;
|
pos = savedPos4;
|
||||||
}
|
}
|
||||||
var result26 = result27 !== null
|
var result26 = result27 !== null
|
||||||
? (function(elements, action) {
|
? (function(elements, code) {
|
||||||
var expression = elements.length != 1
|
var expression = elements.length != 1
|
||||||
? {
|
? {
|
||||||
type: "sequence",
|
type: "sequence",
|
||||||
|
@ -308,7 +308,7 @@ PEG.grammarParser = (function(){
|
||||||
return {
|
return {
|
||||||
type: "action",
|
type: "action",
|
||||||
expression: expression,
|
expression: expression,
|
||||||
action: action
|
code: code
|
||||||
};
|
};
|
||||||
})(result27[0], result27[1])
|
})(result27[0], result27[1])
|
||||||
: null;
|
: null;
|
||||||
|
|
|
@ -35,7 +35,7 @@ choice
|
||||||
}
|
}
|
||||||
|
|
||||||
sequence
|
sequence
|
||||||
= elements:labeled* action:action {
|
= elements:labeled* code:action {
|
||||||
var expression = elements.length != 1
|
var expression = elements.length != 1
|
||||||
? {
|
? {
|
||||||
type: "sequence",
|
type: "sequence",
|
||||||
|
@ -45,7 +45,7 @@ sequence
|
||||||
return {
|
return {
|
||||||
type: "action",
|
type: "action",
|
||||||
expression: expression,
|
expression: expression,
|
||||||
action: action
|
code: code
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
/ elements:labeled* {
|
/ elements:labeled* {
|
||||||
|
|
|
@ -67,11 +67,11 @@ var optional = nodeWithExpressionConstructor("optional");
|
||||||
var zeroOrMore = nodeWithExpressionConstructor("zero_or_more");
|
var zeroOrMore = nodeWithExpressionConstructor("zero_or_more");
|
||||||
var oneOrMore = nodeWithExpressionConstructor("one_or_more");
|
var oneOrMore = nodeWithExpressionConstructor("one_or_more");
|
||||||
|
|
||||||
function action(expression, action) {
|
function action(expression, code) {
|
||||||
return {
|
return {
|
||||||
type: "action",
|
type: "action",
|
||||||
expression: expression,
|
expression: expression,
|
||||||
action: action
|
code: code
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue