Skip to content

Commit

Permalink
Improve generated PEG parser. Related to issue #2354
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreQuentel committed Jan 20, 2024
1 parent 643b343 commit 11ab0d3
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 11 deletions.
1 change: 1 addition & 0 deletions scripts/pegen/javascript_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ def _set_up_token_start_metadata_extraction(self) -> None:
self.print("p.error_indicator = 1;")
self.add_return("NULL")
self.print("}")
self.print("var EXTRA = {}")
self.print("EXTRA.lineno = p.tokens[_mark].lineno;")
self.print("EXTRA.col_offset = p.tokens[_mark].col_offset;")

Expand Down
2 changes: 1 addition & 1 deletion www/src/action_helpers_generated_version.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ $B._PyPegen.formatted_value = function(p,
debug.end_lineno = debug_end_line
debug.end_col_offset = debug_end_offset
var joined_str = new $B.ast.JoinedStr([debug, formatted_value])
set_position_from_obj(joined_str, p.arena)
set_position_from_obj(joined_str, arena)
return joined_str
}
return formatted_value
Expand Down
Loading

0 comments on commit 11ab0d3

Please sign in to comment.