Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE - 1121] Change parsing rule of block to disallow multiple else #1154

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sshailabh
Copy link

@sshailabh sshailabh commented Dec 8, 2024

This PR tries to fix the this issue : #1121
I am changing the parser grammar of block:

block
  :
    startToken = START_BLOCK DECORATOR? sexpr blockParams? END
    thenBody=body
    elseBlock
    END_BLOCK nameEnd=QID END
  ;

elseBlock
  :
    elseStmtChain*
    elseStmt?
  ;

This would ensure that elseBlock would have 0 or more elseStmtChain with zero or once elseStmt.

Sample example can be found in ParsingErrorTest.java:

{{#if true}} b1 {{else}} b2 {{else}} b3 {{/if}}

@sshailabh sshailabh changed the title change parsing rule to disallow multiple else statements [ISSUE - 1121] Change parsing rule of block to disallow multiple else Dec 8, 2024
@sshailabh
Copy link
Author

@jknack Would you please take a look at this PR when you get time?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant