Skip to content

Commit

Permalink
fix: allow closing flow seq/map at same indentation
Browse files Browse the repository at this point in the history
Resolves: ikatyang#29
  • Loading branch information
rliebz committed Mar 27, 2024
1 parent 10c6c7a commit 5dec996
Show file tree
Hide file tree
Showing 5 changed files with 19,422 additions and 19,104 deletions.
12 changes: 6 additions & 6 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ module.exports = grammar({
$._r_blk_fld_bgn, $._br_blk_fld_bgn, // >
$._br_blk_str_ctn, // block scalar content
$._r_flw_seq_bgn, $._br_flw_seq_bgn, $._b_flw_seq_bgn, // [
$._r_flw_seq_end, $._br_flw_seq_end, // ]
$._r_flw_seq_end, $._br_flw_seq_end, $._b_flw_seq_end, // ]
$._r_flw_map_bgn, $._br_flw_map_bgn, $._b_flw_map_bgn, // {
$._r_flw_map_end, $._br_flw_map_end, // }
$._r_flw_map_end, $._br_flw_map_end, $._b_flw_map_end, // }
$._r_flw_sep_bgn, $._br_flw_sep_bgn, // ,
$._r_flw_key_bgn, $._br_flw_key_bgn, // ?
$._r_flw_jsv_bgn, $._br_flw_jsv_bgn, // : (json key)
Expand Down Expand Up @@ -298,7 +298,7 @@ module.exports = grammar({
_br_sgl_flw_seq: $ => seq($._br_flw_seq_bgn, $._sgl_flw_seq_tal),
_b_sgl_flw_seq: $ => seq($._b_flw_seq_bgn, $._sgl_flw_seq_tal),

_flw_seq_tal: $ => seq(optional(choice($._r_flw_seq_dat, $._br_flw_seq_dat)), choice($._r_flw_seq_end, $._br_flw_seq_end)),
_flw_seq_tal: $ => seq(optional(choice($._r_flw_seq_dat, $._br_flw_seq_dat)), choice($._r_flw_seq_end, $._br_flw_seq_end, $._b_flw_seq_end)),
_sgl_flw_seq_tal: $ => seq(optional($._r_sgl_flw_col_dat), $._r_flw_seq_end),

// flow mapping
Expand All @@ -317,7 +317,7 @@ module.exports = grammar({
_br_sgl_flw_map: $ => seq($._br_flw_map_bgn, $._sgl_flw_map_tal),
_b_sgl_flw_map: $ => seq($._b_flw_map_bgn, $._sgl_flw_map_tal),

_flw_map_tal: $ => seq(optional(choice($._r_flw_map_dat, $._br_flw_map_dat)), choice($._r_flw_map_end, $._br_flw_map_end)),
_flw_map_tal: $ => seq(optional(choice($._r_flw_map_dat, $._br_flw_map_dat)), choice($._r_flw_map_end, $._br_flw_map_end, $._b_flw_map_end)),
_sgl_flw_map_tal: $ => seq(optional($._r_sgl_flw_col_dat), $._r_flw_map_end),

// flow collection data
Expand Down Expand Up @@ -529,9 +529,9 @@ module.exports.grammar = global_alias(global_alias(module.exports.grammar, {
..._("|", "_r_blk_lit_bgn", "_br_blk_lit_bgn"),
..._(">", "_r_blk_fld_bgn", "_br_blk_fld_bgn"),
..._("[", "_r_flw_seq_bgn", "_br_flw_seq_bgn", "_b_flw_seq_bgn"),
..._("]", "_r_flw_seq_end", "_br_flw_seq_end"),
..._("]", "_r_flw_seq_end", "_br_flw_seq_end", "_b_flw_seq_end"),
..._("{", "_r_flw_map_bgn", "_br_flw_map_bgn", "_b_flw_map_bgn"),
..._("}", "_r_flw_map_end", "_br_flw_map_end"),
..._("}", "_r_flw_map_end", "_br_flw_map_end", "_b_flw_map_end"),
..._(",", "_r_flw_sep_bgn", "_br_flw_sep_bgn"),
..._("?", "_r_flw_key_bgn", "_br_flw_key_bgn"),
..._(":", "_r_flw_jsv_bgn", "_br_flw_jsv_bgn"),
Expand Down
26 changes: 26 additions & 0 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5dec996

Please sign in to comment.