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/branches/1.4@179807 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2009-03-03 18:11:34 +00:00
parent 2e4471d758
commit 604a51f341
7 changed files with 210 additions and 149 deletions

View File

@@ -1,7 +1,9 @@
/* A Bison parser, made by GNU Bison 2.1a. */
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
/* Skeleton implementation for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,10 +20,18 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
@@ -37,7 +47,7 @@
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "2.1a"
#define YYBISON_VERSION "2.3"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -179,7 +189,7 @@ enum valtype {
} ;
#ifdef STANDALONE
void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__((format(printf,5,6)));
void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__ ((format (printf,5,6)));
#endif
struct val {
@@ -278,8 +288,8 @@ typedef union YYSTYPE
{
struct val *val;
}
/* Line 198 of yacc.c. */
#line 283 "ast_expr2.c"
/* Line 187 of yacc.c. */
#line 293 "ast_expr2.c"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -306,8 +316,8 @@ typedef struct YYLTYPE
extern int ast_yylex __P((YYSTYPE *, YYLTYPE *, yyscan_t));
/* Line 221 of yacc.c. */
#line 311 "ast_expr2.c"
/* Line 216 of yacc.c. */
#line 321 "ast_expr2.c"
#ifdef short
# undef short
@@ -437,8 +447,13 @@ YYID (i)
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
# ifdef __cplusplus
extern "C" {
# if (defined __cplusplus && ! defined _STDLIB_H \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef _STDLIB_H
# define _STDLIB_H 1
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
@@ -454,9 +469,6 @@ void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifdef __cplusplus
}
# endif
# endif
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
@@ -860,14 +872,14 @@ do { \
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep, const YYLTYPE * const yylocationp)
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
#else
static void
yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
FILE *yyoutput;
int yytype;
const YYSTYPE * const yyvaluep;
const YYLTYPE * const yylocationp;
YYSTYPE const * const yyvaluep;
YYLTYPE const * const yylocationp;
#endif
{
if (!yyvaluep)
@@ -894,14 +906,14 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep, const YYLTYPE * const yylocationp)
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
#else
static void
yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
FILE *yyoutput;
int yytype;
const YYSTYPE * const yyvaluep;
const YYLTYPE * const yylocationp;
YYSTYPE const * const yyvaluep;
YYLTYPE const * const yylocationp;
#endif
{
if (yytype < YYNTOKENS)
@@ -954,8 +966,7 @@ static void
yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
#else
static void
yy_reduce_print (yyvsp, yylsp, yyrule
)
yy_reduce_print (yyvsp, yylsp, yyrule)
YYSTYPE *yyvsp;
YYLTYPE *yylsp;
int yyrule;
@@ -1078,7 +1089,7 @@ yytnamerr (char *yyres, const char *yystr)
{
if (*yystr == '"')
{
size_t yyn = 0;
YYSIZE_T yyn = 0;
char const *yyp = yystr;
for (;;)
@@ -1125,7 +1136,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
{
int yyn = yypact[yystate];
if (! (YYPACT_NINF < yyn && yyn < YYLAST))
if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
return 0;
else
{
@@ -1163,7 +1174,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn;
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yycount = 1;
@@ -1253,112 +1264,112 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp)
case 3: /* "TOK_COLONCOLON" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1257 "ast_expr2.c"
#line 1268 "ast_expr2.c"
break;
case 4: /* "TOK_COND" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1262 "ast_expr2.c"
#line 1273 "ast_expr2.c"
break;
case 5: /* "TOK_OR" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1267 "ast_expr2.c"
#line 1278 "ast_expr2.c"
break;
case 6: /* "TOK_AND" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1272 "ast_expr2.c"
#line 1283 "ast_expr2.c"
break;
case 7: /* "TOK_NE" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1277 "ast_expr2.c"
#line 1288 "ast_expr2.c"
break;
case 8: /* "TOK_LE" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1282 "ast_expr2.c"
#line 1293 "ast_expr2.c"
break;
case 9: /* "TOK_GE" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1287 "ast_expr2.c"
#line 1298 "ast_expr2.c"
break;
case 10: /* "TOK_LT" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1292 "ast_expr2.c"
#line 1303 "ast_expr2.c"
break;
case 11: /* "TOK_GT" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1297 "ast_expr2.c"
#line 1308 "ast_expr2.c"
break;
case 12: /* "TOK_EQ" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1302 "ast_expr2.c"
#line 1313 "ast_expr2.c"
break;
case 13: /* "TOK_MINUS" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1307 "ast_expr2.c"
#line 1318 "ast_expr2.c"
break;
case 14: /* "TOK_PLUS" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1312 "ast_expr2.c"
#line 1323 "ast_expr2.c"
break;
case 15: /* "TOK_MOD" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1317 "ast_expr2.c"
#line 1328 "ast_expr2.c"
break;
case 16: /* "TOK_DIV" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1322 "ast_expr2.c"
#line 1333 "ast_expr2.c"
break;
case 17: /* "TOK_MULT" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1327 "ast_expr2.c"
#line 1338 "ast_expr2.c"
break;
case 18: /* "TOK_COMPL" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1332 "ast_expr2.c"
#line 1343 "ast_expr2.c"
break;
case 19: /* "TOK_EQTILDE" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1337 "ast_expr2.c"
#line 1348 "ast_expr2.c"
break;
case 20: /* "TOK_COLON" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1342 "ast_expr2.c"
#line 1353 "ast_expr2.c"
break;
case 21: /* "TOK_LP" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1347 "ast_expr2.c"
#line 1358 "ast_expr2.c"
break;
case 22: /* "TOK_RP" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1352 "ast_expr2.c"
#line 1363 "ast_expr2.c"
break;
case 23: /* "TOKEN" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1357 "ast_expr2.c"
#line 1368 "ast_expr2.c"
break;
case 26: /* "expr" */
#line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
#line 1362 "ast_expr2.c"
#line 1373 "ast_expr2.c"
break;
default:
@@ -1859,8 +1870,8 @@ yyreduce:
break;
/* Line 1270 of yacc.c. */
#line 1864 "ast_expr2.c"
/* Line 1267 of yacc.c. */
#line 1875 "ast_expr2.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2075,7 +2086,8 @@ yyreturn:
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
return yyresult;
/* Make sure YYID is used. */
return YYID (yyresult);
}
@@ -2235,6 +2247,14 @@ is_zero_or_null (struct val *vp)
#ifdef STANDALONE
void ast_register_file_version(const char *file, const char *version)
{
}
void ast_unregister_file_version(const char *file)
{
}
void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
{
va_list vars;

View File

@@ -158,6 +158,12 @@ HIBIT [\x80-\xff]
return TOKEN;
}
([a-zA-Z0-9\.';\\_^#@]|{HIBIT}|($[^{]))+\$\{ {
curlycount = 0;
BEGIN(var);
yymore();
}
<var>[^{}]*\} {
curlycount--;
@@ -182,6 +188,12 @@ HIBIT [\x80-\xff]
return TOKEN;
}
<trail>[^-\t\r \n$():?%/+=*<>!|&]*\$\{ {
curlycount = 0;
BEGIN(var);
yymore();
}
<trail>[-\t\r \n$():?%/+=*<>!|&] {
char c = yytext[yyleng-1];
BEGIN(0);
@@ -191,12 +203,6 @@ HIBIT [\x80-\xff]
return TOKEN;
}
<trail>\$\{ {
curlycount = 0;
BEGIN(var);
yymore();
}
<trail><<EOF>> {
BEGIN(0);
SET_COLUMNS;

View File

@@ -1,7 +1,9 @@
/* A Bison parser, made by GNU Bison 2.1a. */
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,10 +20,18 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
@@ -84,8 +94,8 @@ typedef union YYSTYPE
{
struct val *val;
}
/* Line 1536 of yacc.c. */
#line 89 "ast_expr2.h"
/* Line 1489 of yacc.c. */
#line 99 "ast_expr2.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -108,5 +118,3 @@ typedef struct YYLTYPE
#endif

View File

@@ -422,6 +422,14 @@ is_zero_or_null (struct val *vp)
#ifdef STANDALONE
void ast_register_file_version(const char *file, const char *version)
{
}
void ast_unregister_file_version(const char *file)
{
}
void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
{
va_list vars;

View File

@@ -351,8 +351,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 35
#define YY_END_OF_BUFFER 36
#define YY_NUM_RULES 36
#define YY_END_OF_BUFFER 37
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -360,14 +360,14 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[56] =
static yyconst flex_int16_t yy_accept[58] =
{ 0,
0, 0, 0, 0, 32, 32, 36, 35, 25, 27,
19, 35, 29, 35, 17, 2, 22, 23, 15, 13,
14, 16, 28, 20, 9, 3, 8, 18, 1, 35,
31, 30, 32, 33, 33, 12, 0, 26, 29, 0,
0, 0, 0, 0, 33, 33, 37, 36, 25, 27,
19, 36, 29, 36, 17, 2, 22, 23, 15, 13,
14, 16, 28, 20, 9, 3, 8, 18, 1, 36,
32, 31, 33, 35, 35, 12, 0, 26, 29, 0,
24, 5, 28, 21, 11, 6, 7, 10, 4, 0,
31, 30, 32, 34, 0
32, 31, 33, 0, 34, 30, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -404,31 +404,31 @@ static yyconst flex_int32_t yy_ec[256] =
static yyconst flex_int32_t yy_meta[27] =
{ 0,
1, 2, 2, 2, 1, 1, 2, 2, 2, 2,
1, 2, 2, 2, 1, 1, 1, 2, 2, 2,
2, 2, 2, 2, 2, 1, 2, 2, 2, 2,
2, 1, 2, 1, 1, 1
} ;
static yyconst flex_int16_t yy_base[62] =
static yyconst flex_int16_t yy_base[64] =
{ 0,
0, 0, 5, 6, 30, 56, 60, 114, 114, 114,
40, 53, 77, 31, 114, 42, 114, 114, 114, 114,
114, 114, 34, 32, 29, 13, 28, 114, 22, 17,
114, 114, 0, 114, 22, 114, 38, 114, 0, 12,
0, 0, 5, 6, 30, 56, 66, 114, 114, 114,
46, 59, 77, 38, 114, 50, 114, 114, 114, 114,
114, 114, 42, 36, 32, 13, 31, 114, 26, 17,
114, 114, 41, 114, 25, 114, 40, 114, 0, 22,
114, 114, 0, 114, 114, 114, 114, 114, 114, 18,
114, 114, 0, 114, 114, 103, 105, 107, 109, 111,
32
114, 114, 36, 12, 114, 114, 114, 103, 105, 107,
109, 111, 32
} ;
static yyconst flex_int16_t yy_def[62] =
static yyconst flex_int16_t yy_def[64] =
{ 0,
55, 1, 56, 56, 57, 57, 55, 55, 55, 55,
55, 58, 55, 59, 55, 55, 55, 55, 55, 55,
55, 55, 13, 55, 55, 55, 55, 55, 55, 60,
55, 55, 61, 55, 55, 55, 58, 55, 13, 59,
55, 55, 23, 55, 55, 55, 55, 55, 55, 60,
55, 55, 61, 55, 0, 55, 55, 55, 55, 55,
55
57, 1, 58, 58, 59, 59, 57, 57, 57, 57,
57, 60, 57, 61, 57, 57, 57, 57, 57, 57,
57, 57, 13, 57, 57, 57, 57, 57, 57, 62,
57, 57, 63, 57, 57, 57, 60, 57, 13, 61,
57, 57, 23, 57, 57, 57, 57, 57, 57, 62,
57, 57, 63, 57, 57, 57, 0, 57, 57, 57,
57, 57, 57
} ;
static yyconst flex_int16_t yy_nxt[141] =
@@ -437,17 +437,17 @@ static yyconst flex_int16_t yy_nxt[141] =
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 8, 29, 8, 8, 13, 31, 31, 32, 32,
33, 46, 53, 55, 33, 33, 35, 47, 51, 51,
52, 52, 38, 54, 49, 33, 48, 45, 44, 43,
42, 33, 41, 33, 33, 33, 33, 38, 36, 55,
33, 33, 35, 55, 55, 55, 55, 55, 55, 55,
55, 33, 55, 55, 55, 55, 55, 33, 55, 33,
33, 33, 39, 40, 55, 55, 55, 55, 55, 55,
55, 55, 39, 55, 55, 55, 55, 55, 55, 55,
52, 52, 54, 56, 38, 33, 55, 54, 49, 48,
45, 33, 44, 33, 33, 33, 33, 43, 42, 41,
33, 33, 35, 38, 36, 57, 57, 57, 57, 57,
57, 33, 57, 57, 57, 57, 57, 33, 57, 33,
33, 33, 39, 40, 57, 57, 57, 57, 57, 57,
57, 57, 39, 57, 57, 57, 57, 57, 57, 57,
55, 55, 39, 30, 30, 34, 34, 37, 37, 39,
39, 50, 50, 7, 55, 55, 55, 55, 55, 55,
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
55, 55, 55, 55, 55, 55, 55, 55, 55, 55
57, 57, 39, 30, 30, 34, 34, 37, 37, 39,
39, 50, 50, 7, 57, 57, 57, 57, 57, 57,
57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
57, 57, 57, 57, 57, 57, 57, 57, 57, 57
} ;
static yyconst flex_int16_t yy_chk[141] =
@@ -455,18 +455,18 @@ static yyconst flex_int16_t yy_chk[141] =
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, 26, 61, 40, 5, 5, 5, 26, 30, 50,
30, 50, 37, 35, 29, 5, 27, 25, 24, 23,
16, 5, 14, 5, 5, 5, 6, 12, 11, 7,
6, 6, 6, 0, 0, 0, 0, 0, 0, 0,
5, 26, 63, 54, 5, 5, 5, 26, 30, 50,
30, 50, 53, 40, 37, 5, 35, 33, 29, 27,
25, 5, 24, 5, 5, 5, 6, 23, 16, 14,
6, 6, 6, 12, 11, 7, 0, 0, 0, 0,
0, 6, 0, 0, 0, 0, 0, 6, 0, 6,
6, 6, 13, 13, 0, 0, 0, 0, 0, 0,
0, 0, 13, 0, 0, 0, 0, 0, 0, 0,
0, 0, 13, 56, 56, 57, 57, 58, 58, 59,
59, 60, 60, 55, 55, 55, 55, 55, 55, 55,
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
55, 55, 55, 55, 55, 55, 55, 55, 55, 55
0, 0, 13, 58, 58, 59, 59, 60, 60, 61,
61, 62, 62, 57, 57, 57, 57, 57, 57, 57,
57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
57, 57, 57, 57, 57, 57, 57, 57, 57, 57
} ;
/* The intent behind this definition is that it'll catch
@@ -879,13 +879,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 >= 56 )
if ( yy_current_state >= 58 )
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 != 55 );
while ( yy_current_state != 57 );
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
@@ -1075,7 +1075,17 @@ YY_RULE_SETUP
case 30:
/* rule 30 can match eol */
YY_RULE_SETUP
#line 162 "ast_expr2.fl"
#line 161 "ast_expr2.fl"
{
curlycount = 0;
BEGIN(var);
yymore();
}
YY_BREAK
case 31:
/* rule 31 can match eol */
YY_RULE_SETUP
#line 168 "ast_expr2.fl"
{
curlycount--;
if (curlycount < 0) {
@@ -1086,18 +1096,18 @@ YY_RULE_SETUP
}
}
YY_BREAK
case 31:
/* rule 31 can match eol */
case 32:
/* rule 32 can match eol */
YY_RULE_SETUP
#line 172 "ast_expr2.fl"
#line 178 "ast_expr2.fl"
{
curlycount++;
yymore();
}
YY_BREAK
case 32:
case 33:
YY_RULE_SETUP
#line 178 "ast_expr2.fl"
#line 184 "ast_expr2.fl"
{
BEGIN(0);
SET_COLUMNS;
@@ -1105,10 +1115,19 @@ YY_RULE_SETUP
return TOKEN;
}
YY_BREAK
case 33:
/* rule 33 can match eol */
case 34:
YY_RULE_SETUP
#line 185 "ast_expr2.fl"
#line 191 "ast_expr2.fl"
{
curlycount = 0;
BEGIN(var);
yymore();
}
YY_BREAK
case 35:
/* rule 35 can match eol */
YY_RULE_SETUP
#line 197 "ast_expr2.fl"
{
char c = yytext[yyleng-1];
BEGIN(0);
@@ -1118,17 +1137,8 @@ YY_RULE_SETUP
return TOKEN;
}
YY_BREAK
case 34:
YY_RULE_SETUP
#line 194 "ast_expr2.fl"
{
curlycount = 0;
BEGIN(var);
yymore();
}
YY_BREAK
case YY_STATE_EOF(trail):
#line 200 "ast_expr2.fl"
#line 206 "ast_expr2.fl"
{
BEGIN(0);
SET_COLUMNS;
@@ -1137,12 +1147,12 @@ case YY_STATE_EOF(trail):
/*actually, if an expr is only a variable ref, this could happen a LOT */
}
YY_BREAK
case 35:
case 36:
YY_RULE_SETUP
#line 208 "ast_expr2.fl"
#line 214 "ast_expr2.fl"
ECHO;
YY_BREAK
#line 1146 "ast_expr2f.c"
#line 1156 "ast_expr2f.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(var):
yyterminate();
@@ -1438,7 +1448,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 >= 56 )
if ( yy_current_state >= 58 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1467,11 +1477,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 >= 56 )
if ( yy_current_state >= 58 )
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 == 55);
yy_is_jam = (yy_current_state == 57);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2318,7 +2328,7 @@ void *ast_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
#line 208 "ast_expr2.fl"
#line 214 "ast_expr2.fl"

View File

@@ -15,7 +15,17 @@
.PHONY: clean all uninstall
# to get check_expr, add it to the ALL_UTILS list
# to get check_expr, add it to the ALL_UTILS list -- this is a somewhat old checking
# program that wants an ael file for input, and will check each $[] expr for
# possible (old) problems, like spacing around operators, which dates back to
# the 1.2 days. The neat part is that it will actually evaluate the expressions.
# Users could use this to quickly check expressions in their .ael file.
# to get check_expr2, add it to the ALL_UTILS list -- this is a program that will
# read in a file containing expressions (as if they were in $[ ]), one per line.
# It will, of course signal any syntax errors. Devs (like murf) should use this whenever
# changes are made to ast_expr2.y or ast_expr2.fl (or the corresponding .c files),
# as a regression test. Others (mere mortals?) need not bother, but they are
# more than welcome to play! The regression test itself is in expr2.testinput.
ALL_UTILS:=astman smsq stereorize streamplayer aelparse muted
UTILS:=$(ALL_UTILS)
@@ -93,6 +103,10 @@ ast_expr2f.o: ASTCFLAGS+=-DSTANDALONE_AEL -I../main -Wno-unused
check_expr: check_expr.o ast_expr2.o ast_expr2f.o
check_expr2: ast_expr2.c ast_expr2f.o
gcc -DSTANDALONE ast_expr2.c ast_expr2f.o -o check_expr2
check_expr2 expr2.testinput
aelbison.c: ../pbx/ael/ael.tab.c
@cp $< $@
aelbison.o: aelbison.c ../pbx/ael/ael.tab.h ../include/asterisk/ael_structs.h
@@ -112,13 +126,6 @@ aelparse.o: ASTCFLAGS+=-I../pbx -DSTANDALONE_AEL -Wno-unused
aelparse: aelparse.o aelbison.o pbx_ael.o ael_main.o ast_expr2f.o ast_expr2.o strcompat.o
testexpr2s: ../main/ast_expr2f.c ../main/ast_expr2.c ../main/ast_expr2.h
$(CC) -g -c -I../include -DSTANDALONE_AEL ../main/ast_expr2f.c -o ast_expr2f.o
$(CC) -g -c -I../include -DSTANDALONE_AEL ../main/ast_expr2.c -o ast_expr2.o
$(CC) -g -o testexpr2s ast_expr2f.o ast_expr2.o
rm ast_expr2.o ast_expr2f.o
./testexpr2s expr2.testinput
smsq: smsq.o strcompat.o
smsq: LIBS+=$(POPT_LIB)

View File

@@ -90,3 +90,5 @@ x != x
3
something
043
${GLOBAL(ULKOPREFIX)}9${x}
512059${x}