tree-sitter-sql icon indicating copy to clipboard operation
tree-sitter-sql copied to clipboard

Literals lose their type in the parse tree

Open stackmystack opened this issue 8 months ago • 1 comments

Hi,

I find it highly problematic that literals lose their types in the parse tree.

Even for syntax highlighting, this info is quite useful, so I can't see a logical justification from where I come from. I am sure there is one :)

I am interested in it because it helps guide my parsing of the output parse tree.

e.g.

select 1, 'str'

gives:

program [0, 0] - [2, 0]
  statement [0, 0] - [0, 15]
    select [0, 0] - [0, 15]
      keyword_select [0, 0] - [0, 6]
      select_expression [0, 7] - [0, 15]
        term [0, 7] - [0, 8]
          value: literal [0, 7] - [0, 8]
        term [0, 10] - [0, 15]
          value: literal [0, 10] - [0, 15]

Would you accept a patch for this? What am I missing?

stackmystack avatar Apr 10 '25 09:04 stackmystack