Releases: siy/java-peglib
Releases · siy/java-peglib
v0.1.8
Changes
Changed
- Java 25 Grammar Sync - Synced grammar improvements from jbct-cli
- Added cut operators (
^) after discriminating keywords for better error messages - Added keyword helper rules with word boundaries (
ClassKW,InterfaceKW,EnumKW, etc.) - Added token boundaries to
PrimType,Modifier,Literal,Primaryrules - Updated
RefTypelookahead to handleType.@Annotation Innercorrectly - Added
TypeExprrule forType.classandType::newexpressions - Updated operator rules with lookaheads to prevent compound operator conflicts
- Added
RecordDecllookahead to distinguish from methods/fields named 'record'
- Added cut operators (
Fixed
- Farthest Failure Tracking - Error positions now report at the furthest parsing position instead of 1:1 after backtracking
- Added
furthestPos/furthestFailuretracking to both AST and CST generated parsers - Replaces null checks with
Option<T>in CST parser generator for consistency - Fixed infinite recursion in AST parser when whitespace rule contained
*quantifier - Fixed "unexpected input" errors to also use furthest failure position
- Added
Added
- Error Position Tests - 3 new tests verifying farthest failure tracking in generated parsers
- Test count: 305 → 308
Release 0.1.7
Changes
Changed
- JBCT Compliance Refactoring - Replaced null usage with
Option<T>throughout the codebaseParseResultWithDiagnostics.node()returnsOption<CstNode>ParseModeusesOptionfor nullable fieldsParsingContextpackrat cache usesOptionDiagnostic.code()returnsOption<String>- Generated
ParseResultandCstParseResultuseOptionfor nullable fields
Added
- JBCT Maven Plugin - Added jbct-maven-plugin 0.4.1 for code formatting and linting
- Internal Type Tests - 24 new tests for ParseResult, ParsingContext, and generated parser diagnostics
Test count: 271 → 305
Maven
<dependency>
<groupId>org.pragmatica-lite</groupId>
<artifactId>peglib</artifactId>
<version>0.1.7</version>
</dependency>v0.1.6
Added
-
AST Support in Generated Parsers
- Generated CST parsers now include
AstNodetype andparseAst()method - Allows parsing directly to AST (without trivia) from generated parsers
- Generated CST parsers now include
-
Packrat Toggle in Generated Parsers
- Added
setPackratEnabled(boolean)method to generated parsers - Allows disabling memoization at runtime to reduce memory usage for large inputs
- Added
-
Unlimited Action Variable Support
- Action code now supports unlimited
$Npositional variables (previously limited to$1-$20) - Uses regex-based substitution for flexibility
- Action code now supports unlimited
Fixed
-
Grammar Validation
- Implemented
Grammar.validate()to detect undefined rule references - Recursively walks all expressions and reports first undefined reference with location
- Implemented
-
Thread Safety in Whitespace Skipping
- Moved
skippingWhitespaceflag fromPegEngine(per-instance) toParsingContext(per-parse) - Fixes potential race conditions when reusing parser instances across threads
- Moved
-
Packrat Cache Key Collision Risk
- Changed cache key from
hashCode()to unique sequential IDs - Eliminates theoretical collision bugs with different rule names having same hash
- Changed cache key from
Changed
-
Builder API Naming Standardized
PegParser.Buildermethods renamed:withPackrat()→packrat(),withTrivia()→trivia(),withErrorRecovery()→recovery()- Removed duplicate
ParserConfig.Builder(unused)
-
Code Simplification
- Consolidated 3 duplicate expression parsing switch statements into unified
parseExpressionWithMode() - Extracted
buildParseError()helper to eliminate duplicate error message construction - Removed unused
SemanticValues.choice,SourceLocation.advanceColumn()/advanceLine()methods - ~120 lines of duplicate code eliminated
- Consolidated 3 duplicate expression parsing switch statements into unified
-
Test count: 268 → 271
-
Updated pragmatica-lite dependency: 0.8.4 → 0.9.0
📦 Maven Central
```xml
org.pragmatica-lite
peglib
0.1.6
```