Skip to content

Commit 55e04a7

Browse files
authored
Add location information to group AST node (#112)
1 parent 363e750 commit 55e04a7

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ Released: TBD
1515
data,for example, path to the currently parsed file.
1616
[@Mingun](https://github.com/peggyjs/peggy/pull/95)
1717

18+
### Bug fixes
19+
20+
- [#112](https://github.com/peggyjs/peggy/pull/112): `"group"` node in the AST now have `location` information (back-ported)
21+
22+
1823
1.1.0
1924
-----
2025

lib/parser.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/parser.pegjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ PrimaryExpression
201201
// nodes that already isolate label scope themselves. This leaves us with
202202
// "labeled" and "sequence".
203203
return expression.type === "labeled" || expression.type === "sequence"
204-
? { type: "group", expression: expression }
204+
? { type: "group", expression: expression, location: location() }
205205
: expression;
206206
}
207207

0 commit comments

Comments
 (0)