[−][src]Trait lrpar::NonStreamingLexer
A NonStreamingLexer
is one that takes input in one go, and is then able to hand out
substrings to that input and calculate line and column numbers from a Span.
Required methods
fn span_str(&self, span: Span) -> &'input str
[src]
Return the user input associated with a Span.
The Span must be well formed:
- The start/end byte indexes must be valid UTF-8 character indexes.
- The end byte index must not exceed the input's length. If these requirements are not respected this function may panic or return unexpected portions of the input.
fn span_lines_str(&self, span: Span) -> &'input str
[src]
Return the lines containing the input at span
(including all the text on the lines
that span
starts and ends on).
The Span must be well formed:
- The start/end byte indexes must be valid UTF-8 character indexes.
- The end byte index must not exceed the input's length. If these requirements are not respected this function may panic or return unexpected portions of the input.
fn line_col(&self, span: Span) -> ((usize, usize), (usize, usize))
[src]
Return ((start line, start column), (end line, end column))
for span
. Note that column
characters (not bytes) are returned.
The Span must be well formed:
- The start/end byte indexes must be valid UTF-8 character indexes.
- The end byte index must not exceed the input's length. If these requirements are not respected this function may panic or return unexpected portions of the input.