Skip to content
New issue

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

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

Already on GitHub? # to your account

Parse error #304

Closed
t-bltg opened this issue Aug 6, 2021 · 0 comments · Fixed by #305
Closed

Parse error #304

t-bltg opened this issue Aug 6, 2021 · 0 comments · Fixed by #305
Labels

Comments

@t-bltg
Copy link

t-bltg commented Aug 6, 2021

Sorry guys, here is another parsing error (with #303 applied) 😉.

I'm trying to add the JuliaFormatter github actions to Plots.jl, so the whole Plots.jl repo must be parsed and formatted.

using CSTParser
str = """
const _examples = PlotExample[
    PlotExample( # 40
        "Lens",
        "A lens lets you easily magnify a region of a plot. x and y coordinates refer to the to be magnified region and the via the `inset` keyword the subplot index and the bounding box (in relative coordinates) of the inset plot with the magnified plot can be specified. Additional attributes count for the inset plot.",
        [
            quote
                begin
                    plot(
                        [(0, 0), (0, 0.9), (1, 0.9), (2, 1), (3, 0.9), (80, 0)],
                        legend = :outertopright,
                    )
                    plot!([(0, 0), (0, 0.9), (2, 0.9), (3, 1), (4, 0.9), (80, 0)])
                    plot!([(0, 0), (0, 0.9), (3, 0.9), (4, 1), (5, 0.9), (80, 0)])
                    plot!([(0, 0), (0, 0.9), (4, 0.9), (5, 1), (6, 0.9), (80, 0)])
                    lens!(
                        [1, 6],
                        [0.9, 1.1],
                        inset = (1, bbox(0.5, 0.0, 0.4, 0.4)),
                    )
                end
            end,
        ],
    ),
]
"""
Meta.parse(str)  # OK
x, ps = CSTParser.parse(CSTParser.ParseState(str), true)  # NOK
@show ps.errored
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants