diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-09-06 22:05:38 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-09-06 22:05:38 +0200 |
commit | 42a52e16ffaa4d49fa26f1184a0660324705bc7c (patch) | |
tree | bf4935f062b8b5dc1fb10ae75ed286fab2d8ae0f /parser.y | |
parent | 88099fdaf55a24854508b7a75d690fa76be6f44a (diff) |
parser: make final semicolon optional
Modify the grammar to allow omitting the last semicolon after the last
statement of a compound statement.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'parser.y')
-rw-r--r-- | parser.y | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -120,7 +120,9 @@ stmt(A) ::= break_stmt(B). { A = B; } stmt(A) ::= decl_stmt(B). { A = B; } //cpd_stmt(A) ::= T_LBRACE T_RBRACE. { A = NULL; } +cpd_stmt(A) ::= T_LBRACE stmts(B) exp(C) T_RBRACE. { A = B ? append_op(B, C) : C; } cpd_stmt(A) ::= T_LBRACE stmts(B) T_RBRACE. { A = B; } +cpd_stmt(A) ::= T_LBRACE exp(B) T_RBRACE. { A = B; } exp_stmt(A) ::= exp(B) T_SCOL. { A = B; } exp_stmt(A) ::= T_SCOL. { A = 0; } |