release 0.3.0: multi-module reshape + parseRuleAt API#21
Conversation
…ental/formatter shells)
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe PR restructures the Maven project from a single-module JAR layout to a multi-module reactor ( Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant InterpreterParser as Parser<br/>(Interpreter)
participant PegEngine
participant ParsingContext
participant Rule as Grammar<br/>Rule
Client->>InterpreterParser: parseRuleAt(ruleId, input, offset)
InterpreterParser->>PegEngine: parseRuleAt(ruleId, input, offset)
PegEngine->>PegEngine: resolveRuleName(ruleId)
PegEngine->>PegEngine: computeLocation(offset)
PegEngine->>ParsingContext: create & position at offset
PegEngine->>Rule: parseRule(ruleId)
Rule->>ParsingContext: consume input
ParsingContext-->>Rule: CST node
Rule-->>PegEngine: CstNode
PegEngine->>PegEngine: wrap in PartialParse(node, endOffset)
PegEngine-->>Client: Result<PartialParse>
sequenceDiagram
participant Client
participant GenParser as Generated<br/>Parser
participant Dispatch as RuleId<br/>Dispatch
participant ParseMethod as parse_rule()<br/>Method
Client->>GenParser: parseRuleAt(ruleId, input, offset)
GenParser->>GenParser: validate inputs
GenParser->>Dispatch: lookup(ruleId)
Dispatch-->>GenParser: supplier
GenParser->>GenParser: seekTo(offset)
GenParser->>ParseMethod: invoke via supplier
ParseMethod->>ParseMethod: consume input
ParseMethod-->>GenParser: CstNode
GenParser->>GenParser: wrap in PartialParse(node, pos)
GenParser-->>Client: Result<PartialParse>
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
Infrastructure-only minor-bump release. Two deliverables, both setting up 0.3.1+:
peglib-parent(packaging=pom); current content moves topeglib-core/sub-module. Shell modulespeglib-incremental/andpeglib-formatter/reserved for 0.3.1 and 0.3.3. Existing sibling modulespeglib-maven-pluginandpeglib-playgroundbecome proper reactor children.parseRuleAtAPI. NewParser#parseRuleAt(Class<? extends RuleId>, String, int) → Result<PartialParse>. Implemented in interpreter and generator emission. Enables 0.3.1's incremental-reparse boundary algorithm perdocs/incremental/SPEC.md§5.6.Maven coordinate preserved
org.pragmatica-lite:peglib:0.3.0still resolves to the same primary jar consumers got in 0.2.x — the artifact lives in a sub-directory, coordinate unchanged. Downstream pins need no updates.Tests
Aggregate across all modules: 701 passing, 1 skipped, 0 failures.
peglib-core: 663 → 674 (+11ParseRuleAtTest)peglib-maven-plugin: 5 (unchanged)peglib-playground: 22 (unchanged)GeneratorFlagInertnessTest3/3Breaking changes
None for consumers of
org.pragmatica-lite:peglib. The new shell modules and parent pom are additive.Test plan
mvn install -DskipTestsat root — reactor buildsmvn testat root — 701/701 + 1 skippedjar tf ~/.m2/.../peglib-0.3.0.jarhas all expected classescd peglib-maven-plugin && mvn test— sibling plugin still workscd peglib-playground && mvn test— sibling playground still worksSummary by CodeRabbit
New Features
parseRuleAtAPI enabling partial parsing at specific input offsets, returning aPartialParserecord with the parsed CST node and endpoint offset.Documentation
Project Structure
peglib-parent) withpeglib-coreas primary artifact and placeholder modules for incremental parsing and code formatting.