dataset-builder / data2 /step22 /debug_parser.py
SunDou's picture
Upload data2/step22/debug_parser.py with huggingface_hub
a38d186 verified
from tree_sitter import Language, Parser
import os
LANG_SO = "build/my-languages.so"
LANGUAGES = ["python", "c", "cpp", "java", "go", "rust", "julia"]
def test_load():
print(f"CWD: {os.getcwd()}")
print(f"LANG_SO path: {os.path.abspath(LANG_SO)}")
print(f"Exists: {os.path.exists(LANG_SO)}")
for lang in LANGUAGES:
try:
language = Language(LANG_SO, lang)
parser = Parser()
parser.set_language(language)
print(f"Successfully loaded {lang}")
except Exception as e:
print(f"Failed to load {lang}: {e}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
test_load()