mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 19:42:50 -06:00
added hasLinearization method in the Python binding
This commit is contained in:
@@ -1488,6 +1488,19 @@ Concr_bracketedLinearize(ConcrObject* self, PyObject *args)
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
|
Concr_hasLinearization(ConcrObject* self, PyObject *args)
|
||||||
|
{
|
||||||
|
PgfCId id;
|
||||||
|
if (!PyArg_ParseTuple(args, "s", &id))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (pgf_has_linearization(self->concr, id))
|
||||||
|
Py_RETURN_TRUE;
|
||||||
|
else
|
||||||
|
Py_RETURN_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
Concr_getName(ConcrObject *self, void *closure)
|
Concr_getName(ConcrObject *self, void *closure)
|
||||||
{
|
{
|
||||||
@@ -1743,6 +1756,9 @@ static PyMethodDef Concr_methods[] = {
|
|||||||
{"bracketedLinearize", (PyCFunction)Concr_bracketedLinearize, METH_VARARGS,
|
{"bracketedLinearize", (PyCFunction)Concr_bracketedLinearize, METH_VARARGS,
|
||||||
"Takes an abstract tree and linearizes it to a bracketed string"
|
"Takes an abstract tree and linearizes it to a bracketed string"
|
||||||
},
|
},
|
||||||
|
{"hasLinearization", (PyCFunction)Concr_hasLinearization, METH_VARARGS,
|
||||||
|
"hasLinearization(f) returns true if the function f has linearization in the concrete syntax"
|
||||||
|
},
|
||||||
{"graphvizParseTree", (PyCFunction)Concr_graphvizParseTree, METH_VARARGS,
|
{"graphvizParseTree", (PyCFunction)Concr_graphvizParseTree, METH_VARARGS,
|
||||||
"Renders an abstract syntax tree as a parse tree in Graphviz format"
|
"Renders an abstract syntax tree as a parse tree in Graphviz format"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user