ptal / oak

A typed parser generator embedded in Rust code for Parsing Expression Grammars
Apache License 2.0
142 stars 14 forks source link

unit or invisible type annotation on expression instead of rules. #47

Closed ptal closed 9 years ago

ptal commented 9 years ago

For the moment, annotations invisible_type and unit_type are on rules but there is no real reason to prevent it from being used directly on expression. Instead of:

#[invisible_type]
spacing = [" \n\t"]*

#[unit_type]
spacing = [" \n\t"]*

We propose the syntax:

spacing = [" \n\t"]* -> (^)
spacing = [" \n\t"]* -> ()

The (^) is for the invisible type because it propagates a unit type on the calling site.