aboutsummaryrefslogtreecommitdiff
path: root/bindings/python/tree_sitter_gsp/binding.c
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-04-18 11:07:53 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-04-18 11:35:24 +0200
commit4b160d1b2119cd2007ea7a76d4baba56ad66b825 (patch)
treea6c5d491c8306304cc9ec112ffedcae4ff6bced3 /bindings/python/tree_sitter_gsp/binding.c
parent1f10ff9a6039a50e2f7be394fc22b1400832cf17 (diff)
Support comments… sortav1.2.0
Diffstat (limited to 'bindings/python/tree_sitter_gsp/binding.c')
-rw-r--r--bindings/python/tree_sitter_gsp/binding.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/bindings/python/tree_sitter_gsp/binding.c b/bindings/python/tree_sitter_gsp/binding.c
new file mode 100644
index 0000000..569c1dc
--- /dev/null
+++ b/bindings/python/tree_sitter_gsp/binding.c
@@ -0,0 +1,27 @@
+#include <Python.h>
+
+typedef struct TSLanguage TSLanguage;
+
+TSLanguage *tree_sitter_gsp(void);
+
+static PyObject* _binding_language(PyObject *self, PyObject *args) {
+ return PyLong_FromVoidPtr(tree_sitter_gsp());
+}
+
+static PyMethodDef methods[] = {
+ {"language", _binding_language, METH_NOARGS,
+ "Get the tree-sitter language for this grammar."},
+ {NULL, NULL, 0, NULL}
+};
+
+static struct PyModuleDef module = {
+ .m_base = PyModuleDef_HEAD_INIT,
+ .m_name = "_binding",
+ .m_doc = NULL,
+ .m_size = -1,
+ .m_methods = methods
+};
+
+PyMODINIT_FUNC PyInit__binding(void) {
+ return PyModule_Create(&module);
+}