diff --git a/corpus/commands.txt b/corpus/commands.txt index ef20fcc..f44f498 100644 --- a/corpus/commands.txt +++ b/corpus/commands.txt @@ -110,3 +110,24 @@ Negated command (command_name (identifier)) (word))) + +=============================== +Mix functions and commands +=============================== + +generate() | cut -d ' ' -f 1 + +--- + +(source_file + (pipeline + (call_expression + (identifier) + (argument_list)) + (command + (command_name + (identifier)) + (word) + (raw_string) + (word) + (word)))) diff --git a/grammar.js b/grammar.js index a0ae8e2..3df1040 100644 --- a/grammar.js +++ b/grammar.js @@ -25,7 +25,6 @@ module.exports = grammar({ $.variable_declaration, $._statement, $.return, - $.while, 'break', 'continue', ), @@ -74,6 +73,7 @@ module.exports = grammar({ _statement: $ => choice( $.command, $.pipeline, + $.while, seq('!', $.command), $._expression, ), @@ -174,7 +174,7 @@ module.exports = grammar({ line_comment: $ => token(seq('//', /.*/)), block_comment: $ => token(seq('/*', /[^*]*\*+([^/*][^*]*\*+)*/, '/')), identifier: $ => /[a-zA-Z_][a-zA-Z0-9_]*/, - word: $ => /[^#'"\\\s$<>{}&;]+/, + word: $ => /[^#'"\\\s$<>{}&;()]+/, number: $ => /\d+/, boolean: $ => choice('true', 'false'), template_string: $ => seq(