You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Populate ScriptTokenStream and precise token bounds during AST construction #34
During static analysis in SonarQube, issue reporting relies on TSqlFragment.firstTokenIndex, TSqlFragment.lastTokenIndex, and TSqlFragment.ScriptTokenStream (or token line/column positions) to highlight exact issue text ranges.
Problem
When parsing scripts via TSqlParser.parse(sql):
TSqlScript.ScriptTokenStream is empty (size == 0).
Child statement and expression nodes (TSqlFragment) have firstTokenIndex and lastTokenIndex set to 0, preventing downstream static analyzers from computing exact source line and column spans (file.newRange(startLine, startCol, endLine, endCol)).
This causes issue highlights to fall back to statement or line 1 boundaries.
Proposed Solution
Ensure the underlying lexer token stream is preserved and attached to the root TSqlScript.ScriptTokenStream.
Ensure UpdateTokenInfo(first, last) is properly called during ANTLR AST node construction to set firstTokenIndex and lastTokenIndex on all parsed fragment nodes.
Activity