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

Function parse_comparison_op

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

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