forked from andialbrecht/sqlparse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
39 lines (32 loc) · 1.44 KB
/
utils.py
File metadata and controls
39 lines (32 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import itertools
import re
from collections import deque
from contextlib import contextmanager
SPLIT_REGEX = re.compile('\n(\n (?: # Start of non-capturing group\n (?:\\r\\n|\\r|\\n) | # Match any single newline, or\n [^\\r\\n\'"]+ | # Match any character series without quotes or\n # newlines, or\n "(?:[^"\\\\]|\\\\.)*" | # Match double-quoted strings, or\n \'(?:[^\'\\\\]|\\\\.)*\' # Match single quoted strings\n )\n)\n', re.VERBOSE)
LINE_MATCH = re.compile('(\\r\\n|\\r|\\n)')
def split_unquoted_newlines(stmt):
"""Split a string on all unquoted newlines.
Unlike str.splitlines(), this will ignore CR/LF/CR+LF if the requisite
character is inside of a string."""
pass
def remove_quotes(val):
"""Helper that removes surrounding quotes from strings."""
pass
def recurse(*cls):
"""Function decorator to help with recursion
:param cls: Classes to not recurse over
:return: function
"""
pass
def imt(token, i=None, m=None, t=None):
"""Helper function to simplify comparisons Instance, Match and TokenType
:param token:
:param i: Class or Tuple/List of Classes
:param m: Tuple of TokenType & Value. Can be list of Tuple for multiple
:param t: TokenType or Tuple/List of TokenTypes
:return: bool
"""
pass
def consume(iterator, n):
"""Advance the iterator n-steps ahead. If n is none, consume entirely."""
pass