Skip to content

parser: Make parser more tolerant to trailing else and then after if#6550

Draft
fridis wants to merge 4 commits intomainfrom
parser_elseif_indentation_simplification
Draft

parser: Make parser more tolerant to trailing else and then after if#6550
fridis wants to merge 4 commits intomainfrom
parser_elseif_indentation_simplification

Conversation

@fridis
Copy link
Copy Markdown
Member

@fridis fridis commented Jan 29, 2026

Originally, I added a comment and simplified code for setting the else if indentation limit in ifexpr().

Found that the last tests in tests/else_indentation_reference where disabled because the parster gets stuck before this, so made the parser more tolerant to trailing else and then parts after an ifexpr.

For this to work, add an argument ignoreTrailingElse to block and exprs. If not set and previous errors occured, trailing else and then parts will be skipped since otherwise the parser may get stuck here.

Also did some cleanup to avoid argument newScope for method block().

… `if`

Originally, I added a comment and simplified code for setting the `else if`
indentation limit in `ifexpr()`.

Found that the last tests in `tests/else_indentation_reference` where disabled
because the parster gets stuck before this, so made the parser more tolerant to
trailing `else` and `then` parts after an `ifexpr`.

For this to work, add an argument `ignoreTrailingElse` to `block` and
`exprs`. If not set and previous errors occured, trailing `else` and `then`
parts will be skipped since otherwise the parser may get stuck here.

Also did some cleanup to avoid argument `newScope` for method `block()`.
@fridis fridis marked this pull request as draft January 30, 2026 10:22
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