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

Function parse_comparison_op

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

907
908/* Try to parse a comparison operator. Returns heap-allocated op string or NULL. */
909static char *parse_comparison_op(parser_t *p) {
910 if (match(p, TOK_EQ)) {
911 return heap_strdup("=");
912 }
913 if (match(p, TOK_NEQ)) {
914 return heap_strdup("<>");
915 }
916 if (match(p, TOK_EQTILDE)) {
917 return heap_strdup("=~");
918 }
919 if (match(p, TOK_GTE)) {
920 return heap_strdup(">=");
921 }
922 if (match(p, TOK_LTE)) {
923 return heap_strdup("<=");
924 }
925 if (match(p, TOK_GT)) {
926 return heap_strdup(">");
927 }
928 if (match(p, TOK_LT)) {
929 return heap_strdup("<");
930 }
931 if (check(p, TOK_CONTAINS)) {
932 advance(p);
933 return heap_strdup("CONTAINS");
934 }
935 if (check(p, TOK_STARTS)) {
936 advance(p);
937 expect(p, TOK_WITH);
938 return heap_strdup("STARTS WITH");
939 }
940 if (check(p, TOK_ENDS)) {
941 advance(p);
942 expect(p, TOK_WITH);
943 return heap_strdup("ENDS WITH");
944 }
945 return NULL;
946}
947
948/* Parse a single condition: var.prop OP value | var.prop IS [NOT] NULL | var.prop IN [...] */
949/* Free the heap fields of a standalone node pattern (not owned by a pattern). */

Callers 1

parse_condition_exprFunction · 0.85

Calls 5

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

Tested by

no test coverage detected