Skip to content

Commit

Permalink
fix: param_value before param_type & multiline collection type & expr…
Browse files Browse the repository at this point in the history
…_binary with val_range
  • Loading branch information
blindFS committed Dec 6, 2024
1 parent 41a1c57 commit 1739292
Show file tree
Hide file tree
Showing 8 changed files with 306,896 additions and 284,796 deletions.
48 changes: 24 additions & 24 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ module.exports = grammar({
"param_value",
choice(
$._item_expression,
alias($._unquoted_in_list, $.val_string),
alias($._unquoted_in_list_with_expr, $.val_string),
alias($._unquoted_in_record, $.val_string),
alias($._unquoted_in_record_with_expr, $.val_string),
),
),
),
Expand All @@ -269,27 +269,22 @@ module.exports = grammar({
flat_type: (_$) => field("flat_type", FLAT_TYPES()),

collection_type: ($) => {
const key = field(
"key",
choice($.identifier, alias($.val_string, $.identifier)),
const type_and_completion = seq(
PUNC().colon,
$._all_type,
field("completion", optional($.param_cmd)),
);
const entry = seq(
field("key", choice($.identifier, alias($.val_string, $.identifier))),
optional(type_and_completion),
);

return seq(
choice("record", "table"),
seq(
token.immediate(BRACK().open_angle),
repeat(
seq(
key,
optional(
seq(
PUNC().colon,
$._all_type,
field("completion", optional($.param_cmd)),
),
),
optional(PUNC().comma),
),
optional(
general_body_rules("", entry, $._entry_separator, $._newline),
),
BRACK().close_angle,
),
Expand Down Expand Up @@ -793,11 +788,18 @@ module.exports = grammar({
expr_binary_parenthesized: _expr_binary_rule(true),

_expr_binary_expression: ($) =>
choice($._value, $.expr_binary, $.expr_unary, $.expr_parenthesized),
choice(
$._value,
$.val_range,
$.expr_binary,
$.expr_unary,
$.expr_parenthesized,
),

_expr_binary_expression_parenthesized: ($) =>
choice(
$._value,
$.val_range,
alias($.expr_binary_parenthesized, $.expr_binary),
$.expr_unary,
$.expr_parenthesized,
Expand Down Expand Up @@ -1279,12 +1281,10 @@ module.exports = grammar({
redirection: ($) =>
seq(
choice(...REDIR_APPEND()),
seq(
$._space,
field(
"file_path",
choice(alias($._unquoted_naive, $.val_string), $._stringish),
),
$._space,
field(
"file_path",
choice(alias($._unquoted_naive, $.val_string), $._stringish),
),
),

Expand Down
1 change: 0 additions & 1 deletion internal.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ encode base32
encode base32hex
encode base64
encode hex
error make
explore ir
format date
format duration
Expand Down
Loading

0 comments on commit 1739292

Please sign in to comment.