This leads to a syntax error inside PrettyPrinter.java.
rules Entry ::= [A];
rules A ::= "a";
separator A "\n";
~/Downloads/bnfc-2.9.6.3-linux.binary a.cf -java
Generated code with the un-escaped newline in render().
private static void ppListA(java.util.Iterator<a.Absyn.A> it, int _i_)
{
if (it.hasNext())
{ /* cons */
a.Absyn.A el = it.next();
pp(el, _i_); render("
"); ppListA(it, _i_);
}
}
Of course, because of whitespace normalisation, a "\n" separator is the same as a " " separator and we could just use that instead. But it would be nice to avoid the syntax error.
I haven't tested all other backends. The Ocaml and Tree-sitter ones seemed to be fine with the same grammar.
This leads to a syntax error inside PrettyPrinter.java.
Generated code with the un-escaped newline in
render().Of course, because of whitespace normalisation, a
"\n"separator is the same as a" "separator and we could just use that instead. But it would be nice to avoid the syntax error.I haven't tested all other backends. The Ocaml and Tree-sitter ones seemed to be fine with the same grammar.