-
|
I'm working a "hello world" type project as part of my evaluation of ohm for something bigger. I'm getting a little tripped up with some newline behavior and I wonder if anyone has any insight. Here's my grammar: The following program works I get the following json But when I add a few more edges to my example I get the following error Apologies if this is a simple problem! My full program is below. Program |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
The problem is in casing of the name of the rule it sees it as an If you want to permit arbitrary whitespace within the compound identifiers, then you would have to disambiguate this. The most straightforward way to resolve this would be to prohibit sequential dots (sports..baseball): P.S. https://ohmjs.org/editor is a great tool to debug your grammar |
Beta Was this translation helpful? Give feedback.
The problem is in casing of the name of the rule
FullIdent. The capital "F" instructs Ohm to ignore the whitespace when concatenating theidentPartfragments. Therefore when it parses this fragment:it sees it as an
EdgeDefinitionconsisting ofsports.football,->, andball\r\nsports.soccer. Then it tries to parse the rest,-> ball, and fails since neitherNodeDefinitionnorEdgeDefinitioncan start with->.Simple solution is to rename the rule into
fullIdent. It will cause Ohm to stop grabbing theidentParts after the first whitespace.However, this will break parsing of the following program (if it was expected to succeed) (note the whites…