Says ':' is invalid input for cypher.ebnf
(insta/defparser parse-cypher
"https://s3.amazonaws.com/artifacts.opencypher.org/M18/cypher.ebnf")
Error parsing grammar specification: Parse error at line 284, column 50:
MapLiteral = '{', [SP], [PropertyKeyName, [SP], ':', [SP], Expression, [SP],
{ ',', [SP], PropertyKeyName, [SP], ':', [SP], Expression, [SP] }], '}' ; ^
Expected one of: ? (* * + / ! & ε eps EPSILON epsilon Epsilon < ( { [
#"#\"[^\"\\]*(?:\\.[^\"\\]*)*\"(?x) #Double-quoted regexp"
#"#'[^'\\]*(?:\\.[^'\\]*)*'(?x) #Single-quoted regexp"
#"\"[^\"\\]*(?:\\.[^\"\\]*)*\"(?x) #Double-quoted string"
#"'[^'\\]*(?:\\.[^'\\]*)*'(?x) #Single-quoted string" } | #"[^,
\r\t\n<>(){}\[\]+*?:=|'"#&!;./]+(?x) #Non-terminal"
I can't figure out why ':' is a bad expression.
In that line, it looks like [PropertyKeyName has a left bracket but no right bracket.
@Engelberg Thanks for reply.
it does have right bracket on the end of the line:
, [SP] }], '}' ;
it have the same error even if MapLiteral is reduced to:
MapLiteral = ':';
I believe the culprit is in your EscapedChar rule. Your rule begins '\'. That backslash is escaping that single-quote character, which is throwing off everything that follows. You probably mean '\\'.
I see some other issues you'll need to resolve. You use a - character frequently, which has no meaning in EBNF, and bounded repetition like 4 * HexDigit is an ABNF concept, not EBNF. But I don't think these are causing this specific error; it is treating - and 4 as the names of non-terminals it is expecting you to define later.
The best way to troubleshoot this kind of thing is to try to shrink the grammar and see what happens. The instaparse.combinators/ebnf function is very useful to work with smaller grammar fragments and see how they are parsed.