From 22a000aeb0d92c584db22a6282225bd5889f051f Mon Sep 17 00:00:00 2001 From: ArArgon Date: Tue, 25 Jun 2024 09:53:14 -0700 Subject: [PATCH 1/6] feat: support `enum` and `match` --- batch-test.py | 7 + grammar.js | 70 +- src/grammar.json | 406 +- src/node-types.json | 385 + src/parser.c | 145622 ++++++++++++++++++++++++----------------- 5 files changed, 86274 insertions(+), 60216 deletions(-) diff --git a/batch-test.py b/batch-test.py index 3cd4955..3a6d24d 100644 --- a/batch-test.py +++ b/batch-test.py @@ -89,6 +89,13 @@ def visit_file(file: str) -> TestResult: 'attribute_no_closing_bracket', 'attribute_num_sign_no_bracket', 'type_variable_join_single_pack.move', + + # error cases + 'abort_negative_stack_size', + 'variants_parse_err', + 'constants_standalone_let', + 'pack_err', + 'variables_err', ] def retain_file(file: str) -> bool: for excl in exclude: diff --git a/grammar.js b/grammar.js index 7a8df8b..1ff05fc 100644 --- a/grammar.js +++ b/grammar.js @@ -57,6 +57,8 @@ module.exports = grammar({ [$._reuseable_keywords, $.for_loop_expr], [$.discouraged_name, $._type], [$.var, $.pack_expr], + [$._quantifier_directive, $.quantifier], + [$.var, $.call_expr], ], extras: $ => [ @@ -82,6 +84,10 @@ module.exports = grammar({ $._error_sentinel, ], + precedences: $ => [ + [$.var_name, $.name_access_chain], + ], + rules: { // Parse a file: // File = ( ( | |