libcypher-parser
libcypher-parser copied to clipboard
Question on setting parameters
What is the recommended way to set parameters in libcypher-parser?
":param x => [1,2];"
results in:
@0 0..17 command name=@1, args=[@2, @3, @4]
@1 1..6 > string "param"
@2 7..8 > string "x"
@3 9..11 > string "=>"
@4 12..17 > string "[1,2]"
Looking at the client-arg-string
definition in the source, it seems that arguments are always interpreted as simple strings. Would it be difficult to parse parameter values as atoms instead, or does that pose issues I haven't considered?
I don't imagine parsing the :param
comamnd presents any major challenges, especially as, :param x => ...
isn't part of the Cypher grammar.
The challenge is how that would interplay with tools that use the parameter parsing, like https://neo4j-client.net/.
Actually, one big issue would be determining what tokens are expressions and what are not. The command parsing just recognizes :<symbolic_name>
followed by arguments. Which of those arguments are to be considered Cypher expressions is entirely dependent on what the command represents, which isn't something the parser knows (because there is no standard). E.g. there is no standard that says ":param" is followed by a string, a =>
, and then an expression.