[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Match at least one?
From: |
Chris Gembarowski |
Subject: |
Match at least one? |
Date: |
Mon, 4 Apr 2011 16:41:26 -0700 (PDT) |
I have a message that can be defined thus:
msg
: MSG34 blocks TERMINATOR
;
blocks
: block
| blocks block
;
block
: optional_block
| mandatory_block
;
optional_block
: BLK1
| BLK2
| BLK3
;
mandatory_block
: BLK7
| BLK8
| BLK9
;
So, message 34 is made up of blocks that can come in any order. Some of the
blocks are mandatory and some are optional. All of the mandatory blocks must
exist in order for the message to be valid.
The problem with the grammar that I've written is that the mandatory blocks
aren't required to be there (I want to have at least one of each mandatory
block). How can I define the grammar such that at least one of each mandatory
block is required?
I'm guessing that I can't do it with the grammar itself and that I'll have to
do
some post processing once msg is matched.
Thanks,
Chris
- Match at least one?,
Chris Gembarowski <=