Skip to content

Commit 0d94e6e

Browse files
committed
Handle backquoted identifiers [grammar and tests]
1 parent 0ceab66 commit 0d94e6e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

grammar.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module.exports = grammar({
6868
[$._indentable_expression, $.do_while_expression],
6969
],
7070

71-
word: $ => $.identifier,
71+
word: $ => $._plainid,
7272

7373
rules: {
7474
compilation_unit: $ => repeat($._top_level_definition),
@@ -778,7 +778,12 @@ module.exports = grammar({
778778
),
779779

780780
// TODO: Include operators.
781-
identifier: $ => /[a-zA-Z_]\w*/,
781+
_plainid: $ => /[a-zA-Z_]\w*/,
782+
_backquoted_id: $=> /`[^\n`]+`/,
783+
identifier: $ => choice(
784+
$._plainid,
785+
$._backquoted_id
786+
),
782787

783788
wildcard: $ => '_',
784789

0 commit comments

Comments
 (0)