| Crates.io | sexpr_parse |
| lib.rs | sexpr_parse |
| version | 1.0.0 |
| created_at | 2026-01-01 23:36:47.748209+00 |
| updated_at | 2026-01-01 23:36:47.748209+00 |
| description | Parser for S-expressions |
| homepage | |
| repository | https://github.com/cyruscook/spectec_parse |
| max_upload_size | |
| id | 2017709 |
| size | 13,119 |
Parser for S-expressions.
Reads a string and parses it into S-expressions of either nodes, atoms, or text.
This crate is specifically designed to parse the S-expressions generated by SpecTec, and it has not been tested on other forms of S-expressions.
let input = r#"(typ "m" (inst (alias nat)))"#;
let sexprs = parse_sexpr_stream(input).unwrap();
assert_eq!(
sexprs,
vec![SExprItem::Node(
"typ".to_string(),
vec![
SExprItem::Text("m".to_string()),
SExprItem::Node(
"inst".to_string(),
vec![SExprItem::Node(
"alias".to_string(),
vec![SExprItem::Atom("nat".to_string())]
)]
)
]
)]
);