diff options
Diffstat (limited to 'sqlparse')
| -rw-r--r-- | sqlparse/keywords.py | 2 | ||||
| -rw-r--r-- | sqlparse/sql.py | 4 | ||||
| -rw-r--r-- | sqlparse/tokens.py | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py index ad85368..602051a 100644 --- a/sqlparse/keywords.py +++ b/sqlparse/keywords.py @@ -43,6 +43,8 @@ SQL_REGEX = { (r'%(\(\w+\))?s', tokens.Name.Placeholder), (r'(?<!\w)[$:?]\w+', tokens.Name.Placeholder), + (r'\\\w+', tokens.Command), + # FIXME(andi): VALUES shouldn't be listed here # see https://github.com/andialbrecht/sqlparse/pull/64 # IN is special, it may be followed by a parenthesis, but diff --git a/sqlparse/sql.py b/sqlparse/sql.py index d9702ca..a752555 100644 --- a/sqlparse/sql.py +++ b/sqlparse/sql.py @@ -625,3 +625,7 @@ class Operation(TokenList): class Values(TokenList): """Grouping of values""" + + +class Command(TokenList): + """Grouping of CLI commands.""" diff --git a/sqlparse/tokens.py b/sqlparse/tokens.py index 41e3742..eefc0b4 100644 --- a/sqlparse/tokens.py +++ b/sqlparse/tokens.py @@ -55,6 +55,7 @@ Assignment = Token.Assignment # Generic types for non-source code Generic = Token.Generic +Command = Generic.Command # String and some others are not direct children of Token. # alias them: @@ -66,4 +67,3 @@ Token.Number = Number DML = Keyword.DML DDL = Keyword.DDL CTE = Keyword.CTE -Command = Keyword.Command |
