Trait lrpar::NonStreamingLexer[][src]

pub trait NonStreamingLexer<'input, StorageT: Hash + PrimInt + Unsigned>: Lexer<StorageT> {
    fn span_str(&self, span: Span) -> &'input str;
fn span_lines_str(&self, span: Span) -> &'input str;
fn line_col(&self, span: Span) -> ((usize, usize), (usize, usize)); }
Expand description

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

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.

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.

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.

Implementors