Skip to content
Snippets Groups Projects
Commit ef8f9a28 authored by Luigi Rizzo's avatar Luigi Rizzo
Browse files

remove duplicated code

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@22842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 53715e59
Branches
Tags
No related merge requests found
...@@ -167,51 +167,24 @@ includes { STORE_POS; return KW_INCLUDES;} ...@@ -167,51 +167,24 @@ includes { STORE_POS; return KW_INCLUDES;}
} }
} }
<paren>{NOPARENS}\( { <paren>{NOPARENS}[\(\[\{] {
char c = yytext[yyleng-1];
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
parencount++; if (c == '(')
pbcpush('('); parencount++;
yymore(); pbcpush(c);
}
<paren>{NOPARENS}\[ {
yylloc->first_line = my_lineno;
yylloc->first_column=my_col;
pbcpush('[');
yymore();
}
<paren>{NOPARENS}\] {
yylloc->first_line = my_lineno;
yylloc->first_column=my_col;
if ( pbcpop(']') ) { /* error */
pbcwhere(yytext, &my_lineno, &my_col);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n",
my_file, my_lineno, my_col);
BEGIN(0);
yylloc->last_line = my_lineno;
yylloc->last_column = my_col;
yylval->str = strdup(yytext);
return word;
}
yymore();
}
<paren>{NOPARENS}\{ {
yylloc->first_line = my_lineno;
yylloc->first_column=my_col;
pbcpush('{');
yymore(); yymore();
} }
<paren>{NOPARENS}\} { <paren>{NOPARENS}[\]\}] {
char c = yytext[yyleng-1];
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop('}') ) { /* error */ if ( pbcpop(c)) { /* error */
pbcwhere(yytext, &my_lineno, &my_col); pbcwhere(yytext, &my_lineno, &my_col);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n",
my_file, my_lineno, my_col); my_file, my_lineno, my_col, c);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno; yylloc->last_line = my_lineno;
yylloc->last_column = my_col; yylloc->last_column = my_col;
...@@ -221,9 +194,6 @@ includes { STORE_POS; return KW_INCLUDES;} ...@@ -221,9 +194,6 @@ includes { STORE_POS; return KW_INCLUDES;}
yymore(); yymore();
} }
<argg>{NOARGG}\( { <argg>{NOARGG}\( {
/* printf("ARGG:%s\n",yytext); */ /* printf("ARGG:%s\n",yytext); */
/* printf("GOT AN LP!!!\n"); */ /* printf("GOT AN LP!!!\n"); */
...@@ -539,18 +509,22 @@ static int pbcpop(char x) ...@@ -539,18 +509,22 @@ static int pbcpop(char x)
static int c_prevword(void) static int c_prevword(void)
{ {
char *c = prev_word; char *c = prev_word;
int ret = 0; if (c == NULL)
while ( c && *c ) { return 0;
while ( *c ) {
switch (*c) { switch (*c) {
case '{': pbcpush('{');break; case '{':
case '}': ret = pbcpop('}');break; case '[':
case '[':pbcpush('[');break; case '(':
case ']':ret = pbcpop(']');break; pbcpush(*c);
case '(':pbcpush('(');break; break;
case ')':ret = pbcpop(')'); break; case '}':
case ']':
case ')':
if (pbcpop(*c))
return 1;
break;
} }
if( ret )
return 1;
c++; c++;
} }
return 0; return 0;
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment