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.

pub type Input(i) =
  List(i)

Functions

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

Returns true if the input has been fully consumed

pub fn get(input: List(a)) -> Option(#(a, List(a)))

Get the head and tail of an input.

Examples

get(Input([1, 2, 3]))
// => Some(#(1, Input([2, 3])))
get(Input([]))
// => None
Search Document