@@ -23,22 +23,22 @@ static int ReadLen(const void *data, const char *prop)
2323 return PySequence_Size (children_obj );
2424}
2525
26- static const char * GetInternalType (const void * node )
26+ static const char * InternalType (const void * node )
2727{
2828 return ReadStr (node , "internal_type" );
2929}
3030
31- static const char * GetToken (const void * node )
31+ static const char * Token (const void * node )
3232{
3333 return ReadStr (node , "token" );
3434}
3535
36- static int GetChildrenSize (const void * node )
36+ static int ChildrenSize (const void * node )
3737{
3838 return ReadLen (node , "children" );
3939}
4040
41- static void * GetChild (const void * data , int index )
41+ static void * ChildAt (const void * data , int index )
4242{
4343 PyObject * node = (PyObject * )data ;
4444 PyObject * children_obj = PyObject_GetAttrString (node , "children" );
@@ -49,12 +49,12 @@ static void *GetChild(const void *data, int index)
4949 return PyList_GET_ITEM (seq , index );
5050}
5151
52- static int GetRolesSize (const void * node )
52+ static int RolesSize (const void * node )
5353{
5454 return ReadLen (node , "roles" );
5555}
5656
57- static uint16_t GetRoleAt (const void * data , int index )
57+ static uint16_t RoleAt (const void * data , int index )
5858{
5959 PyObject * node = (PyObject * )data ;
6060 PyObject * roles_obj = PyObject_GetAttrString (node , "roles" );
@@ -64,7 +64,7 @@ static uint16_t GetRoleAt(const void *data, int index)
6464 return (uint16_t )PyLong_AsUnsignedLong (PyList_GET_ITEM (seq , index ));
6565}
6666
67- static int GetPropertiesSize (const void * data )
67+ static int PropertiesSize (const void * data )
6868{
6969 PyObject * node = (PyObject * )data ;
7070 PyObject * properties_obj = PyObject_GetAttrString (node , "properties" );
@@ -74,7 +74,7 @@ static int GetPropertiesSize(const void *data)
7474 return (int )PyLong_AsLong (properties_obj );
7575}
7676
77- static const char * GetPropertyAt (const void * data , int index )
77+ static const char * PropertyAT (const void * data , int index )
7878{
7979 PyObject * node = (PyObject * )data ;
8080 PyObject * properties_obj = PyObject_GetAttrString (node , "properties" );
@@ -91,7 +91,7 @@ static Uast *ctx;
9191/////////// PYTHON API //////////////
9292/////////////////////////////////////
9393
94- static PyObject * PyFind (PyObject * self , PyObject * args )
94+ static PyObject * PyFilter (PyObject * self , PyObject * args )
9595{
9696 PyObject * obj = NULL ;
9797 const char * query = NULL ;
@@ -116,7 +116,7 @@ static PyObject *PyFind(PyObject *self, PyObject *args)
116116}
117117
118118static PyMethodDef extension_methods [] = {
119- {"find " , PyFind , METH_VARARGS , "Find a node in the UAST" },
119+ {"filter " , PyFilter , METH_VARARGS , "Filter nodes in the UAST using the given query " },
120120 {NULL , NULL , 0 , NULL }
121121};
122122
@@ -135,14 +135,14 @@ static struct PyModuleDef module_def = {
135135PyMODINIT_FUNC PyInit_pyuast (void )
136136{
137137 NodeIface iface = {
138- .InternalType = GetInternalType ,
139- .Token = GetToken ,
140- .ChildrenSize = GetChildrenSize ,
141- .ChildAt = GetChild ,
142- .RolesSize = GetRolesSize ,
143- .RoleAt = GetRoleAt ,
144- .PropertiesSize = GetPropertiesSize ,
145- .PropertyAt = GetPropertyAt ,
138+ .InternalType = InternalType ,
139+ .Token = Token ,
140+ .ChildrenSize = ChildrenSize ,
141+ .ChildAt = ChildAt ,
142+ .RolesSize = RolesSize ,
143+ .RoleAt = RoleAt ,
144+ .PropertiesSize = PropertiesSize ,
145+ .PropertyAt = PropertyAT ,
146146 };
147147
148148 ctx = UastNew (iface );
0 commit comments