Skip to content

Commit

Permalink
better ident parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
klahnakoski committed Jun 27, 2024
1 parent 54eb867 commit cfaad79
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mo_sql_parsing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,8 +908,9 @@ def no_dashes(tokens, start, string):

digit = Char("0123456789")
with whitespaces.NO_WHITESPACE:
ident_w_dash = Char(FIRST_IDENT_CHAR) + (Regex("(?<=[^ 0-9])\\-(?=[^ 0-9])") | Char(IDENT_CHAR))[...]
ident_w_dash_warning = Regex(ident_w_dash.__regex__()[1]).set_parser_name("identifier_with_dashes") / no_dashes
# repack the expression into a regex for faster parsing ident_w_dash
ident_w_dash = Regex((Char(FIRST_IDENT_CHAR) + (Regex("(?<=[^ 0-9])\\-(?=[^ 0-9])") | Char(IDENT_CHAR))[...]).__regex__()[1])
ident_w_dash_warning = ident_w_dash.set_parser_name("identifier_with_dashes") / no_dashes

simple_ident = Word(FIRST_IDENT_CHAR, IDENT_CHAR).set_parser_name("identifier")
sqlserver_local_ident = Word("@" + FIRST_IDENT_CHAR, IDENT_CHAR).set_parser_name("identifier")

0 comments on commit cfaad79

Please sign in to comment.