Skip to content

fix: add SQL comment support to the scanner (-- and /* */) - #277

Open
0x5t4l1n wants to merge 1 commit into
tomarrell:masterfrom
0x5t4l1n:fix/sql-comment-lexer-support
Open

fix: add SQL comment support to the scanner (-- and /* */)#277
0x5t4l1n wants to merge 1 commit into
tomarrell:masterfrom
0x5t4l1n:fix/sql-comment-lexer-support

Conversation

@0x5t4l1n

@0x5t4l1n 0x5t4l1n commented Aug 2, 2026

Copy link
Copy Markdown

Summary\n\nFixes #200 — SQL comments as specified in https://www.sqlite.org/lang_comment.html were not recognised by the scanner, causing parse errors when SQL input contained comments.\n\nNew files in internal/parser/scanner/:\n- token/kind.go — adds SingleLineComment and MultiLineComment token kinds\n- comment_scanner.goTryScanComment(src, pos) handles -- and /* */ forms\n- comment_scanner_test.go — full test coverage including unterminated comments and edge cases\n\nThe parser layer skips both comment token kinds so they are transparent to grammar rules.\n\n## Test plan\n- [ ] go test ./internal/parser/scanner/...\n- [ ] Parse SELECT 1 -- comment → succeeds\n- [ ] Parse SELECT /* multi\\nline */ 1 → succeeds\n\n🤖 Generated with Claude Code

Resolves tomarrell#200. The parser had no token types or scanner rules for SQL
comments as specified in https://www.sqlite.org/lang_comment.html.
Both single-line (--) and multi-line (/* */) comment forms are now
recognised by the rule-based scanner and emitted as distinct token
kinds. The parser skips these tokens so comments are transparent to
grammar rules, matching SQLite behaviour.
@0x5t4l1n
0x5t4l1n requested a review from SUMUKHA-PK as a code owner August 2, 2026 19:39
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