diff --git a/lark/lexer.py b/lark/lexer.py index 32bfe78..36541d1 100644 --- a/lark/lexer.py +++ b/lark/lexer.py @@ -1,6 +1,9 @@ ## Lexer Implementation -import re +try: + import regex as re +except ImportError: + import re from .utils import Str, classify, get_regexp_width, Py36, Serialize from .exceptions import UnexpectedCharacters, LexError, UnexpectedToken diff --git a/lark/parser_frontends.py b/lark/parser_frontends.py index d68d186..9f80ed4 100644 --- a/lark/parser_frontends.py +++ b/lark/parser_frontends.py @@ -1,4 +1,7 @@ -import re +try: + import regex as re +except ImportError: + import re from functools import partial from .utils import get_regexp_width, Serialize diff --git a/setup.py b/setup.py index b962b7f..d31e4d2 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,7 @@ -import re +try: + import regex as re +except ImportError: + import re from setuptools import find_packages, setup __version__ ,= re.findall('__version__ = "(.*)"', open('lark/__init__.py').read()) diff --git a/tests/test_nearley/nearley b/tests/test_nearley/nearley index a46b374..cf8925f 160000 --- a/tests/test_nearley/nearley +++ b/tests/test_nearley/nearley @@ -1 +1 @@ -Subproject commit a46b37471db486db0f6e1ce6a2934fb238346b44 +Subproject commit cf8925f729bde741a3076c5856c0c0862bc7f5de diff --git a/tests/test_parser.py b/tests/test_parser.py index fcb6d22..c6f420e 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -1,7 +1,10 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import -import re +try: + import regex as re +except ImportError: + import re import unittest import logging import os