Skip to content

Release v5.2.0 - #31

Merged
RomeCore merged 2 commits into
mainfrom
develop
Jun 21, 2026
Merged

Release v5.2.0#31
RomeCore merged 2 commits into
mainfrom
develop

Conversation

@RomeCore

Copy link
Copy Markdown
Owner

New features:

  • Add Scan() methods returning interleaved sequence of raw text
    segments and parsed matches via Or<StringSegment, ParsedRuleResultBase>
  • Add SplitSegments() methods to split input by parser rule matches
    (analogous to Regex.Split)
  • Add new overloads of MatchesToken() that return ParsedElement instead
    of just matched length
  • Add AnyCharTokenPattern — matches any single character
  • Add ParserTokenPattern — allows nesting one parser as a token in
    another parser
  • Add StringSegment struct — lightweight zero-copy string slice with
    lazy cached substring
  • Add SemanticException — structured exception with AST node reference,
    source position formatting, and nested children errors
  • Expose PositionalFormatter.Format() as public static method

Bug fixes:

  • Fix startIndex in RepeatParserRule, SeparatedRepeatParserRule,
    SequenceParserRule and all combinator token patterns: initialPosition
    now correctly set to first child's startIndex instead of parsing start
    position, which fixes wrong offsets when SkipStrategies are used
  • Fix LiteralCharTokenPattern boundary check (position >= barrierPosition)
  • Fix RegexTokenPattern null-safety in ToString()
  • Fix CaptureTextTokenPattern: set intermediateValue directly on child
    element instead of creating new ParsedElement
  • Fix SkipWhitespacesTokenPattern: return child result directly instead
    of wrapping in a new ParsedElement with accumulated whitespace offset

DX improvements:

  • Replace hard casts (T)value in ParsedRuleResultBase with soft 'is T'
    checks that throw SemanticException with detailed context instead of
    InvalidCastException
  • Same for GetIntermediateValue, ConvertValue, GetParsingParameter

Tests:

  • Add ReplaceAllMatchesTests (10 test cases)
  • Add ScanTests (14 test cases)
  • Add SplitSegmentsTests (8 test cases)
  • Update CombinatorTokensTests and KeywordTokenTests to use explicit
    out variable types

RomeCore added 2 commits March 2, 2026 10:53
…dex in combinators

This commit introduces several major improvements and bug fixes for
v5.2.0 release.

New features:
- Add Scan() methods returning interleaved sequence of raw text
  segments and parsed matches via Or<StringSegment, ParsedRuleResultBase>
- Add SplitSegments() methods to split input by parser rule matches
  (analogous to Regex.Split)
- Add new overloads of MatchesToken() that return ParsedElement instead
  of just matched length
- Add AnyCharTokenPattern — matches any single character
- Add ParserTokenPattern — allows nesting one parser as a token in
  another parser
- Add StringSegment struct — lightweight zero-copy string slice with
  lazy cached substring
- Add SemanticException — structured exception with AST node reference,
  source position formatting, and nested children errors
- Expose PositionalFormatter.Format() as public static method

Bug fixes:
- Fix startIndex in RepeatParserRule, SeparatedRepeatParserRule,
  SequenceParserRule and all combinator token patterns: initialPosition
  now correctly set to first child's startIndex instead of parsing start
  position, which fixes wrong offsets when SkipStrategies are used
- Fix LiteralCharTokenPattern boundary check (position >= barrierPosition)
- Fix RegexTokenPattern null-safety in ToString()
- Fix CaptureTextTokenPattern: set intermediateValue directly on child
  element instead of creating new ParsedElement
- Fix SkipWhitespacesTokenPattern: return child result directly instead
  of wrapping in a new ParsedElement with accumulated whitespace offset

DX improvements:
- Replace hard casts (T)value in ParsedRuleResultBase with soft 'is T'
  checks that throw SemanticException with detailed context instead of
  InvalidCastException
- Same for GetIntermediateValue<T>, ConvertValue<T>, GetParsingParameter<T>

Tests:
- Add ReplaceAllMatchesTests (10 test cases)
- Add ScanTests (14 test cases)
- Add SplitSegmentsTests (8 test cases)
- Update CombinatorTokensTests and KeywordTokenTests to use explicit
  out variable types

Version: 5.1.0 -> 5.2.0
@RomeCore
RomeCore merged commit 0161b8c into main Jun 21, 2026
2 checks passed
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