Skip to content

Conversation

@MasonProtter
Copy link

@MasonProtter MasonProtter commented Jul 26, 2024

This is my current attempt at #436, sorry it took me a little while to post it @c42f.

Lots of things work, but the main problem currently is that my criterion for detecting cases like (@foo x) is too broad. Specifically, cases like this aren't doing what we want:

julia> """
       (@foo function bar()
           @baz x
           y
       end)
       """ |> Meta.parse
:(#= none:1 =# @foo function bar()
          #= none:1 =#
          #= none:2 =#
          #= none:2 =# @baz x y
      end)

Basically, it's detecting that (@foo is matching the desired pattern, but then its also recursively applying the new parsing rule to @baz x and grabbing the y incorrectly.

I haven't yet figured out the right way to fix this.

@c42f
Copy link
Member

c42f commented Nov 20, 2025

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/475 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/475
  • 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/475
git rebase origin/master

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

@MasonProtter
Copy link
Author

MasonProtter commented Nov 20, 2025

Thanks Claire! I was actually just looking at this again the other day. I'm still a bit stuck. I've gotten it to a point where I've fixed the problem shown in the original post here, but this case still regresses:

parsestmt(Expr, """
       Ex(@a, function   @g
                 @la   
             end)
       """)

I'll post my updated idea and maybe you can tell me if I'm just completely taking the wrong approach


Nevermind, I figured it out and opened a PR!

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