mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 00:14:41 +01:00
refactoring: restore parser to backwards compatibility after refactoring (#5571)
Restore parser location after movings in #5552 for backwards compatibility. ## For community ⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍 comment** --------- Co-authored-by: a <1@1.1> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
c638fbbc71
commit
40be260cb0
5 changed files with 21 additions and 20 deletions
2
setup.py
2
setup.py
|
@ -41,7 +41,7 @@ def build_tables():
|
||||||
print("Building lexer and parser tables.", file=sys.stderr)
|
print("Building lexer and parser tables.", file=sys.stderr)
|
||||||
root_dir = os.path.abspath(os.path.dirname(__file__))
|
root_dir = os.path.abspath(os.path.dirname(__file__))
|
||||||
sys.path.insert(0, root_dir)
|
sys.path.insert(0, root_dir)
|
||||||
from xonsh.parsers import Parser
|
from xonsh.parser import Parser
|
||||||
from xonsh.parsers.completion_context import CompletionContextParser
|
from xonsh.parsers.completion_context import CompletionContextParser
|
||||||
|
|
||||||
Parser(
|
Parser(
|
||||||
|
|
|
@ -6,7 +6,7 @@ import textwrap
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from xonsh.parsers import Parser
|
from xonsh.parser import Parser
|
||||||
from xonsh.parsers.ast import AST, Call, Pass, With, is_const_str
|
from xonsh.parsers.ast import AST, Call, Pass, With, is_const_str
|
||||||
from xonsh.parsers.fstring_adaptor import FStringAdaptor
|
from xonsh.parsers.fstring_adaptor import FStringAdaptor
|
||||||
from xonsh.pytest.tools import (
|
from xonsh.pytest.tools import (
|
||||||
|
|
|
@ -6,7 +6,7 @@ import inspect
|
||||||
import sys
|
import sys
|
||||||
import types
|
import types
|
||||||
|
|
||||||
from xonsh.parsers import Parser
|
from xonsh.parser import Parser
|
||||||
from xonsh.parsers.ast import CtxAwareTransformer
|
from xonsh.parsers.ast import CtxAwareTransformer
|
||||||
from xonsh.tools import (
|
from xonsh.tools import (
|
||||||
balanced_parens,
|
balanced_parens,
|
||||||
|
|
17
xonsh/parser.py
Normal file
17
xonsh/parser.py
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
"""Implements the xonsh parser."""
|
||||||
|
|
||||||
|
from xonsh.lib.lazyasd import lazyobject
|
||||||
|
from xonsh.platform import PYTHON_VERSION_INFO
|
||||||
|
|
||||||
|
|
||||||
|
@lazyobject
|
||||||
|
def Parser():
|
||||||
|
if PYTHON_VERSION_INFO > (3, 10):
|
||||||
|
from xonsh.parsers.v310 import Parser as p
|
||||||
|
elif PYTHON_VERSION_INFO > (3, 9):
|
||||||
|
from xonsh.parsers.v39 import Parser as p
|
||||||
|
elif PYTHON_VERSION_INFO > (3, 8):
|
||||||
|
from xonsh.parsers.v38 import Parser as p
|
||||||
|
else:
|
||||||
|
from xonsh.parsers.v36 import Parser as p
|
||||||
|
return p
|
|
@ -1,17 +1 @@
|
||||||
"""Implements the xonsh parser."""
|
"""Implements the xonsh parsers."""
|
||||||
|
|
||||||
from xonsh.lib.lazyasd import lazyobject
|
|
||||||
from xonsh.platform import PYTHON_VERSION_INFO
|
|
||||||
|
|
||||||
|
|
||||||
@lazyobject
|
|
||||||
def Parser():
|
|
||||||
if PYTHON_VERSION_INFO > (3, 10):
|
|
||||||
from xonsh.parsers.v310 import Parser as p
|
|
||||||
elif PYTHON_VERSION_INFO > (3, 9):
|
|
||||||
from xonsh.parsers.v39 import Parser as p
|
|
||||||
elif PYTHON_VERSION_INFO > (3, 8):
|
|
||||||
from xonsh.parsers.v38 import Parser as p
|
|
||||||
else:
|
|
||||||
from xonsh.parsers.v36 import Parser as p
|
|
||||||
return p
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue