[fine] Tests for conditional, semicolon optional at end of block

Just like rust, ';' means "discard this value".
This commit is contained in:
John Doty 2024-01-04 19:47:44 -08:00
parent ec5e59aed3
commit f203da328b
2 changed files with 38 additions and 6 deletions

View file

@ -0,0 +1,26 @@
// concrete:
// | File
// | IfStatement
// | ConditionalExpression
// | If:'"if"'
// | LiteralExpression
// | True:'"true"'
// | Block
// | LeftBrace:'"{"'
// | ExpressionStatement
// | LiteralExpression
// | String:'"\"discarded\""'
// | Semicolon:'";"'
// | ExpressionStatement
// | LiteralExpression
// | Number:'"23"'
// | RightBrace:'"}"'
// | Else:'"else"'
// | Block
// | LeftBrace:'"{"'
// | ExpressionStatement
// | LiteralExpression
// | Number:'"45"'
// | RightBrace:'"}"'
//
if true { "discarded"; 23 } else { 45 }