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 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),
|
action_declaration: $ => seq($.action, $.identifier, $.parameters, $.blockStatement),
|
||||||
table_declaration: $ => seq($.table, $.identifier, '{', optional($.table_property_list), '}'),
|
table_declaration: $ => seq($.table, $.identifier, '{', optional($.table_property_list), '}'),
|
||||||
|
|
||||||
// Table property list
|
// Table property list
|
||||||
@@ -107,7 +107,7 @@ export default grammar({
|
|||||||
assignmentStatement: $=> seq($.expression, $.assignment, $.expression, $._semicolon),
|
assignmentStatement: $=> seq($.expression, $.assignment, $.expression, $._semicolon),
|
||||||
return_statement: $=> seq($._return, $.expression, $._semicolon),
|
return_statement: $=> seq($._return, $.expression, $._semicolon),
|
||||||
exit_statement: $=> seq($._exit, $._semicolon),
|
exit_statement: $=> seq($._exit, $._semicolon),
|
||||||
apply_statement: $=> seq($.apply, $.statement),
|
apply_statement: $=> seq($.apply, $.blockStatement),
|
||||||
|
|
||||||
// Parser statements
|
// Parser statements
|
||||||
parserStatements: $ => repeat1($.parserStatement),
|
parserStatements: $ => repeat1($.parserStatement),
|
||||||
|
|||||||
@@ -24,10 +24,8 @@ control simple() {
|
|||||||
(action)
|
(action)
|
||||||
(identifier)
|
(identifier)
|
||||||
(parameters)
|
(parameters)
|
||||||
(statement
|
|
||||||
(blockStatement)
|
(blockStatement)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(table_declaration
|
(table_declaration
|
||||||
(table)
|
(table)
|
||||||
(identifier)
|
(identifier)
|
||||||
@@ -51,11 +49,9 @@ control simple() {
|
|||||||
)
|
)
|
||||||
(apply_statement
|
(apply_statement
|
||||||
(apply)
|
(apply)
|
||||||
(statement
|
|
||||||
(blockStatement)
|
(blockStatement)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ control T() {
|
|||||||
(parameters)
|
(parameters)
|
||||||
(apply_statement
|
(apply_statement
|
||||||
(apply)
|
(apply)
|
||||||
(statement
|
|
||||||
(blockStatement
|
(blockStatement
|
||||||
(statements
|
(statements
|
||||||
(statement
|
(statement
|
||||||
@@ -26,7 +25,6 @@ control T() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
)
|
)
|
||||||
=========================
|
=========================
|
||||||
Return Statement
|
Return Statement
|
||||||
|
|||||||
Reference in New Issue
Block a user