From 6d0733fdb1aee115965e9b276ac06b286c1b2451 Mon Sep 17 00:00:00 2001 From: Davis Vaughan Date: Fri, 6 Sep 2024 15:31:53 -0400 Subject: [PATCH] Tweak NOTE. Closes #135. --- grammar.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/grammar.js b/grammar.js index f8ad50d..7315567 100644 --- a/grammar.js +++ b/grammar.js @@ -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}.]*/;