From 6a36ce77fff65076707126fc6803b3b010bed2f7 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Mon, 11 Feb 2013 15:51:26 +0000 Subject: the class PgfConcr from the Python binding now has a property name which returns the name of the concrete syntax --- src/runtime/python/pypgf.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/runtime/python') diff --git a/src/runtime/python/pypgf.c b/src/runtime/python/pypgf.c index 4b2ab5891..95d92fbce 100644 --- a/src/runtime/python/pypgf.c +++ b/src/runtime/python/pypgf.c @@ -731,6 +731,20 @@ Concr_linearize(ConcrObject* self, PyObject *args) return pystr; } +static PyObject* +Concr_getName(ConcrObject *self, void *closure) +{ + return gu2py_string(pgf_concrete_name(self->concr)); +} + +static PyGetSetDef Concr_getseters[] = { + {"name", + (getter)Concr_getName, NULL, + "the name of the concrete syntax", + }, + {NULL} /* Sentinel */ +}; + static PyMethodDef Concr_methods[] = { {"printName", (PyCFunction)Concr_printName, METH_VARARGS, "Returns the print name of a function or category" @@ -775,7 +789,7 @@ static PyTypeObject pgf_ConcrType = { 0, /*tp_iternext */ Concr_methods, /*tp_methods */ 0, /*tp_members */ - 0, /*tp_getset */ + Concr_getseters, /*tp_getset */ 0, /*tp_base */ 0, /*tp_dict */ 0, /*tp_descr_get */ -- cgit v1.2.3