Skip to content

support for for-else and while-else#513

Open
simeonschaub wants to merge 1 commit into
mainfrom
sds/for_else
Open

support for for-else and while-else#513
simeonschaub wants to merge 1 commit into
mainfrom
sds/for_else

Conversation

@simeonschaub

Copy link
Copy Markdown
Member

companion to JuliaLang/julia#56153

@c42f c42f left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The upstream reception of this seems overall negative, so I guess we might not do it?

A minor comment if we do ever merge this - for tests we should never depend on VERSION unless really necessary: JuliaSyntax is multi-version aware :)

Comment thread test/expr.jl
Comment on lines +192 to +206
if VERSION >= v"1.12-"
@test parsestmt("for x=xs\ny\nelse\nz\nend") ==
Expr(:for,
Expr(:(=), :x, :xs),
Expr(:block,
LineNumberNode(2),
:y,
),
Expr(:block,
LineNumberNode(4),
:z,
LineNumberNode(5)
)
)
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if VERSION >= v"1.12-"
@test parsestmt("for x=xs\ny\nelse\nz\nend") ==
Expr(:for,
Expr(:(=), :x, :xs),
Expr(:block,
LineNumberNode(2),
:y,
),
Expr(:block,
LineNumberNode(4),
:z,
LineNumberNode(5)
)
)
end
@test parsestmt("for x=xs\ny\nelse\nz\nend", version=v"1.12") ==
Expr(:for,
Expr(:(=), :x, :xs),
Expr(:block,
LineNumberNode(2),
:y,
),
Expr(:block,
LineNumberNode(4),
:z,
LineNumberNode(5)
)
)

@c42f

c42f commented Nov 20, 2025

Copy link
Copy Markdown
Member

Heya, we just moved JuliaSyntax into Base in JuliaLang/julia#59870 - if you want to re-propose this PR over there, I've created a branch https://github.com/JuliaLang/JuliaSyntax.jl/tree/pr-for-Base/513 to make this easier.

To make use of the branch, you can use the following steps:

  • Clone JuliaLang/julia
  • Add JuliaSyntax as a git remote
  • Check out pr-for-Base/513
  • Rebase on top of master

For example:

# git clone git@github.com:JuliaLang/julia julia_dir
# cd julia_dir

git remote add JuliaSyntax git@github.com:JuliaLang/JuliaSyntax.jl
git fetch JuliaSyntax
git checkout pr-for-Base/513
git rebase origin/master

Sorry this wasn't dealt with prior to the big move!

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.

2 participants