Skip to content

Commit

Permalink
refactor: collection_type
Browse files Browse the repository at this point in the history
  • Loading branch information
blindFS committed Feb 23, 2025
1 parent 477d94b commit 5ebfbde
Show file tree
Hide file tree
Showing 3 changed files with 260,778 additions and 266,794 deletions.
33 changes: 16 additions & 17 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,28 +274,27 @@ module.exports = grammar({

flat_type: (_$) => field("flat_type", FLAT_TYPES()),

collection_type: ($) => {
const type_and_completion = seq(
_collection_annotation: ($) =>
seq(
PUNC().colon,
$._all_type,
field("completion", optional($.param_cmd)),
);
const entry = seq(
),
_collection_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),
optional(
general_body_rules("", entry, $._entry_separator, $._newline),
),
BRACK().close_angle,
optional($._collection_annotation),
),
collection_type: ($) => seq(
choice("record", "table"),
seq(
token.immediate(BRACK().open_angle),
optional(
general_body_rules("", $._collection_entry, $._entry_separator, $._newline),
),
);
},
BRACK().close_angle,
),
),

list_type: ($) =>
seq(
Expand Down
Loading

0 comments on commit 5ebfbde

Please sign in to comment.