Skip to content

Commit

Permalink
refactor: add newlines in CallExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
shenyih0ng committed Apr 17, 2024
1 parent 5779ea3 commit cf9c99a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions src/go-slang/parser/go.js
Original file line number Diff line number Diff line change
Expand Up @@ -2133,7 +2133,7 @@ function peg$parse(input, options) {
}

function peg$parseCallExpression() {
var s0, s1, s2, s3, s4;
var s0, s1, s2, s3, s4, s5, s6;

var key = peg$currPos * 107 + 32;
var cached = peg$resultsCache[key];
Expand All @@ -2155,20 +2155,22 @@ function peg$parse(input, options) {
if (peg$silentFails === 0) { peg$fail(peg$e0); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parseExpressionList();
if (s3 === peg$FAILED) {
s3 = null;
s3 = peg$parse_();
s4 = peg$parseExpressionList();
if (s4 === peg$FAILED) {
s4 = null;
}
s5 = peg$parse_();
if (input.charCodeAt(peg$currPos) === 41) {
s4 = peg$c1;
s6 = peg$c1;
peg$currPos++;
} else {
s4 = peg$FAILED;
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e1); }
}
if (s4 !== peg$FAILED) {
if (s6 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f17(s1, s3);
s0 = peg$f17(s1, s4);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
Expand Down
2 changes: 1 addition & 1 deletion src/go-slang/parser/go.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ LogicalOrExpression
{ return buildBinaryExpression(head, tail); }

CallExpression
= callee:PrimaryExpression "(" args:ExpressionList? ")" {
= callee:PrimaryExpression "(" _ args:ExpressionList? _ ")" {
return makeNode({ type: "CallExpression", callee, args: args ?? [] })
}

Expand Down

0 comments on commit cf9c99a

Please sign in to comment.