# Path: purplequery/bq_operator.py
# BINARY_OPERATOR_PATTERN = '|'.join(
#     sorted([re.escape(op) for op in BINARY_OPERATOR_INFO if not op.isalpha()],
#            key=len, reverse=True))
# 
# Path: purplequery/patterns.py
# BACKTICK_PATTERN = '`[^`]+`'
# 
# COMMENT_PATTERN = '--.*$|#.*$|/\*([^*]|\*[^/])*\*/'
# 
# FLOAT_LITERAL_PATTERNS = [
#     # Digits, decimal point, optional digits, optional exponent
#     r'\d+\.\d*(?:[eE][+-]?\d+)?',
#     # Optional digits, decimal point, digits, optional exponent
#     r'\d*\.\d+(?:[eE][+-]?\d+)?',
#     # Digits, exponent
#     r'\d+[eE][+-]?\d+']
# 
# IDENTIFIER_PATTERN = '[A-Za-z_][A-Za-z0-9_]*'
# 
# INT_LITERAL_PATTERN = r'\d+'
# 
# NON_OPERATOR_TOKEN_PATTERN = r'[().,!]|\[|\]'
# 
# STR_LITERAL_PATTERNS = ['"[^"]*"', "'[^']*'"]


import re
from typing import List  # noqa: F401
from .bq_operator import BINARY_OPERATOR_PATTERN
from .patterns import (BACKTICK_PATTERN, COMMENT_PATTERN, FLOAT_LITERAL_PATTERNS,
                       IDENTIFIER_PATTERN, INT_LITERAL_PATTERN, NON_OPERATOR_TOKEN_PATTERN,
                       STR_LITERAL_PATTERNS)
# Copyright 2019 Verily Life Sciences LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

"""Tokenize a Google BigQuery Standard SQL query."""



_COMPILED_COMMENT_PATTERN = re.compile(COMMENT_PATTERN, flags=re.MULTILINE)


def remove_comments(query):
    # type: (str) -> str
    return _COMPILED_COMMENT_PATTERN.sub('', query)


_COMBINED_PATTERN = re.compile(
    '|'.join((
        BACKTICK_PATTERN,
        '|'.join(STR_LITERAL_PATTERNS),
        BINARY_OPERATOR_PATTERN,
        '|'.join(FLOAT_LITERAL_PATTERNS),
        INT_LITERAL_PATTERN,

# Path: purplequery/bq_operator.py
# BINARY_OPERATOR_PATTERN = '|'.join(
#     sorted([re.escape(op) for op in BINARY_OPERATOR_INFO if not op.isalpha()],
#            key=len, reverse=True))
# 
# Path: purplequery/patterns.py
# BACKTICK_PATTERN = '`[^`]+`'
# 
# COMMENT_PATTERN = '--.*$|#.*$|/\*([^*]|\*[^/])*\*/'
# 
# FLOAT_LITERAL_PATTERNS = [
#     # Digits, decimal point, optional digits, optional exponent
#     r'\d+\.\d*(?:[eE][+-]?\d+)?',
#     # Optional digits, decimal point, digits, optional exponent
#     r'\d*\.\d+(?:[eE][+-]?\d+)?',
#     # Digits, exponent
#     r'\d+[eE][+-]?\d+']
# 
# IDENTIFIER_PATTERN = '[A-Za-z_][A-Za-z0-9_]*'
# 
# INT_LITERAL_PATTERN = r'\d+'
# 
# NON_OPERATOR_TOKEN_PATTERN = r'[().,!]|\[|\]'
# 
# STR_LITERAL_PATTERNS = ['"[^"]*"', "'[^']*'"]


# Path: purplequery/tokenizer.py
import re
from typing import List  # noqa: F401
from .bq_operator import BINARY_OPERATOR_PATTERN
from .patterns import (BACKTICK_PATTERN, COMMENT_PATTERN, FLOAT_LITERAL_PATTERNS,
                       IDENTIFIER_PATTERN, INT_LITERAL_PATTERN, NON_OPERATOR_TOKEN_PATTERN,
                       STR_LITERAL_PATTERNS)

# Copyright 2019 Verily Life Sciences LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

"""Tokenize a Google BigQuery Standard SQL query."""



_COMPILED_COMMENT_PATTERN = re.compile(COMMENT_PATTERN, flags=re.MULTILINE)


def remove_comments(query):
    # type: (str) -> str
    return _COMPILED_COMMENT_PATTERN.sub('', query)


_COMBINED_PATTERN = re.compile(
    '|'.join((
        BACKTICK_PATTERN,
        '|'.join(STR_LITERAL_PATTERNS),
        BINARY_OPERATOR_PATTERN,
        '|'.join(FLOAT_LITERAL_PATTERNS),
        INT_LITERAL_PATTERN,

        NON_OPERATOR_TOKEN_PATTERN,