tree-sitter implementation for the confindent configuration language
at main 35 lines 844 B view raw
1#include <Python.h> 2 3typedef struct TSLanguage TSLanguage; 4 5TSLanguage *tree_sitter_confindent(void); 6 7static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args)) { 8 return PyCapsule_New(tree_sitter_confindent(), "tree_sitter.Language", NULL); 9} 10 11static struct PyModuleDef_Slot slots[] = { 12#ifdef Py_GIL_DISABLED 13 {Py_mod_gil, Py_MOD_GIL_NOT_USED}, 14#endif 15 {0, NULL} 16}; 17 18static PyMethodDef methods[] = { 19 {"language", _binding_language, METH_NOARGS, 20 "Get the tree-sitter language for this grammar."}, 21 {NULL, NULL, 0, NULL} 22}; 23 24static struct PyModuleDef module = { 25 .m_base = PyModuleDef_HEAD_INIT, 26 .m_name = "_binding", 27 .m_doc = NULL, 28 .m_size = 0, 29 .m_methods = methods, 30 .m_slots = slots, 31}; 32 33PyMODINIT_FUNC PyInit__binding(void) { 34 return PyModuleDef_Init(&module); 35}