Repository navigation
fix: support full Unicode in account names (Cyrillic, CJK, Arabic, etc.) - #817
Merged
Merged
Conversation
Closes #816 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates rustledger’s account-name handling to accept Unicode scripts (e.g., Cyrillic and CJK) as valid account component starts, aligning parser behavior with the stated goal of supporting non-Latin account names.
Changes:
- Expand the Logos lexer
Accounttoken regex to allow Unicode letter categories at component starts. - Update parser integration/unit tests to expect Unicode accounts to parse successfully.
- Adjust validation helper logic/comments toward Unicode support (but see review comments for a correctness gap).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
crates/rustledger-validate/src/validators/helpers.rs |
Updates account-component start validation logic intended to allow Unicode starts. |
crates/rustledger-parser/src/logos_lexer.rs |
Expands the Account token regex and updates documentation/tests for Unicode accounts. |
crates/rustledger-parser/tests/parser_integration_test.rs |
Changes integration test to accept Unicode accounts during parsing. |
crates/rustledger-parser/src/winnow_parser.rs |
Updates parser unit test to assert Unicode accounts parse without errors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
📊 Benchmark Results
vs main branch (2026-04-14)
What do these numbers mean?
|
Add Unicode account examples to syntax.md showing Cyrillic and CJK account types. Remove stale reference to beancount C lexer in validator comment. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
…docs Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Allow account name components to start with any Unicode uppercase letter or CJK ideograph, not just ASCII
[A-Z].Before / After
Why
The beancount v3 spec restricts account components to start with ASCII
[A-Z]. This is an artifact of the C flex lexer's poor Unicode support, not a meaningful language design choice. It has been a longstanding pain point for non-Latin users:\p{Lu}butis_root_account()still uses[A-Z]. Inconsistent.Python beancount v2 partially supports Unicode uppercase via
\p{Lu}in the account regex, but internal functions are inconsistent. Rustledger now fully supports it throughout.Change
Lexer regex:
[A-Z]→[\p{Lu}\p{Lo}\p{Lt}]\p{Lu}— Unicode uppercase letters (Latin A-Z, Cyrillic А-Я, Greek Α-Ω, etc.)\p{Lo}— Letters without case (CJK ideographs, Arabic, Hebrew, etc.)\p{Lt}— Titlecase lettersEmoji and symbols remain rejected (not letters).
Test plan
Капитал:Retained-Earnings✓资产:银行:支票✓Assets:銀行口座✓Assets:CORP✨✗Closes #816
🤖 Generated with Claude Code