ptal / oak

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

Range and span expressions #86

Closed ptal closed 3 years ago

ptal commented 8 years ago

Manipulation of span in parser is something utterly important. We feel the need to propose some support to handle span more easily. We therefore propose two expression extensions:

(... e1 e2)

which have the type (Range<S>, T1, T2) where Range<S> is as defined in #85 and

(.. e1 e2)

with the type (Span, T1, T2) where Span is obtained by calling range.span().

Design

It was first proposed in #13 to infer span, we propose here a better control while the span type is still correctly inferred and propagated.

ptal commented 3 years ago

Triage of issues: I abandon the syntax ... (only .. remains) for now. It is subsumed by a more general mechanism which allows us to call external parsers inside a Oak rule.