Skip to content

Cypher: pipe-syntax label alternation MATCH (n:A|B) not supported #242

@maksodf

Description

@maksodf

Environment

  • cbm version: 0.6.0
  • Platform: macOS (Darwin arm64)

Bug

Pipe-syntax label alternation in node patterns (standard openCypher MATCH (n:A|B), added in Neo4j 5+) is not supported.

Minimal reproducer

MATCH (n:Class|Method) WHERE n.file_path CONTAINS 'JarvisApp.swift'
RETURN count(n) AS c

Expected: count of all Class-or-Method nodes in the file.
Actual: parse error — expected token type 67, got 83 at pos 14.

Root cause

src/cypher/cypher.hcbm_node_pattern_t (line 157-163) has a single const char *label field. The AST can only store one label per node pattern; multi-label alternation isn't representable.

Proposed fix

Change cbm_node_pattern_t.label from const char * to const char **labels + int label_count. Update:

  • parse_node (line 507) to parse pipe-separated label lists
  • Every consumer of node_pattern.label in the executor (pattern matching, scanning, etc.)
  • free_pattern (line 1509) for cleanup

Architectural change — touches AST + parser + executor + memory management. Reporting for visibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcypherCypher query language parser/executor bugs

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions