Browse code

core: cfg parser - resolve conflict between proto:host and event route name

- there was a conflict on same kind of id:id format
- event route name is expected now only after an event_route

Daniel-Constantin Mierla authored on 05/01/2015 17:50:40
Showing 1 changed files
... ...
@@ -117,6 +117,7 @@
117 117
 	#define IFDEF_EOL_S             14
118 118
 	#define IFDEF_SKIP_S            15
119 119
 	#define DEFINE_DATA_S           16
120
+	#define EVRT_NAME_S             17
120 121
 
121 122
 	#define STR_BUF_ALLOC_UNIT	128
122 123
 	struct str_buf{
... ...
@@ -181,7 +182,7 @@
181 182
 
182 183
 /* start conditions */
183 184
 %x STRING1 STRING2 STR_BETWEEN COMMENT COMMENT_LN ATTR SELECT AVP_PVAR PVAR_P 
184
-%x PVARID INCLF IMPTF
185
+%x PVARID INCLF IMPTF EVRTNAME
185 186
 %x LINECOMMENT DEFINE_ID DEFINE_EOL DEFINE_DATA IFDEF_ID IFDEF_EOL IFDEF_SKIP
186 187
 
187 188
 /* config script types : #!SER  or #!KAMAILIO or #!MAX_COMPAT */
... ...
@@ -619,7 +620,19 @@ IMPORTFILE      "import_file"
619 620
 <INITIAL>{ROUTE_SEND} { count(); default_routename="DEFAULT_SEND";
620 621
 							yylval.strval=yytext; return ROUTE_SEND; }
621 622
 <INITIAL>{ROUTE_EVENT} { count(); default_routename="DEFAULT_EVENT";
622
-							yylval.strval=yytext; return ROUTE_EVENT; }
623
+							yylval.strval=yytext;
624
+							state=EVRT_NAME_S; BEGIN(EVRTNAME);
625
+							return ROUTE_EVENT; }
626
+<EVRTNAME>{LBRACK}          { count(); return LBRACK; }
627
+<EVRTNAME>{EAT_ABLE}|{CR}				{ count(); };
628
+<EVRTNAME>{EVENT_RT_NAME}	{ count();
629
+								addstr(&s_buf, yytext, yyleng);
630
+								yylval.strval=s_buf.s;
631
+								memset(&s_buf, 0, sizeof(s_buf));
632
+								return EVENT_RT_NAME; }
633
+<EVRTNAME>{RBRACK}          { count();
634
+								state=INITIAL_S; BEGIN(INITIAL);
635
+								return RBRACK; }
623 636
 <INITIAL>{EXEC}	{ count(); yylval.strval=yytext; return EXEC; }
624 637
 <INITIAL>{SET_HOST}	{ count(); yylval.strval=yytext; return SET_HOST; }
625 638
 <INITIAL>{SET_HOSTPORT}	{ count(); yylval.strval=yytext; return SET_HOSTPORT; }
... ...
@@ -1150,11 +1163,6 @@ IMPORTFILE      "import_file"
1150 1163
 <INITIAL>{DOT}		{ count(); return DOT; }
1151 1164
 <INITIAL>\\{CR}		{count(); } /* eat the escaped CR */
1152 1165
 <INITIAL>{CR}		{ count();/* return CR;*/ }
1153
-<INITIAL>{EVENT_RT_NAME}	{ count();
1154
-								addstr(&s_buf, yytext, yyleng);
1155
-								yylval.strval=s_buf.s;
1156
-								memset(&s_buf, 0, sizeof(s_buf));
1157
-								return EVENT_RT_NAME; }
1158 1166
 
1159 1167
 
1160 1168
 <INITIAL,SELECT>{QUOTES} { count(); old_initial = YY_START;