add 'enum ID' options to IE and PDU definition

We don't actually have a way how to define enum's yet, but this will
be next.
This commit is contained in:
Harald Welte 2011-02-19 14:55:49 +09:00
parent 334493f3b2
commit 49b12363b9
1 changed files with 13 additions and 4 deletions

View File

@ -18,7 +18,9 @@ tokens {
root : root :
(pdu_spec | ie_spec | ie_alias)* (pdu_spec | ie_spec | ie_alias)*
-> ^(IE_SPECS ie_spec*) ^(IE_ALIASES ie_alias*) ^(PDU_SPECS pdu_spec*) -> ^(IE_SPECS ie_spec*)
^(IE_ALIASES ie_alias*)
^(PDU_SPECS pdu_spec*)
; ;
/* INFORMATION ELEMENTS */ /* INFORMATION ELEMENTS */
@ -53,7 +55,7 @@ ie_field_type
| 'bcd' // BCD digits, always 'lower nibble, upper nibble, lower nibble, ... | 'bcd' // BCD digits, always 'lower nibble, upper nibble, lower nibble, ...
); );
ie_field_opt ie_field_opt
: (field_val | ie_field_cond | ie_field_endian) : (field_val | ie_field_cond | ie_field_endian | ie_field_enum)
; ;
ie_field_cond ie_field_cond
: 'if (' ie_field_name ('&' ie_field_cond_mask)? COMP_OP ie_field_cond_reference ')' : 'if (' ie_field_name ('&' ie_field_cond_mask)? COMP_OP ie_field_cond_reference ')'
@ -68,7 +70,10 @@ ie_field_endian
| 'little' -> ^(IEFIELD_ENDIAN 'little') | 'little' -> ^(IEFIELD_ENDIAN 'little')
) )
; ;
ie_field_enum
: 'enum' ID -> ^('enum' ID)
;
/* PDU DEFINITIONS*/ /* PDU DEFINITIONS*/
@ -97,7 +102,7 @@ pdu_field_size
; ;
pdu_field_opts pdu_field_opts
: pdu_up_downlink | pdu_opt_ie : pdu_up_downlink | pdu_opt_ie | pdu_opt_enum
; ;
pdu_up_downlink pdu_up_downlink
: 'uplink_only' | 'downlink_only'; // only valid in uplink or downlink : 'uplink_only' | 'downlink_only'; // only valid in uplink or downlink
@ -105,6 +110,10 @@ pdu_opt_ie
: 'ie' ID // use speciifed IE definition : 'ie' ID // use speciifed IE definition
-> ^('ie' ID) -> ^('ie' ID)
; ;
pdu_opt_enum
: 'enum' ID
-> ^('enum' ID)
;
pdu_field_type pdu_field_type
: ( : (