Skip to content

[BUG] JSQLParser master (dff722b) : ALL : block comment followed directly by a non-whitespace character #2509

Description

@fudianchn

AI disclosure: this issue was prepared with AI coding agents, reviewed and revised line by line by me.

Failing SQL Feature:

A block comment followed directly by a non-whitespace character breaks parsing — the first character after */ is swallowed into the comment token.

SQL Example:

SELECT /* c */1      -- ParseException
SELECT 1 /* c */+2   -- ParseException
SELECT 1/*x*/+2      -- ParseException

SELECT 1 /* c */ +2  -- fine (blank after */)

Software Information:

  • JSqlParser: current master dff722b (verified with a local build today)
  • Database: dialect-independent (lexer level)

Tips:

Discovered while working on #2508 (the # line comments switch) — implementing its stream-level pieces required a close read of the lexer and the block comment machinery.

Suspected cause: the BLOCK_COMMENT_END production matches one char with ~[] and relies on its token action (input_stream.backup(1) + image restore) to put it back — but the JavaCC fork does not execute SPECIAL_TOKEN actions (the special path calls SkipLexicalActions, whose generated switch only contains the SKIP cases), so the char after */ is consumed into the comment token. -- line comments are self-contained productions and unaffected.

Happy to provide a fix as a separate PR once a direction is agreed.

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions