pears/input

This module defines the Input(i) type that represents a list of tokens that can be consumed by a parser. It also provides some helper functions for working with Input(i).

Types

Represents a list of tokens that can be consumed by a parser, along with a cursor indicating the current position.

pub type Input(i) {
  Input(tokens: List(i), cursor: Int)
}

Constructors

  • Input(tokens: List(i), cursor: Int)

Functions

pub fn at_end(input: Input(a)) -> Bool

Returns true if the input has been fully consumed

pub fn get(input: Input(a)) -> Option(a)
pub fn get_n(input: Input(a), n: Int) -> List(a)
pub fn next(input: Input(a)) -> Input(a)
pub fn next_n(input: Input(a), n: Int) -> Input(a)
Search Document