In an EBNF grammar I have two tokens shape and attr. How would I express that shape should occur one or more times and attr zero or more times, but in no particular order, i.e.:
shape1 shape2 shape3
attr1 shape1
shape1 attr1
shape1 shape2 attr1 shape3
Would all be parsed, but
attr1 attr2 ..
would not?
Answering my own question:
does the trick
(where
shapeandattrare defined elsewhere in the grammar. e.g.shape = 'a'andattr = 'b'. Then 'a' 'ab' 'aaab' 'bbbab' will all match but 'b' 'bb' 'bbb..' etc will not)