Skip to content

Commit

Permalink
add A { b, ..c }
Browse files Browse the repository at this point in the history
  • Loading branch information
0xLucqs committed Jun 10, 2024
1 parent a182bd3 commit 478436b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const PREC = {
or: 2,
assign: 0,
};
const TOKEN_TREE_NON_SPECIAL_PUNCTUATION = ['+', '-', '*', '/', '%', '^', '!', '~', '&', '|', '&&', '||', '<<', '>>', '+=', '-=', '*=', '/=', '%=', '^=', '&=', '|=', '=', '==', '!=', '>', '<', '>=', '<=', '@', '_', '.', ',', ';', ':', '::', '->', '=>', '#', '?',
const TOKEN_TREE_NON_SPECIAL_PUNCTUATION = ['+', '-', '*', '/', '%', '^', '!', '~', '&', '|', '&&', '||', '<<', '>>', '+=', '-=', '*=', '/=', '%=', '^=', '&=', '|=', '=', '==', '!=', '>', '<', '>=', '<=', '@', '..', '_', '.', ',', ';', ':', '::', '->', '=>', '#', '?',
];

const integerTypes = ['u8', 'i8', 'u16', 'i16', 'u32', 'i32', 'u64', 'i64', 'u128', 'i128', 'usize',
Expand Down Expand Up @@ -560,7 +560,7 @@ module.exports = grammar({
field_initializer_list: ($) =>
seq(
'{',
sepBy(',', choice($.shorthand_field_initializer, $.field_initializer)),
sepBy(',', choice($.shorthand_field_initializer, $.field_initializer, base_field_initializer)),
optional(','),
'}',
),
Expand All @@ -577,6 +577,8 @@ module.exports = grammar({
field('value', $.expression),
),

base_field_initializer: ($) => seq('..', $._expression),

// for example in let mut a; it would be `mut a`
mut_pattern: ($) => prec(-1, seq($.mutable_specifier, $._pattern)),

Expand Down

0 comments on commit 478436b

Please sign in to comment.