neco_gleam/scanner
Types
Values
pub fn peek(scanner: Scanner) -> option.Option(Int)
Returns the current byte while preserving the scanner position, or None
at the end of the input.
pub fn read(scanner: Scanner) -> Result(#(Int, Scanner), Nil)
Reads one byte and advances the returned scanner. End of input produces
Error(Nil) while the input scanner remains available to the caller.
pub fn read_n(
scanner: Scanner,
take n: Int,
) -> Result(#(BitArray, Scanner), Nil)
Reads exactly n bytes and advances the returned scanner. A negative count
or insufficient input produces Error(Nil). A zero count returns an empty
bit array and the input scanner.
pub fn remaining_bytes(scanner: Scanner) -> BitArray
pub fn span(
scanner: Scanner,
from start: Int,
) -> Result(diagnostic.Span, diagnostic.Failure)
Creates [start, position(scanner)), returning InvalidSpan for a negative
start or a start greater than the current position.