diff options
| author | Jesús Leganés Combarro "Piranna" <piranna@gmail.com> | 2012-03-24 18:48:27 +0100 |
|---|---|---|
| committer | Jesús Leganés Combarro "Piranna" <piranna@gmail.com> | 2012-03-24 18:48:27 +0100 |
| commit | 2c96cdc940c166603118cbab3b3589c7b49c978c (patch) | |
| tree | 3291538dceac36111f8d6f4c3aaab312687aa45b /sqlparse | |
| parent | f0708f982a77f116243d6139249a3f202be9557c (diff) | |
| download | sqlparse-2c96cdc940c166603118cbab3b3589c7b49c978c.tar.gz | |
Clean-up
Diffstat (limited to 'sqlparse')
| -rw-r--r-- | sqlparse/filters.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sqlparse/filters.py b/sqlparse/filters.py index cbf6b9e..528a5cb 100644 --- a/sqlparse/filters.py +++ b/sqlparse/filters.py @@ -76,19 +76,22 @@ class StripComments(Filter): def StripWhitespace(stream): "Strip the useless whitespaces from a stream leaving only the minimal ones" last_type = None + ignore_group = Whitespace, Whitespace.Newline, Comparison, Punctuation for token_type, value in stream: # We got a previous token if last_type: print repr(token_type), repr(value) + if token_type in Whitespace: print '\t', repr(token_type), repr(value) - if last_type in (Whitespace, Whitespace.Newline, Comparison, Punctuation): + + if last_type in ignore_group: continue value = ' ' # Ignore first empty spaces and dot-commas - elif token_type in (Whitespace, Whitespace.Newline, Punctuation): + elif token_type in ignore_group: continue yield token_type, value |
