Skip to content

Help with Parsing Issue in Custom Diagramming DSL #479

Answered by evilguest
zekenie asked this question in Help
Discussion options

You must be logged in to vote

The problem is in casing of the name of the rule FullIdent. The capital "F" instructs Ohm to ignore the whitespace when concatenating the identPart fragments. Therefore when it parses this fragment:

sports.football -> ball
sports.soccer -> ball

it sees it as an EdgeDefinition consisting of sports.football, ->, and ball\r\nsports.soccer. Then it tries to parse the rest, -> ball, and fails since neither NodeDefinition nor EdgeDefinition can start with ->.
Simple solution is to rename the rule into fullIdent. It will cause Ohm to stop grabbing the identParts after the first whitespace.
However, this will break parsing of the following program (if it was expected to succeed) (note the whites…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zekenie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants