Module ledger_rs_lib::parser
source · Expand description
Parser with iterators
Parses string tokens into model entities (Account, Transaction, Post, Amount…)
The main idea here is to minimize memory allocations. The parsing is done in functions, not objects. Each parser will provide an iterator over the tokens it recognizes, i.e. Xact parser will iterate over the Xact header items: date, payee, note. Post parser provides an iterator over Account, Amount. Amount parser provides sign, quantity, symbol, price. Iterator returns None if a token is not present.
Tokens are then handled by lexer, which creates instances of Structs and populates the collections in the Journal. It also creates links among the models. This functionality is from finalize() function.
Constants
Functions
- Parse amount parts (quantity, commodity), i.e. “25”, “AUD”. Returns Amount. Panics if parsing fails.
- Create DateTime from date string only.