Skip to content

Add ELSEIF/ELSE branch-chain support to TEPL conditionals - #33

Merged
Xtqm merged 3 commits into
mainfrom
copilot/add-elseif-support
Oct 2, 2026
Merged

Xtqm merged 3 commits into
mainfrom
copilot/add-elseif-support

Conversation

Copilot AI commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

TEPL conditionals previously accepted only a single IF ... THEN ... END branch. This update adds native ELSEIF support (and ELSE THEN) so multi-branch logical flows parse and compile correctly.

  • Grammar + tokens

    • Added ELSEIF and ELSE keywords.
    • Extended if_then_stmt to support:
      • IF ... THEN body
      • ELSEIF ... THEN body (0..n)
      • ELSE THEN body (0..1)
      • END
  • AST model

    • Expanded If node to carry:
      • elif_branches: list[(condition, body)]
      • else_body: optional body
  • Semantic validation + code generation

    • Added semantic checks for elif_branches and else_body.
    • Updated Python emission to generate if / elif / else blocks from the new AST shape.
  • Focused coverage

    • Added tests that verify:
      • parser output includes ELSEIF/ELSE branches in AST
      • compiled output includes elif and else and executes the expected branch
if 1 == 2 then
    output "first"
elseif 2 == 2 then
    output "second"
else then
    output "third"
end

Copilot AI assigned Copilot and Xtqm Oct 2, 2026
Copilot AI linked an issue Oct 2, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits October 2, 2026 18:20
Co-authored-by: Xtqm <133138386+Xtqm@users.noreply.github.com>
Co-authored-by: Xtqm <133138386+Xtqm@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for ELSEIF statements in logical branches Add ELSEIF/ELSE branch-chain support to TEPL conditionals Oct 2, 2026
Copilot AI requested a review from Xtqm October 2, 2026 18:22
@Xtqm
Xtqm marked this pull request as ready for review October 2, 2026 18:40
Copilot AI balanced review requested due to automatic review settings October 2, 2026 18:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Xtqm
Xtqm merged commit 2632ea2 into main Oct 2, 2026
1 check failed
@Xtqm
Xtqm deleted the copilot/add-elseif-support branch October 6, 2026 22:24
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.

Add ELSEIF

3 participants