Merged revisions 179807 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

I had some work to do to port these changes to trunk; the 
check_expr stuff hasn't been updated here for quite some
time, it appears. I added some more tests to the check_expr2
suite. I had to play around with the makefile a bit, etc.

I added STANDALONE2 #ifdefs to ast_expr2.y so as not to
conflict structure with aelparse.

........
  r179807 | murf | 2009-03-03 11:11:34 -0700 (Tue, 03 Mar 2009) | 19 lines
  
  These changes allow AEL to better check ${} constructs within $[...], that are concatenated with text.
  
  I modified and added rules in ast_expr2.fl to better handle
  the concatenations.
  
  I added some default routines to ast_expr2.y so the standalone would
  compile. It also looks like I haven't run this thru bison since 2.1, so
  it's good to get this updated.
  
  The Makefile has comments added now for check_expr2 and check_expr to
  explain what they are for, and how to run them. 
  
  The testexpr2s stuff has been removed, in favor of check_expr2.
  
  expr2.testinput has been updated to include the two expressions
  that inspired these changes (from mcnobody on #asterisk this morning)
  The regression has been run and all looks well.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@179973 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2009-03-03 22:12:02 +00:00
parent ae786501f1
commit f47b03877b
7 changed files with 346 additions and 190 deletions

View File

@@ -353,8 +353,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 37
#define YY_END_OF_BUFFER 38
#define YY_NUM_RULES 38
#define YY_END_OF_BUFFER 39
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -362,14 +362,15 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[61] =
static yyconst flex_int16_t yy_accept[63] =
{ 0,
0, 0, 0, 0, 34, 34, 38, 37, 27, 29,
21, 37, 31, 37, 19, 2, 24, 25, 17, 14,
0, 0, 0, 0, 35, 35, 39, 38, 27, 29,
21, 38, 31, 38, 19, 2, 24, 25, 17, 14,
15, 16, 18, 30, 22, 10, 3, 9, 20, 1,
37, 37, 33, 32, 34, 35, 35, 13, 0, 28,
38, 38, 34, 33, 35, 37, 37, 13, 0, 28,
31, 0, 26, 5, 31, 30, 23, 12, 6, 7,
11, 4, 8, 0, 33, 32, 34, 36, 30, 0
11, 4, 8, 0, 34, 33, 35, 0, 36, 32,
30, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -406,75 +407,73 @@ static yyconst flex_int32_t yy_ec[256] =
static yyconst flex_int32_t yy_meta[29] =
{ 0,
1, 2, 2, 2, 1, 3, 4, 2, 2, 2,
1, 2, 2, 2, 1, 3, 3, 2, 2, 2,
2, 2, 2, 1, 2, 3, 2, 3, 2, 2,
2, 2, 2, 1, 2, 1, 1, 3
} ;
static yyconst flex_int16_t yy_base[68] =
static yyconst flex_int16_t yy_base[70] =
{ 0,
0, 0, 5, 6, 32, 60, 69, 137, 137, 137,
47, 59, 56, 38, 137, 48, 137, 137, 137, 137,
137, 137, 137, 83, 36, 33, 13, 32, 137, 27,
24, 17, 137, 137, 0, 137, 25, 137, 42, 137,
38, 12, 137, 137, 17, 0, 137, 137, 137, 137,
137, 137, 137, 18, 137, 137, 0, 137, 0, 137,
111, 115, 119, 121, 125, 129, 133
0, 0, 5, 6, 32, 60, 73, 130, 130, 130,
51, 66, 63, 45, 130, 59, 130, 130, 130, 130,
130, 130, 130, 83, 45, 42, 13, 41, 130, 32,
28, 17, 130, 130, 47, 130, 29, 130, 47, 130,
44, 25, 130, 130, 29, 0, 130, 130, 130, 130,
130, 130, 130, 18, 130, 130, 38, 12, 130, 130,
0, 130, 111, 114, 117, 32, 120, 123, 126
} ;
static yyconst flex_int16_t yy_def[68] =
static yyconst flex_int16_t yy_def[70] =
{ 0,
60, 1, 61, 61, 62, 62, 60, 60, 60, 60,
60, 63, 64, 65, 60, 60, 60, 60, 60, 60,
60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
60, 66, 60, 60, 67, 60, 60, 60, 63, 60,
64, 65, 60, 60, 41, 24, 60, 60, 60, 60,
60, 60, 60, 66, 60, 60, 67, 60, 45, 0,
60, 60, 60, 60, 60, 60, 60
62, 1, 63, 63, 64, 64, 62, 62, 62, 62,
62, 65, 66, 67, 62, 62, 62, 62, 62, 62,
62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
62, 68, 62, 62, 69, 62, 62, 62, 65, 62,
66, 67, 62, 62, 41, 24, 62, 62, 62, 62,
62, 62, 62, 68, 62, 62, 69, 62, 62, 62,
45, 0, 62, 62, 62, 62, 62, 62, 62
} ;
static yyconst flex_int16_t yy_nxt[166] =
static yyconst flex_int16_t yy_nxt[159] =
{ 0,
8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 13, 23, 24, 25, 26,
27, 28, 29, 8, 30, 8, 31, 13, 33, 33,
34, 34, 35, 49, 59, 60, 35, 35, 37, 50,
55, 55, 56, 56, 42, 35, 40, 35, 58, 35,
53, 52, 51, 48, 47, 35, 44, 35, 35, 35,
35, 43, 42, 40, 35, 35, 37, 38, 60, 60,
60, 60, 60, 35, 60, 35, 60, 35, 60, 60,
60, 60, 60, 35, 60, 35, 35, 35, 41, 42,
60, 60, 60, 60, 60, 60, 60, 60, 45, 60,
34, 34, 35, 49, 41, 59, 35, 35, 37, 50,
55, 55, 56, 56, 58, 35, 61, 35, 60, 35,
42, 40, 59, 58, 53, 35, 52, 35, 35, 35,
35, 51, 48, 47, 35, 35, 37, 44, 43, 42,
40, 38, 62, 35, 62, 35, 62, 35, 62, 62,
62, 62, 62, 35, 62, 35, 35, 35, 41, 42,
62, 62, 62, 62, 62, 62, 62, 62, 45, 62,
46, 60, 60, 60, 60, 60, 60, 60, 60, 60,
41, 32, 32, 32, 32, 36, 36, 36, 36, 39,
39, 39, 39, 41, 41, 41, 41, 41, 41, 54,
54, 54, 54, 57, 60, 57, 7, 60, 60, 60,
60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
60, 60, 60, 60, 60
46, 62, 62, 62, 62, 62, 62, 62, 62, 62,
41, 32, 32, 32, 36, 36, 36, 39, 39, 39,
41, 41, 41, 54, 54, 54, 57, 62, 57, 7,
62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
62, 62, 62, 62, 62, 62, 62, 62
} ;
static yyconst flex_int16_t yy_chk[166] =
static yyconst flex_int16_t yy_chk[159] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 3, 4,
3, 4, 5, 27, 45, 42, 5, 5, 5, 27,
32, 54, 32, 54, 41, 5, 39, 5, 37, 5,
31, 30, 28, 26, 25, 5, 16, 5, 5, 5,
6, 14, 13, 12, 6, 6, 6, 11, 7, 0,
0, 0, 0, 6, 0, 6, 0, 6, 0, 0,
3, 4, 5, 27, 66, 58, 5, 5, 5, 27,
32, 54, 32, 54, 57, 5, 45, 5, 42, 5,
41, 39, 37, 35, 31, 5, 30, 5, 5, 5,
6, 28, 26, 25, 6, 6, 6, 16, 14, 13,
12, 11, 7, 6, 0, 6, 0, 6, 0, 0,
0, 0, 0, 6, 0, 6, 6, 6, 24, 24,
0, 0, 0, 0, 0, 0, 0, 0, 24, 0,
24, 0, 0, 0, 0, 0, 0, 0, 0, 0,
24, 61, 61, 61, 61, 62, 62, 62, 62, 63,
63, 63, 63, 64, 64, 65, 65, 65, 65, 66,
66, 66, 66, 67, 0, 67, 60, 60, 60, 60,
60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
60, 60, 60, 60, 60
24, 63, 63, 63, 64, 64, 64, 65, 65, 65,
67, 67, 67, 68, 68, 68, 69, 0, 69, 62,
62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
62, 62, 62, 62, 62, 62, 62, 62
} ;
/* The intent behind this definition is that it'll catch
@@ -597,7 +596,7 @@ int ast_yyget_column(yyscan_t yyscanner);
static int curlycount = 0;
static char *expr2_token_subst(const char *mess);
#line 599 "ast_expr2f.c"
#line 598 "ast_expr2f.c"
#define INITIAL 0
#define var 1
@@ -843,7 +842,7 @@ YY_DECL
#line 125 "ast_expr2.fl"
#line 845 "ast_expr2f.c"
#line 844 "ast_expr2f.c"
yylval = yylval_param;
@@ -906,13 +905,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 61 )
if ( yy_current_state >= 63 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_current_state != 60 );
while ( yy_current_state != 62 );
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
@@ -1112,7 +1111,17 @@ YY_RULE_SETUP
case 32:
/* rule 32 can match eol */
YY_RULE_SETUP
#line 182 "ast_expr2.fl"
#line 181 "ast_expr2.fl"
{
curlycount = 0;
BEGIN(var);
yymore();
}
YY_BREAK
case 33:
/* rule 33 can match eol */
YY_RULE_SETUP
#line 187 "ast_expr2.fl"
{
curlycount--;
if (curlycount < 0) {
@@ -1123,18 +1132,18 @@ YY_RULE_SETUP
}
}
YY_BREAK
case 33:
/* rule 33 can match eol */
case 34:
/* rule 34 can match eol */
YY_RULE_SETUP
#line 192 "ast_expr2.fl"
#line 197 "ast_expr2.fl"
{
curlycount++;
yymore();
}
YY_BREAK
case 34:
case 35:
YY_RULE_SETUP
#line 198 "ast_expr2.fl"
#line 203 "ast_expr2.fl"
{
BEGIN(0);
SET_COLUMNS;
@@ -1142,10 +1151,19 @@ YY_RULE_SETUP
return TOKEN;
}
YY_BREAK
case 35:
/* rule 35 can match eol */
case 36:
YY_RULE_SETUP
#line 205 "ast_expr2.fl"
#line 210 "ast_expr2.fl"
{
curlycount = 0;
BEGIN(var);
yymore();
}
YY_BREAK
case 37:
/* rule 37 can match eol */
YY_RULE_SETUP
#line 216 "ast_expr2.fl"
{
char c = yytext[yyleng-1];
BEGIN(0);
@@ -1155,17 +1173,8 @@ YY_RULE_SETUP
return TOKEN;
}
YY_BREAK
case 36:
YY_RULE_SETUP
#line 214 "ast_expr2.fl"
{
curlycount = 0;
BEGIN(var);
yymore();
}
YY_BREAK
case YY_STATE_EOF(trail):
#line 220 "ast_expr2.fl"
#line 225 "ast_expr2.fl"
{
BEGIN(0);
SET_COLUMNS;
@@ -1174,12 +1183,12 @@ case YY_STATE_EOF(trail):
/*actually, if an expr is only a variable ref, this could happen a LOT */
}
YY_BREAK
case 37:
case 38:
YY_RULE_SETUP
#line 228 "ast_expr2.fl"
#line 233 "ast_expr2.fl"
ECHO;
YY_BREAK
#line 1181 "ast_expr2f.c"
#line 1190 "ast_expr2f.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(var):
yyterminate();
@@ -1475,7 +1484,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 61 )
if ( yy_current_state >= 63 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1504,11 +1513,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 61 )
if ( yy_current_state >= 63 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 60);
yy_is_jam = (yy_current_state == 62);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2355,7 +2364,7 @@ void *ast_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
#line 228 "ast_expr2.fl"
#line 233 "ast_expr2.fl"