Crate rustledger_parser

Crate rustledger_parser 

Source
Expand description

Beancount parser using chumsky parser combinators.

This crate provides a parser for the Beancount file format. It produces a stream of Directives from source text, along with any parse errors.

§Features

  • Full Beancount syntax support (all 12 directive types)
  • Error recovery (continues parsing after errors)
  • Precise source locations for error reporting
  • Support for includes, options, plugins

§Example

use rustledger_parser::parse;

let source = r#"
2024-01-15 * "Coffee Shop" "Morning coffee"
  Expenses:Food:Coffee  5.00 USD
  Assets:Cash
"#;

let (directives, errors) = parse(source);
assert!(errors.is_empty());
assert_eq!(directives.len(), 1);

Modules§

logos_lexer
SIMD-accelerated lexer using Logos.

Structs§

ParseError
A parse error with location information.
ParseResult
Result of parsing a beancount file.
Span
A span in the source code, represented as a byte range.
Spanned
A value with an associated source span.

Enums§

ParseErrorKind
Kinds of parse errors.

Functions§

parse
Parse beancount source code.
parse_directives
Parse beancount source code, returning only directives and errors.