Conversation
Added `RollParserError` base class with typed `RollParserErrorCode` union and `isRollParserError()` type guard derived from a single `as const` array source of truth. Refactored `LexerError`, `ParseError`, and `EvaluatorError` to extend `RollParserError` with error codes and structured context (`nodeType` for evaluator errors). Narrowed `src/index.ts` exports by removing `Lexer`, `Parser`, `lex`, `TokenType`, `Token`, and mock RNG re-exports while keeping AST types required by `parse()` return type. Created `roll-parser/testing` subpath export with `createMockRng` and `MockRNGExhaustedError`, including dedicated ESM/CJS build scripts. Added bounds validation to `MockRNG.nextInt` that throws `RangeError` for out-of-range values. Replaced hardcoded `VERSION` constant with `package.json` import, migrated `bun-types` to `@types/bun`, and aligned line width to 100 chars. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added
RollParserErrorbase class with typed error codes andisRollParserError()type guard.Refactored
LexerError,ParseError,EvaluatorErrorto extendRollParserError.Narrowed public API by removing internal exports (
Lexer,Parser,lex,TokenType,Token).Created
roll-parser/testingsubpath export forcreateMockRngandMockRNGExhaustedError.Added bounds validation to
MockRNG.nextInt.Replaced hardcoded
VERSIONwithpackage.jsonimport.Migrated
bun-typesto@types/bun.Aligned line width to 100 chars across biome and rules.
Closes #24
Drafted with AI assistance