fix: (()) is allowed as a null value, a number's base might be an expansion

pull/504/merge
Amaan Qureshi 2023-08-22 00:13:41 +07:00
parent 877894e746
commit 92037a32a6
1 changed files with 6 additions and 2 deletions

@ -353,7 +353,7 @@ module.exports = grammar({
choice(
seq('[', choice($._expression, $.redirected_statement), ']'),
seq('[[', $._expression, ']]'),
seq('(', '(', $._expression, '))'),
seq('(', '(', optional($._expression), '))'),
),
),
@ -661,7 +661,11 @@ module.exports = grammar({
ansi_c_string: _ => /\$'([^']|\\')*'/,
number: _ => /-?(0x)?[0-9]+(#[0-9A-Za-z@_]+)?/,
number: $ => choice(
/-?(0x)?[0-9]+(#[0-9A-Za-z@_]+)?/,
// the base can be an expansion
seq(/-?(0x)?[0-9]+#/, $.expansion),
),
simple_expansion: $ => seq(
'$',