Closed vsajip closed 1 year ago
RR tries to detect repetitions with separators, and it comes up here with an empty repeated part, with everything else as the separator. This depends on the order of left- and right-factoring steps, and there is no way to influence this, but rephrasing the production. In this case you will get the desired result, if you put EOL*
first in the original repetition, rather than last:
key_value ::= ( EOL* key ( ':' | '=' ) value ','? )* EOL*
But what I would probably do is separate the key value pair from the repetion into separate productions:
key_value_pairs ::= EOL* ( key_value_pair EOL* )*
key_value_pair ::= key ( ':' | '=' ) value ','?
The following production
leads to diagram
However, adding
EOL*
to the beginning of the productionleads to
which, while not wrong, can confuse the reader because of the right-to-left ordering of
key
andvalue
in the diagram. Is there a workaround for this? I tried changing some of the options but nothing caused left-to-right display ofkey
andvalue
.