Skip to content

Simplify lexer interface, improve error messages#34

Open
xpmatteo wants to merge 2 commits intouberto:version_4_0from
xpmatteo:matteo-change-position-tracking
Open

Simplify lexer interface, improve error messages#34
xpmatteo wants to merge 2 commits intouberto:version_4_0from
xpmatteo:matteo-change-position-tracking

Conversation

@xpmatteo
Copy link

Two improvements

  • error messages now show line and column number, where previously they only had the char position in the stream
  • simplify the lexer interface: tokens carry their own location in the input stream, so the TokenStream does not need to track position anymore

xpmatteo-tw and others added 2 commits October 16, 2025 15:42
Replace character position tracking with line/column numbers in error
messages for better usability. Previously errors reported "at position 38",
now they report "at line 1, column 39" which is much easier to locate
in source files.

Changes:
- Add Location data class to track line and column (both 1-indexed)
- Update all KondorToken types to include location information
- Change token separators from data objects to data classes to hold location
- Update lexers to track line/column during tokenization
- Simplify TokensStream by removing position tracking logic
- Update parser error construction to use Location instead of Int position
- Update all tests to reflect new error message format and token locations

All 208+ tests pass across all modules (kondor-core, kondor-outcome,
kondor-tools, kondor-auto, kondor-jackson, kondor-examples).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Update README.md error message example to show new line/column format
instead of character position. Add CHANGELOG entry for v4.0.0-beta2
documenting this improvement.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

2 participants