Skip to content

Commit

Permalink
Tweak NOTE. Closes #135.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisVaughan committed Sep 6, 2024
1 parent bf44417 commit 6d0733f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,11 @@ module.exports = grammar({
// check that `_foo` is an invalid identifier. It seems simpler to parse `_foo` as a
// single identifier, and then let downstream consumers do further checks on the
// validity as needed (#71).
// NOTE: Due to the linked tree-sitter bug, if `_identifier` and `_quoted_identifier`
// are their own hidden rules, then we can't detect implied `identifier`s as missing
// with `ts_node_is_missing()`, essentially making that function useless since
// tree-sitter seems to fill in named missing nodes with `identifier` most of the
// time. The workaround used here inlines the regexes, and wraps the `choice()` call
// in a single terminal `token()` so `identifier` can still be used as the `word` rule.
// NOTE: Due to the linked tree-sitter discussion, if `_identifier` and
// `_quoted_identifier` are their own hidden rules, then we can't detect error
// recovered `identifier`s as missing with `ts_node_is_missing()`. The workaround used
// here inlines the regexes, and wraps the `choice()` call in a single terminal
// `token()` so `identifier` can still be used as the `word` rule.
// https://github.com/tree-sitter/tree-sitter/issues/3332
identifier: $ => {
const _identifier = /[\p{XID_Start}._][\p{XID_Continue}.]*/;
Expand Down

0 comments on commit 6d0733f

Please sign in to comment.