fix: For loop params trailing comma

issue: #88
This commit is contained in:
FalsePattern 2024-12-24 12:50:23 +01:00
parent 694acfc1d3
commit ff75518aa8
Signed by: falsepattern
GPG key ID: E930CDEC50C50E23
2 changed files with 13 additions and 5 deletions

View file

@ -21,6 +21,7 @@ Changelog structure reference:
- Zig - Zig
- Unterminated string at the end of the file soft-locks the editor - Unterminated string at the end of the file soft-locks the editor
- Trailing commas in for loop parameters don't get parsed correctly
## [20.1.0] ## [20.1.0]

View file

@ -416,14 +416,21 @@ WhilePrefix ::= KEYWORD_WHILE ZB_WhilePrefix_Operand PtrPayload? WhileContinueEx
private ZB_WhilePrefix_Operand ::= LPAREN Expr RPAREN {pin=1} private ZB_WhilePrefix_Operand ::= LPAREN Expr RPAREN {pin=1}
ForRange ::= Expr DOT2 Expr? ForPrefix ::= KEYWORD_FOR LPAREN ZB_ForParams RPAREN ForPayload {pin=1}
ForOperand ::= ForRange | Expr {recoverWhile="ZB_ForOperand_Recover"}
private ZB_ForOperand_Recover ::= !(COMMA | RPAREN) private ZB_ForParams ::= ForInput (COMMA ForInput)* COMMA? {recoverWhile="ZB_ForParams_Recover"}
ForPrefix ::= KEYWORD_FOR ZB_ForPrefix_Operands PtrIndexPayload {pin=1} private ZB_ForParams_Recover ::= !(RPAREN)
private ZB_ForPrefix_Operands ::= LPAREN (ForOperand COMMA)* ForOperand RPAREN {pin=1} ForInput ::= Expr (DOT2 Expr?)? {recoverWhile="ZB_ForInput_Recover"}
private ZB_ForInput_Recover ::= !(COMMA | RPAREN)
ForPayload ::= PIPE ZB_ForPayload_Item (COMMA ZB_ForPayload_Item)* PIPE {pin=1}
private ZB_ForPayload_Item ::= ASTERISK? IDENTIFIER {recoverWhile="ZB_ForPayload_Recover"}
private ZB_ForPayload_Recover ::= !(COMMA | PIPE)
// Payloads // Payloads
Payload ::= PIPE IDENTIFIER PIPE Payload ::= PIPE IDENTIFIER PIPE