Skip to content

Commit

Permalink
core: try to catch dash immediately after ID in define/ifdef
Browse files Browse the repository at this point in the history
- reported by GH #743
  • Loading branch information
miconda committed Sep 7, 2016
1 parent 3d49fd5 commit 38b4bbd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cfg.lex
Expand Up @@ -1192,9 +1192,9 @@ IMPORTFILE "import_file"

<INITIAL>{COM_LINE}!{SER_CFG}{CR} { count();
sr_cfg_compat=SR_COMPAT_SER;}
<INITIAL>{COM_LINE}!{KAMAILIO_CFG}{CR} { count();
<INITIAL>{COM_LINE}!{KAMAILIO_CFG}{CR} { count();
sr_cfg_compat=SR_COMPAT_KAMAILIO;}
<INITIAL>{COM_LINE}!{MAXCOMPAT_CFG}{CR} { count();
<INITIAL>{COM_LINE}!{MAXCOMPAT_CFG}{CR} { count();
sr_cfg_compat=SR_COMPAT_MAX;}

<INITIAL>{PREP_START}{DEFINE}{EAT_ABLE}+ { count(); pp_define_set_type(0);
Expand All @@ -1203,6 +1203,12 @@ IMPORTFILE "import_file"
state = DEFINE_S; BEGIN(DEFINE_ID); }
<INITIAL>{PREP_START}{REDEF}{EAT_ABLE}+ { count(); pp_define_set_type(2);
state = DEFINE_S; BEGIN(DEFINE_ID); }
<DEFINE_ID>{ID}{MINUS} { count();
LOG(L_CRIT,
"error at %s line %d: '-' not allowed\n",
(finame)?finame:"cfg", line);
exit(-1);
}
<DEFINE_ID>{ID} { count();
if (pp_define(yyleng, yytext)) return 1;
state = DEFINE_EOL_S; BEGIN(DEFINE_EOL); }
Expand Down Expand Up @@ -1230,6 +1236,12 @@ IMPORTFILE "import_file"
<INITIAL,IFDEF_SKIP>{PREP_START}{IFNDEF}{EAT_ABLE}+ { count();
if (pp_ifdef_type(0)) return 1;
state = IFDEF_S; BEGIN(IFDEF_ID); }
<IFDEF_ID>{ID}{MINUS} { count();
LOG(L_CRIT,
"error at %s line %d: '-' not allowed\n",
(finame)?finame:"cfg", line);
exit(-1);
}
<IFDEF_ID>{ID} { count();
pp_ifdef_var(yyleng, yytext);
state = IFDEF_EOL_S; BEGIN(IFDEF_EOL); }
Expand Down

0 comments on commit 38b4bbd

Please sign in to comment.