in reply to PRD parser problem: How to deal with mutiple lines
This is about choices. From the examples, there are three possible section contents: single line description, description with a brace block, and blank. That leads to three productions (including blank which is not an <error>).
You could start that like:
Then define a descriptionsection_content: description |
Finally a statementdescription: 'DESCRIPTION' '=' statement | 'DESCRIPTION' '=' '{' statement(s) '}'
statement: ...
The key is to think: what are the choices for a valid description or statement or whatever? Each choice is an alternative. Each alternative is made of pieces which themselves might have choices.
p.s. Normal conventions of grammars have us use upper case on the left side of a rule only if we are defining a token. Other left sides, which are built from other things, are usually lower case.
Phil
The Gantry Web Framework Book is now available.
In Section
Seekers of Perl Wisdom