Handle backquoted identifiers [grammar and tests]
@@ -68,7 +68,7 @@ module.exports = grammar({
[$._indentable_expression, $.do_while_expression],
],
- word: $ => $.identifier,
+ word: $ => $._plainid,
rules: {
compilation_unit: $ => repeat($._top_level_definition),
@@ -778,7 +778,12 @@ module.exports = grammar({
),
// TODO: Include operators.
- identifier: $ => /[a-zA-Z_]\w*/,
+ _plainid: $ => /[a-zA-Z_]\w*/,
+ _backquoted_id: $=> /`[^\n`]+`/,
+ identifier: $ => choice(
+ $._plainid,
+ $._backquoted_id
+ ),
wildcard: $ => '_',
