Update grammar

This commit is contained in:
Maix0 2024-06-23 18:35:39 +02:00
parent ff6bba98de
commit 2b698450a3

View file

@ -38,7 +38,7 @@ module.exports = grammar({
name: 'sh', name: 'sh',
conflicts: $ => [ conflicts: $ => [
[$.command, $.variable_assignments], [$.command, $._variable_assignments],
[$.redirected_statement, $.command], [$.redirected_statement, $.command],
[$.redirected_statement, $.command_substitution], [$.redirected_statement, $.command_substitution],
[$.function_definition, $.command_name], [$.function_definition, $.command_name],
@ -87,10 +87,10 @@ module.exports = grammar({
/\\( |\t|\v|\f)/, /\\( |\t|\v|\f)/,
], ],
supertypes: $ => [ // supertypes: $ => [
$._statement, // $._statement,
$._primary_expression, // $._primary_expression,
], // ],
word: $ => $.word, word: $ => $.word,
@ -130,7 +130,7 @@ module.exports = grammar({
$.pipeline, $.pipeline,
$.redirected_statement, $.redirected_statement,
$.variable_assignment, $.variable_assignment,
$.variable_assignments, $._variable_assignments,
$.while_statement, $.while_statement,
), ),
@ -146,7 +146,7 @@ module.exports = grammar({
$.redirected_statement, $.redirected_statement,
$.subshell, $.subshell,
$.variable_assignment, $.variable_assignment,
$.variable_assignments, $._variable_assignments,
$.while_statement, $.while_statement,
)), )),
@ -239,7 +239,7 @@ module.exports = grammar({
function_definition: $ => prec.right(seq( function_definition: $ => prec.right(seq(
field('name', $.word), field('name', $.word),
'(', ')', '(', ')',
field('body', choice($.compound_statement, $.subshell, $.command, $.while_statement, $.if_statement, $.for_statement, $.variable_assignments, repeat1($.file_redirect))), field('body', choice($.compound_statement, $.subshell, $.command, $.while_statement, $.if_statement, $.for_statement, $._variable_assignments, repeat1($.file_redirect))),
)), )),
compound_statement: $ => seq('{', $._terminated_statement, '}'), compound_statement: $ => seq('{', $._terminated_statement, '}'),
@ -296,7 +296,7 @@ module.exports = grammar({
)), )),
), ),
variable_assignments: $ => seq($.variable_assignment, repeat1($.variable_assignment)), _variable_assignments: $ => seq($.variable_assignment, repeat1($.variable_assignment)),
file_redirect: $ => prec.left(seq( file_redirect: $ => prec.left(seq(
field('fd', optional($.file_descriptor)), field('fd', optional($.file_descriptor)),