antlr / antlr4

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
http://antlr.org
BSD 3-Clause "New" or "Revised" License
17.12k stars 3.28k forks source link

can not find the correct column names when column names start with a number #3590

Open 1172015211 opened 2 years ago

1172015211 commented 2 years ago
1172015211 commented 2 years ago

example sql is:select a66,66dd from test .

I have acquired tokens is:

[@ 0, 0, 5 = 'select', < 157 >, 1-0]

= 'a66' [@ 1, 7, 9, < 347 >, did

= ', '@ 2, 10, 10, < 248 >, "]

[@ 3, 11, 12 = '66', < 351 >, 1:11]

= 'dd' [@ 4, 13, 14, < 347 >, 1:13]

[@ 5:19 = 'from', < 270 >, for

[@ 6, 22, 25 = 'test', < 347 >, and

[@ 7, 27:26 = '< EOF >' < 1 >, 2-0]

Expected Results:

[@ 0, 0, 5 = 'select', < 157 >, 1-0]

= 'a66' [@ 1, 7, 9, < 347 >, did

= ', '@ 2, 10, 10, < 248 >, "]

[@ 3, 11, 12 = '66 dd, < 347 >, 1:13]

[@ 4:19 = 'from', < 270 >, for

[@ 5, 22, 25 = 'test', < 347 >, and

[@ 6, 27:26 = '< EOF >' < 1 >, 2-0]

What can I do to achieve the desired results

KvanTTT commented 2 years ago

The issue is not relevant to repository, it should be moved to grammars-v4. Also, please clarify what SQL dialect you are using.