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§
- ABytes
- A Bytes literal
- ADecimal
- Decimal Number (e.g.
1.3
) - ANum
- Integral Number
- Parser
- S-Expr Parser
- Position
- A file position for human composed of the line (starting at 1), and column (starting a 0)
- Printer
- Simple printer
- Span
- Span defined by 2 positions, defining a range between start and end
- Tokenizer
- Tokenizer state on the data
- Tokenizer
Config - Config for the tokenizer, for flags
Enums§
- Atom
- Atom literal (Number, Bytes, String, or Ident)
- Element
- Element of S-Expr
- Group
Kind - Type of group
- Parser
Error - Parser Error, which are either token error or some error related to group balancing like unterminated group, or mismatch of group
- Token
- Tokens
- Token
Error
Type Aliases§
- Spanned
Element - Spanned Element
- Spanned
Token - A Token with the span (start and end positions) associated