diff --git a/CHANGELOG.md b/CHANGELOG.md index fe36deff..f2a210dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 ----- diff --git a/lib/parser.js b/lib/parser.js index 8a4570de..4aa2f01d 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -290,7 +290,7 @@ function peg$parse(input, options) { // 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; }; var peg$c40 = function(name) { diff --git a/src/parser.pegjs b/src/parser.pegjs index 76963042..784ec04b 100644 --- a/src/parser.pegjs +++ b/src/parser.pegjs @@ -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; }