File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1294,9 +1294,11 @@ class StartupError(Exception):
12941294_comments_and_strings_re = re .compile (
12951295 r"""
12961296 --[^\n]* # single line comment
1297- | /\*.*?\*/ # multi line comment
1297+ | /\*.*?(?: \*/|\Z) # multi line comment, possibly to end-of-input
12981298 | '(?:''|[^'])*' # single quoted string ('' escapes a quote)
12991299 | "(?:""|[^"])*" # double quoted identifier ("" escapes a quote)
1300+ | \[(?:[^\]])*\] # square-bracket quoted identifier
1301+ | `(?:``|[^`])*` # backtick quoted identifier
13001302 """ ,
13011303 re .DOTALL | re .VERBOSE ,
13021304)
Original file line number Diff line number Diff line change @@ -764,6 +764,11 @@ def test_parse_metadata(content, expected):
764764 # Parameters that live inside a comment should be ignored
765765 ("select :x -- and :ignored" , ["x" ]),
766766 ("select :x /* and :ignored */ from t" , ["x" ]),
767+ ("select :x /* and :ignored" , ["x" ]),
768+ # Parameters inside quoted identifiers should be ignored
769+ ("select [a:b] from t where id = :id" , ["id" ]),
770+ ("select `a:b` from t where id = :id" , ["id" ]),
771+ ("select `a``:b` from t where id = :id" , ["id" ]),
767772 # Parameters inside a string literal should be ignored
768773 ("select ':ignored' || :real" , ["real" ]),
769774 ),
You can’t perform that action at this time.
0 commit comments