From 49b12363b91102a79d1428ddafd97abeca068db2 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 19 Feb 2011 14:55:49 +0900 Subject: [PATCH] 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. --- osmo_codegen.g | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/osmo_codegen.g b/osmo_codegen.g index 68125e9..fe45cef 100644 --- a/osmo_codegen.g +++ b/osmo_codegen.g @@ -18,7 +18,9 @@ tokens { root : (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 */ @@ -53,7 +55,7 @@ ie_field_type | 'bcd' // BCD digits, always 'lower nibble, upper nibble, lower nibble, ... ); 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 : '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') ) ; - +ie_field_enum + : 'enum' ID -> ^('enum' ID) + ; + /* PDU DEFINITIONS*/ @@ -97,7 +102,7 @@ pdu_field_size ; pdu_field_opts - : pdu_up_downlink | pdu_opt_ie + : pdu_up_downlink | pdu_opt_ie | pdu_opt_enum ; pdu_up_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) ; +pdu_opt_enum + : 'enum' ID + -> ^('enum' ID) + ; pdu_field_type : (