Skip to content

Commit

Permalink
Add location information to group AST node (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingun authored Apr 23, 2021
1 parent 363e750 commit 55e04a7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Released: TBD
data,for example, path to the currently parsed file.
[@Mingun](https://github.com/peggyjs/peggy/pull/95)

### Bug fixes

- [#112](https://github.com/peggyjs/peggy/pull/112): `"group"` node in the AST now have `location` information (back-ported)


1.1.0
-----

Expand Down
2 changes: 1 addition & 1 deletion lib/parser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/parser.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ PrimaryExpression
// nodes that already isolate label scope themselves. This leaves us with
// "labeled" and "sequence".
return expression.type === "labeled" || expression.type === "sequence"
? { type: "group", expression: expression }
? { type: "group", expression: expression, location: location() }
: expression;
}

Expand Down

0 comments on commit 55e04a7

Please sign in to comment.