├── .envrc ├── .github └── workflows │ └── test-suite.yml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── beancount-parser-lima-python ├── .gitignore ├── Cargo.toml ├── README.md ├── pyproject.toml ├── python-examples │ └── parse.py └── src │ ├── conversions.rs │ ├── lib.rs │ ├── types.rs │ └── types │ └── format.rs ├── beancount-parser-lima ├── Cargo.toml ├── README.md ├── build.rs ├── examples │ ├── check-postings-balance.rs │ ├── check.rs │ ├── data │ │ ├── account-types.beancount │ │ ├── error-account-types.beancount │ │ ├── error-duplicate-options.beancount │ │ ├── error-duplicates.beancount │ │ ├── error-include-cycle.beancount │ │ ├── error-include-cycle │ │ │ └── included.beancount │ │ ├── error-include-duplicate.beancount │ │ ├── error-include-duplicate │ │ │ └── included.beancount │ │ ├── error-include-no-such-file.beancount │ │ ├── error-includes.beancount │ │ ├── error-includes │ │ │ └── simple-errors.beancount │ │ ├── error-options.beancount │ │ ├── error-parse.beancount │ │ ├── error-post-balancing.beancount │ │ ├── error-validation.beancount │ │ ├── full.beancount │ │ ├── includes.beancount │ │ ├── includes │ │ │ └── included.beancount │ │ ├── long_string.beancount │ │ ├── options.beancount │ │ └── simple.beancount │ ├── dump.rs │ └── images │ │ └── beancount-parser-balancing-errors.png ├── proptest-regressions │ └── parser │ │ └── types │ │ └── tests.txt ├── protobuf │ ├── COPYING │ ├── README.md │ └── beancount │ │ ├── ccore │ │ ├── data.proto │ │ ├── date.proto │ │ ├── number.proto │ │ └── precision.proto │ │ └── cparser │ │ ├── inter.proto │ │ ├── ledger.proto │ │ └── options.proto ├── src │ ├── format.rs │ ├── lexer.rs │ ├── lexer │ │ └── tests.rs │ ├── lib.rs │ ├── options.rs │ ├── parsers.rs │ ├── parsers │ │ └── tests.rs │ ├── sort.rs │ ├── sort │ │ └── tests.rs │ ├── types.rs │ └── types │ │ └── tests.rs └── tests │ ├── helpers │ ├── beancount.rs │ └── mod.rs │ └── parser_tests.rs ├── flake.lock ├── flake.nix ├── justfile ├── test-cases-unsupported ├── ParserEntryTypes.Custom.beancount ├── ParserEntryTypes.Custom.txtpb ├── ParserOptions.UnaryOption.beancount └── ParserOptions.UnaryOption.txtpb └── test-cases ├── Arithmetic.NumberExprAdd.beancount ├── Arithmetic.NumberExprAdd.txtpb ├── Arithmetic.NumberExprDifferentPlaces.beancount ├── Arithmetic.NumberExprDifferentPlaces.txtpb ├── Arithmetic.NumberExprDifferentPlaces2.beancount ├── Arithmetic.NumberExprDifferentPlaces2.txtpb ├── Arithmetic.NumberExprDivide.beancount ├── Arithmetic.NumberExprDivide.txtpb ├── Arithmetic.NumberExprGroups.beancount ├── Arithmetic.NumberExprGroups.txtpb ├── Arithmetic.NumberExprMultiply.beancount ├── Arithmetic.NumberExprMultiply.txtpb ├── Arithmetic.NumberExprNegative.beancount ├── Arithmetic.NumberExprNegative.txtpb ├── Arithmetic.NumberExprPositive.beancount ├── Arithmetic.NumberExprPositive.txtpb ├── Arithmetic.NumberExprPrecedence.beancount ├── Arithmetic.NumberExprPrecedence.txtpb ├── Arithmetic.NumberExprSubtract.beancount ├── Arithmetic.NumberExprSubtract.txtpb ├── Balance.TotalCost.beancount ├── Balance.TotalCost.txtpb ├── Balance.TotalPrice.beancount ├── Balance.TotalPrice.txtpb ├── Comment.CommentAfterPostings.beancount ├── Comment.CommentAfterPostings.txtpb ├── Comment.CommentAfterTransaction.beancount ├── Comment.CommentAfterTransaction.txtpb ├── Comment.CommentAfterTransactionStart.beancount ├── Comment.CommentAfterTransactionStart.txtpb ├── Comment.CommentBeforeTransaction.beancount ├── Comment.CommentBeforeTransaction.txtpb ├── Comment.CommentBetweenPostings.beancount ├── Comment.CommentBetweenPostings.txtpb ├── Currencies.DifferentCostAndPriceCurrency.beancount ├── Currencies.DifferentCostAndPriceCurrency.txtpb ├── Currencies.ParseCurrencies.beancount ├── Currencies.ParseCurrencies.txtpb ├── DeprecatedOptions.DeprecatedOption.beancount ├── DeprecatedOptions.DeprecatedOption.txtpb ├── DeprecatedOptions.DeprecatedPlugin.beancount ├── DeprecatedOptions.DeprecatedPlugin.txtpb ├── DisplayContextOptions.RenderCommasError.beancount ├── DisplayContextOptions.RenderCommasError.txtpb ├── DisplayContextOptions.RenderCommasNo.beancount ├── DisplayContextOptions.RenderCommasNo.txtpb ├── DisplayContextOptions.RenderCommasYes.beancount ├── DisplayContextOptions.RenderCommasYes.txtpb ├── DisplayContextOptions.RenderCommasYes2.beancount ├── DisplayContextOptions.RenderCommasYes2.txtpb ├── Document.DocumentLinks.beancount ├── Document.DocumentLinks.txtpb ├── Document.DocumentNoTagsLinks.beancount ├── Document.DocumentNoTagsLinks.txtpb ├── Document.DocumentTags.beancount ├── Document.DocumentTags.txtpb ├── Expressions.ExplicitPrecision.beancount ├── Expressions.ExplicitPrecision.txtpb ├── Expressions.ExplicitPrecision2.beancount ├── Expressions.ExplicitPrecision2.txtpb ├── IncompleteInputs.CostAverage.beancount ├── IncompleteInputs.CostAverage.txtpb ├── IncompleteInputs.CostAverageMissingBasis.beancount ├── IncompleteInputs.CostAverageMissingBasis.txtpb ├── IncompleteInputs.CostAverageWithOther.beancount ├── IncompleteInputs.CostAverageWithOther.txtpb ├── IncompleteInputs.CostEmpty.beancount ├── IncompleteInputs.CostEmpty.txtpb ├── IncompleteInputs.CostEmptyWithOther.beancount ├── IncompleteInputs.CostEmptyWithOther.txtpb ├── IncompleteInputs.CostFull.beancount ├── IncompleteInputs.CostFull.txtpb ├── IncompleteInputs.CostMissingBasis.beancount ├── IncompleteInputs.CostMissingBasis.txtpb ├── IncompleteInputs.CostMissingCurrency.beancount ├── IncompleteInputs.CostMissingCurrency.txtpb ├── IncompleteInputs.CostMissingNumberPer.beancount ├── IncompleteInputs.CostMissingNumberPer.txtpb ├── IncompleteInputs.CostMissingNumberTotal.beancount ├── IncompleteInputs.CostMissingNumberTotal.txtpb ├── IncompleteInputs.CostMissingNumbers.beancount ├── IncompleteInputs.CostMissingNumbers.txtpb ├── IncompleteInputs.CostNoNumberTotal.beancount ├── IncompleteInputs.CostNoNumberTotal.txtpb ├── IncompleteInputs.PriceMissing.beancount ├── IncompleteInputs.PriceMissing.txtpb ├── IncompleteInputs.PriceMissingCurrency.beancount ├── IncompleteInputs.PriceMissingCurrency.txtpb ├── IncompleteInputs.PriceMissingNumber.beancount ├── IncompleteInputs.PriceMissingNumber.txtpb ├── IncompleteInputs.PriceNone.beancount ├── IncompleteInputs.PriceNone.txtpb ├── IncompleteInputs.UnitsFull.beancount ├── IncompleteInputs.UnitsFull.txtpb ├── IncompleteInputs.UnitsMissing.beancount ├── IncompleteInputs.UnitsMissing.txtpb ├── IncompleteInputs.UnitsMissingCurrency.beancount ├── IncompleteInputs.UnitsMissingCurrency.txtpb ├── IncompleteInputs.UnitsMissingCurrencyWithCost.beancount ├── IncompleteInputs.UnitsMissingCurrencyWithCost.txtpb ├── IncompleteInputs.UnitsMissingCurrencyWithPrice.beancount ├── IncompleteInputs.UnitsMissingCurrencyWithPrice.txtpb ├── IncompleteInputs.UnitsMissingNumber.beancount ├── IncompleteInputs.UnitsMissingNumber.txtpb ├── IncompleteInputs.UnitsMissingNumberWithCost.beancount ├── IncompleteInputs.UnitsMissingNumberWithCost.txtpb ├── IncompleteInputs.UnitsMissingNumberWithPrice.beancount ├── IncompleteInputs.UnitsMissingNumberWithPrice.txtpb ├── IncompleteInputs.UnitsMissingWithCost.beancount ├── IncompleteInputs.UnitsMissingWithCost.txtpb ├── IncompleteInputs.UnitsMissingWithPrice.beancount ├── IncompleteInputs.UnitsMissingWithPrice.txtpb ├── LexerAndParserErrors.GrammarExceptionsAmount.beancount ├── LexerAndParserErrors.GrammarExceptionsAmount.txtpb ├── LexerAndParserErrors.GrammarExceptionsBalance.beancount ├── LexerAndParserErrors.GrammarExceptionsBalance.txtpb ├── LexerAndParserErrors.GrammarExceptionsClose.beancount ├── LexerAndParserErrors.GrammarExceptionsClose.txtpb ├── LexerAndParserErrors.GrammarExceptionsCommodity.beancount ├── LexerAndParserErrors.GrammarExceptionsCommodity.txtpb ├── LexerAndParserErrors.GrammarExceptionsCompoundAmount.beancount ├── LexerAndParserErrors.GrammarExceptionsCompoundAmount.txtpb ├── LexerAndParserErrors.GrammarExceptionsDocument.beancount ├── LexerAndParserErrors.GrammarExceptionsDocument.txtpb ├── LexerAndParserErrors.GrammarExceptionsEvent.beancount ├── LexerAndParserErrors.GrammarExceptionsEvent.txtpb ├── LexerAndParserErrors.GrammarExceptionsInclude.beancount ├── LexerAndParserErrors.GrammarExceptionsInclude.txtpb ├── LexerAndParserErrors.GrammarExceptionsInclude └── Included.beancount ├── LexerAndParserErrors.GrammarExceptionsKeyValue.beancount ├── LexerAndParserErrors.GrammarExceptionsKeyValue.txtpb ├── LexerAndParserErrors.GrammarExceptionsLotCostDate.beancount ├── LexerAndParserErrors.GrammarExceptionsLotCostDate.txtpb ├── LexerAndParserErrors.GrammarExceptionsNote.beancount ├── LexerAndParserErrors.GrammarExceptionsNote.txtpb ├── LexerAndParserErrors.GrammarExceptionsOpen.beancount ├── LexerAndParserErrors.GrammarExceptionsOpen.txtpb ├── LexerAndParserErrors.GrammarExceptionsOption.beancount ├── LexerAndParserErrors.GrammarExceptionsOption.txtpb ├── LexerAndParserErrors.GrammarExceptionsPad.beancount ├── LexerAndParserErrors.GrammarExceptionsPad.txtpb ├── LexerAndParserErrors.GrammarExceptionsPlugin.beancount ├── LexerAndParserErrors.GrammarExceptionsPlugin.txtpb ├── LexerAndParserErrors.GrammarExceptionsPoptag.beancount ├── LexerAndParserErrors.GrammarExceptionsPoptag.txtpb ├── LexerAndParserErrors.GrammarExceptionsPosting.beancount ├── LexerAndParserErrors.GrammarExceptionsPosting.txtpb ├── LexerAndParserErrors.GrammarExceptionsPrice.beancount ├── LexerAndParserErrors.GrammarExceptionsPrice.txtpb ├── LexerAndParserErrors.GrammarExceptionsPushtag.beancount ├── LexerAndParserErrors.GrammarExceptionsPushtag.txtpb ├── LexerAndParserErrors.GrammarExceptionsTagLinkLink.beancount ├── LexerAndParserErrors.GrammarExceptionsTagLinkLink.txtpb ├── LexerAndParserErrors.GrammarExceptionsTagLinkNew.beancount ├── LexerAndParserErrors.GrammarExceptionsTagLinkNew.txtpb ├── LexerAndParserErrors.GrammarExceptionsTagLinkPipe.beancount ├── LexerAndParserErrors.GrammarExceptionsTagLinkPipe.txtpb ├── LexerAndParserErrors.GrammarExceptionsTagLinkTag.beancount ├── LexerAndParserErrors.GrammarExceptionsTagLinkTag.txtpb ├── LexerAndParserErrors.GrammarExceptionsTransaction.beancount ├── LexerAndParserErrors.GrammarExceptionsTransaction.txtpb ├── LexerAndParserErrors.GrammarSyntaxError.beancount ├── LexerAndParserErrors.GrammarSyntaxError.txtpb ├── LexerAndParserErrors.GrammarSyntaxErrorMultiple.beancount ├── LexerAndParserErrors.GrammarSyntaxErrorMultiple.txtpb ├── LexerAndParserErrors.GrammarSyntaxErrorRecovery.beancount ├── LexerAndParserErrors.GrammarSyntaxErrorRecovery.txtpb ├── LexerAndParserErrors.GrammarSyntaxErrorRecovery2.beancount ├── LexerAndParserErrors.GrammarSyntaxErrorRecovery2.txtpb ├── LexerAndParserErrors.LexerErrorsInPostings.beancount ├── LexerAndParserErrors.LexerErrorsInPostings.txtpb ├── LexerAndParserErrors.LexerException.beancount ├── LexerAndParserErrors.LexerException.txtpb ├── LexerAndParserErrors.LexerExceptionRecovery.beancount ├── LexerAndParserErrors.LexerExceptionRecovery.txtpb ├── LexerAndParserErrors.LexerInvalidToken.beancount ├── LexerAndParserErrors.LexerInvalidToken.txtpb ├── LexerAndParserErrors.LexerInvalidTokenRecovery.beancount ├── LexerAndParserErrors.LexerInvalidTokenRecovery.txtpb ├── LexerAndParserErrors.ParsingErrorAtRoot.beancount ├── LexerAndParserErrors.ParsingErrorAtRoot.txtpb ├── MetaData.MetadataDataTypes.beancount ├── MetaData.MetadataDataTypes.txtpb ├── MetaData.MetadataEmpty.beancount ├── MetaData.MetadataEmpty.txtpb ├── MetaData.MetadataKeySyntax.beancount ├── MetaData.MetadataKeySyntax.txtpb ├── MetaData.MetadataOther.beancount ├── MetaData.MetadataOther.txtpb ├── MetaData.MetadataTransactionBegin.beancount ├── MetaData.MetadataTransactionBegin.txtpb ├── MetaData.MetadataTransactionEnd.beancount ├── MetaData.MetadataTransactionEnd.txtpb ├── MetaData.MetadataTransactionIndented.beancount ├── MetaData.MetadataTransactionIndented.txtpb ├── MetaData.MetadataTransactionMany.beancount ├── MetaData.MetadataTransactionMany.txtpb ├── MetaData.MetadataTransactionMiddle.beancount ├── MetaData.MetadataTransactionMiddle.txtpb ├── MetaData.MetadataTransactionRepeated.beancount ├── MetaData.MetadataTransactionRepeated.txtpb ├── MetaData.MetadataTransactionRepeated2.beancount ├── MetaData.MetadataTransactionRepeated2.txtpb ├── Misc.CommentInPostings.beancount ├── Misc.CommentInPostings.txtpb ├── Misc.CommentInPostingsInvalid.beancount ├── Misc.CommentInPostingsInvalid.txtpb ├── MiscOptions.PluginProcessingModeDefault.beancount ├── MiscOptions.PluginProcessingModeDefault.txtpb ├── MiscOptions.PluginProcessingModeInvalid.beancount ├── MiscOptions.PluginProcessingModeInvalid.txtpb ├── MiscOptions.PluginProcessingModeRaw.beancount ├── MiscOptions.PluginProcessingModeRaw.txtpb ├── MultipleLines.MultilineNarration.beancount ├── MultipleLines.MultilineNarration.txtpb ├── ParseLots.CostAmount.beancount ├── ParseLots.CostAmount.txtpb ├── ParseLots.CostBothCosts.beancount ├── ParseLots.CostBothCosts.txtpb ├── ParseLots.CostDate.beancount ├── ParseLots.CostDate.txtpb ├── ParseLots.CostEmpty.beancount ├── ParseLots.CostEmpty.txtpb ├── ParseLots.CostEmptyComponents.beancount ├── ParseLots.CostEmptyComponents.txtpb ├── ParseLots.CostLabel.beancount ├── ParseLots.CostLabel.txtpb ├── ParseLots.CostMerge.beancount ├── ParseLots.CostMerge.txtpb ├── ParseLots.CostNone.beancount ├── ParseLots.CostNone.txtpb ├── ParseLots.CostRepeated.beancount ├── ParseLots.CostRepeated.txtpb ├── ParseLots.CostRepeatedDate.beancount ├── ParseLots.CostRepeatedDate.txtpb ├── ParseLots.CostRepeatedLabel.beancount ├── ParseLots.CostRepeatedLabel.txtpb ├── ParseLots.CostRepeatedMerge.beancount ├── ParseLots.CostRepeatedMerge.txtpb ├── ParseLots.CostThreeComponents.beancount ├── ParseLots.CostThreeComponents.txtpb ├── ParseLots.CostTotalCostOnly.beancount ├── ParseLots.CostTotalCostOnly.txtpb ├── ParseLots.CostTotalEmptyTotal.beancount ├── ParseLots.CostTotalEmptyTotal.txtpb ├── ParseLots.CostTotalJustCurrency.beancount ├── ParseLots.CostTotalJustCurrency.txtpb ├── ParseLots.CostTwoComponents.beancount ├── ParseLots.CostTwoComponents.txtpb ├── ParseLots.CostWithSlashes.beancount ├── ParseLots.CostWithSlashes.txtpb ├── Parser.BasicTesting.beancount ├── Parser.BasicTesting.txtpb ├── ParserComplete.Comment.beancount ├── ParserComplete.Comment.txtpb ├── ParserComplete.CommentEOF.beancount ├── ParserComplete.CommentEOF.txtpb ├── ParserComplete.Empty1.beancount ├── ParserComplete.Empty1.txtpb ├── ParserComplete.Empty2.beancount ├── ParserComplete.Empty2.txtpb ├── ParserComplete.ExtraWhitespaceComment.beancount ├── ParserComplete.ExtraWhitespaceComment.txtpb ├── ParserComplete.ExtraWhitespaceCommentIndented.beancount ├── ParserComplete.ExtraWhitespaceCommentIndented.txtpb ├── ParserComplete.ExtraWhitespaceNote.beancount ├── ParserComplete.ExtraWhitespaceNote.txtpb ├── ParserComplete.ExtraWhitespaceTransaction.beancount ├── ParserComplete.ExtraWhitespaceTransaction.txtpb ├── ParserComplete.IndentEOF.beancount ├── ParserComplete.IndentEOF.txtpb ├── ParserComplete.NoEmptyLines.beancount ├── ParserComplete.NoEmptyLines.txtpb ├── ParserComplete.TransactionImbalanceFromSinglePosting.beancount ├── ParserComplete.TransactionImbalanceFromSinglePosting.txtpb ├── ParserComplete.TransactionSinglePostingAtZero.beancount ├── ParserComplete.TransactionSinglePostingAtZero.txtpb ├── ParserEntryTypes.Balance.beancount ├── ParserEntryTypes.Balance.txtpb ├── ParserEntryTypes.BalanceWithCost.beancount ├── ParserEntryTypes.BalanceWithCost.txtpb ├── ParserEntryTypes.Close.beancount ├── ParserEntryTypes.Close.txtpb ├── ParserEntryTypes.Commodity.beancount ├── ParserEntryTypes.Commodity.txtpb ├── ParserEntryTypes.Document.beancount ├── ParserEntryTypes.Document.txtpb ├── ParserEntryTypes.Event.beancount ├── ParserEntryTypes.Event.txtpb ├── ParserEntryTypes.Note.beancount ├── ParserEntryTypes.Note.txtpb ├── ParserEntryTypes.Open1.beancount ├── ParserEntryTypes.Open1.txtpb ├── ParserEntryTypes.Open2.beancount ├── ParserEntryTypes.Open2.txtpb ├── ParserEntryTypes.Open3.beancount ├── ParserEntryTypes.Open3.txtpb ├── ParserEntryTypes.Open4.beancount ├── ParserEntryTypes.Open4.txtpb ├── ParserEntryTypes.Open5.beancount ├── ParserEntryTypes.Open5.txtpb ├── ParserEntryTypes.Pad.beancount ├── ParserEntryTypes.Pad.txtpb ├── ParserEntryTypes.Price.beancount ├── ParserEntryTypes.Price.txtpb ├── ParserEntryTypes.Query.beancount ├── ParserEntryTypes.Query.txtpb ├── ParserEntryTypes.TransactionOneString.beancount ├── ParserEntryTypes.TransactionOneString.txtpb ├── ParserEntryTypes.TransactionThreeStrings.beancount ├── ParserEntryTypes.TransactionThreeStrings.txtpb ├── ParserEntryTypes.TransactionTwoStrings.beancount ├── ParserEntryTypes.TransactionTwoStrings.txtpb ├── ParserEntryTypes.TransactionWithTxnKeyword.beancount ├── ParserEntryTypes.TransactionWithTxnKeyword.txtpb ├── ParserInclude.IncludeAbsolute.beancount ├── ParserInclude.IncludeAbsolute.txtpb ├── ParserInclude.IncludeCycle.beancount ├── ParserInclude.IncludeCycle.txtpb ├── ParserInclude.IncludeCycle └── Included1.beancount ├── ParserInclude.IncludeDuplicate.beancount ├── ParserInclude.IncludeDuplicate.txtpb ├── ParserInclude.IncludeDuplicate └── Included1.beancount ├── ParserInclude.IncludeRelative.beancount ├── ParserInclude.IncludeRelative.txtpb ├── ParserInclude.IncludeRelative ├── Included1.beancount └── Included2.beancount ├── ParserInclude.IncludeRelativeFromString.beancount ├── ParserInclude.IncludeRelativeFromString.txtpb ├── ParserLinks.ParseLinks.beancount ├── ParserLinks.ParseLinks.txtpb ├── ParserOptions.InvalidAccountNames.beancount ├── ParserOptions.InvalidAccountNames.txtpb ├── ParserOptions.InvalidOption.beancount ├── ParserOptions.InvalidOption.txtpb ├── ParserOptions.LegacyTranslations.beancount ├── ParserOptions.LegacyTranslations.txtpb ├── ParserOptions.OptionListValue.beancount ├── ParserOptions.OptionListValue.txtpb ├── ParserOptions.OptionSingleValue.beancount ├── ParserOptions.OptionSingleValue.txtpb ├── ParserOptions.ReadonlyOption.beancount ├── ParserOptions.ReadonlyOption.txtpb ├── ParserOptions.ToleranceMapValue.beancount ├── ParserOptions.ToleranceMapValue.txtpb ├── ParserPlugin.Plugin.beancount ├── ParserPlugin.Plugin.txtpb ├── ParserPlugin.PluginAsOption.beancount ├── ParserPlugin.PluginAsOption.txtpb ├── ParserPlugin.PluginWithConfig.beancount ├── ParserPlugin.PluginWithConfig.txtpb ├── PushPopMeta.PushmetaForgotten.beancount ├── PushPopMeta.PushmetaForgotten.txtpb ├── PushPopMeta.PushmetaInvalidPop.beancount ├── PushPopMeta.PushmetaInvalidPop.txtpb ├── PushPopMeta.PushmetaNormal.beancount ├── PushPopMeta.PushmetaNormal.txtpb ├── PushPopMeta.PushmetaOverride.beancount ├── PushPopMeta.PushmetaOverride.txtpb ├── PushPopMeta.PushmetaShadow.beancount ├── PushPopMeta.PushmetaShadow.txtpb ├── PushPopTag.Multiple.beancount ├── PushPopTag.Multiple.txtpb ├── PushPopTag.PopInvalidTag.beancount ├── PushPopTag.PopInvalidTag.txtpb ├── PushPopTag.TagLeftUnclosed.beancount ├── PushPopTag.TagLeftUnclosed.txtpb ├── SyntaxErrors.ErrorInPosting.beancount ├── SyntaxErrors.ErrorInPosting.txtpb ├── SyntaxErrors.ErrorInTransactionLine.beancount ├── SyntaxErrors.ErrorInTransactionLine.txtpb ├── SyntaxErrors.NoFinalNewline.beancount ├── SyntaxErrors.NoFinalNewline.txtpb ├── SyntaxErrors.SingleErrorTokenAtTopLevel.beancount ├── SyntaxErrors.SingleErrorTokenAtTopLevel.txtpb ├── TotalsAndSigns.CostNegative.beancount ├── TotalsAndSigns.CostNegative.txtpb ├── TotalsAndSigns.PriceNegative.beancount ├── TotalsAndSigns.PriceNegative.txtpb ├── TotalsAndSigns.TotalCost.beancount ├── TotalsAndSigns.TotalCost.txtpb ├── TotalsAndSigns.TotalCostInvalid.beancount ├── TotalsAndSigns.TotalCostInvalid.txtpb ├── TotalsAndSigns.TotalCostNegative.beancount ├── TotalsAndSigns.TotalCostNegative.txtpb ├── TotalsAndSigns.TotalPriceInverted.beancount ├── TotalsAndSigns.TotalPriceInverted.txtpb ├── TotalsAndSigns.TotalPriceNegative.beancount ├── TotalsAndSigns.TotalPriceNegative.txtpb ├── TotalsAndSigns.TotalPricePositive.beancount ├── TotalsAndSigns.TotalPricePositive.txtpb ├── TotalsAndSigns.TotalPriceWithMissing.beancount ├── TotalsAndSigns.TotalPriceWithMissing.txtpb ├── TotalsAndSigns.TotalPriceWithMissing2.beancount ├── TotalsAndSigns.TotalPriceWithMissing2.txtpb ├── TotalsAndSigns.ZeroAmount.beancount ├── TotalsAndSigns.ZeroAmount.txtpb ├── TotalsAndSigns.ZeroCost.beancount ├── TotalsAndSigns.ZeroCost.txtpb ├── Transactions.BlankLineNotAllowed.beancount ├── Transactions.BlankLineNotAllowed.txtpb ├── Transactions.BlankLineWithSpacesNotAllowed.beancount ├── Transactions.BlankLineWithSpacesNotAllowed.txtpb ├── Transactions.EmptyNarration.beancount ├── Transactions.EmptyNarration.txtpb ├── Transactions.Imbalance.beancount ├── Transactions.Imbalance.txtpb ├── Transactions.LinkAndThenTag.beancount ├── Transactions.LinkAndThenTag.txtpb ├── Transactions.MultipleTagsLinksOnMetadataLine.beancount ├── Transactions.MultipleTagsLinksOnMetadataLine.txtpb ├── Transactions.NoNarration.beancount ├── Transactions.NoNarration.txtpb ├── Transactions.NoPostings.beancount ├── Transactions.NoPostings.txtpb ├── Transactions.PayeeNoNarration.beancount ├── Transactions.PayeeNoNarration.txtpb ├── Transactions.Simple1.beancount ├── Transactions.Simple1.txtpb ├── Transactions.Simple2.beancount ├── Transactions.Simple2.txtpb ├── Transactions.TagThenLink.beancount ├── Transactions.TagThenLink.txtpb ├── Transactions.TagsAfterFirstLine.beancount ├── Transactions.TagsAfterFirstLine.txtpb ├── Transactions.TagsAfterFirstPosting.beancount ├── Transactions.TagsAfterFirstPosting.txtpb ├── Transactions.TooManyStrings.beancount ├── Transactions.TooManyStrings.txtpb ├── Transactions.ZeroCosts.beancount ├── Transactions.ZeroCosts.txtpb ├── Transactions.ZeroPrices.beancount ├── Transactions.ZeroPrices.txtpb ├── Transactions.ZeroUnits.beancount ├── Transactions.ZeroUnits.txtpb ├── Whitespace.IndentError0.beancount ├── Whitespace.IndentError0.txtpb ├── Whitespace.IndentError1.beancount └── Whitespace.IndentError1.txtpb /.envrc: -------------------------------------------------------------------------------- 1 | use flake 2 | -------------------------------------------------------------------------------- /.github/workflows/test-suite.yml: -------------------------------------------------------------------------------- 1 | name: test suite 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | branches: 8 | - main 9 | 10 | jobs: 11 | run-tests: 12 | name: Run Tests 13 | runs-on: ubuntu-24.04 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v4 17 | - name: Install Rust Toolchain 18 | uses: dtolnay/rust-toolchain@stable 19 | - name: Run Tests 20 | run: | 21 | cargo test 22 | 23 | check-nix-flake: 24 | name: Check Nix Flake 25 | runs-on: ubuntu-latest 26 | steps: 27 | - name: Checkout 28 | uses: actions/checkout@v4 29 | - name: Install Nix 30 | uses: cachix/install-nix-action@v30 31 | - name: Check Nix Flake 32 | run: | 33 | nix flake check 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.direnv/ 2 | /target/ 3 | /flamegraph.svg 4 | /perf.data* 5 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | resolver = "2" 3 | members = ["beancount-parser-lima", "beancount-parser-lima-python"] 4 | 5 | [workspace.dependencies] 6 | lazy_format = "2.0.3" 7 | rust_decimal = "1.36.0" 8 | strum = "0.27.1" 9 | strum_macros = "0.27.1" 10 | time = "0.3.37" 11 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Copyright 2023 Simon Guest 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2023 Simon Guest 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | beancount-parser-lima/README.md -------------------------------------------------------------------------------- /beancount-parser-lima-python/.gitignore: -------------------------------------------------------------------------------- 1 | /.venv/ 2 | -------------------------------------------------------------------------------- /beancount-parser-lima-python/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "beancount-parser-lima-python" 3 | version = "0.9.0-alpha.1" 4 | edition = "2021" 5 | license = "MIT OR Apache-2.0" 6 | description = "Python bindings for beancount-parser-lima" 7 | homepage = "https://github.com/tesujimath/beancount-parser-lima" 8 | repository = "https://github.com/tesujimath/beancount-parser-lima" 9 | 10 | [lib] 11 | name = "beancount_parser_lima" 12 | crate-type = ["cdylib"] 13 | doc = false 14 | 15 | [dependencies] 16 | beancount-parser-lima = { version = "0.9.0-alpha.1", path = "../beancount-parser-lima" } 17 | pyo3 = { version = "0.23.4", features = [ 18 | "extension-module", 19 | "rust_decimal", 20 | "py-clone", 21 | ] } 22 | string-interner = "0.19.0" 23 | lazy_format = { workspace = true } 24 | rust_decimal = { workspace = true } 25 | strum = { workspace = true } 26 | strum_macros = { workspace = true } 27 | time = { workspace = true } 28 | -------------------------------------------------------------------------------- /beancount-parser-lima-python/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["maturin>=1.4.0,<2"] 3 | build-backend = "maturin" 4 | 5 | [project] 6 | name = "beancount-parser-lima" 7 | version = "0.9.0-alpha.1" 8 | description = "Python bindings for beancount-parser-lima" 9 | readme = "README.md" 10 | requires-python = ">=3.7" 11 | license = "Either of Apache License v2.0 or MIT License at your option" 12 | classifiers = [ 13 | "Programming Language :: Rust", 14 | "Programming Language :: Python :: Implementation :: CPython", 15 | "Programming Language :: Python :: Implementation :: PyPy", 16 | ] 17 | 18 | [project.urls] 19 | Homepage = "https://github.com/tesujimath/beancount-parser-lima" 20 | Documentation = "https://github.com/tesujimath/beancount-parser-lima/blob/main/beancount-parser-lima-python/README.md" 21 | Repository = "https://github.com/tesujimath/beancount-parser-lima" 22 | Issues = "https://github.com/tesujimath/beancount-parser-lima/issues" 23 | 24 | [tool.pyright] 25 | venvPath = "." 26 | venv = ".venv" 27 | -------------------------------------------------------------------------------- /beancount-parser-lima-python/python-examples/parse.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import beancount_parser_lima as lima 5 | 6 | def main(): 7 | if len(sys.argv) != 2: 8 | sys.stderr.write("usage: parse.py \n") 9 | sys.exit(1) 10 | 11 | sources = lima.BeancountSources(sys.argv[1]) 12 | result = sources.parse() 13 | 14 | if isinstance(result, lima.ParseSuccess): 15 | for directive in result.directives: 16 | print(directive) 17 | print() 18 | print(result.options) 19 | 20 | print("Assets account is called '%s'" % result.options.account_name_by_type["Assets"]) 21 | 22 | for plugin in result.plugins: 23 | print("plugin \"%s\"%s" % (plugin.module_name, (" with config \"%s\"" % plugin.config) if plugin.config is not None else " without config")) 24 | # print(plugin) 25 | 26 | sources.write(result.warnings) 27 | else: 28 | sources.write(result.errors) 29 | sources.write(result.warnings) 30 | 31 | if __name__ == '__main__': 32 | main() 33 | -------------------------------------------------------------------------------- /beancount-parser-lima/build.rs: -------------------------------------------------------------------------------- 1 | use std::{env, path::PathBuf}; 2 | 3 | fn autogen_beancount_proto() { 4 | let cargo_manifest_dir: PathBuf = env::var("CARGO_MANIFEST_DIR").unwrap().into(); 5 | let proto_dir = cargo_manifest_dir.join("protobuf"); 6 | 7 | protobuf_codegen::Codegen::new() 8 | .pure() 9 | .include(proto_dir.as_path()) 10 | .inputs( 11 | [ 12 | "beancount/cparser/options.proto", 13 | "beancount/cparser/inter.proto", 14 | "beancount/cparser/ledger.proto", 15 | "beancount/ccore/date.proto", 16 | "beancount/ccore/precision.proto", 17 | "beancount/ccore/number.proto", 18 | "beancount/ccore/data.proto", 19 | ] 20 | .iter() 21 | .map(|input| proto_dir.join(input)), 22 | ) 23 | .cargo_out_dir("proto") 24 | .run_from_script(); 25 | } 26 | fn main() -> std::io::Result<()> { 27 | autogen_beancount_proto(); 28 | 29 | Ok(()) 30 | } 31 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/error-account-types.beancount: -------------------------------------------------------------------------------- 1 | option "name_assets" "Mine-All-Mine" 2 | 3 | ; this is an error, as we already used this name for Assets 4 | option "name_income" "Mine-All-Mine" 5 | 6 | ; this is also an error 7 | option "name_expenses" "Liabilities" 8 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/error-duplicate-options.beancount: -------------------------------------------------------------------------------- 1 | option "conversion_currency" "WOOHOO" 2 | option "inferred_tolerance_default" "*:0.01" 3 | option "inferred_tolerance_default" "NZD:0.02" 4 | option "inferred_tolerance_default" "GBP:0.03" 5 | option "inferred_tolerance_default" "*:0.02" 6 | option "documents" "/a" 7 | option "documents" "/a" 8 | option "operating_currency" "NZD" 9 | option "operating_currency" "NZD" 10 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/error-duplicates.beancount: -------------------------------------------------------------------------------- 1 | 2016-03-01 open Assets:Bank:Current 2 | 3 | 2016-03-01 open Expenses:Technology NZD NZD GBP 4 | 5 | 2023-05-29 * "JB HiFI" "" #technology #abc #technology #tag1 ^birthday ^mother ^birthday 6 | m1: "s1" 7 | m2: 101 8 | m1: NZD 9 | #tag1 10 | #tag2 11 | ^link1 12 | ^birthday 13 | Assets:Bank:Current -39.65 NZD 14 | Expenses:Technology 15 | 16 | 2023-05-30 * "New World Gardens North East Va ;" #essential 17 | Assets:Bank:Current -39.65 NZD 18 | ofxid: "0.12-3456-1234567-01.29May2023.1" ; from ledger-autosync 19 | Expenses:Groceries 20 | 21 | 2023-05-30 * "The Innocuous Company ;" 22 | Assets:Bank:Current -10.50 NZD 23 | Expenses:Technology 24 | 25 | pushtag #essential 26 | 27 | pushmeta importance: "1" 28 | 29 | 2023-05-30 * "New World Gardens North East Va ;" #essential 30 | importance: "2" 31 | Assets:Bank:Current -39.65 NZD 32 | ofxid: "0.12-3456-1234567-01.29May2023.1" ; from ledger-autosync 33 | Expenses:Groceries 34 | 35 | popmeta importance: 36 | 37 | poptag #essential 38 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/error-include-cycle.beancount: -------------------------------------------------------------------------------- 1 | ; an example Beancount file 2 | 3 | 1970-01-01 commodity NZD 4 | ; ; New Zealand Dollar 5 | 6 | 2016-03-01 open Assets:Bank:Current 7 | ; check commodity == "NZD" 8 | 9 | 2016-03-01 open Expenses:Groceries 10 | ; check commodity == "NZD" 11 | 12 | 2016-03-01 open Expenses:Entertainment:Drinks-and-snacks 13 | ; check commodity == "NZD" 14 | 15 | 2023-05-29 * "New World Gardens North East Va ;" 16 | Assets:Bank:Current -39.65X NZD 17 | ofxid: "0.12-3456-1234567-01.29May2023.1" ; from ledger-autosync 18 | Expenses:Groceries 19 | 20 | include "error-include-cycle/included.beancount" 21 | 22 | 2023-05-31 * "EMERSON S TAPROOM DUNEDIN ;" 23 | ; indented comment 24 | Assets:Bank:Current -25.00 NZD 25 | ofxid: "0.12-3456-1234567-01.31May2023.3" 26 | Expenses:Entertainment:Drinks-and-snacks 27 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/error-include-cycle/included.beancount: -------------------------------------------------------------------------------- 1 | 2023-05-30 * "The Craic Irish Tavern ;" 2 | Assets:Bank:Current -22.50Y NZD 3 | Expenses:Entertainment:Drinks-and-snacks 4 | 5 | include "../error-include-cycle.beancount" 6 | 7 | 2023-05-30 * "New World ;" 8 | Assets:Bank:Current -4.90 NZD 9 | Expenses:Groceries 10 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/error-include-duplicate.beancount: -------------------------------------------------------------------------------- 1 | ; an example Beancount file 2 | 3 | 2023-05-29 * "New World Gardens North East Va ;" 4 | Assets:Bank:Current -39.65 NZD 5 | ofxid: "0.12-3456-1234567-01.29May2023.1" ; from ledger-autosync 6 | Expenses:Groceries 7 | 8 | pushtag #included 9 | 10 | include "error-include-duplicate/included.beancount" 11 | 12 | poptag #included 13 | 14 | 2023-05-31 * "EMERSON S TAPROOM DUNEDIN ;" 15 | ; indented comment 16 | Assets:Bank:Current -25.00 NZD 17 | ofxid: "0.12-3456-1234567-01.31May2023.3" 18 | Expenses:Entertainment:Drinks-and-snacks 19 | 20 | pushtag #duplicate-include 21 | 22 | include "error-include-duplicate/included.beancount" 23 | 24 | poptag #duplicate-include 25 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/error-include-duplicate/included.beancount: -------------------------------------------------------------------------------- 1 | 2023-06-01 * "Inclusion is everything" 2 | Assets:Bank:Current -5.65 NZD 3 | Expenses:Groceries 4 | 5 | 2023-05-31 * "Include some beer" 6 | Assets:Bank:Current -15.30 NZD 7 | Expenses:Entertainment:Drinks-and-snacks 8 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/error-include-no-such-file.beancount: -------------------------------------------------------------------------------- 1 | ; an example Beancount file 2 | 3 | 2023-05-29 * "New World Gardens North East Va ;" 4 | Assets:Bank:Current -39.65 NZD 5 | ofxid: "0.12-3456-1234567-01.29May2023.1" ; from ledger-autosync 6 | Expenses:Groceries 7 | 8 | pushtag #included 9 | 10 | include "/this/file/does/not/exist.beancount" 11 | 12 | poptag #included 13 | 14 | 2023-05-31 * "EMERSON S TAPROOM DUNEDIN ;" 15 | ; indented comment 16 | Assets:Bank:Current -25.00 NZD 17 | ofxid: "0.12-3456-1234567-01.31May2023.3" 18 | Expenses:Entertainment:Drinks-and-snacks 19 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/error-includes.beancount: -------------------------------------------------------------------------------- 1 | ; an example Beancount file 2 | 3 | option "documents" "doc" 4 | 5 | 1970-01-01 commodity NZD 6 | ; ; New Zealand Dollar 7 | 8 | 2016-03-01 open Assets:Bank:Current 9 | ; check commodity == "NZD" 10 | 11 | 2016-03-01 open Expenses:Groceries 12 | ; check commodity == "NZD" 13 | 14 | 2016-03-01 open Expenses:Entertainment:Drinks-and-snacks 15 | ; check commodity == "NZD" 16 | 17 | 2023-05-29 * "New World Gardens North East Va ;" 18 | Assets:Bank:Current -39.65 NZD 19 | ofxid: "0.12-3456-1234567-01.29May2023.1" ; from ledger-autosync 20 | Expenses:Groceries 21 | 22 | pushtag #included 23 | 24 | include "error-includes/simple-errors.beancount" 25 | 26 | poptag #included 27 | 28 | 2023-05-31 * "EMERSON S TAPROOM DUNEDIN ;" 29 | ; indented comment 30 | Assets:Bank:Current -25.00 oops NZD 31 | ofxid: "0.12-3456-1234567-01.31May2023.3" 32 | Expenses:Entertainment:Drinks-and-snacks 33 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/error-includes/simple-errors.beancount: -------------------------------------------------------------------------------- 1 | 2023-06-01 * "Inclusion is everything" 2 | Assets:Bank:Current -5.65 freddo NZD 3 | Expenses:Groceries 4 | 5 | 2023-05-31 * "Include some beer" 6 | Assets:Bank:Current -15.30 billy NZD 7 | Expenses:Entertainment:Drinks-and-snacks 8 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/error-options.beancount: -------------------------------------------------------------------------------- 1 | option "account_previous_balances" "oopsy" 2 | 3 | option "flobado" "Bill and Ben" 4 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/error-parse.beancount: -------------------------------------------------------------------------------- 1 | ; an example Beancount file 2 | 3 | 1970-01-01 commodity NZD 4 | ; ; New Zealand Dollar 5 | 6 | 2016-03-01 open Assets:Bank:Current* 7 | ; check commodity == "NZD" 8 | 9 | 2016-03-01 open Expenses:Groceries! 10 | ; check commodity == "NZD" 11 | 12 | 2016-03-01 open Expenses:Entertainment:Drinks-and-snacks 13 | ; check commodity == "NZD" 14 | 15 | 2023-05-29 * "New World Gardens North East Va ;" 16 | Assets:Bank:Current -39.65 oops NZD 17 | ofxid*: "0.12-3456-1234567-01.29May2023.1" ; from ledger-autosync 18 | Expenses:Groceries 19 | 20 | 2023-05-31 * "EMERSON S TAPROOM DUNEDIN ;" 21 | ; indented comment 22 | Assets:Bank:Current -25.00 freddo NZD 23 | ofxid: "0.12-3456-1234567-01.31May2023.3" 24 | Expenses:Entertainment:Drinks-and-snacks 25 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/error-post-balancing.beancount: -------------------------------------------------------------------------------- 1 | ; exploring post balancing 2 | 3 | 1970-01-01 commodity NZD 4 | 5 | 1970-01-01 commodity GBP 6 | 7 | 2016-03-01 open Assets:Bank:Current NZD 8 | 9 | 2016-03-01 open Assets:Bank:Uk GBP 10 | 11 | 2016-03-01 open Expenses:Groceries NZD 12 | 13 | 2016-03-01 open Expenses:Beer NZD 14 | 15 | 2016-03-01 open Expenses:Luxuries NZD 16 | 17 | 2023-05-29 * "Pak'n'Save" 18 | 19 | 2023-05-29 * "Fresh Choice" 20 | Assets:Bank:Current -100 NZD 21 | Expenses:Groceries 10 NZD 22 | Expenses:Beer 20 NZD 23 | 24 | 2023-05-29 * "New World" 25 | Assets:Bank:Current -100 NZD 26 | Expenses:Groceries 27 | Expenses:Beer 28 | Expenses:Luxuries 60 NZD 29 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/error-validation.beancount: -------------------------------------------------------------------------------- 1 | ; an example Beancount file 2 | 3 | 1970-01-01 commodity NZD 4 | 5 | 2016-03-01 open Assets:Bank:Current NZD 6 | 7 | 2016-03-01 open Expenses:Fun NZD 8 | 9 | 2016-03-01 open Expenses:Entertainment:Drinks-and-snacks 10 | 11 | 2017-01-01 close Assets:Bank:Savings 12 | 13 | 2017-01-01 close Assets:Bank:Current 14 | 15 | 2017-03-01 open Assets:Bank:Current NZD 16 | 17 | 2017-04-01 close Assets:Bank:Current 18 | 19 | 2023-05-31 * "EMERSON S TAPROOM DUNEDIN ;" 20 | ; indented comment 21 | Assets:Bank:Current -75.00 NZD 22 | Expenses:Fun 50.00 NZD 23 | Expenses:Entertainment:Drinks-and-snacks 23.50 NZD ; oops 24 | 25 | 2022-01-30 * "Z Energy ;" 26 | Assets:Bank:Current -125.00 NZD 27 | Expenses:Car:Fuel 125.00 NZD 28 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/includes.beancount: -------------------------------------------------------------------------------- 1 | ; an example Beancount file 2 | 3 | option "documents" "doc" 4 | 5 | 1970-01-01 commodity NZD 6 | ; ; New Zealand Dollar 7 | 8 | 2016-03-01 open Assets:Bank:Current 9 | ; check commodity == "NZD" 10 | 11 | 2016-03-01 open Expenses:Groceries 12 | ; check commodity == "NZD" 13 | 14 | 2016-03-01 open Expenses:Entertainment:Drinks-and-snacks 15 | ; check commodity == "NZD" 16 | 17 | 2023-05-29 * "New World Gardens North East Va ;" 18 | Assets:Bank:Current -39.65 NZD 19 | ofxid: "0.12-3456-1234567-01.29May2023.1" ; from ledger-autosync 20 | Expenses:Groceries 21 | 22 | pushtag #included 23 | 24 | include "includes/included.beancount" 25 | 26 | poptag #included 27 | 28 | 2023-05-31 * "EMERSON S TAPROOM DUNEDIN ;" 29 | ; indented comment 30 | Assets:Bank:Current -25.00 NZD 31 | ofxid: "0.12-3456-1234567-01.31May2023.3" 32 | Expenses:Entertainment:Drinks-and-snacks 33 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/includes/included.beancount: -------------------------------------------------------------------------------- 1 | option "documents" "doc" 2 | 3 | option "documents" "/absolute/path/docs" 4 | 5 | 2023-05-30 * "The Craic Irish Tavern ;" 6 | Assets:Bank:Current -22.50 NZD 7 | Expenses:Entertainment:Drinks-and-snacks 8 | 9 | 2023-05-30 * "New World ;" 10 | Assets:Bank:Current -4.90 NZD 11 | Expenses:Groceries 12 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/long_string.beancount: -------------------------------------------------------------------------------- 1 | option "long_string_maxlines" "3" 2 | 3 | 1970-01-01 commodity NZD 4 | 5 | 2016-03-01 open Assets:Bank:Current NZD 6 | 7 | 2016-03-01 open Expenses:Groceries NZD 8 | 9 | 2023-05-29 * "New World Gardens North East Va ;" 10 | Assets:Bank:Current -35 NZD 11 | Expenses:Groceries 12 | 13 | 2023-05-30 * "New World Gardens North East Va 14 | with some extra commentary 15 | which is perfectly OK" 16 | Assets:Bank:Current -40 NZD 17 | Expenses:Groceries 18 | 19 | 2023-05-31 * "New World Gardens North East Va 20 | with some extra commentary 21 | which would have been OK 22 | except for this fourth line" 23 | Assets:Bank:Current -55 NZD 24 | Expenses:Groceries 25 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/options.beancount: -------------------------------------------------------------------------------- 1 | option "title" "A vacuous account" 2 | option "name_assets" "Mine-All-Mine" 3 | option "name_liabilities" "Watch-Out" 4 | option "name_equity" "Became-Mine" 5 | option "name_income" "Well-Deserved" 6 | option "name_expenses" "Painful" 7 | option "account_previous_balances" "Previous:Balances" 8 | option "account_previous_earnings" "Previous:Earnings" 9 | option "account_previous_conversions" "Previous:Conversions" 10 | option "account_current_earnings" "Current:Earnings" 11 | option "account_current_conversions" "Current:Conversions" 12 | option "account_unrealized_gains" "Unrealized:Gains" 13 | option "account_rounding" "Rug:Under" 14 | option "conversion_currency" "WOOHOO" 15 | option "inferred_tolerance_default" "*:0.01" 16 | option "inferred_tolerance_default" "NZD:0.02" 17 | option "inferred_tolerance_default" "GBP:0.03" 18 | option "inferred_tolerance_multiplier" "1.01" 19 | option "infer_tolerance_from_cost" "true" 20 | option "documents" "/a" 21 | option "documents" "/b" 22 | option "operating_currency" "NZD" 23 | option "operating_currency" "GBP" 24 | option "render_commas" "TRUE" 25 | option "long_string_maxlines" "10" 26 | option "booking_method" "STRICT_WITH_SIZE" 27 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/data/simple.beancount: -------------------------------------------------------------------------------- 1 | ; an example Beancount file 2 | 3 | 1970-01-01 commodity NZD 4 | ; ; New Zealand Dollar 5 | 6 | 2016-03-01 open Assets:Bank:Current NZD 7 | ; check commodity == "NZD" 8 | 9 | 2024-03-01 close Assets:Bank:Current 10 | 11 | ; TODO this should be an error, can only open an account once: 12 | 2025-03-01 open Assets:Bank:Current 13 | 14 | 15 | 2016-03-01 open Expenses:Groceries NZD 16 | ; check commodity == "NZD" 17 | 18 | 2016-03-01 open Expenses:Entertainment:Drinks-and-snacks 19 | ; check commodity == "NZD" 20 | 21 | 2023-05-29 * "New World Gardens North East Va ;" 22 | Assets:Bank:Current -39.65 NZD 23 | ofxid: "0.12-3456-1234567-01.29May2023.1" ; from ledger-autosync 24 | Expenses:Groceries 25 | 26 | 2023-05-31 * "EMERSON S TAPROOM DUNEDIN ;" 27 | ; indented comment 28 | Assets:Bank:Current -25.00 NZD 29 | ofxid: "0.12-3456-1234567-01.31May2023.3" 30 | Expenses:Entertainment:Drinks-and-snacks 31 | -------------------------------------------------------------------------------- /beancount-parser-lima/examples/images/beancount-parser-balancing-errors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tesujimath/beancount-parser-lima/f4190c7a910cf12080e46539a9f29d5903c4bff2/beancount-parser-lima/examples/images/beancount-parser-balancing-errors.png -------------------------------------------------------------------------------- /beancount-parser-lima/proptest-regressions/parser/types/tests.txt: -------------------------------------------------------------------------------- 1 | # Seeds for failure cases proptest has generated in the past. It is 2 | # automatically read and these particular cases re-run before any 3 | # novel cases are generated. 4 | # 5 | # It is recommended to check this file in to source control so that 6 | # everyone who runs the test benefits from these saved cases. 7 | cc 6566e5ff441551c79b9277170de3fba772e72dbcdeace1d1d9327b670930c5dd # shrinks to x1 = 0, x2 = 1, s1 = 0..0, s2 = 0..0 8 | -------------------------------------------------------------------------------- /beancount-parser-lima/protobuf/README.md: -------------------------------------------------------------------------------- 1 | # Beancount protobuf files 2 | 3 | These files were copied from the [main Beancount repo](https://github.com/beancount/beancount/blob/cpp/beancount/cparser/ledger.proto), 4 | and are licenced under GPLv2. 5 | -------------------------------------------------------------------------------- /beancount-parser-lima/protobuf/beancount/ccore/date.proto: -------------------------------------------------------------------------------- 1 | // -*- mode: protobuf -*- 2 | // 3 | // Representation of civil date. 4 | 5 | syntax = "proto2"; 6 | 7 | package beancount; 8 | 9 | // Civil dates. 10 | // See https://abseil.io/blog/20181010-civil-time. 11 | message Date { 12 | optional int32 year = 1; 13 | optional int32 month = 2; 14 | optional int32 day = 3; 15 | } 16 | -------------------------------------------------------------------------------- /beancount-parser-lima/protobuf/beancount/ccore/number.proto: -------------------------------------------------------------------------------- 1 | // Proto serialization for decimal numbers. 2 | // This is based on representing numbers from mpdecimal (IEEE 754). 3 | 4 | // TODO(blais): Change this to proto3 when it becomes possible to either (a) 5 | // enable --experimental_allow_proto3_optional by providing flags to the native 6 | // proto_library() rule (currently not possible AFAICT), or (b) it is supported 7 | // directly, and metadata can be used to enable it. In the meantime we use 8 | // proto2, because I really do want optionals with a presence field. 9 | syntax = "proto2"; 10 | 11 | package beancount; 12 | 13 | // Variant for number representation. 14 | message Number { 15 | // Exact string for the number, explicit and readable, requires conversion. 16 | optional string exact = 1; 17 | 18 | // Representation as `mpd_t`. 19 | optional Mpd mpd = 2; 20 | 21 | // Representation as `mpd_uint128_triple_t`. 22 | optional MpdTriple triple = 3; 23 | } 24 | 25 | // Representation of mpdecimal's `mpd_t` with serialized data block. 26 | message Mpd { 27 | required int32 flags = 1; 28 | required int32 exp = 2; 29 | required int32 digits = 3; 30 | required int32 len = 4; 31 | repeated uint32 data = 5 [packed=true]; 32 | } 33 | // Representation of mpdecimal's `mpd_uint128_triple_t`. 34 | message MpdTriple { 35 | required uint32 tag = 1; 36 | required uint32 sign = 2; 37 | required uint64 hi = 3; 38 | required uint64 lo = 4; 39 | required int64 exp = 5; 40 | } 41 | -------------------------------------------------------------------------------- /beancount-parser-lima/protobuf/beancount/ccore/precision.proto: -------------------------------------------------------------------------------- 1 | // -*- mode: protobuf -*- 2 | // 3 | // A schema for precision statistics and the display context. 4 | 5 | syntax = "proto2"; 6 | 7 | package beancount.precision; 8 | 9 | // Summarized precision statistics data. 10 | // This can be used to format numbers. 11 | message PrecisionStats { 12 | repeated Pair pairs = 1; 13 | } 14 | 15 | // Stats over a specific currency pair. 16 | message Pair { 17 | optional string quote = 1; 18 | optional string base = 2; 19 | optional bool has_sign = 3; 20 | optional int32 max_integer_digits = 4; 21 | optional int32 exponent_mode = 5; 22 | optional int32 exponent_max = 6; 23 | map exponents = 7; 24 | } 25 | -------------------------------------------------------------------------------- /beancount-parser-lima/protobuf/beancount/cparser/ledger.proto: -------------------------------------------------------------------------------- 1 | // -*- mode: protobuf -*- 2 | // 3 | // A schema for Beancount's parser output. This is the intermediate state of the 4 | // data, merely representing the production of the parser, before the subsequent 5 | // processing (booking) that will produce the finalized directives. 6 | // 7 | // The data structures seen here are not visible in the final output nor to the 8 | // regular plugins, which see the resolved ones produced after booking and 9 | // interpolation. 10 | 11 | syntax = "proto2"; 12 | 13 | package beancount.inter; 14 | 15 | import 'beancount/ccore/data.proto'; 16 | import 'beancount/cparser/options.proto'; 17 | 18 | // Container for all data produced by the parser, and the by Beancount in 19 | // general (after booking, interpolation, and plugins processing. 20 | message Ledger { 21 | // A list of directives, with ownership. 22 | repeated beancount.Directive directives = 1; 23 | 24 | // A list of errors encountered during parsing and processing. 25 | repeated beancount.Error errors = 2; 26 | 27 | // Parsed options. 28 | optional options.Options options = 3; 29 | 30 | // Processing details. 31 | optional options.ProcessingInfo info = 4; 32 | 33 | // NOTE(blais): the final balances accumulated from processing the Ledger could 34 | // be saved and produced in the output, so that booking on top of it is cheap 35 | // and fast. This would be useful for importers, for example. 36 | } 37 | -------------------------------------------------------------------------------- /beancount-parser-lima/tests/helpers/beancount.rs: -------------------------------------------------------------------------------- 1 | // auto-generated from Beancount protobuf schema and our own test schema 2 | include!(concat!(env!("OUT_DIR"), "/proto/mod.rs")); 3 | -------------------------------------------------------------------------------- /beancount-parser-lima/tests/parser_tests.rs: -------------------------------------------------------------------------------- 1 | use rstest::rstest; 2 | use std::path::PathBuf; 3 | 4 | #[rstest] 5 | fn test_parser(#[files("../test-cases/*.beancount")] path: PathBuf) { 6 | let test_name = path.file_stem().unwrap().to_string_lossy(); 7 | check_parse(test_name); 8 | } 9 | 10 | use helpers::check_parse; 11 | mod helpers; 12 | -------------------------------------------------------------------------------- /justfile: -------------------------------------------------------------------------------- 1 | build: 2 | cargo build 3 | 4 | test: 5 | cargo test 6 | 7 | build-image := "ghcr.io/pyo3/maturin" 8 | 9 | [working-directory: 'beancount-parser-lima-python'] 10 | build-python-wheel: 11 | docker run --rm -v $(pwd)/..:/io -w /io/beancount-parser-lima-python {{build-image}} build --release 12 | 13 | upload-testpypi: 14 | twine upload -r testpypi "target/wheels/$(ls -t target/wheels | head -1)" 15 | 16 | upload-pypi: 17 | twine upload "target/wheels/$(ls -t target/wheels | head -1)" 18 | 19 | clean: 20 | cargo clean 21 | docker rm {{build-image}} 22 | 23 | -------------------------------------------------------------------------------- /test-cases-unsupported/ParserEntryTypes.Custom.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 custom "budget" "weekly < 1000.00 USD" 2016-02-28 TRUE 43.03 USD 23 2 | -------------------------------------------------------------------------------- /test-cases-unsupported/ParserEntryTypes.Custom.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | custom { 4 | type: "budget" 5 | values { 6 | text: "weekly < 1000.00 USD" 7 | } 8 | values { 9 | date { year: 2016 month: 2 day: 28 } 10 | } 11 | values { 12 | boolean: true 13 | } 14 | values { 15 | number { exact: "43.03" } 16 | } 17 | values { 18 | currency: "USD" 19 | } 20 | values { 21 | number { exact: "23" } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test-cases-unsupported/ParserOptions.UnaryOption.beancount: -------------------------------------------------------------------------------- 1 | options "inferred_tolerance_default { key: 'USD' value: '0.00001' }" 2 | options "account_types { 3 | assets: 'Actifs' 4 | liabilities: 'Passifs' 5 | }" 6 | -------------------------------------------------------------------------------- /test-cases-unsupported/ParserOptions.UnaryOption.txtpb: -------------------------------------------------------------------------------- 1 | options { 2 | account_types { 3 | assets: 'Actifs' 4 | liabilities: 'Passifs' 5 | } 6 | inferred_tolerance_default { key: 'USD' value: '0.00001' } 7 | } 8 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprAdd.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Test" 2 | Assets:Something 12 + 3 USD 3 | Assets:Something 7.5 + 3.1 USD 4 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprAdd.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Test" 6 | postings { 7 | account: "Assets:Something" 8 | spec { 9 | units { number { exact: "15" } currency: "USD" } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Something" 14 | spec { 15 | units { number { exact: "10.6" } currency: "USD" } 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprDifferentPlaces.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Test" 2 | Assets:Something -(3 * 4) HOOL {120.01 * 2.1 USD} @ 134.02 * 2.1 USD 3 | Assets:Something 1000000 USD ;; No balance checks. 4 | 2014-01-01 balance Assets:Something 3 * 4 * 120.01 * 2.1 USD 5 | number: -(5662.23 + 22.3) 6 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprDifferentPlaces.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Test" 6 | postings { 7 | account: "Assets:Something" 8 | spec { 9 | units { number { exact: "-12" } currency: "HOOL" } 10 | # ANOMALY: Lima calculates the values of expressions using scaled decimals 11 | # which retain accuracy to the number of decimal places given. 12 | # So here it results in a rounded value of 252.02, rather than 252.021 13 | # See some discussion here: 14 | # https://beancount.github.io/docs/rounding_precision_in_beancount.html#automatically-inferring-tolerance 15 | cost { per_unit { number { exact: "252.02" } } currency: "USD" } 16 | price { number { exact: "281.44" } currency: "USD" } 17 | } 18 | } 19 | postings { 20 | account: "Assets:Something" 21 | spec { 22 | units { number { exact: "1000000" } currency: "USD" } 23 | } 24 | } 25 | } 26 | } 27 | directives { 28 | date { year: 2014 month: 1 day: 1 } 29 | meta { 30 | kv { key: "number" value { number { exact: "-5684.53" } } } 31 | } 32 | balance { 33 | account: "Assets:Something" 34 | # ANOMALY: as above 35 | amount { number { exact: "3024.25" } currency: "USD" } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprDifferentPlaces2.beancount: -------------------------------------------------------------------------------- 1 | ; ANOMALY: this is an additional Lima test to demonstrate how to force 2 | ; the precision of evaluation of an expression 3 | 2013-05-18 * "Test" 4 | Assets:Something -(3 * 4) HOOL {120.010 * 2.1 USD} @ 134.020 * 2.1 USD 5 | Assets:Something 1000000 USD ;; No balance checks. 6 | 2014-01-01 balance Assets:Something 3 * 4 * 120.010 * 2.1 USD 7 | number: -(5662.23 + 22.3) 8 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprDifferentPlaces2.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Test" 6 | postings { 7 | account: "Assets:Something" 8 | spec { 9 | units { number { exact: "-12" } currency: "HOOL" } 10 | # ANOMALY: Lima calculates the values of expressions using scaled decimals 11 | # which retain accuracy to the number of decimal places given. 12 | # So here it results in a rounded value of 252.02, rather than 252.021 13 | # See some discussion here: 14 | # https://beancount.github.io/docs/rounding_precision_in_beancount.html#automatically-inferring-tolerance 15 | cost { per_unit { number { exact: "252.021" } } currency: "USD" } 16 | price { number { exact: "281.442" } currency: "USD" } 17 | } 18 | } 19 | postings { 20 | account: "Assets:Something" 21 | spec { 22 | units { number { exact: "1000000" } currency: "USD" } 23 | } 24 | } 25 | } 26 | } 27 | directives { 28 | date { year: 2014 month: 1 day: 1 } 29 | meta { 30 | kv { key: "number" value { number { exact: "-5684.53" } } } 31 | } 32 | balance { 33 | account: "Assets:Something" 34 | amount { number { exact: "3024.252" } currency: "USD" } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprDivide.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Test" 2 | Assets:Something 12 / 3 USD 3 | Assets:Something 7.5 / 3 USD 4 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprDivide.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Test" 6 | postings { 7 | account: "Assets:Something" 8 | spec { 9 | units { number { exact: "4" } currency: "USD" } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Something" 14 | spec { 15 | units { number { exact: "2.5" } currency: "USD" } 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprGroups.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Test" 2 | Assets:Something (2 + -3) * 4 USD 3 | Assets:Something 2 * (2 + -3) USD 4 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprGroups.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Test" 6 | postings { 7 | account: "Assets:Something" 8 | spec { 9 | units { number { exact: "-4" } currency: "USD" } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Something" 14 | spec { 15 | units { number { exact: "-2" } currency: "USD" } 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprMultiply.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Test" 2 | Assets:Something 12 * 3 USD 3 | Assets:Something 7.5 * 3.1 USD 4 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprMultiply.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Test" 6 | postings { 7 | account: "Assets:Something" 8 | spec { 9 | units { number { exact: "36" } currency: "USD" } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Something" 14 | spec { 15 | # ANOMALY on precision as per Arithmetic.NumberExprDifferentPlaces 16 | # see discussion in that test 17 | units { number { exact: "23.3" } currency: "USD" } 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprNegative.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Test" 2 | Assets:Something -12 USD 3 | Assets:Something -7.5 USD 4 | Assets:Something - 7.5 USD 5 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprNegative.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Test" 6 | postings { 7 | account: "Assets:Something" 8 | spec { 9 | units { number { exact: "-12" } currency: "USD" } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Something" 14 | spec { 15 | units { number { exact: "-7.5" } currency: "USD" } 16 | } 17 | } 18 | postings { 19 | account: "Assets:Something" 20 | spec { 21 | units { number { exact: "-7.5" } currency: "USD" } 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprPositive.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Test" 2 | Assets:Something +12 USD 3 | Assets:Something -7.5 USD 4 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprPositive.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Test" 6 | postings { 7 | account: "Assets:Something" 8 | spec { 9 | units { number { exact: "12" } currency: "USD" } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Something" 14 | spec { 15 | units { number { exact: "-7.5" } currency: "USD" } 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprPrecedence.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Test" 2 | Assets:Something 2 * 3 + 4 USD 3 | Assets:Something 2 + 3 * 4 USD 4 | Assets:Something 2 + -3 * 4 USD 5 | Assets:Something (2 + -3) * 4 USD 6 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprPrecedence.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Test" 6 | postings { 7 | account: "Assets:Something" 8 | spec { 9 | units { number { exact: "10" } currency: "USD" } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Something" 14 | spec { 15 | units { number { exact: "14" } currency: "USD" } 16 | } 17 | } 18 | postings { 19 | account: "Assets:Something" 20 | spec { 21 | units { number { exact: "-10" } currency: "USD" } 22 | } 23 | } 24 | postings { 25 | account: "Assets:Something" 26 | spec { 27 | units { number { exact: "-4" } currency: "USD" } 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprSubtract.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Test" 2 | Assets:Something 12 - 3 USD 3 | Assets:Something 7.5 - 3.1 USD 4 | -------------------------------------------------------------------------------- /test-cases/Arithmetic.NumberExprSubtract.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Test" 6 | postings { 7 | account: "Assets:Something" 8 | spec { 9 | units { number { exact: "9" } currency: "USD" } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Something" 14 | spec { 15 | units { number { exact: "4.4" } currency: "USD" } 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/Balance.TotalCost.beancount: -------------------------------------------------------------------------------- 1 | ; ANOMALY: we use newstyle # for total, since 2 | ; {{ }} is unsupported in Lima parser 3 | 2013-05-18 * "" 4 | Assets:Investments:MSFT 10 MSFT {# 2,000 USD} 5 | Assets:Investments:Cash -20000 USD 6 | 7 | 2013-05-18 * "" 8 | Assets:Investments:MSFT 10 MSFT {# 2000 USD, 2014-02-25} 9 | Assets:Investments:Cash -20000 USD 10 | -------------------------------------------------------------------------------- /test-cases/Balance.TotalCost.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | # ANOMALY: Lima distinguishes empty string from no string 6 | narration: "" 7 | postings { 8 | account: "Assets:Investments:MSFT" 9 | spec { 10 | units { number { exact: "10" } currency: "MSFT" } 11 | cost { total { number { exact: "2000" } } currency: "USD" } 12 | } 13 | } 14 | postings { 15 | account: "Assets:Investments:Cash" 16 | spec { 17 | units { number { exact: "-20000" } currency: "USD" } 18 | } 19 | } 20 | } 21 | } 22 | directives { 23 | date { year: 2013 month: 5 day: 18 } 24 | transaction { 25 | flag: "*" 26 | # ANOMALY: Lima distinguishes empty string from no string 27 | narration: "" 28 | postings { 29 | account: "Assets:Investments:MSFT" 30 | spec { 31 | units { number { exact: "10" } currency: "MSFT" } 32 | cost { 33 | total { number { exact: "2000" } } 34 | currency: "USD" 35 | date { year: 2014 month: 2 day: 25 } 36 | } 37 | } 38 | } 39 | postings { 40 | account: "Assets:Investments:Cash" 41 | spec { units { number { exact: "-20000" } currency: "USD" } } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /test-cases/Balance.TotalPrice.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | Assets:Investments:MSFT 10 MSFT @@ 2000 USD 3 | Assets:Investments:Cash -20000 USD 4 | -------------------------------------------------------------------------------- /test-cases/Balance.TotalPrice.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | # ANOMALY: Lima distinguishes empty string from no string 6 | narration: "" 7 | postings { 8 | account: "Assets:Investments:MSFT" 9 | spec { 10 | units { number { exact: "10" } currency: "MSFT" } 11 | price { number { exact: "2000" } currency: "USD" is_total: true } 12 | } 13 | } 14 | postings { 15 | account: "Assets:Investments:Cash" 16 | spec { units { number { exact: "-20000" } currency: "USD" } } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/Comment.CommentAfterPostings.beancount: -------------------------------------------------------------------------------- 1 | 2015-06-07 * 2 | Assets:Cash 1 USD ; Hi 3 | Assets:Cash -1 USD 4 | -------------------------------------------------------------------------------- /test-cases/Comment.CommentAfterPostings.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2015 month: 6 day: 7 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Cash" 7 | spec { units { number { exact: "1" } currency: "USD" } } 8 | } 9 | postings { 10 | account: "Assets:Cash" 11 | spec { units { number { exact: "-1" } currency: "USD" } } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test-cases/Comment.CommentAfterTransaction.beancount: -------------------------------------------------------------------------------- 1 | 2015-06-07 * 2 | Assets:Cash 1 USD 3 | Assets:Cash -1 USD 4 | ; Hi 5 | -------------------------------------------------------------------------------- /test-cases/Comment.CommentAfterTransaction.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2015 month: 6 day: 7 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Cash" 7 | spec { units { number { exact: "1" } currency: "USD" } } 8 | } 9 | postings { 10 | account: "Assets:Cash" 11 | spec { units { number { exact: "-1" } currency: "USD" } } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test-cases/Comment.CommentAfterTransactionStart.beancount: -------------------------------------------------------------------------------- 1 | 2015-06-07 * ; Hi 2 | Assets:Cash 1 USD 3 | Assets:Cash -1 USD 4 | -------------------------------------------------------------------------------- /test-cases/Comment.CommentAfterTransactionStart.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2015 month: 6 day: 7 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Cash" 7 | spec { units { number { exact: "1" } currency: "USD" } } 8 | } 9 | postings { 10 | account: "Assets:Cash" 11 | spec { units { number { exact: "-1" } currency: "USD" } } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test-cases/Comment.CommentBeforeTransaction.beancount: -------------------------------------------------------------------------------- 1 | ; Hi 2 | 2015-06-07 * 3 | Assets:Cash 1 USD 4 | Assets:Cash -1 USD 5 | -------------------------------------------------------------------------------- /test-cases/Comment.CommentBeforeTransaction.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2015 month: 6 day: 7 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Cash" 7 | spec { units { number { exact: "1" } currency: "USD" } } 8 | } 9 | postings { 10 | account: "Assets:Cash" 11 | spec { units { number { exact: "-1" } currency: "USD" } } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test-cases/Comment.CommentBetweenPostings.beancount: -------------------------------------------------------------------------------- 1 | 2015-06-07 * 2 | Assets:Cash 1 USD 3 | ; Hi 4 | Assets:Cash -1 USD 5 | -------------------------------------------------------------------------------- /test-cases/Comment.CommentBetweenPostings.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2015 month: 6 day: 7 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Cash" 7 | spec { units { number { exact: "1" } currency: "USD" } } 8 | } 9 | postings { 10 | account: "Assets:Cash" 11 | spec { units { number { exact: "-1" } currency: "USD" } } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test-cases/Currencies.DifferentCostAndPriceCurrency.beancount: -------------------------------------------------------------------------------- 1 | 2018-03-21 * "Convert MR to KrisFlyer" 2 | Assets:Test -100 MR {0.0075 USD} @ 1 KRISFLYER 3 | Assets:Krisflyer 100 KRISFLYER 4 | -------------------------------------------------------------------------------- /test-cases/Currencies.DifferentCostAndPriceCurrency.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima parser doesn't check for matching currencies 2 | # Should be done in post-processing 3 | directives { 4 | date { year: 2018 month: 3 day: 21 } 5 | transaction { 6 | flag: "*" 7 | narration: "Convert MR to KrisFlyer" 8 | postings { 9 | account: "Assets:Test" 10 | spec { 11 | units { number { exact: "-100" } currency: "MR" } 12 | cost { per_unit { number { exact: "0.0075" } } currency: "USD" } 13 | price { number { exact: "1" } currency: "KRISFLYER" } 14 | } 15 | } 16 | postings { 17 | account: "Assets:Krisflyer" 18 | spec { units { number { exact: "100" } currency: "KRISFLYER" } } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test-cases/Currencies.ParseCurrencies.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-19 open Assets:Underscore DJ_EURO 2 | 2014-01-19 open Assets:Period DJ.EURO 3 | 2014-01-19 open Assets:Apostrophe DJ'EURO 4 | 2014-01-19 open Assets:Numbers EURO123 5 | 2014-01-19 open Assets:Futures /LOX21_211204_P100.25 6 | -------------------------------------------------------------------------------- /test-cases/Currencies.ParseCurrencies.txtpb: -------------------------------------------------------------------------------- 1 | directives { date { year: 2014 month: 1 day: 19 } 2 | open { account: "Assets:Underscore" currencies: "DJ_EURO" } } 3 | directives { date { year: 2014 month: 1 day: 19 } 4 | open { account: "Assets:Period" currencies: "DJ.EURO" } } 5 | directives { date { year: 2014 month: 1 day: 19 } 6 | open { account: "Assets:Apostrophe" currencies: "DJ\'EURO" } } 7 | directives { date { year: 2014 month: 1 day: 19 } 8 | open { account: "Assets:Numbers" currencies: "EURO123" } } 9 | directives { date { year: 2014 month: 1 day: 19 } 10 | open { account: "Assets:Futures" currencies: "/LOX21_211204_P100.25" } } 11 | -------------------------------------------------------------------------------- /test-cases/DeprecatedOptions.DeprecatedOption.beancount: -------------------------------------------------------------------------------- 1 | option "allow_pipe_separator" "TRUE" 2 | -------------------------------------------------------------------------------- /test-cases/DeprecatedOptions.DeprecatedOption.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "unknown option" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/DeprecatedOptions.DeprecatedPlugin.beancount: -------------------------------------------------------------------------------- 1 | option "plugin" "beancount.plugins.module_name" 2 | -------------------------------------------------------------------------------- /test-cases/DeprecatedOptions.DeprecatedPlugin.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "unknown option" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/DisplayContextOptions.RenderCommasError.beancount: -------------------------------------------------------------------------------- 1 | option "render_commas" "TRUE" 2 | -------------------------------------------------------------------------------- /test-cases/DisplayContextOptions.RenderCommasError.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima parses this successfully 2 | options { 3 | render_commas: true 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/DisplayContextOptions.RenderCommasNo.beancount: -------------------------------------------------------------------------------- 1 | option "render_commas" "0" 2 | -------------------------------------------------------------------------------- /test-cases/DisplayContextOptions.RenderCommasNo.txtpb: -------------------------------------------------------------------------------- 1 | options { 2 | render_commas: false 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/DisplayContextOptions.RenderCommasYes.beancount: -------------------------------------------------------------------------------- 1 | option "render_commas" "1" 2 | -------------------------------------------------------------------------------- /test-cases/DisplayContextOptions.RenderCommasYes.txtpb: -------------------------------------------------------------------------------- 1 | options { 2 | render_commas: true 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/DisplayContextOptions.RenderCommasYes2.beancount: -------------------------------------------------------------------------------- 1 | option "render_commas" "true" 2 | -------------------------------------------------------------------------------- /test-cases/DisplayContextOptions.RenderCommasYes2.txtpb: -------------------------------------------------------------------------------- 1 | options { 2 | render_commas: true 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/Document.DocumentLinks.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 document Assets:US:BestBank:Checking "/statement.pdf" ^something 2 | -------------------------------------------------------------------------------- /test-cases/Document.DocumentLinks.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | links: "something" 4 | document { 5 | account: "Assets:US:BestBank:Checking" 6 | filename: "/statement.pdf" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test-cases/Document.DocumentNoTagsLinks.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 document Assets:US:BestBank:Checking "/Accounting/statement.pdf" 2 | -------------------------------------------------------------------------------- /test-cases/Document.DocumentNoTagsLinks.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | document { 4 | account: "Assets:US:BestBank:Checking" 5 | filename: "/Accounting/statement.pdf" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test-cases/Document.DocumentTags.beancount: -------------------------------------------------------------------------------- 1 | pushtag #something 2 | 2013-05-18 document Assets:US:BestBank:Checking "/Accounting/statement.pdf" #else 3 | poptag #something 4 | -------------------------------------------------------------------------------- /test-cases/Document.DocumentTags.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | tags: "something" 4 | tags: "else" 5 | document { 6 | account: "Assets:US:BestBank:Checking" 7 | filename: "/Accounting/statement.pdf" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test-cases/Expressions.ExplicitPrecision.beancount: -------------------------------------------------------------------------------- 1 | 2021-09-19 balance Assets:US:Checking (1 + 5) / 2.1 USD 2 | -------------------------------------------------------------------------------- /test-cases/Expressions.ExplicitPrecision.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2021 month: 9 day: 19 } 3 | balance { 4 | account: "Assets:US:Checking" 5 | # ANOMALY on precision as per Arithmetic.NumberExprDifferentPlaces 6 | amount { number { exact: "2.9" } currency: "USD" } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test-cases/Expressions.ExplicitPrecision2.beancount: -------------------------------------------------------------------------------- 1 | 2021-09-19 balance Assets:US:Checking (1 + 5) / 2.1 USD 2 | ; ANOMALY: this option is currently unsupported by Lima 3 | ; see the discussion on precision in Arithmetic.NumberExprDifferentPlaces test 4 | ; option "decimal_evaluation_precision" "5" 5 | -------------------------------------------------------------------------------- /test-cases/Expressions.ExplicitPrecision2.txtpb: -------------------------------------------------------------------------------- 1 | options { 2 | decimal_evaluation_precision: 5 3 | } 4 | directives { 5 | date { year: 2021 month: 9 day: 19 } 6 | balance { 7 | account: "Assets:US:Checking" 8 | # ANOMALY on precision as per Arithmetic.NumberExprDifferentPlaces 9 | amount { number { exact: "2.9" } currency: "USD" } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostAverage.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 2 HOOL {*} 3 | Assets:Account2 120.00 CAD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostAverage.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "2" } currency: "HOOL" } 9 | cost { 10 | merge_cost: true 11 | } 12 | } 13 | } 14 | postings { 15 | account: "Assets:Account2" 16 | spec { 17 | units { number { exact: "120.00" } currency: "CAD" } 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostAverageMissingBasis.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 2 HOOL {*, 2015-09-21, "blablabla"} 3 | Assets:Account2 120.00 CAD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostAverageMissingBasis.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "2" } currency: "HOOL" } 9 | cost { 10 | date { year: 2015 month: 9 day: 21 } 11 | label: "blablabla" 12 | merge_cost: true 13 | } 14 | } 15 | } 16 | postings { 17 | account: "Assets:Account2" 18 | spec { 19 | units { number { exact: "120.00" } currency: "CAD" } 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostAverageWithOther.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 2 HOOL {*, 100.00 CAD, 2015-09-21, "blablabla"} 3 | Assets:Account2 120.00 CAD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostAverageWithOther.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "2" } currency: "HOOL" } 9 | cost { 10 | per_unit { number { exact: "100.00" } } 11 | currency: "CAD" 12 | date { year: 2015 month: 9 day: 21 } 13 | label: "blablabla" 14 | merge_cost: true 15 | } 16 | } 17 | } 18 | postings { 19 | account: "Assets:Account2" 20 | spec { 21 | units { number { exact: "120.00" } currency: "CAD" } 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostEmpty.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 2 HOOL {} 3 | Assets:Account2 120.00 CAD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostEmpty.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "2" } currency: "HOOL" } 9 | # ANOMALY: Lima parser doesn't include empty cost spec in result 10 | } 11 | } 12 | postings { 13 | account: "Assets:Account2" 14 | spec { 15 | units { number { exact: "120.00" } currency: "CAD" } 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostEmptyWithOther.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 2 HOOL {2015-09-21, "blablabla"} 3 | Assets:Account2 120.00 CAD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostEmptyWithOther.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "2" } currency: "HOOL" } 9 | cost { 10 | date { year: 2015 month: 9 day: 21 } 11 | label: "blablabla" 12 | } 13 | } 14 | } 15 | postings { 16 | account: "Assets:Account2" 17 | spec { 18 | units { number { exact: "120.00" } currency: "CAD" } 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostFull.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 2 HOOL {150 # 5 USD} 3 | Assets:Account2 120.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostFull.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "2" } currency: "HOOL" } 9 | cost { 10 | per_unit { number { exact: "150" } } 11 | total { number { exact: "5" } } 12 | currency: "USD" 13 | } 14 | } 15 | } 16 | postings { 17 | account: "Assets:Account2" 18 | spec { 19 | units { number { exact: "120.00" } currency: "USD" } 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostMissingBasis.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 2 HOOL {2015-09-21, "blablabla"} 3 | Assets:Account2 120.00 CAD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostMissingBasis.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "2" } currency: "HOOL" } 9 | cost { 10 | date { year: 2015 month: 9 day: 21 } 11 | label: "blablabla" 12 | } 13 | } 14 | } 15 | postings { 16 | account: "Assets:Account2" 17 | spec { 18 | units { number { exact: "120.00" } currency: "CAD" } 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostMissingCurrency.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 2 HOOL {150} 3 | Assets:Account2 120.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostMissingCurrency.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "2" } currency: "HOOL" } 9 | cost { 10 | per_unit { number { exact: "150" } } 11 | } 12 | } 13 | } 14 | postings { 15 | account: "Assets:Account2" 16 | spec { 17 | units { number { exact: "120.00" } currency: "USD" } 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostMissingNumberPer.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 2 HOOL {# 5 USD} 3 | Assets:Account2 120.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostMissingNumberPer.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "2" } currency: "HOOL" } 9 | cost { 10 | total { number { exact: "5" } } 11 | currency: "USD" 12 | } 13 | } 14 | } 15 | postings { 16 | account: "Assets:Account2" 17 | spec { 18 | units { number { exact: "120.00" } currency: "USD" } 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostMissingNumberTotal.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 2 HOOL {150 # USD} 3 | Assets:Account2 120.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostMissingNumberTotal.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "2" } currency: "HOOL" } 9 | cost { 10 | per_unit { number { exact: "150" } } 11 | currency: "USD" 12 | } 13 | } 14 | } 15 | postings { 16 | account: "Assets:Account2" 17 | spec { 18 | units { number { exact: "120.00" } currency: "USD" } 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostMissingNumbers.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 2 HOOL {USD} 3 | Assets:Account2 120.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostMissingNumbers.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "2" } currency: "HOOL" } 9 | cost { 10 | currency: "USD" 11 | } 12 | } 13 | } 14 | postings { 15 | account: "Assets:Account2" 16 | spec { 17 | units { number { exact: "120.00" } currency: "USD" } 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostNoNumberTotal.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 2 HOOL {150 USD} 3 | Assets:Account2 120.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.CostNoNumberTotal.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "2" } currency: "HOOL" } 9 | cost { 10 | per_unit { number { exact: "150" } } 11 | currency: "USD" 12 | } 13 | } 14 | } 15 | postings { 16 | account: "Assets:Account2" 17 | spec { 18 | units { number { exact: "120.00" } currency: "USD" } 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.PriceMissing.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 100.00 USD @ 3 | Assets:Account2 120.00 CAD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.PriceMissing.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "100.00" } currency: "USD" } 9 | # ANOMALY: Lima parser doesn't include empty price in result 10 | } 11 | } 12 | postings { 13 | account: "Assets:Account2" 14 | spec { 15 | units { number { exact: "120.00" } currency: "CAD" } 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.PriceMissingCurrency.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 100.00 USD @ 1.2 3 | Assets:Account2 120.00 CAD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.PriceMissingCurrency.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "100.00" } currency: "USD" } 9 | price { number { exact: "1.2" } } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Account2" 14 | spec { 15 | units { number { exact: "120.00" } currency: "CAD" } 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.PriceMissingNumber.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 100.00 USD @ CAD 3 | Assets:Account2 120.00 CAD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.PriceMissingNumber.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "100.00" } currency: "USD" } 9 | price { currency: "CAD" } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Account2" 14 | spec { 15 | units { number { exact: "120.00" } currency: "CAD" } 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.PriceNone.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 100.00 USD 3 | Assets:Account2 120.00 CAD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.PriceNone.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "100.00" } currency: "USD" } 9 | } 10 | } 11 | postings { 12 | account: "Assets:Account2" 13 | spec { 14 | units { number { exact: "120.00" } currency: "CAD" } 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsFull.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 100.00 USD 3 | Assets:Account2 -100.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsFull.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "100.00" } currency: "USD" } 9 | } 10 | } 11 | postings { 12 | account: "Assets:Account2" 13 | spec { 14 | units { number { exact: "-100.00" } currency: "USD" } 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissing.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 100.00 USD 3 | Assets:Account2 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissing.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "100.00" } currency: "USD" } 9 | } 10 | } 11 | postings { 12 | account: "Assets:Account2" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingCurrency.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 100.00 USD 3 | Assets:Account2 -100.00 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingCurrency.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "100.00" } currency: "USD" } 9 | } 10 | } 11 | postings { 12 | account: "Assets:Account2" 13 | spec { 14 | units { number { exact: "-100.00" } } 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingCurrencyWithCost.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 10 {300.00 USD} 3 | Assets:Account2 -600.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingCurrencyWithCost.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "10" } } 9 | cost { per_unit { number { exact: "300.00" } } currency: "USD" } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Account2" 14 | spec { 15 | units { number { exact: "-600.00" } currency: "USD" } 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingCurrencyWithPrice.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account2 120.00 @ 1.2 USD 3 | Assets:Account1 100.00 USD @ 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingCurrencyWithPrice.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account2" 7 | spec { 8 | units { number { exact: "120.00" } } 9 | price { number { exact: "1.2" } currency: "USD" } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Account1" 14 | spec { 15 | units { number { exact: "100.00" } currency: "USD" } 16 | # ANOMALY: Lima parser doesn't include empty price in result 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingNumber.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 100.00 USD 3 | Assets:Account2 USD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingNumber.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account1" 7 | spec { 8 | units { number { exact: "100.00" } currency: "USD" } 9 | } 10 | } 11 | postings { 12 | account: "Assets:Account2" 13 | spec { 14 | units { currency: "USD" } 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingNumberWithCost.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 HOOL {300.00 USD} 3 | Assets:Account2 -600.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingNumberWithCost.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { account: "Assets:Account1" 6 | spec { 7 | units { currency: "HOOL" } 8 | cost { per_unit { number { exact: "300.00" } } currency: "USD" } 9 | } 10 | } 11 | postings { 12 | account: "Assets:Account2" 13 | spec { 14 | units { number { exact: "-600.00" } currency: "USD" } 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingNumberWithPrice.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account2 CAD @ 1.2 USD 3 | Assets:Account1 100.00 USD @ 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingNumberWithPrice.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account2" 7 | spec { 8 | units { currency: "CAD" } 9 | price { number { exact: "1.2" } currency: "USD" } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Account1" 14 | spec { 15 | units { number { exact: "100.00" } currency: "USD" } 16 | # ANOMALY: Lima parser doesn't include empty price in result 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingWithCost.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account1 {300.00 USD} 3 | Assets:Account2 -600.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingWithCost.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" postings { account: "Assets:Account1" 5 | spec { 6 | cost { per_unit { number { exact: "300.00" } } currency: "USD" } 7 | } 8 | } 9 | postings { 10 | account: "Assets:Account2" 11 | spec { 12 | units { number { exact: "-600.00" } currency: "USD" } 13 | } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingWithPrice.beancount: -------------------------------------------------------------------------------- 1 | 2010-05-28 * 2 | Assets:Account2 @ 1.2 USD 3 | Assets:Account1 100.00 USD @ 4 | -------------------------------------------------------------------------------- /test-cases/IncompleteInputs.UnitsMissingWithPrice.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2010 month: 5 day: 28 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Account2" 7 | spec { 8 | price { number { exact: "1.2" } currency: "USD" } 9 | } 10 | } 11 | postings { 12 | account: "Assets:Account1" 13 | spec { 14 | units { number { exact: "100.00" } currency: "USD" } 15 | # ANOMALY: Lima parser doesn't include empty price in result 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsAmount.beancount: -------------------------------------------------------------------------------- 1 | 2000-01-01 open Assets:Before 2 | 2001-02-02 balance Assets:Before 23.00 USD 3 | 2010-01-01 close Assets:Before 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsAmount.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2000 month: 1 day: 1 } 3 | open { account: "Assets:Before" } 4 | } 5 | directives { 6 | date { year: 2001 month: 2 day: 2 } 7 | balance { 8 | account: "Assets:Before" 9 | amount { number { exact: "23.00" } currency: "USD" } 10 | } 11 | } 12 | directives { 13 | date { year: 2010 month: 1 day: 1 } 14 | close { account: "Assets:Before" } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsBalance.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 close Assets:Before 2 | 2010-01-01 balance Assets:Before 100 USD 3 | 2000-01-01 open Assets:Before 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsBalance.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | close { account: "Assets:Before" } 9 | } 10 | directives { 11 | date { year: 2010 month: 1 day: 1 } 12 | balance { 13 | account: "Assets:Before" 14 | amount { number { exact: "100" } currency: "USD" } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsClose.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 balance Assets:Before 1 USD 2 | 2010-01-01 close Assets:Before 3 | 2000-01-01 open Assets:Before 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsClose.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | balance { 9 | account: "Assets:Before" 10 | amount { number { exact: "1" } currency: "USD" } 11 | } 12 | } 13 | directives { 14 | date { year: 2010 month: 1 day: 1 } 15 | close { account: "Assets:Before" } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsCommodity.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 close Assets:Before 2 | 2010-01-01 commodity USD 3 | 2000-01-01 open Assets:Before 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsCommodity.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | close { account: "Assets:Before" } 9 | } 10 | directives { 11 | date { year: 2010 month: 1 day: 1 } 12 | commodity { currency: "USD" } 13 | } 14 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsCompoundAmount.beancount: -------------------------------------------------------------------------------- 1 | 2000-01-01 open Assets:Before 2 | 2001-02-02 * 3 | Assets:Before 10.00 HOOL {100.00 # 9.95 USD} 4 | Assets:After -100.00 USD 5 | 2010-01-01 close Assets:Before 6 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsCompoundAmount.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2000 month: 1 day: 1 } 3 | open { account: "Assets:Before" } 4 | } 5 | directives { 6 | date { year: 2001 month: 2 day: 2 } 7 | transaction { 8 | flag: "*" 9 | postings { 10 | account: "Assets:Before" 11 | spec { 12 | units { number { exact: "10.00" } currency: "HOOL" } 13 | cost { per_unit { number { exact: "100.00" } } 14 | total { number { exact: "9.95" } } 15 | currency: "USD" } 16 | } 17 | } 18 | postings { 19 | account: "Assets:After" 20 | spec { 21 | units { number { exact: "-100.00" } currency: "USD" } 22 | } 23 | } 24 | } 25 | } 26 | directives { 27 | date { year: 2010 month: 1 day: 1 } 28 | close { account: "Assets:Before" } 29 | } 30 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsDocument.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 close Assets:Before 2 | 2010-01-01 document Assets:Before "/path/to/document.png" 3 | 2000-01-01 open Assets:Before 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsDocument.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | close { account: "Assets:Before" } 9 | } 10 | directives { 11 | date { year: 2010 month: 1 day: 1 } 12 | document { 13 | account: "Assets:Before" 14 | filename: "/path/to/document.png" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsEvent.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 close Assets:Before 2 | 2010-01-01 event "location" "New York, NY" 3 | 2000-01-01 open Assets:Before 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsEvent.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | close { account: "Assets:Before" } 9 | } 10 | directives { 11 | date { year: 2010 month: 1 day: 1 } 12 | event { 13 | type: "location" 14 | description: "New York, NY" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsInclude.beancount: -------------------------------------------------------------------------------- 1 | 2000-01-01 open Assets:Before 2 | include "LexerAndParserErrors.GrammarExceptionsInclude/Included.beancount" 3 | 2010-01-01 close Assets:Before 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsInclude.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2000 month: 1 day: 1 } 3 | open { account: "Assets:Before" } 4 | } 5 | # ANOMALY: Lima resolves includes in the core parser, so we add something here 6 | directives { 7 | date { year: 2005 month: 1 day: 1 } 8 | transaction { 9 | flag: "*" 10 | narration: "Another Nice dinner at Mermaid Inn" 11 | postings { 12 | account: "Expenses:Restaurant" 13 | spec { units { number { exact: "100" } currency: "USD" } } 14 | } 15 | postings { 16 | account: "Assets:US:Cash" 17 | spec { units { number { exact: "-100" } currency: "USD" } } 18 | } 19 | } 20 | } 21 | directives { 22 | date { year: 2010 month: 1 day: 1 } 23 | close { account: "Assets:Before" } 24 | } 25 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsInclude/Included.beancount: -------------------------------------------------------------------------------- 1 | 2005-01-01 * "Another Nice dinner at Mermaid Inn" 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash -100 USD 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsKeyValue.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 close Assets:Before 2 | 2010-01-01 commodity HOOL 3 | key: "Value" 4 | 2000-01-01 open Assets:Before 5 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsKeyValue.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | close { account: "Assets:Before" } 9 | } 10 | directives { 11 | date { year: 2010 month: 1 day: 1 } 12 | meta { 13 | kv { key: "key" value { text: "Value" } } 14 | } 15 | commodity { currency: "HOOL" } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsLotCostDate.beancount: -------------------------------------------------------------------------------- 1 | 2000-01-01 open Assets:Before 2 | 2001-02-02 * 3 | Assets:Before 10.00 HOOL {100.00 USD} 4 | Assets:After -100.00 USD 5 | 2010-01-01 close Assets:Before 6 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsLotCostDate.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2000 month: 1 day: 1 } 3 | open { account: "Assets:Before" } 4 | } 5 | directives { 6 | date { year: 2001 month: 2 day: 2 } 7 | transaction { 8 | flag: "*" 9 | postings { 10 | account: "Assets:Before" 11 | spec { 12 | units { number { exact: "10.00" } currency: "HOOL" } 13 | cost { per_unit { number { exact: "100.00" } } currency: "USD" } 14 | } 15 | } 16 | postings { 17 | account: "Assets:After" 18 | spec { 19 | units { number { exact: "-100.00" } currency: "USD" } 20 | } 21 | } 22 | } 23 | } 24 | directives { 25 | date { year: 2010 month: 1 day: 1 } 26 | close { account: "Assets:Before" } 27 | } 28 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsNote.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 close Assets:Before 2 | 2010-01-01 note Assets:Before "Something something" 3 | 2000-01-01 open Assets:Before 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsNote.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | close { account: "Assets:Before" } 9 | } 10 | directives { 11 | date { year: 2010 month: 1 day: 1 } 12 | note { 13 | account: "Assets:Before" 14 | comment: "Something something" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsOpen.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 balance Assets:Before 1 USD 2 | 2000-01-01 open Assets:Before 3 | 2010-01-01 close Assets:Before 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsOpen.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | balance { 9 | account: "Assets:Before" 10 | amount { number { exact: "1" } currency: "USD" } 11 | } 12 | } 13 | directives { 14 | date { year: 2010 month: 1 day: 1 } 15 | close { account: "Assets:Before" } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsOption.beancount: -------------------------------------------------------------------------------- 1 | 2000-01-01 open Assets:Before 2 | option "operating_currency" "CAD" 3 | 2010-01-01 close Assets:Before 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsOption.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2000 month: 1 day: 1 } 3 | open { account: "Assets:Before" } 4 | } 5 | directives { 6 | date { year: 2010 month: 1 day: 1 } 7 | close { account: "Assets:Before" } 8 | } 9 | options { 10 | operating_currency: "CAD" 11 | } 12 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsPad.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 close Assets:Before 2 | 2010-01-01 pad Assets:Before Assets:After 3 | 2000-01-01 open Assets:Before 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsPad.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | close { account: "Assets:Before" } 9 | } 10 | directives { 11 | date { year: 2010 month: 1 day: 1 } 12 | pad { 13 | account: "Assets:Before" 14 | source_account: "Assets:After" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsPlugin.beancount: -------------------------------------------------------------------------------- 1 | 2000-01-01 open Assets:Before 2 | plugin "answer.beancount" 3 | 2010-01-01 close Assets:Before 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsPlugin.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2000 month: 1 day: 1 } 3 | open { account: "Assets:Before" } 4 | } 5 | directives { 6 | date { year: 2010 month: 1 day: 1 } 7 | close { account: "Assets:Before" } 8 | } 9 | info { 10 | plugin { name: "answer.beancount" } 11 | } 12 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsPoptag.beancount: -------------------------------------------------------------------------------- 1 | 2000-01-01 open Assets:Before 2 | poptag #sometag 3 | 2010-01-01 close Assets:Before 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsPoptag.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: if there are parse errors, Lima only returns the errors 2 | errors { 3 | message: "invalid poptag" 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsPosting.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 close Assets:Before 2 | 2010-01-01 * 3 | Assets:Before 100.00 USD 4 | Assets:After -100.00 USD 5 | 2000-01-01 open Assets:Before 6 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsPosting.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | close { account: "Assets:Before" } 9 | } 10 | directives { 11 | date { year: 2010 month: 1 day: 1 } 12 | transaction { 13 | flag: "*" 14 | postings { 15 | account: "Assets:Before" 16 | spec { 17 | units { number { exact: "100.00" } currency: "USD" } 18 | } 19 | } 20 | postings { 21 | account: "Assets:After" 22 | spec { 23 | units { number { exact: "-100.00" } currency: "USD" } 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsPrice.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 close Assets:Before 2 | 2010-01-01 price HOOL 20 USD 3 | 2000-01-01 open Assets:Before 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsPrice.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | close { account: "Assets:Before" } 9 | } 10 | directives { 11 | date { year: 2010 month: 1 day: 1 } 12 | price { 13 | currency: "HOOL" 14 | amount { number { exact: "20" } currency: "USD" } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsPushtag.beancount: -------------------------------------------------------------------------------- 1 | 2000-01-01 open Assets:Before 2 | pushtag #sometag 3 | 2010-01-01 close Assets:Before 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsPushtag.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: if there are parse errors, Lima only returns the errors 2 | errors { 3 | message: "invalid pushtag" 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsTagLinkLink.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 close Assets:Before 2 | 2010-01-01 * "Payee" "Narration" ^somelink 3 | Assets:Before 100.00 USD 4 | Assets:After -100.00 USD 5 | 2000-01-01 open Assets:Before 6 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsTagLinkLink.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | close { account: "Assets:Before" } 9 | } 10 | directives { 11 | date { year: 2010 month: 1 day: 1 } 12 | links: "somelink" 13 | transaction { 14 | flag: "*" 15 | payee: "Payee" 16 | narration: "Narration" 17 | postings { 18 | account: "Assets:Before" 19 | spec { 20 | units { number { exact: "100.00" } currency: "USD" } 21 | } 22 | } 23 | postings { 24 | account: "Assets:After" 25 | spec { 26 | units { number { exact: "-100.00" } currency: "USD" } 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsTagLinkNew.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 close Assets:Before 2 | 2010-01-01 * "Payee" "Narration" 3 | Assets:Before 100.00 USD 4 | Assets:After -100.00 USD 5 | 2000-01-01 open Assets:Before 6 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsTagLinkNew.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | close { account: "Assets:Before" } 9 | } 10 | directives { 11 | date { year: 2010 month: 1 day: 1 } 12 | transaction { 13 | flag: "*" 14 | payee: "Payee" 15 | narration: "Narration" 16 | postings { 17 | account: "Assets:Before" 18 | spec { 19 | units { number { exact: "100.00" } currency: "USD" } 20 | } 21 | } 22 | postings { 23 | account: "Assets:After" 24 | spec { 25 | units { number { exact: "-100.00" } currency: "USD" } 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsTagLinkPipe.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 close Assets:Before 2 | 2010-01-01 * "Payee" "Narration" 3 | Assets:Before 100.00 USD 4 | Assets:After -100.00 USD 5 | 2000-01-01 open Assets:Before 6 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsTagLinkPipe.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | close { account: "Assets:Before" } 9 | } 10 | directives { 11 | date { year: 2010 month: 1 day: 1 } 12 | transaction { 13 | flag: "*" 14 | payee: "Payee" 15 | narration: "Narration" 16 | postings { 17 | account: "Assets:Before" 18 | spec { 19 | units { number { exact: "100.00" } currency: "USD" } 20 | } 21 | } 22 | postings { 23 | account: "Assets:After" 24 | spec { 25 | units { number { exact: "-100.00" } currency: "USD" } 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsTagLinkTag.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 close Assets:Before 2 | 2010-01-01 * "Payee" "Narration" #sometag 3 | Assets:Before 100.00 USD 4 | Assets:After -100.00 USD 5 | 2000-01-01 open Assets:Before 6 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsTagLinkTag.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima parser returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | close { account: "Assets:Before" } 9 | } 10 | directives { 11 | date { year: 2010 month: 1 day: 1 } 12 | tags: "sometag" 13 | transaction { 14 | flag: "*" 15 | payee: "Payee" 16 | narration: "Narration" 17 | postings { 18 | account: "Assets:Before" 19 | spec { 20 | units { number { exact: "100.00" } currency: "USD" } 21 | } 22 | } 23 | postings { 24 | account: "Assets:After" 25 | spec { 26 | units { number { exact: "-100.00" } currency: "USD" } 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsTransaction.beancount: -------------------------------------------------------------------------------- 1 | 2010-01-01 close Assets:Before 2 | 2010-01-01 * "Payee" "Narration" 3 | Assets:Before 100.00 USD 4 | Assets:After -100.00 USD 5 | 2000-01-01 open Assets:Before 6 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarExceptionsTransaction.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima returns directives in date order 2 | directives { 3 | date { year: 2000 month: 1 day: 1 } 4 | open { account: "Assets:Before" } 5 | } 6 | directives { 7 | date { year: 2010 month: 1 day: 1 } 8 | close { account: "Assets:Before" } 9 | } 10 | directives { 11 | date { year: 2010 month: 1 day: 1 } 12 | transaction { 13 | flag: "*" 14 | payee: "Payee" 15 | narration: "Narration" 16 | postings { 17 | account: "Assets:Before" 18 | spec { 19 | units { number { exact: "100.00" } currency: "USD" } 20 | } 21 | } 22 | postings { 23 | account: "Assets:After" 24 | spec { 25 | units { number { exact: "-100.00" } currency: "USD" } 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarSyntaxError.beancount: -------------------------------------------------------------------------------- 1 | 2000-01-01 open open 2 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarSyntaxError.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "found 'open' expected something else" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarSyntaxErrorMultiple.beancount: -------------------------------------------------------------------------------- 1 | 2000-01-01 open Assets:Before 2 | 2000-01-02 open open 3 | 2000-01-03 open Assets:After 4 | 2000-01-04 close close 5 | 2000-01-05 close Assets:After 6 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarSyntaxErrorMultiple.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: if there are parse errors, Lima only returns the errors 2 | errors { 3 | message: "found 'open' expected something else" 4 | } 5 | errors { 6 | message: "found 'close' expected something else" 7 | } 8 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarSyntaxErrorRecovery.beancount: -------------------------------------------------------------------------------- 1 | 2000-01-01 open Assets:Before 2 | 2000-01-02 open open 3 | 2000-01-03 open Assets:After 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarSyntaxErrorRecovery.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: if there are parse errors, Lima only returns the errors 2 | errors { 3 | message: "found 'open' expected something else" 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarSyntaxErrorRecovery2.beancount: -------------------------------------------------------------------------------- 1 | 2000-01-01 open open 2 | 2000-01-02 open Assets:Something 3 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.GrammarSyntaxErrorRecovery2.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: if there are parse errors, Lima only returns the errors 2 | errors { 3 | message: "found 'open' expected something else" 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.LexerErrorsInPostings.beancount: -------------------------------------------------------------------------------- 1 | 2000-01-02 * 2 | Assets:Working ` 3 | Assets:Working 11.11 USD 4 | Assets:Working 22.22 USD 5 | 6 | 2000-01-02 * 7 | Assets:Working 11.11 USD 8 | Assets:Working ` 9 | Assets:Working 22.22 USD 10 | 11 | 2000-01-02 * 12 | Assets:Working 11.11 USD 13 | Assets:Working 22.22 USD 14 | Assets:Working ` 15 | 16 | 2000-01-02 * 17 | Assets:Working ) 18 | Assets:Working 11.11 USD 19 | Assets:Working 22.22 USD 20 | 21 | 2000-01-02 * 22 | Assets:Working 11.11 USD 23 | Assets:Working ) 24 | Assets:Working 22.22 USD 25 | 26 | 2000-01-02 * 27 | Assets:Working 11.11 USD 28 | Assets:Working 22.22 USD 29 | Assets:Working ) 30 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.LexerErrorsInPostings.txtpb: -------------------------------------------------------------------------------- 1 | # Note: no transaction is produced. 2 | 3 | errors { 4 | message: "found 'ERROR unrecognized token'" 5 | } 6 | errors { 7 | message: "found 'ERROR unrecognized token'" 8 | } 9 | errors { 10 | message: "found 'ERROR unrecognized token'" 11 | } 12 | errors { 13 | message: "found ')'" 14 | } 15 | errors { 16 | message: "found ')'" 17 | } 18 | errors { 19 | message: "found ')'" 20 | } 21 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.LexerException.beancount: -------------------------------------------------------------------------------- 1 | 2000-13-32 open Assets:Something 2 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.LexerException.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "found 'ERROR month out of range'" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.LexerExceptionRecovery.beancount: -------------------------------------------------------------------------------- 1 | 2000-13-32 open Assets:Something 2 | 2000-01-02 open Assets:Working 3 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.LexerExceptionRecovery.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: if there are parse errors, Lima only returns the errors 2 | errors { 3 | message: "found 'ERROR month out of range'" 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.LexerInvalidToken.beancount: -------------------------------------------------------------------------------- 1 | 2000-01-01 open ) USD 2 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.LexerInvalidToken.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "found ')' expected something else" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.LexerInvalidTokenRecovery.beancount: -------------------------------------------------------------------------------- 1 | 2000-01-01 open ) USD 2 | 2000-01-02 open Assets:Something 3 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.LexerInvalidTokenRecovery.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: if there are parse errors, Lima only returns the errors 2 | errors { 3 | message: "found ')' expected something else" 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.ParsingErrorAtRoot.beancount: -------------------------------------------------------------------------------- 1 | Not a Beancount input file. 2 | -------------------------------------------------------------------------------- /test-cases/LexerAndParserErrors.ParsingErrorAtRoot.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "found 'ERROR unrecognized token'" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataDataTypes.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | string: "Something" 3 | account: Assets:Investments:Cash 4 | date: 2012-01-01 5 | currency: HOOL 6 | tag: #trip-florida 7 | number: 345.67 8 | amount: 345.67 USD 9 | boolt: TRUE 10 | boolf: FALSE 11 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataDataTypes.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | meta { 4 | kv { key: "string" value { text: "Something" } } 5 | kv { key: "account" value { account: "Assets:Investments:Cash" } } 6 | kv { key: "date" value { date { year: 2012 month: 1 day: 1 } } } 7 | kv { key: "currency" value { currency: "HOOL" } } 8 | kv { key: "tag" value { tag: "trip-florida" } } 9 | kv { key: "number" value { number { exact: "345.67" } } } 10 | kv { key: "amount" value { amount { number { exact: "345.67" } currency: "USD" } } } 11 | kv { key: "boolt" value { boolean: true } } 12 | kv { key: "boolf" value { boolean: false } } 13 | } 14 | transaction { 15 | # ANOMALY: Lima distinguishes empty string from no string 16 | narration: "" 17 | flag: "*" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataEmpty.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "blabla" 2 | oranges: 3 | bananas: 4 | 5 | 2013-05-19 open Assets:Something 6 | apples: 7 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataEmpty.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | meta { 4 | kv { key: "oranges" value {} } 5 | kv { key: "bananas" value {} } 6 | } 7 | transaction { 8 | flag: "*" 9 | narration: "blabla" 10 | } 11 | } 12 | directives { 13 | date { year: 2013 month: 5 day: 19 } 14 | meta { 15 | kv { key: "apples" value {} } 16 | } 17 | open { 18 | account: "Assets:Something" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataKeySyntax.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | nameoncard: "Jim" 3 | nameOnCard: "Joe" 4 | name-on-card: "Bob" 5 | name_on_card: "John" 6 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataKeySyntax.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | meta { 4 | kv { key: "nameoncard" value { text: "Jim" } } 5 | kv { key: "nameOnCard" value { text: "Joe" } } 6 | kv { key: "name-on-card" value { text: "Bob" } } 7 | kv { key: "name_on_card" value { text: "John" } } 8 | } 9 | transaction { 10 | # ANOMALY: Lima distinguishes empty string from no string 11 | narration: "" 12 | flag: "*" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataOther.beancount: -------------------------------------------------------------------------------- 1 | 2013-01-01 open Equity:Other 2 | 3 | 2013-01-01 open Assets:Investments 4 | test1: "Something" 5 | test2: "Something" 6 | 7 | 2014-01-01 close Assets:Investments 8 | test1: "Something" 9 | 10 | 2013-01-10 note Assets:Investments "Bla" 11 | test1: "Something" 12 | 13 | 2013-01-31 pad Assets:Investments Equity:Other 14 | test1: "Something" 15 | 16 | 2013-02-01 balance Assets:Investments 111.00 USD 17 | test1: "Something" 18 | 19 | 2013-03-01 event "location" "Nowhere" 20 | test1: "Something" 21 | 22 | 2013-03-01 document Assets:Investments "/path/to/something.pdf" 23 | test1: "Something" 24 | 25 | 2013-03-01 price HOOL 500 USD 26 | test1: "Something" 27 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataTransactionBegin.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | test: "Something" 3 | Assets:Investments:MSFT 10 MSFT @@ 2000 USD 4 | Assets:Investments:Cash -20000 USD 5 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataTransactionBegin.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | meta { 4 | kv { key: "test" value { text: "Something" } } 5 | } 6 | transaction { 7 | # ANOMALY: Lima distinguishes empty string from no string 8 | narration: "" 9 | flag: "*" 10 | postings { 11 | account: "Assets:Investments:MSFT" 12 | spec { 13 | units { number { exact: "10" } currency: "MSFT" } 14 | price { number { exact: "2000" } currency: "USD" is_total: true } 15 | } 16 | } 17 | postings { 18 | account: "Assets:Investments:Cash" 19 | spec { 20 | units { number { exact: "-20000" } currency: "USD" } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataTransactionEnd.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | Assets:Investments:MSFT 10 MSFT @@ 2000 USD 3 | Assets:Investments:Cash -20000 USD 4 | test: "Something" 5 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataTransactionEnd.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | # ANOMALY: Lima distinguishes empty string from no string 5 | narration: "" 6 | flag: "*" 7 | postings { 8 | account: "Assets:Investments:MSFT" 9 | spec { 10 | units { number { exact: "10" } currency: "MSFT" } 11 | price { number { exact: "2000" } currency: "USD" is_total: true } 12 | } 13 | } 14 | postings { 15 | meta { 16 | kv { key: "test" value { text: "Something" } } 17 | } 18 | account: "Assets:Investments:Cash" 19 | spec { 20 | units { number { exact: "-20000" } currency: "USD" } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataTransactionIndented.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | test1: "Something" 3 | Assets:Investments:MSFT 10 MSFT @@ 2000 USD 4 | test2: "has" 5 | test3: "to" 6 | Assets:Investments:Cash -20000 USD 7 | test4: "come" 8 | test5: "from" 9 | test6: "this" 10 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataTransactionIndented.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima parser is robust to varying levels of indentation, 2 | # so succeeds in parsing this input 3 | directives { 4 | date { year: 2013 month: 5 day: 18 } 5 | meta { 6 | kv { key: "test1" value { text: "Something" } } 7 | } 8 | transaction { 9 | # ANOMALY: Lima distinguishes empty string from no string 10 | narration: "" 11 | flag: "*" 12 | postings { 13 | account: "Assets:Investments:MSFT" 14 | spec { 15 | units { number { exact: "10" } currency: "MSFT" } 16 | price { number { exact: "2000" } currency: "USD" is_total: true } 17 | } 18 | meta { 19 | kv { key: "test2" value { text: "has" } } 20 | kv { key: "test3" value { text: "to" } } 21 | } 22 | } 23 | postings { 24 | account: "Assets:Investments:Cash" 25 | spec { units { number { exact: "-20000" } currency: "USD" } } 26 | meta { 27 | kv { key: "test4" value { text: "come" } } 28 | kv { key: "test5" value { text: "from" } } 29 | kv { key: "test6" value { text: "this" } } 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataTransactionMany.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | test1: "Something" 3 | Assets:Investments:MSFT 10 MSFT @@ 2000 USD 4 | test2: "has" 5 | test3: "to" 6 | Assets:Investments:Cash -20000 USD 7 | test4: "come" 8 | test5: "from" 9 | test6: "this" 10 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataTransactionMany.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | meta { 4 | kv { key: "test1" value { text: "Something" } } 5 | } 6 | transaction { 7 | # ANOMALY: Lima distinguishes empty string from no string 8 | narration: "" 9 | flag: "*" 10 | postings { 11 | meta { 12 | kv { key: "test2" value { text: "has" } } 13 | kv { key: "test3" value { text: "to" } } 14 | } 15 | account: "Assets:Investments:MSFT" 16 | spec { 17 | units { number { exact: "10" } currency: "MSFT" } 18 | price { number { exact: "2000" } currency: "USD" is_total: true } } 19 | } 20 | postings { 21 | meta { 22 | kv { key: "test4" value { text: "come" } } 23 | kv { key: "test5" value { text: "from" } } 24 | kv { key: "test6" value { text: "this" } } 25 | } 26 | account: "Assets:Investments:Cash" 27 | spec { 28 | units { number { exact: "-20000" } currency: "USD" } 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataTransactionMiddle.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | Assets:Investments:MSFT 10 MSFT @@ 2000 USD 3 | test: "Something" 4 | Assets:Investments:Cash -20000 USD 5 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataTransactionMiddle.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | # ANOMALY: Lima distinguishes empty string from no string 5 | narration: "" 6 | flag: "*" 7 | postings { 8 | meta { 9 | kv { key: "test" value { text: "Something" } } 10 | } 11 | account: "Assets:Investments:MSFT" 12 | spec { 13 | units { number { exact: "10" } currency: "MSFT" } 14 | price { number { exact: "2000" } currency: "USD" is_total: true } 15 | } 16 | } 17 | postings { 18 | account: "Assets:Investments:Cash" 19 | spec { 20 | units { number { exact: "-20000" } currency: "USD" } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataTransactionRepeated.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | test: "Bananas" 3 | test: "Apples" 4 | test: "Oranges" 5 | Assets:Investments 100 USD 6 | test: "Mangos" 7 | test: "Pineapple" 8 | Income:Investments -100 USD 9 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataTransactionRepeated.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | meta { 4 | kv { key: "test" value { text: "Bananas" } } 5 | } 6 | transaction { 7 | flag: "*" 8 | postings { 9 | meta { 10 | kv { key: "test" value { text: "Mangos" } } 11 | } 12 | account: "Assets:Investments" 13 | spec { units { number { exact: "100" } currency: "USD" } } 14 | } 15 | postings { 16 | account: "Income:Investments" 17 | spec { units { number { exact: "-100" } currency: "USD" } } 18 | } 19 | } 20 | } 21 | errors { 22 | message: "duplicate key test" 23 | } 24 | errors { 25 | message: "duplicate key test" 26 | } 27 | errors { 28 | message: "duplicate key test" 29 | } 30 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataTransactionRepeated2.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | test: "Bananas" 3 | test: "Apples" 4 | test: "Oranges" 5 | Assets:Investments 100 USD 6 | test: "Mangos" 7 | test: "Pineapple" 8 | Income:Investments -100 USD 9 | -------------------------------------------------------------------------------- /test-cases/MetaData.MetadataTransactionRepeated2.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: duplicated metadata keys is a parse error for Lima 2 | errors { 3 | message: "duplicate key test" 4 | } 5 | errors { 6 | message: "duplicate key test" 7 | } 8 | errors { 9 | message: "duplicate key test" 10 | } 11 | -------------------------------------------------------------------------------- /test-cases/Misc.CommentInPostings.beancount: -------------------------------------------------------------------------------- 1 | 2017-06-27 * "Bitcoin network fee" 2 | ; Account: Pocket money 3 | Expenses:Crypto:NetworkFees 0.00082487 BTC 4 | Assets:Crypto:Bitcoin -0.00082487 BTC 5 | -------------------------------------------------------------------------------- /test-cases/Misc.CommentInPostings.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2017 month: 6 day: 27 } 3 | transaction { 4 | flag: "*" 5 | narration: "Bitcoin network fee" 6 | postings { 7 | account: "Expenses:Crypto:NetworkFees" 8 | spec { 9 | units { number { exact: "0.00082487" } currency: "BTC" } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Crypto:Bitcoin" 14 | spec { 15 | units { number { exact: "-0.00082487" } currency: "BTC" } 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/Misc.CommentInPostingsInvalid.beancount: -------------------------------------------------------------------------------- 1 | 2017-06-27 * "Bitcoin network fee" 2 | Expenses:Crypto:NetworkFees 0.00082487 BTC 3 | ; Account: Pocket money 4 | Assets:Crypto:Bitcoin -0.00082487 BTC 5 | -------------------------------------------------------------------------------- /test-cases/Misc.CommentInPostingsInvalid.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima parser is not sensitive to extra comment lines with unexpected indent 2 | directives { 3 | date { year: 2017 month: 6 day: 27 } 4 | transaction { 5 | flag: "*" 6 | narration: "Bitcoin network fee" 7 | postings { 8 | account: "Expenses:Crypto:NetworkFees" 9 | spec { 10 | units { number { exact: "0.00082487" } currency: "BTC" } 11 | } 12 | } 13 | postings { 14 | account: "Assets:Crypto:Bitcoin" 15 | spec { 16 | units { number { exact: "-0.00082487" } currency: "BTC" } 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test-cases/MiscOptions.PluginProcessingModeDefault.beancount: -------------------------------------------------------------------------------- 1 | option "plugin_processing_mode" "DEFAULT" 2 | -------------------------------------------------------------------------------- /test-cases/MiscOptions.PluginProcessingModeDefault.txtpb: -------------------------------------------------------------------------------- 1 | options { 2 | plugin_processing_mode: DEFAULT 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/MiscOptions.PluginProcessingModeInvalid.beancount: -------------------------------------------------------------------------------- 1 | option "plugin_processing_mode" "INVALID" 2 | -------------------------------------------------------------------------------- /test-cases/MiscOptions.PluginProcessingModeInvalid.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "Expected one of DEFAULT, RAW" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/MiscOptions.PluginProcessingModeRaw.beancount: -------------------------------------------------------------------------------- 1 | option "plugin_processing_mode" "RAW" 2 | -------------------------------------------------------------------------------- /test-cases/MiscOptions.PluginProcessingModeRaw.txtpb: -------------------------------------------------------------------------------- 1 | options { 2 | plugin_processing_mode: RAW 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/MultipleLines.MultilineNarration.beancount: -------------------------------------------------------------------------------- 1 | 2014-07-11 * "Hello one line 2 | and yet another, 3 | and why not another!" 4 | Expenses:Restaurant 100 USD 5 | Assets:Cash -100 USD 6 | -------------------------------------------------------------------------------- /test-cases/MultipleLines.MultilineNarration.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 7 day: 11 } 3 | transaction { 4 | flag: "*" 5 | narration: "Hello one line\nand yet another,\nand why not another!" 6 | postings { 7 | account: "Expenses:Restaurant" 8 | spec { units { number { exact: "100" } currency: "USD" } } 9 | } 10 | postings { 11 | account: "Assets:Cash" 12 | spec { units { number { exact: "-100" } currency: "USD" } } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostAmount.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 20 AAPL {45.23 USD} 3 | Assets:Invest:Cash -90.46 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostAmount.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 1 day: 1 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Invest:AAPL" 7 | spec { units { number { exact: "20" } currency: "AAPL" } 8 | cost { per_unit { number { exact: "45.23" } } currency: "USD" } } 9 | } 10 | postings { 11 | account: "Assets:Invest:Cash" 12 | spec { units { number { exact: "-90.46" } currency: "USD" } } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostBothCosts.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 10 AAPL {45.23 # 9.95 USD} 3 | Assets:Invest:Cash -110.36 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostBothCosts.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 1 day: 1 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Invest:AAPL" 7 | spec { units { number { exact: "10" } currency: "AAPL" } 8 | cost { 9 | per_unit { number { exact: "45.23" } } 10 | total { number { exact: "9.95" } } 11 | currency: "USD" 12 | } } 13 | } 14 | postings { 15 | account: "Assets:Invest:Cash" 16 | spec { units { number { exact: "-110.36" } currency: "USD" } } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostDate.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 20 AAPL {2014-12-26} 3 | Assets:Invest:Cash -20 AAPL 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostDate.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 1 day: 1 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Invest:AAPL" 7 | spec { units { number { exact: "20" } currency: "AAPL" } 8 | cost { date { year: 2014 month: 12 day: 26 } } } 9 | } 10 | postings { 11 | account: "Assets:Invest:Cash" 12 | spec { units { number { exact: "-20" } currency: "AAPL" } } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostEmpty.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 20 AAPL {} 3 | Assets:Invest:Cash -20 AAPL 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostEmpty.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 1 day: 1 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Invest:AAPL" 7 | # ANOMALY: Lima omits empty cost spec 8 | spec { units { number { exact: "20" } currency: "AAPL" } } 9 | } 10 | postings { 11 | account: "Assets:Invest:Cash" 12 | spec { units { number { exact: "-20" } currency: "AAPL" } } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostEmptyComponents.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 10 AAPL {, 100.0 USD, , } 3 | Assets:Invest:Cash -19.90 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostEmptyComponents.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "found ','" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostLabel.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 20 AAPL {"d82d55a0dbe8"} 3 | Assets:Invest:Cash -20 AAPL 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostLabel.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 1 day: 1 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Invest:AAPL" 7 | spec { units { number { exact: "20" } currency: "AAPL" } 8 | cost { label: "d82d55a0dbe8" } } 9 | } 10 | postings { 11 | account: "Assets:Invest:Cash" 12 | spec { units { number { exact: "-20" } currency: "AAPL" } } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostMerge.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 20 AAPL {*} 3 | Assets:Invest:Cash -20 AAPL 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostMerge.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 1 day: 1 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Invest:AAPL" 7 | spec { units { number { exact: "20" } currency: "AAPL" } 8 | cost { merge_cost: true } } 9 | } 10 | postings { 11 | account: "Assets:Invest:Cash" 12 | spec { units { number { exact: "-20" } currency: "AAPL" } } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostNone.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 45.23 USD 3 | Assets:Invest:Cash -45.23 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostNone.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 1 day: 1 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Invest:AAPL" 7 | spec { units { number { exact: "45.23" } currency: "USD" } } 8 | } 9 | postings { 10 | account: "Assets:Invest:Cash" 11 | spec { units { number { exact: "-45.23" } currency: "USD" } } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostRepeated.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 1 AAPL {45.23 USD, 45.24 USD} 3 | Assets:Invest:Cash -45.23 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostRepeated.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | # error message from chumsky 1.0.0-alpha.7 seems a bit strange, so just accept any error 3 | message: "" 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostRepeatedDate.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 1 AAPL {45.23 USD, 2014-12-26, 2014-12-27} 3 | Assets:Invest:Cash -1 AAPL 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostRepeatedDate.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | # error message from chumsky 1.0.0-alpha.7 seems a bit strange, so just accept any error 3 | message: "" 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostRepeatedLabel.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 1 AAPL {"aaa", "bbb", 45.23 USD} 3 | Assets:Invest:Cash -45.23 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostRepeatedLabel.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | # error message from chumsky 1.0.0-alpha.7 seems a bit strange, so just accept any error 3 | message: "" 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostRepeatedMerge.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 1 AAPL {*, *} 3 | Assets:Invest:Cash -45.23 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostRepeatedMerge.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | # error message from chumsky 1.0.0-alpha.7 seems a bit strange, so just accept any error 3 | message: "" 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostThreeComponents.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 1 AAPL {45.23 USD, 2014-12-26, "d82d55a0dbe8"} 3 | Assets:Invest:AAPL 1 AAPL {2014-12-26, 45.23 USD, "d82d55a0dbe8"} 4 | Assets:Invest:AAPL 1 AAPL {45.23 USD, "d82d55a0dbe8", 2014-12-26} 5 | Assets:Invest:AAPL 1 AAPL {2014-12-26, "d82d55a0dbe8", 45.23 USD} 6 | Assets:Invest:AAPL 1 AAPL {"d82d55a0dbe8", 45.23 USD, 2014-12-26} 7 | Assets:Invest:AAPL 1 AAPL {"d82d55a0dbe8", 2014-12-26, 45.23 USD} 8 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostTotalCostOnly.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 10 AAPL {# 9.95 USD} 3 | Assets:Invest:Cash -19.90 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostTotalCostOnly.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 1 day: 1 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Invest:AAPL" 7 | spec { units { number { exact: "10" } currency: "AAPL" } 8 | cost { 9 | total { number { exact: "9.95" } } 10 | currency: "USD" 11 | } } 12 | } 13 | postings { 14 | account: "Assets:Invest:Cash" 15 | spec { units { number { exact: "-19.90" } currency: "USD" } } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostTotalEmptyTotal.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 20 AAPL {45.23 # USD} 3 | Assets:Invest:Cash -45.23 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostTotalEmptyTotal.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 1 day: 1 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Invest:AAPL" 7 | spec { 8 | units { number { exact: "20" } currency: "AAPL" } 9 | cost { per_unit { number { exact: "45.23" } } currency: "USD" } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Invest:Cash" 14 | spec { 15 | units { number { exact: "-45.23" } currency: "USD" } 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostTotalJustCurrency.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 20 AAPL {USD} 3 | Assets:Invest:AAPL 20 AAPL { # USD} 4 | Assets:Invest:Cash 0 USD 5 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostTotalJustCurrency.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 1 day: 1 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Assets:Invest:AAPL" 7 | spec { 8 | units { number { exact: "20" } currency: "AAPL" } 9 | cost { currency: "USD" } 10 | } 11 | } 12 | postings { 13 | account: "Assets:Invest:AAPL" 14 | spec { 15 | units { number { exact: "20" } currency: "AAPL" } 16 | cost { currency: "USD" } 17 | } 18 | } 19 | postings { 20 | account: "Assets:Invest:Cash" 21 | spec { 22 | units { number { exact: "0" } currency: "USD" } 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostTwoComponents.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 1 AAPL {45.23 USD, 2014-12-26} 3 | Assets:Invest:AAPL 1 AAPL {2014-12-26, 45.23 USD} 4 | Assets:Invest:AAPL 1 AAPL {45.23 USD, "d82d55a0dbe8"} 5 | Assets:Invest:AAPL 1 AAPL {"d82d55a0dbe8", 45.23 USD} 6 | Assets:Invest:AAPL 1 AAPL {2014-12-26, "d82d55a0dbe8"} 7 | Assets:Invest:AAPL 1 AAPL {"d82d55a0dbe8", 2014-12-26} 8 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostWithSlashes.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-01 * 2 | Assets:Invest:AAPL 1.1 AAPL {45.23 USD / 2015-07-16 / "blabla"} 3 | Assets:Invest:Cash -45.23 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParseLots.CostWithSlashes.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "found '/' expected ',', or '}'" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/Parser.BasicTesting.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-27 * "UNION MARKET" 2 | Liabilities:US:Amex:BlueCash -22.02 USD 3 | Expenses:Food:Grocery 22.02 USD 4 | -------------------------------------------------------------------------------- /test-cases/Parser.BasicTesting.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 1 day: 27 } 3 | transaction { 4 | flag: "*" 5 | narration: "UNION MARKET" 6 | postings { 7 | account: "Liabilities:US:Amex:BlueCash" 8 | spec { units { number { exact: "-22.02" } currency: "USD" } } 9 | } 10 | postings { 11 | account: "Expenses:Food:Grocery" 12 | spec { units { number { exact: "22.02" } currency: "USD" } } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/ParserComplete.Comment.beancount: -------------------------------------------------------------------------------- 1 | ;; This is some comment. 2 | -------------------------------------------------------------------------------- /test-cases/ParserComplete.Comment.txtpb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tesujimath/beancount-parser-lima/f4190c7a910cf12080e46539a9f29d5903c4bff2/test-cases/ParserComplete.Comment.txtpb -------------------------------------------------------------------------------- /test-cases/ParserComplete.CommentEOF.beancount: -------------------------------------------------------------------------------- 1 | ; comment -------------------------------------------------------------------------------- /test-cases/ParserComplete.CommentEOF.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima parser doesn't handle an incomplete final comment line 2 | errors { 3 | message: "found 'ERROR unrecognized token'" 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/ParserComplete.Empty1.beancount: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tesujimath/beancount-parser-lima/f4190c7a910cf12080e46539a9f29d5903c4bff2/test-cases/ParserComplete.Empty1.beancount -------------------------------------------------------------------------------- /test-cases/ParserComplete.Empty1.txtpb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tesujimath/beancount-parser-lima/f4190c7a910cf12080e46539a9f29d5903c4bff2/test-cases/ParserComplete.Empty1.txtpb -------------------------------------------------------------------------------- /test-cases/ParserComplete.Empty2.beancount: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tesujimath/beancount-parser-lima/f4190c7a910cf12080e46539a9f29d5903c4bff2/test-cases/ParserComplete.Empty2.beancount -------------------------------------------------------------------------------- /test-cases/ParserComplete.Empty2.txtpb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tesujimath/beancount-parser-lima/f4190c7a910cf12080e46539a9f29d5903c4bff2/test-cases/ParserComplete.Empty2.txtpb -------------------------------------------------------------------------------- /test-cases/ParserComplete.ExtraWhitespaceComment.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Nice dinner at Mermaid Inn" 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash 4 | ;; -------------------------------------------------------------------------------- /test-cases/ParserComplete.ExtraWhitespaceComment.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima parser doesn't handle an incomplete final comment line 2 | errors { 3 | message: "found 'ERROR unrecognized token'" 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/ParserComplete.ExtraWhitespaceCommentIndented.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Nice dinner at Mermaid Inn" 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash 4 | ;; -------------------------------------------------------------------------------- /test-cases/ParserComplete.ExtraWhitespaceCommentIndented.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima parser doesn't handle an incomplete final comment line 2 | errors { 3 | message: "found 'ERROR unrecognized token'" 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/ParserComplete.ExtraWhitespaceNote.beancount: -------------------------------------------------------------------------------- 1 | 2013-07-11 note Assets:Cash "test" 2 | ;; 3 | -------------------------------------------------------------------------------- /test-cases/ParserComplete.ExtraWhitespaceNote.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima parser has no trouble with final indented comment line 2 | directives { 3 | date { year: 2013 month: 7 day: 11 } 4 | note { 5 | account: "Assets:Cash" 6 | comment: "test" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test-cases/ParserComplete.ExtraWhitespaceTransaction.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Nice dinner at Mermaid Inn" 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash 4 | 5 | ;; End of file -------------------------------------------------------------------------------- /test-cases/ParserComplete.ExtraWhitespaceTransaction.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima parser doesn't handle an incomplete final comment line 2 | errors { 3 | message: "found 'ERROR unrecognized token'" 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/ParserComplete.IndentEOF.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test-cases/ParserComplete.IndentEOF.txtpb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tesujimath/beancount-parser-lima/f4190c7a910cf12080e46539a9f29d5903c4bff2/test-cases/ParserComplete.IndentEOF.txtpb -------------------------------------------------------------------------------- /test-cases/ParserComplete.NoEmptyLines.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-01 open Assets:Cash USD,CAD,EUR 2 | 2013-05-02 close Assets:US:BestBank:Checking 3 | 2013-05-03 pad Assets:US:BestBank:Checking Equity:Opening-Balances 4 | 2013-05-04 event "location" "New York, USA" 5 | 2013-05-05 * "Payee" "Narration" 6 | Assets:US:BestBank:Checking 100.00 USD 7 | Assets:Cash -100.00 USD 8 | 2013-05-06 note Assets:US:BestBank:Checking "Blah, di blah." 9 | 2013-05-07 price USD 1.0290 CAD 10 | -------------------------------------------------------------------------------- /test-cases/ParserComplete.NoEmptyLines.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 1 } 3 | open { 4 | account: "Assets:Cash" 5 | currencies: "USD" 6 | currencies: "CAD" 7 | currencies: "EUR" 8 | } 9 | } 10 | directives { 11 | date { year: 2013 month: 5 day: 2 } 12 | close { 13 | account: "Assets:US:BestBank:Checking" 14 | } 15 | } 16 | directives { 17 | date { year: 2013 month: 5 day: 3 } 18 | pad { 19 | account: "Assets:US:BestBank:Checking" 20 | source_account: "Equity:Opening-Balances" 21 | } 22 | } 23 | directives { 24 | date { year: 2013 month: 5 day: 4 } 25 | event { 26 | type: "location" 27 | description: "New York, USA" 28 | } 29 | } 30 | directives { 31 | date { year: 2013 month: 5 day: 5 } 32 | transaction { 33 | flag: "*" 34 | payee: "Payee" 35 | narration: "Narration" 36 | postings { 37 | account: "Assets:US:BestBank:Checking" 38 | spec { units { number { exact: "100.00" } currency: "USD" } } 39 | } 40 | postings { 41 | account: "Assets:Cash" 42 | spec { units { number { exact: "-100.00" } currency: "USD" } } 43 | } 44 | } 45 | } 46 | directives { 47 | date { year: 2013 month: 5 day: 6 } 48 | note { 49 | account: "Assets:US:BestBank:Checking" 50 | comment: "Blah, di blah." 51 | } 52 | } 53 | directives { 54 | date { year: 2013 month: 5 day: 7 } 55 | price { 56 | currency: "USD" 57 | amount { number { exact: "1.0290" } currency: "CAD" } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /test-cases/ParserComplete.TransactionImbalanceFromSinglePosting.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Nice dinner at Mermaid Inn" 2 | Expenses:Restaurant 100 USD 3 | -------------------------------------------------------------------------------- /test-cases/ParserComplete.TransactionImbalanceFromSinglePosting.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Nice dinner at Mermaid Inn" 6 | postings { 7 | account: "Expenses:Restaurant" 8 | spec { units { number { exact: "100" } currency: "USD" } } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test-cases/ParserComplete.TransactionSinglePostingAtZero.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Nice dinner at Mermaid Inn" 2 | Expenses:Restaurant 0 USD 3 | -------------------------------------------------------------------------------- /test-cases/ParserComplete.TransactionSinglePostingAtZero.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Nice dinner at Mermaid Inn" 6 | postings { 7 | account: "Expenses:Restaurant" 8 | spec { units { number { exact: "0" } currency: "USD" } } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Balance.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 balance Assets:US:BestBank:Checking 200 USD 2 | 2013-05-18 balance Assets:US:BestBank:Checking 200 ~ 0.002 USD 3 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Balance.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | balance { 4 | account: "Assets:US:BestBank:Checking" 5 | amount { number { exact: "200" } currency: "USD" } 6 | } 7 | } 8 | directives { 9 | date { year: 2013 month: 5 day: 18 } 10 | balance { 11 | account: "Assets:US:BestBank:Checking" 12 | amount { number { exact: "200" } currency: "USD" } 13 | tolerance { exact: "0.002" } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.BalanceWithCost.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 balance Assets:Investments 10 MSFT {45.30 USD} 2 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.BalanceWithCost.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "found '{' expected something else" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Close.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 close Assets:US:BestBank:Checking 2 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Close.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | close { 4 | account: "Assets:US:BestBank:Checking" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Commodity.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 commodity MSFT 2 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Commodity.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | commodity { 4 | currency: "MSFT" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Document.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 document Assets:US:BestBank:Checking "/Accounting/statement.pdf" 2 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Document.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | document { 4 | account: "Assets:US:BestBank:Checking" 5 | filename: "/Accounting/statement.pdf" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Event.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 event "location" "New York, USA" 2 | 3 | ;; Test empty event. 4 | 2013-05-18 event "location" "" 5 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Event.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | event { 4 | type: "location" 5 | description: "New York, USA" 6 | } 7 | } 8 | directives { 9 | date { year: 2013 month: 5 day: 18 } 10 | event { 11 | type: "location" 12 | description: "" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Note.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 note Assets:US:BestBank:Checking "Blah, di blah." 2 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Note.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | note { 4 | account: "Assets:US:BestBank:Checking" 5 | comment: "Blah, di blah." 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Open1.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 open Assets:US:BestBank:Checking 2 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Open1.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | open { 4 | account: "Assets:US:BestBank:Checking" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Open2.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 open Assets:US:BestBank:Checking USD 2 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Open2.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | open { 4 | account: "Assets:US:BestBank:Checking" 5 | currencies: "USD" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Open3.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 open Assets:Cash USD,CAD,EUR 2 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Open3.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | open { 4 | account: "Assets:Cash" 5 | currencies: "USD" 6 | currencies: "CAD" 7 | currencies: "EUR" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Open4.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 open Assets:US:Vanguard:VIIPX VIIPX "STRICT" 2 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Open4.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | open { 4 | account: "Assets:US:Vanguard:VIIPX" 5 | currencies: "VIIPX" 6 | booking: STRICT 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Open5.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 open Assets:US:Vanguard:VIIPX "STRICT" 2 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Open5.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | open { 4 | account: "Assets:US:Vanguard:VIIPX" 5 | booking: STRICT 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Pad.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 pad Assets:US:BestBank:Checking Equity:Opening-Balances 2 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Pad.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | pad { 4 | account: "Assets:US:BestBank:Checking" 5 | source_account: "Equity:Opening-Balances" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Price.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 price USD 1.0290 CAD 2 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Price.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | price { 4 | currency: "USD" 5 | amount { number { exact: "1.0290" } currency: "CAD" } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Query.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 query "cash" "SELECT SUM(position) WHERE currency = 'USD'" 2 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.Query.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | query { 4 | name: "cash" 5 | query_string: "SELECT SUM(position) WHERE currency = \'USD\'" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.TransactionOneString.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Nice dinner at Mermaid Inn" 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash -100 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.TransactionOneString.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Nice dinner at Mermaid Inn" 6 | postings { 7 | account: "Expenses:Restaurant" 8 | spec { units { number { exact: "100" } currency: "USD" } } 9 | } 10 | postings { 11 | account: "Assets:US:Cash" 12 | spec { units { number { exact: "-100" } currency: "USD" } } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.TransactionThreeStrings.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Mermaid Inn" "Nice dinner" "With Caroline" 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash -100 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.TransactionThreeStrings.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "found '\"With Caroline\"' expected something else" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.TransactionTwoStrings.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Mermaid Inn" "Nice dinner" 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash -100 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.TransactionTwoStrings.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | payee: "Mermaid Inn" 6 | narration: "Nice dinner" 7 | postings { 8 | account: "Expenses:Restaurant" 9 | spec { units { number { exact: "100" } currency: "USD" } } 10 | } 11 | postings { 12 | account: "Assets:US:Cash" 13 | spec { units { number { exact: "-100" } currency: "USD" } } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.TransactionWithTxnKeyword.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 txn "Nice dinner at Mermaid Inn" 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash -100 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParserEntryTypes.TransactionWithTxnKeyword.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Nice dinner at Mermaid Inn" 6 | postings { 7 | account: "Expenses:Restaurant" 8 | spec { units { number { exact: "100" } currency: "USD" } } 9 | } 10 | postings { 11 | account: "Assets:US:Cash" 12 | spec { units { number { exact: "-100" } currency: "USD" } } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/ParserInclude.IncludeAbsolute.beancount: -------------------------------------------------------------------------------- 1 | include "/some/absolute/filename.beancount" 2 | -------------------------------------------------------------------------------- /test-cases/ParserInclude.IncludeAbsolute.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima resolves includes within the core parser 2 | # and we cannot write a portable test with an absolute path, alas 3 | errors { 4 | message: "can't read file" 5 | } 6 | -------------------------------------------------------------------------------- /test-cases/ParserInclude.IncludeCycle.beancount: -------------------------------------------------------------------------------- 1 | include "ParserInclude.IncludeRelative/Included1.beancount" 2 | 3 | 2004-01-27 * "QUITE OLD" 4 | Liabilities:US:Amex:BlueCash -122.02 USD 5 | Expenses:Food:Grocery 122.02 USD 6 | 7 | include "ParserInclude.IncludeRelative/Included1.beancount" 8 | -------------------------------------------------------------------------------- /test-cases/ParserInclude.IncludeCycle.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "duplicate include" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/ParserInclude.IncludeCycle/Included1.beancount: -------------------------------------------------------------------------------- 1 | include "../ParserInclude.IncludeCycle.beancount" 2 | -------------------------------------------------------------------------------- /test-cases/ParserInclude.IncludeDuplicate.beancount: -------------------------------------------------------------------------------- 1 | include "ParserInclude.IncludeRelative/Included1.beancount" 2 | 3 | 2004-01-27 * "QUITE OLD" 4 | Liabilities:US:Amex:BlueCash -122.02 USD 5 | Expenses:Food:Grocery 122.02 USD 6 | 7 | include "ParserInclude.IncludeRelative/Included1.beancount" 8 | -------------------------------------------------------------------------------- /test-cases/ParserInclude.IncludeDuplicate.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "duplicate include" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/ParserInclude.IncludeDuplicate/Included1.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-27 * "UNION MARKET" 2 | Liabilities:US:Amex:BlueCash -22.02 USD 3 | Expenses:Food:Grocery 22.02 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParserInclude.IncludeRelative.beancount: -------------------------------------------------------------------------------- 1 | include "ParserInclude.IncludeRelative/Included1.beancount" 2 | 3 | 2004-01-27 * "QUITE OLD" 4 | Liabilities:US:Amex:BlueCash -122.02 USD 5 | Expenses:Food:Grocery 122.02 USD 6 | 7 | include "ParserInclude.IncludeRelative/Included2.beancount" 8 | -------------------------------------------------------------------------------- /test-cases/ParserInclude.IncludeRelative.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2004 month: 1 day: 27 } 3 | transaction { 4 | flag: "*" 5 | narration: "QUITE OLD" 6 | postings { 7 | account: "Liabilities:US:Amex:BlueCash" 8 | spec { units { number { exact: "-122.02" } currency: "USD" } } 9 | } 10 | postings { 11 | account: "Expenses:Food:Grocery" 12 | spec { units { number { exact: "122.02" } currency: "USD" } } 13 | } 14 | } 15 | } 16 | directives { 17 | date { year: 2011 month: 2 day: 27 } 18 | transaction { 19 | flag: "*" 20 | narration: "ANOTHER MARKET" 21 | postings { 22 | account: "Liabilities:US:Amex:BlueCash" 23 | spec { units { number { exact: "-23.03" } currency: "USD" } } 24 | } 25 | postings { 26 | account: "Expenses:Food:Grocery" 27 | spec { units { number { exact: "23.03" } currency: "USD" } } 28 | } 29 | } 30 | } 31 | directives { 32 | date { year: 2014 month: 1 day: 27 } 33 | transaction { 34 | flag: "*" 35 | narration: "UNION MARKET" 36 | postings { 37 | account: "Liabilities:US:Amex:BlueCash" 38 | spec { units { number { exact: "-22.02" } currency: "USD" } } 39 | } 40 | postings { 41 | account: "Expenses:Food:Grocery" 42 | spec { units { number { exact: "22.02" } currency: "USD" } } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /test-cases/ParserInclude.IncludeRelative/Included1.beancount: -------------------------------------------------------------------------------- 1 | 2014-01-27 * "UNION MARKET" 2 | Liabilities:US:Amex:BlueCash -22.02 USD 3 | Expenses:Food:Grocery 22.02 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParserInclude.IncludeRelative/Included2.beancount: -------------------------------------------------------------------------------- 1 | 2011-02-27 * "ANOTHER MARKET" 2 | Liabilities:US:Amex:BlueCash -23.03 USD 3 | Expenses:Food:Grocery 23.03 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParserInclude.IncludeRelativeFromString.beancount: -------------------------------------------------------------------------------- 1 | include "some/relative/filename.beancount" 2 | -------------------------------------------------------------------------------- /test-cases/ParserInclude.IncludeRelativeFromString.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima resolves includes within the core parser 2 | # and we already have a test for including a file which exists, 3 | # so this is the failing case 4 | errors { 5 | message: "can't read file" 6 | } 7 | -------------------------------------------------------------------------------- /test-cases/ParserLinks.ParseLinks.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Something something" ^38784734873 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash -100 USD 4 | -------------------------------------------------------------------------------- /test-cases/ParserLinks.ParseLinks.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | links: "38784734873" 4 | transaction { 5 | flag: "*" 6 | narration: "Something something" 7 | postings { 8 | account: "Expenses:Restaurant" 9 | spec { units { number { exact: "100" } currency: "USD" } } 10 | } 11 | postings { 12 | account: "Assets:US:Cash" 13 | spec { units { number { exact: "-100" } currency: "USD" } } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/ParserOptions.InvalidAccountNames.beancount: -------------------------------------------------------------------------------- 1 | option "name_assets" "Actifs" 2 | option "name_liabilities" "Passifs" 3 | 2021-09-19 open Assets:US:Checking 4 | -------------------------------------------------------------------------------- /test-cases/ParserOptions.InvalidAccountNames.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2021 month: 9 day: 19 } 3 | open { account: "Assets:US:Checking" } 4 | } 5 | errors { 6 | message: "unknown account type Assets, must be one of Actifs, Passifs, Equity, Income, Expenses" 7 | } 8 | options { 9 | account_types { 10 | assets: 'Actifs' 11 | liabilities: 'Passifs' 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test-cases/ParserOptions.InvalidOption.beancount: -------------------------------------------------------------------------------- 1 | option "bladibla_invalid" "Some value" 2 | -------------------------------------------------------------------------------- /test-cases/ParserOptions.InvalidOption.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "unknown option" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/ParserOptions.LegacyTranslations.beancount: -------------------------------------------------------------------------------- 1 | option "name_assets" "Actifs" 2 | option "name_liabilities" "Passifs" 3 | -------------------------------------------------------------------------------- /test-cases/ParserOptions.LegacyTranslations.txtpb: -------------------------------------------------------------------------------- 1 | options { 2 | account_types { 3 | assets: 'Actifs' 4 | liabilities: 'Passifs' 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test-cases/ParserOptions.OptionListValue.beancount: -------------------------------------------------------------------------------- 1 | option "documents" "/path/docs/a" 2 | option "documents" "/path/docs/b" 3 | option "documents" "/path/docs/c" 4 | -------------------------------------------------------------------------------- /test-cases/ParserOptions.OptionListValue.txtpb: -------------------------------------------------------------------------------- 1 | options { 2 | documents: "/path/docs/a" 3 | documents: "/path/docs/b" 4 | documents: "/path/docs/c" 5 | } 6 | -------------------------------------------------------------------------------- /test-cases/ParserOptions.OptionSingleValue.beancount: -------------------------------------------------------------------------------- 1 | option "title" "Super Rich" 2 | -------------------------------------------------------------------------------- /test-cases/ParserOptions.OptionSingleValue.txtpb: -------------------------------------------------------------------------------- 1 | options { 2 | title: "Super Rich" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/ParserOptions.ReadonlyOption.beancount: -------------------------------------------------------------------------------- 1 | option "filename" "gniagniagniagniagnia" 2 | -------------------------------------------------------------------------------- /test-cases/ParserOptions.ReadonlyOption.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "unknown option" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/ParserOptions.ToleranceMapValue.beancount: -------------------------------------------------------------------------------- 1 | option "inferred_tolerance_default" "*:0" 2 | option "inferred_tolerance_default" "USD:0.05" 3 | option "inferred_tolerance_default" "JPY:0.5" 4 | -------------------------------------------------------------------------------- /test-cases/ParserOptions.ToleranceMapValue.txtpb: -------------------------------------------------------------------------------- 1 | options { 2 | inferred_tolerance_default { key: "*" value: "0" } 3 | inferred_tolerance_default { key: "JPY" value: "0.5" } 4 | inferred_tolerance_default { key: "USD" value: "0.05" } 5 | } 6 | -------------------------------------------------------------------------------- /test-cases/ParserPlugin.Plugin.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugin.unrealized" 2 | -------------------------------------------------------------------------------- /test-cases/ParserPlugin.Plugin.txtpb: -------------------------------------------------------------------------------- 1 | info { 2 | plugin { 3 | name: "beancount.plugin.unrealized" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test-cases/ParserPlugin.PluginAsOption.beancount: -------------------------------------------------------------------------------- 1 | option "plugin" "beancount.plugin.unrealized" 2 | -------------------------------------------------------------------------------- /test-cases/ParserPlugin.PluginAsOption.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "unknown option" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/ParserPlugin.PluginWithConfig.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugin.unrealized" "Unrealized" 2 | -------------------------------------------------------------------------------- /test-cases/ParserPlugin.PluginWithConfig.txtpb: -------------------------------------------------------------------------------- 1 | info { 2 | plugin { 3 | name: "beancount.plugin.unrealized" 4 | config: "Unrealized" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test-cases/PushPopMeta.PushmetaForgotten.beancount: -------------------------------------------------------------------------------- 1 | pushmeta location: "Lausanne, Switzerland" 2 | -------------------------------------------------------------------------------- /test-cases/PushPopMeta.PushmetaForgotten.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "invalid pushmeta" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/PushPopMeta.PushmetaInvalidPop.beancount: -------------------------------------------------------------------------------- 1 | popmeta location: 2 | -------------------------------------------------------------------------------- /test-cases/PushPopMeta.PushmetaInvalidPop.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "invalid popmeta" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/PushPopMeta.PushmetaNormal.beancount: -------------------------------------------------------------------------------- 1 | pushmeta location: "Lausanne, Switzerland" 2 | 3 | 2015-06-07 * "Something" 4 | Assets:Something 1 USD 5 | Assets:Something -1 USD 6 | 7 | popmeta location: 8 | -------------------------------------------------------------------------------- /test-cases/PushPopMeta.PushmetaNormal.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2015 month: 6 day: 7 } 3 | meta { 4 | kv { key: "location" value { text: "Lausanne, Switzerland" } } 5 | } 6 | transaction { 7 | flag: "*" 8 | narration: "Something" 9 | postings { 10 | account: "Assets:Something" 11 | spec { units { number { exact: "1" } currency: "USD" } } 12 | } 13 | postings { 14 | account: "Assets:Something" 15 | spec { units { number { exact: "-1" } currency: "USD" } } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test-cases/PushPopMeta.PushmetaOverride.beancount: -------------------------------------------------------------------------------- 1 | pushmeta location: "Lausanne, Switzerland" 2 | 3 | 2015-06-01 * "Something" 4 | Assets:Something 1 USD 5 | Assets:Something -1 USD 6 | 7 | pushmeta location: "Paris, France" 8 | 9 | 2015-06-02 * "Something" 10 | Assets:Something 1 USD 11 | Assets:Something -1 USD 12 | 13 | popmeta location: 14 | popmeta location: 15 | -------------------------------------------------------------------------------- /test-cases/PushPopMeta.PushmetaOverride.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2015 month: 6 day: 1 } 3 | meta { 4 | kv { key: "location" value { text: "Lausanne, Switzerland" } } 5 | } 6 | transaction { 7 | flag: "*" 8 | narration: "Something" 9 | postings { 10 | account: "Assets:Something" 11 | spec { units { number { exact: "1" } currency: "USD" } } 12 | } 13 | postings { 14 | account: "Assets:Something" 15 | spec { units { number { exact: "-1" } currency: "USD" } } 16 | } 17 | } 18 | } 19 | directives { 20 | date { year: 2015 month: 6 day: 2 } 21 | meta { 22 | kv { key: "location" value { text: "Paris, France" } } 23 | } 24 | transaction { 25 | flag: "*" 26 | narration: "Something" 27 | postings { 28 | account: "Assets:Something" 29 | spec { units { number { exact: "1" } currency: "USD" } } 30 | } 31 | postings { 32 | account: "Assets:Something" 33 | spec { units { number { exact: "-1" } currency: "USD" } } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test-cases/PushPopMeta.PushmetaShadow.beancount: -------------------------------------------------------------------------------- 1 | pushmeta location: "Lausanne, Switzerland" 2 | 3 | 2015-06-07 * "Something" 4 | location: "Paris, France" 5 | Assets:Something 1 USD 6 | Assets:Something -1 USD 7 | 8 | popmeta location: 9 | -------------------------------------------------------------------------------- /test-cases/PushPopMeta.PushmetaShadow.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2015 month: 6 day: 7 } 3 | meta { 4 | # ANOMALY: Lima does not allow duplicated keys for metadata. 5 | # The explicit key/values for a directive take precedence over 6 | # any on the push/pop stack. 7 | kv { key: "location" value { text: "Paris, France" } } 8 | } 9 | transaction { 10 | flag: "*" 11 | narration: "Something" 12 | postings { 13 | account: "Assets:Something" 14 | spec { units { number { exact: "1" } currency: "USD" } } 15 | } 16 | postings { 17 | account: "Assets:Something" 18 | spec { units { number { exact: "-1" } currency: "USD" } } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test-cases/PushPopTag.Multiple.beancount: -------------------------------------------------------------------------------- 1 | pushtag #stack-em-up 2 | pushtag #stack-em-up 3 | 4 | 2015-06-07 * "Something" 5 | Assets:Something 1 USD 6 | Assets:Something -1 USD 7 | 8 | poptag #stack-em-up 9 | poptag #stack-em-up 10 | -------------------------------------------------------------------------------- /test-cases/PushPopTag.Multiple.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2015 month: 6 day: 7 } 3 | tags: "stack-em-up" 4 | transaction { 5 | flag: "*" 6 | narration: "Something" 7 | postings { 8 | account: "Assets:Something" 9 | spec { units { number { exact: "1" } currency: "USD" } } 10 | } 11 | postings { 12 | account: "Assets:Something" 13 | spec { units { number { exact: "-1" } currency: "USD" } } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/PushPopTag.PopInvalidTag.beancount: -------------------------------------------------------------------------------- 1 | poptag #trip-to-nowhere 2 | -------------------------------------------------------------------------------- /test-cases/PushPopTag.PopInvalidTag.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "invalid poptag" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/PushPopTag.TagLeftUnclosed.beancount: -------------------------------------------------------------------------------- 1 | pushtag #trip-to-nowhere 2 | -------------------------------------------------------------------------------- /test-cases/PushPopTag.TagLeftUnclosed.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "invalid pushtag" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/SyntaxErrors.ErrorInPosting.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-01 open Assets:US:Cash 2 | 3 | 2013-05-02 * "Dinner" 4 | Expenses:Resta(urant 100 USD 5 | Assets:US:Cash -100 USD 6 | 7 | 2013-05-03 balance Assets:US:Cash -100 USD 8 | -------------------------------------------------------------------------------- /test-cases/SyntaxErrors.ErrorInPosting.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "found 'urant'" 3 | location { lineno: 4 } 4 | } 5 | -------------------------------------------------------------------------------- /test-cases/SyntaxErrors.ErrorInTransactionLine.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-01 open Assets:US:Cash 2 | 3 | 2013-05-02 * "Dinner" A:*:B 4 | Expenses:Restaurant 100 USD 5 | Assets:US:Cash -100 USD 6 | 7 | 2013-05-03 balance Assets:US:Cash -100 USD 8 | -------------------------------------------------------------------------------- /test-cases/SyntaxErrors.ErrorInTransactionLine.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "found 'A' expected something else" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/SyntaxErrors.NoFinalNewline.beancount: -------------------------------------------------------------------------------- 1 | 2014-11-02 * 2 | Assets:Something 1 USD 3 | Assets:Other -1 USD -------------------------------------------------------------------------------- /test-cases/SyntaxErrors.NoFinalNewline.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "found end of input expected '{', '@', '@@', or '\\n'" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/SyntaxErrors.SingleErrorTokenAtTopLevel.beancount: -------------------------------------------------------------------------------- 1 | Error:*:Token 2 | -------------------------------------------------------------------------------- /test-cases/SyntaxErrors.SingleErrorTokenAtTopLevel.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "found 'ERROR unrecognized token'" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.CostNegative.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | Assets:Investments:MSFT -10 MSFT {-200.00 USD} 3 | Assets:Investments:Cash 2000.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.CostNegative.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | # ANOMALY: Lima distinguishes empty string from no string 5 | narration: "" 6 | flag: "*" 7 | postings { 8 | account: "Assets:Investments:MSFT" 9 | spec { 10 | units { number { exact: "-10" } currency: "MSFT" } 11 | cost { per_unit { number { exact: "-200.00" } } currency: "USD" } 12 | } 13 | } 14 | postings { 15 | account: "Assets:Investments:Cash" 16 | spec { 17 | units { number { exact: "2000.00" } currency: "USD" } 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.PriceNegative.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | Assets:Investments:MSFT -10 MSFT @ -200.00 USD 3 | Assets:Investments:Cash 2000.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.PriceNegative.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "" 6 | postings { 7 | account: "Assets:Investments:MSFT" 8 | spec { 9 | units { number { exact: "-10" } currency: "MSFT" } 10 | # ANOMALY: Lima allows negative prices 11 | price { number { exact: "-200.00" } currency: "USD" } 12 | } 13 | } 14 | postings { 15 | account: "Assets:Investments:Cash" 16 | spec { 17 | units { number { exact: "2000.00" } currency: "USD" } 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.TotalCost.beancount: -------------------------------------------------------------------------------- 1 | ; ANOMALY: we use newstyle # for total, since 2 | ; {{ }} is unsupported in Lima parser 3 | 4 | 2013-05-18 * "" 5 | Assets:Investments:MSFT 10 MSFT {# 2,000 USD} 6 | Assets:Investments:Cash -20000 USD 7 | 8 | 2013-05-18 * "" 9 | Assets:Investments:MSFT 10 MSFT {# 2000 USD, 2014-02-25} 10 | Assets:Investments:Cash -20000 USD 11 | 12 | 2013-06-01 * "" 13 | Assets:Investments:MSFT -10 MSFT {# 2,000 USD} 14 | Assets:Investments:Cash 20000 USD 15 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.TotalCostInvalid.beancount: -------------------------------------------------------------------------------- 1 | ; ANOMALY: {{ }} is unsupported in Lima parser 2 | 2013-05-18 * "" 3 | Assets:Investments:MSFT 10 MSFT {100 # 2,000 USD} 4 | Assets:Investments:Cash -20000 USD 5 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.TotalCostInvalid.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: 2 | directives { 3 | date { year: 2013 month: 5 day: 18 } 4 | transaction { 5 | # ANOMALY: Lima distinguishes empty string from no string 6 | narration: "" 7 | flag: "*" 8 | postings { 9 | account: "Assets:Investments:MSFT" 10 | spec { 11 | units { number { exact: "10" } currency: "MSFT" } 12 | # ANOMALY: Lima accepts both per-unit and total 13 | cost { per_unit { number { exact: "100" } } total { number { exact: "2000" } } currency: "USD" } 14 | } 15 | } 16 | postings { 17 | account: "Assets:Investments:Cash" 18 | spec { units { number { exact: "-20000" } currency: "USD" } } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.TotalCostNegative.beancount: -------------------------------------------------------------------------------- 1 | ; ANOMALY: we use newstyle # for total, since 2 | ; {{ }} is unsupported in Lima parser 3 | 2013-05-18 * "" 4 | Assets:Investments:MSFT -10 MSFT {# -200.00 USD} 5 | Assets:Investments:Cash 200.00 USD 6 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.TotalCostNegative.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "" 6 | postings { 7 | account: "Assets:Investments:MSFT" 8 | spec { 9 | units { number { exact: "-10" } currency: "MSFT" } 10 | cost { total { number { exact: "-200.00" } } currency: "USD" } 11 | } 12 | } 13 | postings { 14 | account: "Assets:Investments:Cash" 15 | spec { 16 | units { number { exact: "200.00" } currency: "USD" } 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.TotalPriceInverted.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | Assets:Investments:MSFT 10 MSFT @@ -2000.00 USD 3 | Assets:Investments:Cash 20000.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.TotalPriceInverted.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "" 6 | postings { 7 | account: "Assets:Investments:MSFT" 8 | spec { 9 | units { number { exact: "10" } currency: "MSFT" } 10 | # ANOMALY: Lima parser does not reject negative prices 11 | price { number { exact: "-2000.00" } currency: "USD" is_total: true } 12 | } 13 | } 14 | postings { 15 | account: "Assets:Investments:Cash" 16 | spec { units { number { exact: "20000" } currency: "USD" } } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.TotalPriceNegative.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | Assets:Investments:MSFT -10 MSFT @@ 2000.00 USD 3 | Assets:Investments:Cash 20000.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.TotalPriceNegative.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "" 6 | postings { 7 | account: "Assets:Investments:MSFT" 8 | spec { 9 | units { number { exact: "-10" } currency: "MSFT" } 10 | price { number { exact: "2000.00" } currency: "USD" is_total: true } 11 | } 12 | } 13 | postings { 14 | account: "Assets:Investments:Cash" 15 | spec { units { number { exact: "20000" } currency: "USD" } } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.TotalPricePositive.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | Assets:Investments:MSFT 10 MSFT @@ 2000.00 USD 3 | Assets:Investments:Cash -2000.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.TotalPricePositive.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "" 6 | postings { 7 | account: "Assets:Investments:MSFT" 8 | spec { 9 | units { number { exact: "10" } currency: "MSFT" } 10 | price { number { exact: "2000.00" } currency: "USD" is_total: true } 11 | } 12 | } 13 | postings { 14 | account: "Assets:Investments:Cash" 15 | spec { 16 | units { number { exact: "-2000.00" } currency: "USD" } 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.TotalPriceWithMissing.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | Assets:Investments:MSFT MSFT @@ 2000.00 USD 3 | Assets:Investments:Cash 20000.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.TotalPriceWithMissing.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | # ANOMALY: Lima distinguishes empty string from no string 5 | narration: "" 6 | flag: "*" 7 | postings { 8 | account: "Assets:Investments:MSFT" 9 | spec { 10 | units { currency: "MSFT" } 11 | price { number { exact: "2000.00" } currency: "USD" is_total: true } 12 | } 13 | } 14 | postings { 15 | account: "Assets:Investments:Cash" 16 | spec { units { number { exact: "20000.00" } currency: "USD" } } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.TotalPriceWithMissing2.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | Assets:Investments:MSFT MSFT @@ 2000.00 USD 3 | Assets:Investments:Cash 20000.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.TotalPriceWithMissing2.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | # ANOMALY: Lima distinguishes empty string from no string 5 | narration: "" 6 | flag: "*" 7 | postings { 8 | account: "Assets:Investments:MSFT" 9 | spec { 10 | units { currency: "MSFT" } 11 | # ANOMALY: Lima parser does not validate totals against units, that is for post-processing 12 | price { number { exact: "2000" } currency: "USD" is_total: true } 13 | } 14 | } 15 | postings { 16 | account: "Assets:Investments:Cash" 17 | spec { units { number { exact: "20000.00" } currency: "USD" } } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.ZeroAmount.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | Assets:Investments:MSFT 0 MSFT {200.00 USD} 3 | Assets:Investments:Cash 0 USD 4 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.ZeroAmount.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | # ANOMALY: Lima distinguishes empty string from no string 5 | narration: "" 6 | flag: "*" 7 | postings { 8 | account: "Assets:Investments:MSFT" 9 | spec { 10 | units { number { exact: "0" } currency: "MSFT" } 11 | cost { per_unit { number { exact: "200.00" } } currency: "USD" } 12 | } 13 | } 14 | postings { 15 | account: "Assets:Investments:Cash" 16 | spec { 17 | units { number { exact: "0" } currency: "USD" } 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.ZeroCost.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | Assets:Investments:MSFT -10 MSFT {0.00 USD} 3 | Assets:Investments:Cash 0.00 USD 4 | -------------------------------------------------------------------------------- /test-cases/TotalsAndSigns.ZeroCost.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | # ANOMALY: Lima distinguishes empty string from no string 5 | narration: "" 6 | flag: "*" 7 | postings { 8 | account: "Assets:Investments:MSFT" 9 | spec { 10 | units { number { exact: "-10" } currency: "MSFT" } 11 | cost { per_unit { number { exact: "0.00" } } currency: "USD" } 12 | } 13 | } 14 | postings { 15 | account: "Assets:Investments:Cash" 16 | spec { 17 | units { number { exact: "0.00" } currency: "USD" } 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test-cases/Transactions.BlankLineNotAllowed.beancount: -------------------------------------------------------------------------------- 1 | 2014-04-20 * "Busted!" 2 | Assets:Checking 100 USD 3 | 4 | Assets:Checking -99 USD 5 | -------------------------------------------------------------------------------- /test-cases/Transactions.BlankLineNotAllowed.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: this is not an error in Lima, we allow blank lines 2 | directives { 3 | date { year: 2014 month: 4 day: 20 } 4 | transaction { 5 | flag: "*" 6 | narration: "Busted!" 7 | postings { 8 | account: "Assets:Checking" 9 | spec { units { number { exact: "100" } currency: "USD" } } 10 | } 11 | postings { 12 | account: "Assets:Checking" 13 | spec { units { number { exact: "-99" } currency: "USD" } } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/Transactions.BlankLineWithSpacesNotAllowed.beancount: -------------------------------------------------------------------------------- 1 | 2014-04-20 * "Busted!" 2 | Assets:Checking 100 USD 3 | 4 | Assets:Checking -99 USD 5 | -------------------------------------------------------------------------------- /test-cases/Transactions.BlankLineWithSpacesNotAllowed.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 4 day: 20 } 3 | transaction { 4 | flag: "*" 5 | narration: "Busted!" 6 | postings { 7 | account: "Assets:Checking" 8 | spec { units { number { exact: "100" } currency: "USD" } } 9 | } 10 | postings { 11 | account: "Assets:Checking" 12 | spec { units { number { exact: "-99" } currency: "USD" } } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/Transactions.EmptyNarration.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "" 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash -100 USD 4 | -------------------------------------------------------------------------------- /test-cases/Transactions.EmptyNarration.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | # ANOMALY: Lima distinguishes empty string from no string 6 | narration: "" 7 | postings { 8 | account: "Expenses:Restaurant" 9 | spec { units { number { exact: "100" } currency: "USD" } } 10 | } 11 | postings { 12 | account: "Assets:US:Cash" 13 | spec { units { number { exact: "-100" } currency: "USD" } } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/Transactions.Imbalance.beancount: -------------------------------------------------------------------------------- 1 | 2014-04-20 * "Busted!" 2 | Assets:Checking 100 USD 3 | Assets:Checking -99 USD 4 | -------------------------------------------------------------------------------- /test-cases/Transactions.Imbalance.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 4 day: 20 } 3 | transaction { 4 | flag: "*" 5 | narration: "Busted!" 6 | postings { 7 | account: "Assets:Checking" 8 | spec { units { number { exact: "100" } currency: "USD" } } 9 | } 10 | postings { 11 | account: "Assets:Checking" 12 | spec { units { number { exact: "-99" } currency: "USD" } } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/Transactions.LinkAndThenTag.beancount: -------------------------------------------------------------------------------- 1 | 2014-04-20 * "Money from CC" ^610fa7f17e7a #trip 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash -100 USD 4 | -------------------------------------------------------------------------------- /test-cases/Transactions.LinkAndThenTag.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 4 day: 20 } 3 | tags: "trip" 4 | links: "610fa7f17e7a" 5 | transaction { 6 | flag: "*" 7 | narration: "Money from CC" 8 | postings { 9 | account: "Expenses:Restaurant" 10 | spec { units { number { exact: "100" } currency: "USD" } } 11 | } 12 | postings { 13 | account: "Assets:US:Cash" 14 | spec { units { number { exact: "-100" } currency: "USD" } } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test-cases/Transactions.MultipleTagsLinksOnMetadataLine.beancount: -------------------------------------------------------------------------------- 1 | 2014-04-20 * "Links and tags on subsequent lines" #basetag ^baselink 2 | #tag1 #tag2 ^link1 3 | Assets:Checking 100 USD 4 | Assets:Checking -99 USD 5 | -------------------------------------------------------------------------------- /test-cases/Transactions.MultipleTagsLinksOnMetadataLine.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "found 'tag2'" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/Transactions.NoNarration.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash -100 USD 4 | -------------------------------------------------------------------------------- /test-cases/Transactions.NoNarration.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | postings { 6 | account: "Expenses:Restaurant" 7 | spec { units { number { exact: "100" } currency: "USD" } } 8 | } 9 | postings { 10 | account: "Assets:US:Cash" 11 | spec { units { number { exact: "-100" } currency: "USD" } } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test-cases/Transactions.NoPostings.beancount: -------------------------------------------------------------------------------- 1 | 2014-07-17 * "(JRN) INTRA-ACCOUNT TRANSFER" ^795422780 2 | -------------------------------------------------------------------------------- /test-cases/Transactions.NoPostings.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 7 day: 17 } 3 | links: "795422780" 4 | transaction { 5 | flag: "*" 6 | narration: "(JRN) INTRA-ACCOUNT TRANSFER" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test-cases/Transactions.PayeeNoNarration.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Mermaid Inn" 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash -100 USD 4 | -------------------------------------------------------------------------------- /test-cases/Transactions.PayeeNoNarration.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Mermaid Inn" 6 | postings { 7 | account: "Expenses:Restaurant" 8 | spec { units { number { exact: "100" } currency: "USD" } } 9 | } 10 | postings { 11 | account: "Assets:US:Cash" 12 | spec { units { number { exact: "-100" } currency: "USD" } } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/Transactions.Simple1.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Nice dinner at Mermaid Inn" 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash -100 USD 4 | -------------------------------------------------------------------------------- /test-cases/Transactions.Simple1.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Nice dinner at Mermaid Inn" 6 | postings { 7 | account: "Expenses:Restaurant" 8 | spec { units { number { exact: "100" } currency: "USD" } } 9 | } 10 | postings { 11 | account: "Assets:US:Cash" 12 | spec { units { number { exact: "-100" } currency: "USD" } } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test-cases/Transactions.Simple2.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "Nice dinner at Mermaid Inn" 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash -100 USD 4 | 5 | 2013-05-20 * "Duane Reade" "Toothbrush" 6 | Expenses:BathroomSupplies 4 USD 7 | Assets:US:BestBank:Checking -4 USD 8 | -------------------------------------------------------------------------------- /test-cases/Transactions.Simple2.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2013 month: 5 day: 18 } 3 | transaction { 4 | flag: "*" 5 | narration: "Nice dinner at Mermaid Inn" 6 | postings { 7 | account: "Expenses:Restaurant" 8 | spec { units { number { exact: "100" } currency: "USD" } } 9 | } 10 | postings { 11 | account: "Assets:US:Cash" 12 | spec { units { number { exact: "-100" } currency: "USD" } } 13 | } 14 | } 15 | } 16 | directives { 17 | date { year: 2013 month: 5 day: 20 } 18 | transaction { 19 | flag: "*" 20 | payee: "Duane Reade" 21 | narration: "Toothbrush" 22 | postings { 23 | account: "Expenses:BathroomSupplies" 24 | spec { units { number { exact: "4" } currency: "USD" } } 25 | } 26 | postings { 27 | account: "Assets:US:BestBank:Checking" 28 | spec { units { number { exact: "-4" } currency: "USD" } } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test-cases/Transactions.TagThenLink.beancount: -------------------------------------------------------------------------------- 1 | 2014-04-20 * #trip "Money from CC" ^610fa7f17e7a 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash -100 USD 4 | -------------------------------------------------------------------------------- /test-cases/Transactions.TagThenLink.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "found '\"Money from CC\"' expected something else" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/Transactions.TagsAfterFirstLine.beancount: -------------------------------------------------------------------------------- 1 | 2014-04-20 * "Links and tags on subsequent lines" #basetag ^baselink 2 | #tag1 3 | ^link1 4 | #tag2 5 | ^link2 6 | Assets:Checking 100 USD 7 | Assets:Checking -99 USD 8 | -------------------------------------------------------------------------------- /test-cases/Transactions.TagsAfterFirstLine.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 4 day: 20 } 3 | meta { 4 | kv { value { tag: "tag1" } } 5 | kv { value { link: "link1" } } 6 | kv { value { tag: "tag2" } } 7 | kv { value { link: "link2" } } 8 | } 9 | tags: "basetag" 10 | links: "baselink" 11 | transaction { 12 | flag: "*" 13 | narration: "Links and tags on subsequent lines" 14 | postings { 15 | account: "Assets:Checking" 16 | spec { units { number { exact: "100" } currency: "USD" } } 17 | } 18 | postings { 19 | account: "Assets:Checking" 20 | spec { units { number { exact: "-99" } currency: "USD" } } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test-cases/Transactions.TagsAfterFirstPosting.beancount: -------------------------------------------------------------------------------- 1 | 2014-04-20 * "Links and tags on subsequent lines" #basetag ^baselink 2 | Assets:Checking 100 USD 3 | #tag1 4 | Assets:Checking -99 USD 5 | -------------------------------------------------------------------------------- /test-cases/Transactions.TagsAfterFirstPosting.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: Lima counts any metadata after a posting as associated with that posting 2 | # which seems to match what is described at 3 | # https://beancount.github.io/docs/beancount_language_syntax.html#metadata_1 4 | # which also bears the comment 5 | # (the additional indentation from the posting is not strictly necessary but it helps with readability). 6 | # Futhermore, wherever a line of metadata is accepted, so too is a tag or a link. 7 | directives { 8 | date { year: 2014 month: 4 day: 20 } 9 | tags: "basetag" 10 | links: "baselink" 11 | transaction { 12 | flag: "*" 13 | narration: "Links and tags on subsequent lines" 14 | postings { 15 | account: "Assets:Checking" 16 | spec { units { number { exact: "100" } currency: "USD" } } 17 | meta { kv { value { tag: "tag1" } } } 18 | } 19 | postings { 20 | account: "Assets:Checking" 21 | spec { units { number { exact: "-99" } currency: "USD" } } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test-cases/Transactions.TooManyStrings.beancount: -------------------------------------------------------------------------------- 1 | 2013-05-18 * "A" "B" "C" 2 | Expenses:Restaurant 100 USD 3 | Assets:US:Cash -100 USD 4 | -------------------------------------------------------------------------------- /test-cases/Transactions.TooManyStrings.txtpb: -------------------------------------------------------------------------------- 1 | errors { 2 | message: "found '\"C\"' expected something else" 3 | } 4 | -------------------------------------------------------------------------------- /test-cases/Transactions.ZeroCosts.beancount: -------------------------------------------------------------------------------- 1 | 2014-04-20 * "Like a conversion entry" 2 | Assets:Investment 10 HOOL {0 USD} 3 | Assets:Cash 0 USD 4 | -------------------------------------------------------------------------------- /test-cases/Transactions.ZeroCosts.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 4 day: 20 } 3 | transaction { 4 | flag: "*" 5 | narration: "Like a conversion entry" 6 | postings { 7 | account: "Assets:Investment" 8 | spec { units { number { exact: "10" } currency: "HOOL" } 9 | cost { per_unit { number { exact: "0" } } currency: "USD" } } 10 | } 11 | postings { 12 | account: "Assets:Cash" 13 | spec { units { number { exact: "0" } currency: "USD" } } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/Transactions.ZeroPrices.beancount: -------------------------------------------------------------------------------- 1 | 2014-04-20 * "Like a conversion entry" 2 | Equity:Conversions 100 USD @ 0 XFER 3 | Equity:Conversions 101 CAD @ 0 XFER 4 | Equity:Conversions 102 AUD @ 0 XFER 5 | -------------------------------------------------------------------------------- /test-cases/Transactions.ZeroPrices.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 4 day: 20 } 3 | transaction { 4 | flag: "*" 5 | narration: "Like a conversion entry" 6 | postings { 7 | account: "Equity:Conversions" 8 | spec { units { number { exact: "100" } currency: "USD" } 9 | price { number { exact: "0" } currency: "XFER" } } 10 | } 11 | postings { 12 | account: "Equity:Conversions" 13 | spec { units { number { exact: "101" } currency: "CAD" } 14 | price { number { exact: "0" } currency: "XFER" } } 15 | } 16 | postings { 17 | account: "Equity:Conversions" 18 | spec { units { number { exact: "102" } currency: "AUD" } 19 | price { number { exact: "0" } currency: "XFER" } } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test-cases/Transactions.ZeroUnits.beancount: -------------------------------------------------------------------------------- 1 | 2014-04-20 * "Zero number of units" 2 | Assets:Investment 0 HOOL {500.00 USD} 3 | Assets:Cash 0 USD 4 | -------------------------------------------------------------------------------- /test-cases/Transactions.ZeroUnits.txtpb: -------------------------------------------------------------------------------- 1 | directives { 2 | date { year: 2014 month: 4 day: 20 } 3 | transaction { 4 | flag: "*" 5 | narration: "Zero number of units" 6 | postings { 7 | account: "Assets:Investment" 8 | spec { units { number { exact: "0" } currency: "HOOL" } 9 | cost { per_unit { number { exact: "500.00" } } currency: "USD" } } 10 | } 11 | postings { 12 | account: "Assets:Cash" 13 | spec { units { number { exact: "0" } currency: "USD" } } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test-cases/Whitespace.IndentError0.beancount: -------------------------------------------------------------------------------- 1 | 2020-07-28 open Assets:Foo 2 | 2020-07-28 open Assets:Bar 3 | -------------------------------------------------------------------------------- /test-cases/Whitespace.IndentError0.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: if there are parse errors, Lima only returns the errors 2 | # and we don't test the error location here 3 | errors { 4 | message: "found '2020-07-28' expected something else" 5 | } 6 | -------------------------------------------------------------------------------- /test-cases/Whitespace.IndentError1.beancount: -------------------------------------------------------------------------------- 1 | 2020-07-28 open Assets:Foo 2 | 3 | 2020-07-28 open Assets:Bar 4 | -------------------------------------------------------------------------------- /test-cases/Whitespace.IndentError1.txtpb: -------------------------------------------------------------------------------- 1 | # ANOMALY: if there are parse errors, Lima only returns the errors 2 | # and we don't test the error location here 3 | errors { 4 | message: "found '2020-07-28' expected something else" 5 | } 6 | --------------------------------------------------------------------------------