Skip to content

refactor: consolidate directive grammar API - #234

Merged
rlippmann merged 6 commits into
mainfrom
grammar_cleanup
Aug 11, 2026
Merged

refactor: consolidate directive grammar API#234
rlippmann merged 6 commits into
mainfrom
grammar_cleanup

Conversation

@rlippmann

Copy link
Copy Markdown
Owner

What changed

  • Made decompose_directive() the authoritative grammar parsing boundary.
  • Added explicit invalid directive syntax classification:
    • CanonicalDirective
    • no directive (None)
    • InvalidDirectiveSyntax
  • Reduced grammar API leakage:
    • made directive rendering internal;
    • made parser classification helpers internal.
  • Consolidated grammar-defining literals and directive syntax constants.
  • Preserved engine semantic behavior; this PR only changes grammar classification and ownership boundaries.

Why

The previous grammar API returned only CanonicalDirective | None, which required downstream consumers to reconstruct grammar distinctions.

This change makes grammar responsible for syntax classification while keeping semantic application in the engine layer.

Checklist

  • pre-commit run (uv run pre-commit run --all-files)
  • tests pass (uv run pytest)

@rlippmann
rlippmann merged commit 3e6fe94 into main Aug 11, 2026
16 checks passed
@rlippmann
rlippmann deleted the grammar_cleanup branch August 11, 2026 04:31
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