bowbahdoe / edn-format

Rust implementation of the EDN data format
MIT License
19 stars 3 forks source link

Multiline comments cause error in parsing #1

Closed skyrod-vactai closed 2 years ago

skyrod-vactai commented 2 years ago

This parses ok:

;; foo
 ;; bar

this doesn't:

;; foo
;; bar

The only difference is that in the first example, there's a space before the first semicolon on the 2nd line. Without that whitespace, the parser errors with Err(ParserErrorWithContext { context: [], row: 1, col: 2, error: UnexpectedCharacter(';') })

I looked at the unit tests and they don't cover this, the comment tests all have whitespace.

Here's a tiny reproducer:

extern crate edn_format;

fn main() {
    println!("{:?}", edn_format::parse_str(";; abc\n;; def \n\n ced"));
}
bowbahdoe commented 2 years ago

Taking a look now

bowbahdoe commented 2 years ago

@skyrod-vactai This should be fixed now in 3.2.3. Let me know if you run into anything else + what you are using the library for (genuinely curious)

skyrod-vactai commented 2 years ago

I'm developing a simple programming language (closely related to Joy). Its source code (and data, it's homoiconic) is a subset of edn (vectors, boolean, string, numbers, symbols, and one reader tag for base64 encoded bytes). I'm using your lib as the reader/writer. Thanks for making the lib and being so responsive to my bug report. I'm about to upgrade and try out the fix.

skyrod-vactai commented 2 years ago

Fixed! Thanks!

bowbahdoe commented 2 years ago

@skyrod-vactai As far as i am aware you are my only user, so if you have any issues/questions/feature requests or just want a rubber duck feel free to message me on whatever platform