jelmer / makefile-lossless

Lossless makefile parser
6 stars 3 forks source link

Needs a new line at the end of line to parse correctly. #15

Closed xiyuzhai closed 1 day ago

xiyuzhai commented 1 day ago

For example, the following wouldn't work:

#[test]
fn parse_makefile_example4() {
    // Example Makefile content as a string
    let makefile_content = "\nclean:\n\tcargo clean\n";

    // Parse the Makefile content
    let mf: makefile_lossless::Makefile = makefile_content.parse().unwrap();
    // Example Makefile content as a string
    let makefile_content = "\nclean:\n\tcargo clean";

    // Parse the Makefile content
    let mf: makefile_lossless::Makefile = makefile_content.parse().unwrap();
}

It will panick at the second unwrap, because it doesn't end with a newline.

I'm not very familiar with rowan to propose a quick fix. Probably a few days later when I'm less busy and less burnout.

xiyuzhai commented 18 hours ago

Man, thank you very much! Amazing speed. So cool.