grammar: Refactor apply Grammar

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-04-20 02:39:33 -04:00
parent 902dc945fd
commit 95c489ecd7
3 changed files with 15 additions and 10 deletions
+2 -1
View File
@@ -83,7 +83,7 @@ export default grammar({
variableDeclaration: $ => seq(optional($.annotations), $.typeRef, field('variable_name', $.identifier), optional(seq($.assignment, $.expression)), $._semicolon),
// Control declarations
control_declaration: $ => seq($.control, $.identifier, $.parameters, '{', repeat(choice($.table_declaration, $.action_declaration)), $.apply, $.statement, '}'),
control_declaration: $ => seq($.control, $.identifier, $.parameters, '{', repeat(choice($.table_declaration, $.action_declaration)), $.apply_statement, '}'),
action_declaration: $ => seq($.action, $.identifier, $.parameters, $.statement),
table_declaration: $ => seq($.table, $.identifier, '{', optional($.table_property_list), '}'),
@@ -107,6 +107,7 @@ export default grammar({
assignmentStatement: $=> seq($.expression, $.assignment, $.expression, $._semicolon),
return_statement: $=> seq($._return, $.expression, $._semicolon),
exit_statement: $=> seq($._exit, $._semicolon),
apply_statement: $=> seq($.apply, $.statement),
// Parser statements
parserStatements: $ => repeat1($.parserStatement),
+2
View File
@@ -49,6 +49,7 @@ control simple() {
)
)
)
(apply_statement
(apply)
(statement
(blockStatement)
@@ -56,4 +57,5 @@ control simple() {
)
)
)
)
@@ -13,6 +13,7 @@ control T() {
(control)
(identifier)
(parameters)
(apply_statement
(apply)
(statement
(blockStatement
@@ -26,6 +27,7 @@ control T() {
)
)
)
)
=========================
Return Statement
=========================