sexpr_parse

Crates.iosexpr_parse
lib.rssexpr_parse
version1.0.0
created_at2026-01-01 23:36:47.748209+00
updated_at2026-01-01 23:36:47.748209+00
descriptionParser for S-expressions
homepage
repositoryhttps://github.com/cyruscook/spectec_parse
max_upload_size
id2017709
size13,119
(cyruscook)

documentation

README

sexpr_parse

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.

Usage

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())]
                )]
            )
        ]
    )]
);
Commit count: 0

cargo fmt