Match at least 1 of the following

34 views
Skip to first unread message

Alex Matchneer

unread,
Jan 22, 2013, 10:26:52 PM1/22/13
to pe...@googlegroups.com
Hi, I posted the following sort of question to SO: http://stackoverflow.com/questions/14471921/how-do-i-dry-this-pegjs-rule

I'm tempted to use something close to this:

id:idShortcut? classes:classShortcut* attrs:fullAttribute* 

But i don't want it to match if all three are empty/absent. Is there a way to do this in peg? Right now i have a really repetitive 3 prong rule.

David Majda

unread,
Mar 12, 2013, 3:33:41 PM3/12/13
to mac...@gmail.com, pegjs
Hi,

2013/1/23 Alex Matchneer <mac...@gmail.com>:
> Hi, I posted the following sort of question to SO:
> http://stackoverflow.com/questions/14471921/how-do-i-dry-this-pegjs-rule

I see you already answered your question yourself :-) I just want to
add that I don't think there is a better solution than the one you
figured out.

--
David Majda
Entropy fighter
http://majda.cz/
Reply all
Reply to author
Forward
0 new messages