grammar: Make apply statements have block bodies
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
@@ -84,7 +84,7 @@ export default grammar({
|
||||
|
||||
// Control declarations
|
||||
control_declaration: $ => seq($.control, $.identifier, $.parameters, '{', repeat(choice($.table_declaration, $.action_declaration)), $.apply_statement, '}'),
|
||||
action_declaration: $ => seq($.action, $.identifier, $.parameters, $.statement),
|
||||
action_declaration: $ => seq($.action, $.identifier, $.parameters, $.blockStatement),
|
||||
table_declaration: $ => seq($.table, $.identifier, '{', optional($.table_property_list), '}'),
|
||||
|
||||
// Table property list
|
||||
@@ -107,7 +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),
|
||||
apply_statement: $=> seq($.apply, $.blockStatement),
|
||||
|
||||
// Parser statements
|
||||
parserStatements: $ => repeat1($.parserStatement),
|
||||
|
||||
@@ -24,9 +24,7 @@ control simple() {
|
||||
(action)
|
||||
(identifier)
|
||||
(parameters)
|
||||
(statement
|
||||
(blockStatement)
|
||||
)
|
||||
(blockStatement)
|
||||
)
|
||||
(table_declaration
|
||||
(table)
|
||||
@@ -51,9 +49,7 @@ control simple() {
|
||||
)
|
||||
(apply_statement
|
||||
(apply)
|
||||
(statement
|
||||
(blockStatement)
|
||||
)
|
||||
(blockStatement)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -15,12 +15,10 @@ control T() {
|
||||
(parameters)
|
||||
(apply_statement
|
||||
(apply)
|
||||
(statement
|
||||
(blockStatement
|
||||
(statements
|
||||
(statement
|
||||
(exit_statement)
|
||||
)
|
||||
(blockStatement
|
||||
(statements
|
||||
(statement
|
||||
(exit_statement)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user