chumsky icon indicating copy to clipboard operation
chumsky copied to clipboard

Update indent.rs in order to have a proper Pratt parser

Open Germ210 opened this issue 7 months ago • 1 comments

This rewrites indent.rs to use a real Pratt parser. Previously, the file had a TODO noting that it should eventually use expression parsing, but in the meantime it didn’t actually implement any precedence rules—it just matched the text "expr" directly. This change introduces proper precedence handling using a Pratt parser, making the indentation-sensitive parser more accurate and extensible, while keeping the overall behavior consistent.

Germ210 avatar May 29 '25 04:05 Germ210

Hi, looks like you need to enable the pratt feature for the indent example in Cargo.toml.

My feeling is that we should keep the pratt parser here simple, simpler than this example (perhaps just + and * is fine). The pratt parser is not the focus of the example and shouldn't really 'stand out'.

zesterer avatar Jun 11 '25 09:06 zesterer