Skip to content

Releases: siy/java-peglib

v0.1.8

31 Dec 13:47
@siy siy
a3e70b9

Choose a tag to compare

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, Primary rules
    • Updated RefType lookahead to handle Type.@Annotation Inner correctly
    • Added TypeExpr rule for Type.class and Type::new expressions
    • Updated operator rules with lookaheads to prevent compound operator conflicts
    • Added RecordDecl lookahead to distinguish from methods/fields named 'record'

Fixed

  • Farthest Failure Tracking - Error positions now report at the furthest parsing position instead of 1:1 after backtracking
    • Added furthestPos/furthestFailure tracking 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

  • Error Position Tests - 3 new tests verifying farthest failure tracking in generated parsers
  • Test count: 305 → 308

Release 0.1.7

30 Dec 12:44
@siy siy
bfba16c

Choose a tag to compare

Changes

Changed

  • JBCT Compliance Refactoring - Replaced null usage with Option<T> throughout the codebase
    • ParseResultWithDiagnostics.node() returns Option<CstNode>
    • ParseMode uses Option for nullable fields
    • ParsingContext packrat cache uses Option
    • Diagnostic.code() returns Option<String>
    • Generated ParseResult and CstParseResult use Option for 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

27 Dec 14:24
@siy siy
f88404f

Choose a tag to compare

Added

  • AST Support in Generated Parsers

    • Generated CST parsers now include AstNode type and parseAst() method
    • Allows parsing directly to AST (without trivia) from generated parsers
  • Packrat Toggle in Generated Parsers

    • Added setPackratEnabled(boolean) method to generated parsers
    • Allows disabling memoization at runtime to reduce memory usage for large inputs
  • Unlimited Action Variable Support

    • Action code now supports unlimited $N positional variables (previously limited to $1-$20)
    • Uses regex-based substitution for flexibility

Fixed

  • Grammar Validation

    • Implemented Grammar.validate() to detect undefined rule references
    • Recursively walks all expressions and reports first undefined reference with location
  • Thread Safety in Whitespace Skipping

    • Moved skippingWhitespace flag from PegEngine (per-instance) to ParsingContext (per-parse)
    • Fixes potential race conditions when reusing parser instances across threads
  • 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

  • Builder API Naming Standardized

    • PegParser.Builder methods 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
  • Test count: 268 → 271

  • Updated pragmatica-lite dependency: 0.8.4 → 0.9.0


📦 Maven Central
```xml

org.pragmatica-lite
peglib
0.1.6

```