# Path: coconut/constants.py
# def fixpath(path):
# def str_to_bool(boolstr, default=False):
# WINDOWS = os.name == "nt"
# PYPY = platform.python_implementation() == "PyPy"
# CPYTHON = platform.python_implementation() == "CPython"
# PY32 = sys.version_info >= (3, 2)
# PY33 = sys.version_info >= (3, 3)
# PY34 = sys.version_info >= (3, 4)
# PY35 = sys.version_info >= (3, 5)
# PY36 = sys.version_info >= (3, 6)
# PY38 = sys.version_info >= (3, 8)
# PY310 = sys.version_info >= (3, 10)
# IPY = (
#     ((PY2 and not PY26) or PY35)
#     and not (PYPY and WINDOWS)
#     # necessary until jupyter-console fixes https://github.com/jupyter/jupyter_console/issues/245
#     and not PY310
# )
# MYPY = (
#     PY34
#     and not WINDOWS
#     and not PYPY
# )
# PURE_PYTHON = str_to_bool(os.environ.get(pure_python_env_var, ""))
# 
# Path: coconut/util.py
# def get_clock_time():
#     """Get a time to use for performance metrics."""
#     if PY2:
#         return time.clock()
#     else:
#         return time.process_time()
# 
# Path: coconut/util.py
# def ver_str_to_tuple(ver_str):
#     """Convert a version string into a version tuple."""
#     out = []
#     for x in ver_str.split("."):
#         try:
#             x = int(x)
#         except ValueError:
#             pass
#         out.append(x)
#     return tuple(out)
# 
# def ver_tuple_to_str(req_ver):
#     """Converts a requirement version tuple into a version string."""
#     return ".".join(str(x) for x in req_ver)
# 
# def get_next_version(req_ver, point_to_increment=-1):
#     """Get the next version after the given version."""
#     return req_ver[:point_to_increment] + (req_ver[point_to_increment] + 1,)


from coconut.root import *  # NOQA
from warnings import warn
from collections import defaultdict
from coconut.constants import (
    PURE_PYTHON,
    PYPY,
    use_fast_pyparsing_reprs,
    use_packrat_parser,
    packrat_cache_size,
    default_whitespace_chars,
    varchars,
    min_versions,
    pure_python_env_var,
    enable_pyparsing_warnings,
    use_left_recursion_if_available,
)
from coconut.util import get_clock_time  # NOQA
from coconut.util import (
    ver_str_to_tuple,
    ver_tuple_to_str,
    get_next_version,
)
    from cPyparsing import *  # NOQA
    from cPyparsing import __version__
        from pyparsing import *  # NOQA
        from pyparsing import __version__
    from coconut.terminal import internal_assert  # hide to avoid circular import
    from coconut.terminal import logger  # hide to avoid circular imports
import os
import sys
import traceback
import functools
import inspect
    import cPyparsing as _pyparsing
        import pyparsing as _pyparsing


# warning: do not name this file cPyparsing or pyparsing or it might collide with the following imports
try:

    if PURE_PYTHON:
        raise ImportError("skipping cPyparsing check due to " + pure_python_env_var + " = " + os.environ.get(pure_python_env_var, ""))


    PYPARSING_PACKAGE = "cPyparsing"
    PYPARSING_INFO = "Cython cPyparsing v" + __version__

except ImportError:
    try:


        PYPARSING_PACKAGE = "pyparsing"
        PYPARSING_INFO = "Python pyparsing v" + __version__

    except ImportError:
        traceback.print_exc()
        __version__ = None
        PYPARSING_PACKAGE = "cPyparsing"
        PYPARSING_INFO = None


# -----------------------------------------------------------------------------------------------------------------------
# VERSION CHECKING:
# -----------------------------------------------------------------------------------------------------------------------


# Path: coconut/constants.py
# def fixpath(path):
# def str_to_bool(boolstr, default=False):
# WINDOWS = os.name == "nt"
# PYPY = platform.python_implementation() == "PyPy"
# CPYTHON = platform.python_implementation() == "CPython"
# PY32 = sys.version_info >= (3, 2)
# PY33 = sys.version_info >= (3, 3)
# PY34 = sys.version_info >= (3, 4)
# PY35 = sys.version_info >= (3, 5)
# PY36 = sys.version_info >= (3, 6)
# PY38 = sys.version_info >= (3, 8)
# PY310 = sys.version_info >= (3, 10)
# IPY = (
#     ((PY2 and not PY26) or PY35)
#     and not (PYPY and WINDOWS)
#     # necessary until jupyter-console fixes https://github.com/jupyter/jupyter_console/issues/245
#     and not PY310
# )
# MYPY = (
#     PY34
#     and not WINDOWS
#     and not PYPY
# )
# PURE_PYTHON = str_to_bool(os.environ.get(pure_python_env_var, ""))
# 
# Path: coconut/util.py
# def get_clock_time():
#     """Get a time to use for performance metrics."""
#     if PY2:
#         return time.clock()
#     else:
#         return time.process_time()
# 
# Path: coconut/util.py
# def ver_str_to_tuple(ver_str):
#     """Convert a version string into a version tuple."""
#     out = []
#     for x in ver_str.split("."):
#         try:
#             x = int(x)
#         except ValueError:
#             pass
#         out.append(x)
#     return tuple(out)
# 
# def ver_tuple_to_str(req_ver):
#     """Converts a requirement version tuple into a version string."""
#     return ".".join(str(x) for x in req_ver)
# 
# def get_next_version(req_ver, point_to_increment=-1):
#     """Get the next version after the given version."""
#     return req_ver[:point_to_increment] + (req_ver[point_to_increment] + 1,)


# Path: coconut/_pyparsing.py
from coconut.root import *  # NOQA
from warnings import warn
from collections import defaultdict
from coconut.constants import (
    PURE_PYTHON,
    PYPY,
    use_fast_pyparsing_reprs,
    use_packrat_parser,
    packrat_cache_size,
    default_whitespace_chars,
    varchars,
    min_versions,
    pure_python_env_var,
    enable_pyparsing_warnings,
    use_left_recursion_if_available,
)
from coconut.util import get_clock_time  # NOQA
from coconut.util import (
    ver_str_to_tuple,
    ver_tuple_to_str,
    get_next_version,
)
    from cPyparsing import *  # NOQA
    from cPyparsing import __version__
        from pyparsing import *  # NOQA
        from pyparsing import __version__
    from coconut.terminal import internal_assert  # hide to avoid circular import
    from coconut.terminal import logger  # hide to avoid circular imports
import os
import sys
import traceback
import functools
import inspect
    import cPyparsing as _pyparsing
        import pyparsing as _pyparsing



# warning: do not name this file cPyparsing or pyparsing or it might collide with the following imports
try:

    if PURE_PYTHON:
        raise ImportError("skipping cPyparsing check due to " + pure_python_env_var + " = " + os.environ.get(pure_python_env_var, ""))


    PYPARSING_PACKAGE = "cPyparsing"
    PYPARSING_INFO = "Cython cPyparsing v" + __version__

except ImportError:
    try:


        PYPARSING_PACKAGE = "pyparsing"
        PYPARSING_INFO = "Python pyparsing v" + __version__

    except ImportError:
        traceback.print_exc()
        __version__ = None
        PYPARSING_PACKAGE = "cPyparsing"
        PYPARSING_INFO = None


# -----------------------------------------------------------------------------------------------------------------------
# VERSION CHECKING:
# -----------------------------------------------------------------------------------------------------------------------


min_ver = min(min_versions["pyparsing"], min_versions["cPyparsing"][:3])  # inclusive