clarkmcc / cel-rust

Common Expression Language interpreter written in Rust
https://crates.io/crates/cel-interpreter
MIT License
377 stars 21 forks source link

Parser tests #13

Closed hardbyte closed 1 year ago

hardbyte commented 1 year ago

Ported most of my parser tests across.

I've commented out the few that fail which are due to:

On the last one, do you want to keep the DoubleMinus, DoubleNegative unary ops?

clarkmcc commented 1 year ago

To clarify, your tests are failing with the current LALRPOP parser but are working on the chumsky parser, correct? Edit: ah yes, I see raw strings are not supported by the current parser.

Double minus is not anywhere in the spec that I can find. Seems like we could implement recursive operators if we need to support it in the future. I'm not sure exactly what the thought process was behind supporting double minus, but not implicit triple minus, and so on. I'm good either way, your thoughts?

hardbyte commented 1 year ago

Double minus is not anywhere in the spec that I can find. Seems like we could implement recursive operators if we need to support it in the future. I'm not sure exactly what the thought process was behind supporting double minus, but not implicit triple minus, and so on. I'm good either way, your thoughts?

Oh right I assumed you had implemented the double minus etc. I think we try follow as close to the spec as possible so I'd suggest removing the DoubleX operations. Do you want to try do that for the existing parser though?

Yes a recursive approach to parsing unary operators is how I've implemented it in my parser - https://github.com/hardbyte/common-expression-language/blob/main/parser/src/parser.rs#L261-L270 and yes these tests currently pass in mine.

In my repo I'll aim to add support for byte strings as I skipped those.

clarkmcc commented 1 year ago

I won't worry about trying to remove it from the existing parser unless we decide to keep both parsers.