MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / parse_comparison_op

Function parse_comparison_op

src/cypher/cypher.c:974–1011  ·  view source on GitHub ↗

Try to parse a comparison operator. Returns heap-allocated op string or NULL. */

Source from the content-addressed store, hash-verified

972
973/* Try to parse a comparison operator. Returns heap-allocated op string or NULL. */
974static char *parse_comparison_op(parser_t *p) {
975 if (match(p, TOK_EQ)) {
976 return heap_strdup("=");
977 }
978 if (match(p, TOK_NEQ)) {
979 return heap_strdup("<>");
980 }
981 if (match(p, TOK_EQTILDE)) {
982 return heap_strdup("=~");
983 }
984 if (match(p, TOK_GTE)) {
985 return heap_strdup(">=");
986 }
987 if (match(p, TOK_LTE)) {
988 return heap_strdup("<=");
989 }
990 if (match(p, TOK_GT)) {
991 return heap_strdup(">");
992 }
993 if (match(p, TOK_LT)) {
994 return heap_strdup("<");
995 }
996 if (check(p, TOK_CONTAINS)) {
997 advance(p);
998 return heap_strdup("CONTAINS");
999 }
1000 if (check(p, TOK_STARTS)) {
1001 advance(p);
1002 expect(p, TOK_WITH);
1003 return heap_strdup("STARTS WITH");
1004 }
1005 if (check(p, TOK_ENDS)) {
1006 advance(p);
1007 expect(p, TOK_WITH);
1008 return heap_strdup("ENDS WITH");
1009 }
1010 return NULL;
1011}
1012
1013/* Parse a single condition: var.prop OP value | var.prop IS [NOT] NULL | var.prop IN [...] */
1014/* Free the heap fields of a standalone node pattern (not owned by a pattern). */

Callers 1

parse_condition_opFunction · 0.85

Calls 5

matchFunction · 0.85
advanceFunction · 0.85
expectFunction · 0.85
heap_strdupFunction · 0.70
checkFunction · 0.70

Tested by

no test coverage detected