Crate scnr2

Source
Expand description

A library for creating scanners in Rust. This library provides a macro to define scanners and their modes, tokens, and transitions. It also includes data structures for implementing a scanner runtime, including a scanner implementation, DFA (Deterministic Finite Automaton) states and transitions.

Re-exports§

pub use crate::internals::char_iter::CharIterWithPosition;
pub use crate::internals::find_matches::FindMatches;
pub use crate::internals::find_matches::FindMatchesWithPosition;
pub use crate::internals::match_types::Match;
pub use crate::internals::position::Position;
pub use crate::internals::position::Positions;
pub use crate::internals::scanner_impl::ScannerImpl;

Modules§

internals

Macros§

scanner

Structs§

AcceptData
Data associated with an accepting state in the DFA, including the type of token and lookahead information.
Dfa
A Deterministic Finite Automaton (DFA) that consists of states.
DfaState
A state in the DFA, which includes transitions to other states and optional accept data.
DfaTransition
A transition in the DFA to another state.
ScannerMode
A scanner mode, which includes its name, transitions, and the DFA (Deterministic Finite Automaton) that defines its behavior.

Enums§

Lookahead
Lookahead information for the DFA, which can be positive or negative.
Transition
A transition in the scanner.

Type Aliases§

Span
A range type representing a span in the source code, typically used for token match positions.