chore: scaffold tree-sitter-rune project
This commit is contained in:
26
bindings/python/tree_sitter_rune/__init__.py
Normal file
26
bindings/python/tree_sitter_rune/__init__.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from importlib.resources import files
|
||||
|
||||
from ._binding import language
|
||||
|
||||
|
||||
def _get_query(name, filename):
|
||||
if name in globals():
|
||||
return globals()[name]
|
||||
query = files(__name__).joinpath("queries").joinpath(filename).read_text()
|
||||
globals()[name] = query
|
||||
return query
|
||||
|
||||
|
||||
def __getattr__(name):
|
||||
if name == "HIGHLIGHTS_QUERY":
|
||||
return _get_query("HIGHLIGHTS_QUERY", "highlights.scm")
|
||||
if name == "TAGS_QUERY":
|
||||
return _get_query("TAGS_QUERY", "tags.scm")
|
||||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||
|
||||
|
||||
def __dir__():
|
||||
return [*globals(), "HIGHLIGHTS_QUERY", "TAGS_QUERY"]
|
||||
|
||||
|
||||
__all__ = ["language", "HIGHLIGHTS_QUERY", "TAGS_QUERY"]
|
||||
Reference in New Issue
Block a user