From d914c7b1503ac38f0eadf78660ba9a1f0f2272cc Mon Sep 17 00:00:00 2001 From: Ali Tavakoli Date: Wed, 24 Aug 2016 14:50:13 -0400 Subject: [PATCH] JavaScript example: Use LogicalExpression nodes for "&&" and "||" The buildLogicalExpression function was defined, but not used; specifically, the Logical(AND|OR)Expression(NoIn)? rules were constructing BinaryExpression nodes, but are now LogicalExpression nodes as per the ESTree spec (es5.md). --- examples/javascript.pegjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/javascript.pegjs b/examples/javascript.pegjs index 5f791bd..e39babe 100644 --- a/examples/javascript.pegjs +++ b/examples/javascript.pegjs @@ -855,12 +855,12 @@ BitwiseOROperator LogicalANDExpression = head:BitwiseORExpression tail:(__ LogicalANDOperator __ BitwiseORExpression)* - { return buildBinaryExpression(head, tail); } + { return buildLogicalExpression(head, tail); } LogicalANDExpressionNoIn = head:BitwiseORExpressionNoIn tail:(__ LogicalANDOperator __ BitwiseORExpressionNoIn)* - { return buildBinaryExpression(head, tail); } + { return buildLogicalExpression(head, tail); } LogicalANDOperator = "&&" @@ -868,12 +868,12 @@ LogicalANDOperator LogicalORExpression = head:LogicalANDExpression tail:(__ LogicalOROperator __ LogicalANDExpression)* - { return buildBinaryExpression(head, tail); } + { return buildLogicalExpression(head, tail); } LogicalORExpressionNoIn = head:LogicalANDExpressionNoIn tail:(__ LogicalOROperator __ LogicalANDExpressionNoIn)* - { return buildBinaryExpression(head, tail); } + { return buildLogicalExpression(head, tail); } LogicalOROperator = "||"