Skip to content

Namespace leex/yecc modules to localize_* to coexist with ex_cldr#40

Merged
kipcole9 merged 1 commit into
elixir-localize:mainfrom
loopsocial:namespace-parsers
Jul 11, 2026
Merged

Namespace leex/yecc modules to localize_* to coexist with ex_cldr#40
kipcole9 merged 1 commit into
elixir-localize:mainfrom
loopsocial:namespace-parsers

Conversation

@jerryluk

Copy link
Copy Markdown
Contributor

Problem

localize's grammar modules were extracted from ex_cldr with their module names intact — rbnf_parser, rbnf_lexer, plural_rules_parser, plural_rules_lexer, decimal_formats_parser, decimal_formats_lexer, date_time_format_lexer. An application that depends on both localize (e.g. via ex_money >= 6) and ex_cldr/ex_cldr_numbers (still common for Cldr.Number, territories, locale display) cannot assemble a release:

** (Mix) Duplicated modules:
	rbnf_parser specified in ex_cldr_numbers and localize
	rbnf_lexer specified in ex_cldr_numbers and localize
	plural_rules_parser specified in ex_cldr and localize
	plural_rules_lexer specified in ex_cldr and localize
	decimal_formats_parser specified in ex_cldr_numbers and localize
	decimal_formats_lexer specified in ex_cldr_numbers and localize

This is invisible in dev/test (the BEAM just loads one of them) and only surfaces at mix release, so it tends to be discovered late, in deploy pipelines.

Change

Mechanical rename of the src/ grammar files to a localize_ prefix (module name = filename for leex/yecc) plus the 12 internal call sites and one test assertion that pattern-matches the yecc error tuple. The full suite passes unchanged (27,910 tests).

Happy to adjust naming if you'd prefer a different prefix. Found while upgrading ex_money 5→6 in an app that keeps ex_cldr for its own formatting.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JUoqST4frEDRNjMyVnKZhT

localize's parsers were extracted from ex_cldr with their module names
intact (rbnf_parser, plural_rules_lexer, ...), so an app that depends on
both localize (e.g. via ex_money 6) and ex_cldr/ex_cldr_numbers fails
`mix release` with "Duplicated modules" — the BEAM has one flat module
namespace and release assembly rejects the clash. Renaming the grammar
files (module name = filename for leex/yecc) with a localize_ prefix and
updating the 12 call sites resolves it; full suite passes unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JUoqST4frEDRNjMyVnKZhT
@kipcole9 kipcole9 merged commit 4e03a0e into elixir-localize:main Jul 11, 2026
9 of 10 checks passed
@kipcole9

Copy link
Copy Markdown
Contributor

Thanks very much @jerryluk, you're right - I should have changed these module names but because they are in Erlang-land I missed them during the sweep. And yes, now some divergence - particularly in rbnf_lexer to improve compilation performance (a lot!) and rbnf_parser (to fix bugs).

I'll get a new release out by the end of the weekend.

@kipcole9

Copy link
Copy Markdown
Contributor

I've published localize version 0.49.0 with the following changelog entry:

[0.49.0] — July 12th, 2026

Fixed

  • Change the namespaces on the leex lexers and yecc parsers to avoid module name clash with ex_cldr versions. Thanks to @jerryluk for the PR. Closes Namespace leex/yecc modules to localize_* to coexist with ex_cldr #40.

  • The coverage ignore list follows the renamed lexer/parser modules, restoring measured coverage above the 90% CI threshold; a guard test now fails when an ignore-list entry names a module that no longer exists.

Thanks again for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants