fix grammar: if_xx with else part

This commit is contained in:
Irmen de Jong 2024-04-09 22:35:30 +02:00
parent db80417bd7
commit f4b50368ba
2 changed files with 11 additions and 7 deletions

View File

@ -4,13 +4,17 @@
main { main {
sub start() { sub start() {
const ubyte x=0 sys.clear_carry()
cx16.r0s=-42
if x==3 { if_z
txt.print("three") txt.print("zero")
} else if x==4 { else if_cs
txt.print("four") txt.print("carry")
} else if_neg
txt.print("negative")
else
txt.print("nothing")
} }
} }

View File

@ -296,7 +296,7 @@ if_stmt : 'if' expression EOL? (statement | statement_block) EOL? else_part? ;
else_part : 'else' EOL? (statement | statement_block) ; // statement is constrained later else_part : 'else' EOL? (statement | statement_block) ; // statement is constrained later
branch_stmt : branchcondition EOL? (statement | statement_block) EOL? else_part? EOL ; branch_stmt : branchcondition EOL? (statement | statement_block) EOL? else_part? ;
branchcondition: 'if_cs' | 'if_cc' | 'if_eq' | 'if_z' | 'if_ne' | 'if_nz' | 'if_pl' | 'if_pos' | 'if_mi' | 'if_neg' | 'if_vs' | 'if_vc' ; branchcondition: 'if_cs' | 'if_cc' | 'if_eq' | 'if_z' | 'if_ne' | 'if_nz' | 'if_pl' | 'if_pos' | 'if_mi' | 'if_neg' | 'if_vs' | 'if_vc' ;