1
0
forked from GitHub/gf-core

added hasLinearization method in the Python binding

This commit is contained in:
kr.angelov
2014-03-20 14:48:47 +00:00
parent eb1aa24896
commit d816c34986

View File

@@ -1488,6 +1488,19 @@ Concr_bracketedLinearize(ConcrObject* self, PyObject *args)
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*
Concr_getName(ConcrObject *self, void *closure)
{
@@ -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"
},