Skip to content

Problem parsing in JuliaFormatter #365

@guilhermebodin

Description

@guilhermebodin

I had an error in JuliaFormatter and it might be a problem with the parser domluna/JuliaFormatter.jl#642 (comment)

julia> format_text("@constraint(Lower(model), +x[1] + x[2] <= 2)")
ERROR: Error while PARSING formatted text:

1 @constraint(Lower(model), x[1] + x[2] +  <= 2)

...

Error occurred on line 1, offset 45 of formatted text.

The error might not be precisely on this line but it should be in the region of the code block. Try commenting the region out and see if that removes the error.
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:33
 [2] format_text(cst::CSTParser.EXPR, style::DefaultStyle, s::JuliaFormatter.State)
   @ JuliaFormatter C:\Users\guilhermebodin\.julia\packages\JuliaFormatter\xKNsr\src\JuliaFormatter.jl:699
 [3] format_text(text::String, style::DefaultStyle, opts::JuliaFormatter.Options)
   @ JuliaFormatter C:\Users\guilhermebodin\.julia\packages\JuliaFormatter\xKNsr\src\JuliaFormatter.jl:632
 [4] #format_text#238
   @ C:\Users\guilhermebodin\.julia\packages\JuliaFormatter\xKNsr\src\JuliaFormatter.jl:604 [inlined]
 [5] format_text
   @ C:\Users\guilhermebodin\.julia\packages\JuliaFormatter\xKNsr\src\JuliaFormatter.jl:602 [inlined]
 [6] #format_text#237
   @ C:\Users\guilhermebodin\.julia\packages\JuliaFormatter\xKNsr\src\JuliaFormatter.jl:598 [inlined]
 [7] format_text(text::String)
   @ JuliaFormatter C:\Users\guilhermebodin\.julia\packages\JuliaFormatter\xKNsr\src\JuliaFormatter.jl:598
 [8] top-level scope
   @ REPL[13]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions