Skip to content

Commit

Permalink
always tsl
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Feb 12, 2024
1 parent f86c80c commit 2a83f2b
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions papyri/ts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging
import itertools
from pathlib import Path
from textwrap import dedent, indent
from typing import List, Any, Dict

Expand Down Expand Up @@ -42,28 +41,11 @@
# VisitSubstitutionDefinitionNotImplementedError,
)

allowed_adorn = "=-`:.'\"~^_*+#<>"

try:
from tree_sitter_languages import get_parser

# language = get_language('python')
parser = get_parser("rst")
except ModuleNotFoundError:
# replace by tree-sitter-languages once it works
# See https://github.com/grantjenks/py-tree-sitter-languages/issues/15
try:
from tree_sitter import Language, Parser

pth = str(Path(__file__).parent / "rst.so")
RST = Language(pth, "rst")
except OSError as e:
raise OSError(
"tree-sitter-rst not found, rst parsing will not work. Please run `papyri build-parser`"
) from e

parser = Parser()
parser.set_language(RST)
from tree_sitter_languages import get_parser

parser = get_parser("rst")
allowed_adorn = "=-`:.'\"~^_*+#<>"

log = logging.getLogger("papyri")

Expand Down

0 comments on commit 2a83f2b

Please sign in to comment.