Expand description
S-Expressions Parser and Printer
§Parser example
use s_expr::{Parser, Element, Span};
let mut parser = Parser::new("(let x 1)");
let r = parser.next().expect("parse data").expect("not end of stream");
let elements = r.inner.paren().expect("paren group");
assert_eq!(elements[0].inner.atom().and_then(|atom| atom.ident()), Some("let"));
assert_eq!(elements[0].span, Span::on_line(1, 1, 4));
Structs§
- A Bytes literal
- Decimal Number (e.g.
1.3
) - Integral Number
- S-Expr Parser
- A file position for human composed of the line (starting at 1), and column (starting a 0)
- Simple printer
- Span defined by 2 positions, defining a range between start and end
- Tokenizer state on the data
- Config for the tokenizer, for flags
Enums§
- Atom literal (Number, Bytes, String, or Ident)
- Element of S-Expr
- Type of group
- Parser Error, which are either token error or some error related to group balancing like unterminated group, or mismatch of group
- Tokens
Type Aliases§
- Spanned Element
- A Token with the span (start and end positions) associated