Skip to main content

Crate sbircio

Crate sbircio 

Source
Expand description

A lightweight BufRead wrapper with Unicode-aware peek-ahead and character-level scanning, designed for building parsers and lexers.

§Quick start

use sbircio::Input;
use std::io::Cursor;

let source = Cursor::new("42 + hello");
let mut input = Input::new(source);

let num = input.consume_while(|c| c.is_ascii_digit())?;
input.skip_whitespace()?;
input.expect("+")?;
input.skip_whitespace()?;
let word = input.consume_while(|c| c.is_alphabetic())?;

assert_eq!(num, "42");
assert_eq!(word, "hello");

Structs§

Coordinates
Input
A reader that can peek ahead without consuming characters.

Enums§

InputError
Errors that can occur while reading input.