Debian Codegraph @

debian/rust-vendor/winnow/src/_topic/lexing.rs

raw
1 //! # Lexing and Parsing
2 //!
3 //! ## Parse to AST
4 //!
5 //! The simplest way to write a parser is to parse directly to the AST.
6 //!
7 //! Example:
8 //! ```rust
9 #![doc = include_str!("../../examples/arithmetic/parser_ast.rs")]
10 //! ```
11 //!
12 //! ## Lexing
13 //!
14 //! However, there are times when you may want to separate lexing from parsing.
15 //! Winnow provides [`TokenSlice`] to simplify this.
16 //!
17 //! Example:
18 //! ```rust
19 #![doc = include_str!("../../examples/arithmetic/parser_lexer.rs")]
20 //! ```
21
22 #![allow(unused_imports)]
23 use crate::stream::TokenSlice;