mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 02:26:23 +00:00
simplify case_statements
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@24424 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -121,6 +121,7 @@ static pval *update_last(pval *, YYLTYPE *);
|
|||||||
%type <pval>switchlist_block
|
%type <pval>switchlist_block
|
||||||
%type <pval>timespec
|
%type <pval>timespec
|
||||||
%type <pval>included_entry
|
%type <pval>included_entry
|
||||||
|
%type <pval>opt_statements
|
||||||
|
|
||||||
%type <str>opt_word
|
%type <str>opt_word
|
||||||
%type <str>context_name
|
%type <str>context_name
|
||||||
@@ -169,6 +170,7 @@ static pval *update_last(pval *, YYLTYPE *);
|
|||||||
opt_else
|
opt_else
|
||||||
elements_block switchlist_block
|
elements_block switchlist_block
|
||||||
timespec included_entry
|
timespec included_entry
|
||||||
|
opt_statements
|
||||||
|
|
||||||
%destructor { free($$);} word word_list goto_word word3_list opt_word context_name
|
%destructor { free($$);} word word_list goto_word word3_list opt_word context_name
|
||||||
timerange
|
timerange
|
||||||
@@ -547,27 +549,23 @@ case_statements: /* empty */ { $$ = NULL; }
|
|||||||
| case_statements case_statement { $$ = linku1($1, $2); }
|
| case_statements case_statement { $$ = linku1($1, $2); }
|
||||||
;
|
;
|
||||||
|
|
||||||
case_statement: KW_CASE word COLON statements {
|
/* statement in a switch body after a label */
|
||||||
|
opt_statements : { $$ = NULL; }
|
||||||
|
| statements { $$ = $1; }
|
||||||
|
;
|
||||||
|
|
||||||
|
case_statement: KW_CASE word COLON opt_statements {
|
||||||
$$ = npval2(PV_CASE, &@1, &@3); /* XXX 3 or 4 ? */
|
$$ = npval2(PV_CASE, &@1, &@3); /* XXX 3 or 4 ? */
|
||||||
$$->u1.str = $2;
|
$$->u1.str = $2;
|
||||||
$$->u2.statements = $4;}
|
$$->u2.statements = $4;}
|
||||||
| KW_DEFAULT COLON statements {
|
| KW_DEFAULT COLON opt_statements {
|
||||||
$$ = npval2(PV_DEFAULT, &@1, &@3);
|
$$ = npval2(PV_DEFAULT, &@1, &@3);
|
||||||
$$->u1.str = NULL;
|
$$->u1.str = NULL;
|
||||||
$$->u2.statements = $3;}
|
$$->u2.statements = $3;}
|
||||||
| KW_PATTERN word COLON statements {
|
| KW_PATTERN word COLON opt_statements {
|
||||||
$$ = npval2(PV_PATTERN, &@1, &@4); /* XXX@3 or @4 ? */
|
$$ = npval2(PV_PATTERN, &@1, &@4); /* XXX@3 or @4 ? */
|
||||||
$$->u1.str = $2;
|
$$->u1.str = $2;
|
||||||
$$->u2.statements = $4;}
|
$$->u2.statements = $4;}
|
||||||
| KW_CASE word COLON {
|
|
||||||
$$ = npval2(PV_CASE, &@1, &@3);
|
|
||||||
$$->u1.str = $2;}
|
|
||||||
| KW_DEFAULT COLON {
|
|
||||||
$$ = npval2(PV_DEFAULT, &@1, &@2);
|
|
||||||
$$->u1.str = NULL;}
|
|
||||||
| KW_PATTERN word COLON {
|
|
||||||
$$ = npval2(PV_PATTERN, &@1, &@3);
|
|
||||||
$$->u1.str = $2;}
|
|
||||||
;
|
;
|
||||||
|
|
||||||
macro_statements: /* empty */ { $$ = NULL; }
|
macro_statements: /* empty */ { $$ = NULL; }
|
||||||
|
Reference in New Issue
Block a user