diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2014-03-20 14:48:47 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2014-03-20 14:48:47 +0000 |
| commit | d816c34986d3ecb4624d7638e290adddc941b38d (patch) | |
| tree | ceb196c68eb33850a76843706fda98b9a091bbdf /src/runtime/python/pypgf.c | |
| parent | eb1aa2489642dad9e3d18f146f35a3a9313ce311 (diff) | |
added hasLinearization method in the Python binding
Diffstat (limited to 'src/runtime/python/pypgf.c')
| -rw-r--r-- | src/runtime/python/pypgf.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/runtime/python/pypgf.c b/src/runtime/python/pypgf.c index 23b321d06..3b7611865 100644 --- a/src/runtime/python/pypgf.c +++ b/src/runtime/python/pypgf.c @@ -1489,6 +1489,19 @@ Concr_bracketedLinearize(ConcrObject* self, PyObject *args) } 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* Concr_getName(ConcrObject *self, void *closure) { return PyString_FromString(pgf_concrete_name(self->concr)); @@ -1743,6 +1756,9 @@ static PyMethodDef Concr_methods[] = { {"bracketedLinearize", (PyCFunction)Concr_bracketedLinearize, METH_VARARGS, "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, "Renders an abstract syntax tree as a parse tree in Graphviz format" }, |
