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
Add an expression StreamRange(usize) in the AST.
Add a type Span along with Range.
Force .. and ... to start a sequence, e1 .. e2 is disallowed because it leads to visual ambiguities.
We do not propose Range<(T1, T2)> (for example) because we feel it's inconvenient, it forces the user to extract the span and the value in the semantic action.
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.
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.
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:
which have the type
(Range<S>, T1, T2)
whereRange<S>
is as defined in #85 andwith the type
(Span, T1, T2)
whereSpan
is obtained by callingrange.span()
.Design
StreamRange(usize)
in the AST.Span
along withRange
...
and...
to start a sequence,e1 .. e2
is disallowed because it leads to visual ambiguities.Range<(T1, T2)>
(for example) because we feel it's inconvenient, it forces the user to extract the span and the value in the semantic action.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.