Skip to content

automatonCompiler: tests of the named indexes of the sub-automatons and of a repetition in an alternative - #250

Merged
kleag merged 2 commits into
masterfrom
subautomaton-named-index-tests
Nov 28, 2026
Merged

kleag merged 2 commits into
masterfrom
subautomaton-named-index-tests

Conversation

@kleag

@kleag kleag commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Tests and documentation of the named indexes of the sub-automatons (#20, implemented since the initial import but neither tested nor documented).

  • SubPartIndexTest: resolution of the indexes of the constraints: numeric indexes and first/last/current/next, a name at the sub-automaton's level (1.head → 1.4) or at the first level (head → 4), a name defined by two sub-automatons (the first definition wins), an unknown name (index 0). The lost separator after a named index (1.head.2 gives 1.42) is an expected failure (QEXPECT_FAIL).
  • SubAutomatonNamedIndexTest: compiles with compile-rules the same rule written with right.1.2 and with right.1.head (head=2 and index head=2), and checks that the compiled files are identical; a rule on right.1.1 gives a different file. --configDir/--resourcesDir are given explicitly: by default compile-rules also searches ~/.local/share/lima, whose plugins may not match the build.
  • RepetitionInAlternativeTest (Rule parser accept wrong syntax and generate buggy automaton #34): ($NOUN|$PROPN|t_capital_1st{1-3}) compiles to the same file as ($NOUN|$PROPN|(t_capital_1st){1-3}) (the repetition applies to its element only), and to a different file than ($NOUN|$PROPN|t_capital_1st){1-3}. The compile-rules helper of the tests is shared in tests/CompileRules.h.
  • SubPartIndex and SubAutomaton are exported (LIMA_AUTOMATONCOMPILER_EXPORT) so that the unit test links on Windows.
  • docs/reference/modex-rules.md: a paragraph on the named indexes.

The tests pass locally (Linux, Debug); the Windows and macOS builds are checked by this PR's CI.

🤖 Generated with Claude Code

SubPartIndexTest checks how the indexes of the constraints are resolved,
including the names defined in the sub-automatons (head=4, then right.1.head).
SubAutomatonNamedIndexTest compiles with compile-rules the same rule written
with right.1.2 and with right.1.head (head=2 or index head=2) and checks that
the compiled rules are identical.

The lost separator after a named index (head.2 gives 42) is an expected
failure. SubPartIndex and SubAutomaton are exported for the test on Windows.
The named indexes are documented in the ModEx rules reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 12 complexity · 0 duplication

Metric Results
Complexity 12
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

…ive (#34)

(a|b|c{1-3}) compiles as (a|b|(c){1-3}), not as (a|b|c){1-3}. The
compile-rules helper of the tests is shared in CompileRules.h.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kleag kleag changed the title automatonCompiler: tests of the named indexes of the sub-automatons automatonCompiler: tests of the named indexes of the sub-automatons and of a repetition in an alternative Nov 28, 2026
@kleag
kleag merged commit f38ed35 into master Nov 28, 2026
10 of 12 checks passed
@kleag
kleag deleted the subautomaton-named-index-tests branch November 28, 2026 23:02
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.

1 participant