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

Function parse_comparison_op

src/cypher/cypher.c:983–1020  ·  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

981
982/* Try to parse a comparison operator. Returns heap-allocated op string or NULL. */
983static char *parse_comparison_op(parser_t *p) {
984 if (match(p, TOK_EQ)) {
985 return heap_strdup("=");
986 }
987 if (match(p, TOK_NEQ)) {
988 return heap_strdup("<>");
989 }
990 if (match(p, TOK_EQTILDE)) {
991 return heap_strdup("=~");
992 }
993 if (match(p, TOK_GTE)) {
994 return heap_strdup(">=");
995 }
996 if (match(p, TOK_LTE)) {
997 return heap_strdup("<=");
998 }
999 if (match(p, TOK_GT)) {
1000 return heap_strdup(">");
1001 }
1002 if (match(p, TOK_LT)) {
1003 return heap_strdup("<");
1004 }
1005 if (check(p, TOK_CONTAINS)) {
1006 advance(p);
1007 return heap_strdup("CONTAINS");
1008 }
1009 if (check(p, TOK_STARTS)) {
1010 advance(p);
1011 expect(p, TOK_WITH);
1012 return heap_strdup("STARTS WITH");
1013 }
1014 if (check(p, TOK_ENDS)) {
1015 advance(p);
1016 expect(p, TOK_WITH);
1017 return heap_strdup("ENDS WITH");
1018 }
1019 return NULL;
1020}
1021
1022/* Parse a single condition: var.prop OP value | var.prop IS [NOT] NULL | var.prop IN [...] */
1023/* 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
expectFunction · 0.85
heap_strdupFunction · 0.70
checkFunction · 0.70
advanceFunction · 0.70

Tested by

no test coverage detected