[Bro-Dev] [Bro-Commits] [git/bro] rpc: Add support for enum with explicit enumerator values. (0d37c42)

Gregor Maier gregor at icir.org
Fri Dec 10 08:39:14 PST 2010


On 12/10/10 6:48 , Seth Hall wrote:
> 
> On Dec 9, 2010, at 9:30 PM, Gregor Maier wrote:
> 
>>        redef enum foo += {
>>            BAR_E,      # value will be 12
>>            BAR_F = 5,  # value will be  5
>>            BAR_G,      # value will be  6
>>        };
> 
> 
> Quick question, what if this situation is encountered but the enums being autoincremented go up to 11?  Will it skip and make the next one 13?

I think I don't understand the question.
BAR_E is autoincremented to 12, because BAR_D was 11.

If the autoincrement hits a number that has been defined previously, it
will generate a (parse) error and let you know.

Example:

{  A = 10,
   B =  8,
   C,       # implicit  9
   D,       # would be implicit 10. ERROR. 10 already exists
}

A this version would work.
  { B=8, A=10, C, D }

cu
Gregor
-- 
Gregor Maier                                             gregor at icir.org
Int. Computer Science Institute (ICSI)          gregor at icsi.berkeley.edu
1947 Center St., Ste. 600                    http://www.icir.org/gregor/
Berkeley, CA 94704
USA


More information about the bro-dev mailing list