jamesrhester / Lerche.jl

A Julia port of the Lark parser
MIT License
45 stars 3 forks source link

Parsing signed-float error #30

Closed GiggleLiu closed 1 year ago

GiggleLiu commented 1 year ago

HELP NEEDED.

This PR contains

The following is a minimum one

julia> g = Lark("""start: a
                       ?a: b
                       b: "x"
                    """,parser="lalr",lexer="standard",debug=true);

julia> r = Lerche.parse(g,"x")
Tree(start, Any[Tree(b, Union{Token, Tree}[])
])

julia> print_tree(r)
start
└─ b

One issue not yet resolved

An unfixed one is kind of related to #29 . The parser does not know how to parse "SIGNED_FLOAT" and "INT" properly.

Setting priority does not work. Why it always parse INT first? Even if I define integer and float manually and set their priority manually, the parser still parse integer first.

GiggleLiu commented 1 year ago

@jamesrhester Sorry for mixing multiple features in one PR, this is just convenient for my local development. Really need your help in parsing floating point numbers and integers properly.

jamesrhester commented 1 year ago

I would like to keep the AbstractTrees changes in a separate PR, and I will merge the two obvious bugfixes in fe65bf8 immediately.

GiggleLiu commented 1 year ago

Sounds good.