Repository navigation
2.0.0 (2026-11-15)
⚠ Breaking changes
These are all the changes that can break code built against 1.6.3. Only the first one is marked as breaking in the generated list below.
- The deprecated rule definition API inherited from SSLR is gone (6056700).
Rule.is(...),Rule.override(...),Rule.skip()andRule.skipIfOneChild()are removed, and so areRuleDefinition.is(...)andRuleDefinition.override(...). Define rules throughLexerfulGrammarBuilderorLexerlessGrammarBuilderinstead:b.rule(KEY).is(...),.override(...),.skip(),.skipIfOneChild().- A
Grammarno longer fills itsRulefields by reflection, andGrammar.getRuleFields(...)andGrammar.getAllRuleFields(...)are removed. A grammar written as a class withRulefields must move to aGrammarRuleKeyand a grammar builder. MockHelper(mockToken,mockTokenBuilder,mockAstNode) is removed from flr-testing-harness. Build tokens withToken.builder().
AstNode.fromIndexandAstNode.toIndexare removed (01f197e). The parser no longer records them.AstNode.childrenis read-only (d37e2f5). Its Kotlin type is nowList<AstNode>instead ofMutableList<AstNode>. From Java the signature is unchanged, butchildren.add(...),remove(...)orclear()now throwsUnsupportedOperationExceptionat runtime. UseAstNode.addChild(...)to add a child.- A nonterminal that matched no input has no token (85cc5fd). It used to carry the next token of the input, which gave it a wrong position and listed that token twice in
AstNode.tokens. On such a node:tokenandlastTokenthrowIllegalStateException;- use
tokenOrNull,hasToken()orlastTokenOrNullinstead; tokenValueandtokenOriginalValueare empty, andtokenLineis -1.
A walk that readsnode.tokenon every node must checkhasToken()first.
- Minor:
GrammarRuleBuilderhas a new abstract method,enableMemoRetention(), so a class outside flr that implements the interface must add it.- In Kotlin,
RuleDefinition.getName()is now the propertyname. From Java nothing changes.
Features
These two came in through a merge of the 1.6.x branch, so the generated list does not show them.
- Parsing profiler (760805c). Opt-in per-rule counts of memo hits, misses, matches and overwrites: pass a
ParsingProfilertoParser.parse(..., profiler)and readprofiler.snapshot(). - Selective memo retention (4e8e38c).
GrammarRuleBuilder.enableMemoRetention()keeps a rule's successful memoized results after another result displaces them from the ordinary memo table. It pays off only for rules whose displaced results are requested again; the profiler shows these as memo matcher misses.
Bug Fixes
- ast: build no token for a nonterminal that matched no input (85cc5fd)
- build: pin JGit and configure Mockito java agent (71113c9)
- deps: update dependency jacoco to v0.8.16 (2a219e1)
- deps: update dependency jacoco to v0.8.16 (196a27a)
- deps: update dependency org.ow2.asm:asm to v9.11.1 (738ee1d)
- deps: update dependency org.ow2.asm:asm to v9.11.1 (1becf03)
- lexer: uppercase words independently of the default locale (1a93b7d)
Performance Improvements
- ast: remove the unused fromIndex and toIndex from AstNode (01f197e)
- ast: stop copying the node type array at every node of a tree walk (259fe28)
- ast: store node children in exact-size read-only storage (d37e2f5)
- ast: walk children by index without allocating iterators (795f04c)
- lexer: share equal token strings within one lex (d2afa7c)
Code Refactoring
- remove the deprecated rule definition API and the reflective rule fields inherited from SSLR (6056700)