retrieve the first instance of the specified clause in the AST segment if any
| 278 | |
| 279 | // retrieve the first instance of the specified clause in the AST segment if any |
| 280 | const cypher_astnode_t *AST_GetClause |
| 281 | ( |
| 282 | const AST *ast, |
| 283 | cypher_astnode_type_t clause_type, |
| 284 | uint *clause_idx |
| 285 | ) { |
| 286 | uint clause_count = cypher_ast_query_nclauses(ast->root); |
| 287 | for(uint i = 0; i < clause_count; i ++) { |
| 288 | const cypher_astnode_t *child = cypher_ast_query_get_clause(ast->root, i); |
| 289 | if(cypher_astnode_type(child) == clause_type) { |
| 290 | if(clause_idx) *clause_idx = i; |
| 291 | return child; |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | return NULL; |
| 296 | } |
| 297 | |
| 298 | const cypher_astnode_t *AST_GetClauseByIdx |
| 299 | ( |
no outgoing calls
no test coverage detected