[asterisk-commits] branch murf/AEL2 - r8293 in /team/murf/AEL2: ./ utils/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jan 19 14:01:39 MST 2006


Author: murf
Date: Thu Jan 19 15:01:35 2006
New Revision: 8293

URL: http://svn.digium.com/view/asterisk?rev=8293&view=rev
Log:
Added the same testing feature to the utils/Makefile, as I did for bug 6072;
testexpr2s can be made, and run a quick standalone test, using expr2.testinput
as input.


Added:
    team/murf/AEL2/utils/expr2.testinput
Modified:
    team/murf/AEL2/ast_expr2.c
    team/murf/AEL2/ast_expr2.fl
    team/murf/AEL2/ast_expr2.h
    team/murf/AEL2/ast_expr2.y
    team/murf/AEL2/ast_expr2f.c
    team/murf/AEL2/utils/Makefile

Modified: team/murf/AEL2/ast_expr2.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/ast_expr2.c?rev=8293&r1=8292&r2=8293&view=diff
==============================================================================
--- team/murf/AEL2/ast_expr2.c (original)
+++ team/murf/AEL2/ast_expr2.c Thu Jan 19 15:01:35 2006
@@ -130,6 +130,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <locale.h>
+#include <unistd.h>
 #include <ctype.h>
 #if !defined(SOLARIS) && !defined(__CYGWIN__)
 #include <err.h>
@@ -256,12 +257,12 @@
 #endif
 
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 139 "ast_expr2.y"
+#line 140 "ast_expr2.y"
 typedef union YYSTYPE {
 	struct val *val;
 } YYSTYPE;
 /* Line 190 of yacc.c.  */
-#line 265 "ast_expr2.c"
+#line 266 "ast_expr2.c"
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
 # define YYSTYPE_IS_TRIVIAL 1
@@ -282,13 +283,13 @@
 
 
 /* Copy the second part of user declarations.  */
-#line 143 "ast_expr2.y"
+#line 144 "ast_expr2.y"
 
 extern int		ast_yylex __P((YYSTYPE *, YYLTYPE *, yyscan_t));
 
 
 /* Line 213 of yacc.c.  */
-#line 292 "ast_expr2.c"
+#line 293 "ast_expr2.c"
 
 #if ! defined (yyoverflow) || YYERROR_VERBOSE
 
@@ -470,9 +471,9 @@
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const unsigned char yyrline[] =
 {
-       0,   162,   162,   170,   177,   178,   182,   186,   190,   194,
-     198,   202,   206,   210,   214,   218,   222,   226,   230,   234,
-     238,   242,   246,   250
+       0,   163,   163,   171,   178,   179,   183,   187,   191,   195,
+     199,   203,   207,   211,   215,   219,   223,   227,   231,   235,
+     239,   243,   247,   251
 };
 #endif
 
@@ -1265,7 +1266,7 @@
   switch (yyn)
     {
         case 2:
-#line 162 "ast_expr2.y"
+#line 163 "ast_expr2.y"
     { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
               ((struct parse_io *)parseio)->val->type = (yyvsp[0].val)->type;
               if( (yyvsp[0].val)->type == AST_EXPR_integer )
@@ -1277,7 +1278,7 @@
     break;
 
   case 3:
-#line 170 "ast_expr2.y"
+#line 171 "ast_expr2.y"
     {/* nothing */ ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
               ((struct parse_io *)parseio)->val->type = AST_EXPR_string;
 			  ((struct parse_io *)parseio)->val->u.s = strdup(""); 
@@ -1285,12 +1286,12 @@
     break;
 
   case 4:
-#line 177 "ast_expr2.y"
+#line 178 "ast_expr2.y"
     { (yyval.val)= (yyvsp[0].val);;}
     break;
 
   case 5:
-#line 178 "ast_expr2.y"
+#line 179 "ast_expr2.y"
     { (yyval.val) = (yyvsp[-1].val); 
 	                       (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
 						   (yyloc).first_line=0; (yyloc).last_line=0;
@@ -1298,7 +1299,7 @@
     break;
 
   case 6:
-#line 182 "ast_expr2.y"
+#line 183 "ast_expr2.y"
     { (yyval.val) = op_or ((yyvsp[-2].val), (yyvsp[0].val));
 						DESTROY((yyvsp[-1].val));	
                          (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
@@ -1306,7 +1307,7 @@
     break;
 
   case 7:
-#line 186 "ast_expr2.y"
+#line 187 "ast_expr2.y"
     { (yyval.val) = op_and ((yyvsp[-2].val), (yyvsp[0].val)); 
 						DESTROY((yyvsp[-1].val));	
 	                      (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
@@ -1314,7 +1315,7 @@
     break;
 
   case 8:
-#line 190 "ast_expr2.y"
+#line 191 "ast_expr2.y"
     { (yyval.val) = op_eq ((yyvsp[-2].val), (yyvsp[0].val));
 						DESTROY((yyvsp[-1].val));	
 	                     (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column;
@@ -1322,7 +1323,7 @@
     break;
 
   case 9:
-#line 194 "ast_expr2.y"
+#line 195 "ast_expr2.y"
     { (yyval.val) = op_gt ((yyvsp[-2].val), (yyvsp[0].val));
 						DESTROY((yyvsp[-1].val));	
                          (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column;
@@ -1330,7 +1331,7 @@
     break;
 
   case 10:
-#line 198 "ast_expr2.y"
+#line 199 "ast_expr2.y"
     { (yyval.val) = op_lt ((yyvsp[-2].val), (yyvsp[0].val)); 
 						DESTROY((yyvsp[-1].val));	
 	                     (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
@@ -1338,7 +1339,7 @@
     break;
 
   case 11:
-#line 202 "ast_expr2.y"
+#line 203 "ast_expr2.y"
     { (yyval.val) = op_ge ((yyvsp[-2].val), (yyvsp[0].val)); 
 						DESTROY((yyvsp[-1].val));	
 	                      (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
@@ -1346,7 +1347,7 @@
     break;
 
   case 12:
-#line 206 "ast_expr2.y"
+#line 207 "ast_expr2.y"
     { (yyval.val) = op_le ((yyvsp[-2].val), (yyvsp[0].val)); 
 						DESTROY((yyvsp[-1].val));	
 	                      (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
@@ -1354,7 +1355,7 @@
     break;
 
   case 13:
-#line 210 "ast_expr2.y"
+#line 211 "ast_expr2.y"
     { (yyval.val) = op_ne ((yyvsp[-2].val), (yyvsp[0].val)); 
 						DESTROY((yyvsp[-1].val));	
 	                      (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
@@ -1362,7 +1363,7 @@
     break;
 
   case 14:
-#line 214 "ast_expr2.y"
+#line 215 "ast_expr2.y"
     { (yyval.val) = op_plus ((yyvsp[-2].val), (yyvsp[0].val)); 
 						DESTROY((yyvsp[-1].val));	
 	                       (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
@@ -1370,7 +1371,7 @@
     break;
 
   case 15:
-#line 218 "ast_expr2.y"
+#line 219 "ast_expr2.y"
     { (yyval.val) = op_minus ((yyvsp[-2].val), (yyvsp[0].val)); 
 						DESTROY((yyvsp[-1].val));	
 	                        (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
@@ -1378,7 +1379,7 @@
     break;
 
   case 16:
-#line 222 "ast_expr2.y"
+#line 223 "ast_expr2.y"
     { (yyval.val) = op_negate ((yyvsp[0].val)); 
 						DESTROY((yyvsp[-1].val));	
 	                        (yyloc).first_column = (yylsp[-1]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
@@ -1386,7 +1387,7 @@
     break;
 
   case 17:
-#line 226 "ast_expr2.y"
+#line 227 "ast_expr2.y"
     { (yyval.val) = op_compl ((yyvsp[0].val)); 
 						DESTROY((yyvsp[-1].val));	
 	                        (yyloc).first_column = (yylsp[-1]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
@@ -1394,7 +1395,7 @@
     break;
 
   case 18:
-#line 230 "ast_expr2.y"
+#line 231 "ast_expr2.y"
     { (yyval.val) = op_times ((yyvsp[-2].val), (yyvsp[0].val)); 
 						DESTROY((yyvsp[-1].val));	
 	                       (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
@@ -1402,7 +1403,7 @@
     break;
 
   case 19:
-#line 234 "ast_expr2.y"
+#line 235 "ast_expr2.y"
     { (yyval.val) = op_div ((yyvsp[-2].val), (yyvsp[0].val)); 
 						DESTROY((yyvsp[-1].val));	
 	                      (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
@@ -1410,7 +1411,7 @@
     break;
 
   case 20:
-#line 238 "ast_expr2.y"
+#line 239 "ast_expr2.y"
     { (yyval.val) = op_rem ((yyvsp[-2].val), (yyvsp[0].val)); 
 						DESTROY((yyvsp[-1].val));	
 	                      (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
@@ -1418,7 +1419,7 @@
     break;
 
   case 21:
-#line 242 "ast_expr2.y"
+#line 243 "ast_expr2.y"
     { (yyval.val) = op_colon ((yyvsp[-2].val), (yyvsp[0].val)); 
 						DESTROY((yyvsp[-1].val));	
 	                        (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
@@ -1426,7 +1427,7 @@
     break;
 
   case 22:
-#line 246 "ast_expr2.y"
+#line 247 "ast_expr2.y"
     { (yyval.val) = op_eqtilde ((yyvsp[-2].val), (yyvsp[0].val)); 
 						DESTROY((yyvsp[-1].val));	
 	                        (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
@@ -1434,7 +1435,7 @@
     break;
 
   case 23:
-#line 250 "ast_expr2.y"
+#line 251 "ast_expr2.y"
     { (yyval.val) = op_cond ((yyvsp[-4].val), (yyvsp[-2].val), (yyvsp[0].val)); 
 						DESTROY((yyvsp[-3].val));	
 						DESTROY((yyvsp[-1].val));	
@@ -1446,7 +1447,7 @@
     }
 
 /* Line 1037 of yacc.c.  */
-#line 1450 "ast_expr2.c"
+#line 1451 "ast_expr2.c"
 
   yyvsp -= yylen;
   yyssp -= yylen;
@@ -1681,7 +1682,7 @@
 }
 
 
-#line 257 "ast_expr2.y"
+#line 258 "ast_expr2.y"
 
 
 static struct val *
@@ -1852,11 +1853,40 @@
 
 int main(int argc,char **argv) {
 	char s[4096];
+	char out[4096];
+	FILE *infile;
 	
-	if (ast_expr(argv[1], s, sizeof(s)))
-		printf("=====%s======\n",s);
+	if( !argv[1] )
+		exit(20);
+	
+	if( access(argv[1],F_OK)== 0 )
+	{
+		int ret;
+		
+		infile = fopen(argv[1],"r");
+		if( !infile )
+		{
+			printf("Sorry, couldn't open %s for reading!\n", argv[1]);
+			exit(10);
+		}
+		while( fgets(s,sizeof(s),infile) )
+		{
+			if( s[strlen(s)-1] == '\n' )
+				s[strlen(s)-1] = 0;
+			
+			ret = ast_expr(s, out, sizeof(out));
+			printf("Expression: %s    Result: [%d] '%s'\n",
+				   s, ret, out);
+		}
+		fclose(infile);
+	}
 	else
-		printf("No result\n");
+	{
+		if (ast_expr(argv[1], s, sizeof(s)))
+			printf("=====%s======\n",s);
+		else
+			printf("No result\n");
+	}
 }
 
 #endif

Modified: team/murf/AEL2/ast_expr2.fl
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/ast_expr2.fl?rev=8293&r1=8292&r2=8293&view=diff
==============================================================================
--- team/murf/AEL2/ast_expr2.fl (original)
+++ team/murf/AEL2/ast_expr2.fl Thu Jan 19 15:01:35 2006
@@ -100,6 +100,7 @@
 \/	{ SET_COLUMNS; SET_STRING; return TOK_DIV;}
 \%	{ SET_COLUMNS; SET_STRING; return TOK_MOD;}
 \?	{ SET_COLUMNS; SET_STRING; return TOK_COND;}
+\!	{ SET_COLUMNS; SET_STRING; return TOK_COMPL;}
 \:	{ SET_COLUMNS; SET_STRING; return TOK_COLON;}
 \:\:	{ SET_COLUMNS; SET_STRING; return TOK_COLONCOLON;}
 \(	{ SET_COLUMNS; SET_STRING; return TOK_LP;}
@@ -114,7 +115,8 @@
 [0-9]+		{   SET_COLUMNS;  /* the original behavior of the expression parser was to bring in numbers as a numeric string */
 				SET_NUMERIC_STRING;
 				return TOKEN;}
-[a-zA-Z0-9,.';\\_^%$#@!]+	{SET_COLUMNS; SET_STRING; return TOKEN;}
+
+[a-zA-Z0-9,.';\\_^$#@!]+	{SET_COLUMNS; SET_STRING; return TOKEN;}
 
 <var>[^{}]*\}  {curlycount--; if(curlycount < 0){ BEGIN(trail);  yymore();} else {  yymore();}}
 <var>[^{}]*\{  {curlycount++; yymore();  }
@@ -236,7 +238,7 @@
 	"*",
 	"/",
 	"%",
-	"~",
+	"!",
 	":",
 	"=~",
 	")",

Modified: team/murf/AEL2/ast_expr2.h
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/ast_expr2.h?rev=8293&r1=8292&r2=8293&view=diff
==============================================================================
--- team/murf/AEL2/ast_expr2.h (original)
+++ team/murf/AEL2/ast_expr2.h Thu Jan 19 15:01:35 2006
@@ -78,7 +78,7 @@
 
 
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 139 "ast_expr2.y"
+#line 140 "ast_expr2.y"
 typedef union YYSTYPE {
 	struct val *val;
 } YYSTYPE;

Modified: team/murf/AEL2/ast_expr2.y
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/ast_expr2.y?rev=8293&r1=8292&r2=8293&view=diff
==============================================================================
--- team/murf/AEL2/ast_expr2.y (original)
+++ team/murf/AEL2/ast_expr2.y Thu Jan 19 15:01:35 2006
@@ -17,6 +17,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <locale.h>
+#include <unistd.h>
 #include <ctype.h>
 #if !defined(SOLARIS) && !defined(__CYGWIN__)
 #include <err.h>
@@ -424,11 +425,40 @@
 
 int main(int argc,char **argv) {
 	char s[4096];
+	char out[4096];
+	FILE *infile;
 	
-	if (ast_expr(argv[1], s, sizeof(s)))
-		printf("=====%s======\n",s);
+	if( !argv[1] )
+		exit(20);
+	
+	if( access(argv[1],F_OK)== 0 )
+	{
+		int ret;
+		
+		infile = fopen(argv[1],"r");
+		if( !infile )
+		{
+			printf("Sorry, couldn't open %s for reading!\n", argv[1]);
+			exit(10);
+		}
+		while( fgets(s,sizeof(s),infile) )
+		{
+			if( s[strlen(s)-1] == '\n' )
+				s[strlen(s)-1] = 0;
+			
+			ret = ast_expr(s, out, sizeof(out));
+			printf("Expression: %s    Result: [%d] '%s'\n",
+				   s, ret, out);
+		}
+		fclose(infile);
+	}
 	else
-		printf("No result\n");
+	{
+		if (ast_expr(argv[1], s, sizeof(s)))
+			printf("=====%s======\n",s);
+		else
+			printf("No result\n");
+	}
 }
 
 #endif

Modified: team/murf/AEL2/ast_expr2f.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/ast_expr2f.c?rev=8293&r1=8292&r2=8293&view=diff
==============================================================================
--- team/murf/AEL2/ast_expr2f.c (original)
+++ team/murf/AEL2/ast_expr2f.c Thu Jan 19 15:01:35 2006
@@ -523,7 +523,7 @@
         7,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,
       -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,
       -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,
-      -11,  -11,  -11,   36,  -11,   36,   36,   36,  -11,   36,
+      -11,  -11,  -11,   36,  -11,   36,   36,  -11,  -11,   36,
       -11,  -11,  -11,  -11,   36,  -11,   36,  -11,   36,   36,
        36,   36,   36,   36,   36,   36,   36,   36,  -11,   36,
       -11,   37,  -11,  -11,   36,   36,   36,   36,   36,   36,
@@ -558,7 +558,7 @@
 
       -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,
       -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,
-      -13,  -13,  -13,   36,  -13,   36,   36,   36,  -13,   36,
+      -13,  -13,  -13,   36,  -13,   36,   36,  -13,  -13,   36,
       -13,  -13,  -13,  -13,   36,  -13,   36,  -13,   36,   36,
        36,   36,   36,   36,   36,   36,   36,   36,  -13,   36,
       -13,  -13,  -13,  -13,   36,   36,   36,   36,   36,   36,
@@ -575,7 +575,7 @@
         7,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,
       -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,
       -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,
-      -14,  -14,  -14,   36,  -14,   36,   36,   36,  -14,   36,
+      -14,  -14,  -14,   36,  -14,   36,   36,  -14,  -14,   36,
       -14,  -14,  -14,  -14,   36,  -14,   36,  -14,   36,   36,
        36,   36,   36,   36,   36,   36,   36,   36,  -14,   36,
       -14,  -14,  -14,  -14,   36,   36,   36,   36,   36,   36,
@@ -592,17 +592,17 @@
         7,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
       -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
       -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
-      -15,  -15,  -15,   36,  -15,   36,   36,   36,  -15,   36,
-      -15,  -15,  -15,  -15,   36,  -15,   36,  -15,   36,   36,
-
-       36,   36,   36,   36,   36,   36,   36,   36,  -15,   36,
-      -15,  -15,  -15,  -15,   36,   36,   36,   36,   36,   36,
-       36,   36,   36,   36,   36,   36,   36,   36,   36,   36,
-       36,   36,   36,   36,   36,   36,   36,   36,   36,   36,
-       36,  -15,   36,  -15,   36,   36,  -15,   36,   36,   36,
-       36,   36,   36,   36,   36,   36,   36,   36,   36,   36,
-       36,   36,   36,   36,   36,   36,   36,   36,   36,   36,
-       36,   36,   36,  -15,  -15,  -15,  -15,  -15
+      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
+      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
+
+      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
+      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
+      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
+      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
+      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
+      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
+      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
+      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15
     },
 
     {
@@ -731,7 +731,7 @@
 
       -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,
       -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,
-      -23,  -23,  -23,   36,  -23,   36,   36,   36,  -23,   36,
+      -23,  -23,  -23,   36,  -23,   36,   36,  -23,  -23,   36,
       -23,  -23,  -23,  -23,   36,  -23,   36,  -23,   42,   42,
        42,   42,   42,   42,   42,   42,   42,   42,  -23,   36,
       -23,  -23,  -23,  -23,   36,   36,   36,   36,   36,   36,
@@ -956,7 +956,7 @@
       -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
 
       -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
-      -36,  -36,  -36,   36,  -36,   36,   36,   36,  -36,   36,
+      -36,  -36,  -36,   36,  -36,   36,   36,  -36,  -36,   36,
       -36,  -36,  -36,  -36,   36,  -36,   36,  -36,   36,   36,
        36,   36,   36,   36,   36,   36,   36,   36,  -36,   36,
       -36,  -36,  -36,  -36,   36,   36,   36,   36,   36,   36,
@@ -1059,7 +1059,7 @@
         7,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
       -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
       -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
-      -42,  -42,  -42,   36,  -42,   36,   36,   36,  -42,   36,
+      -42,  -42,  -42,   36,  -42,   36,   36,  -42,  -42,   36,
 
       -42,  -42,  -42,  -42,   36,  -42,   36,  -42,   42,   42,
        42,   42,   42,   42,   42,   42,   42,   42,  -42,   36,
@@ -1281,8 +1281,8 @@
 	*yy_cp = '\0'; \
 	yyg->yy_c_buf_p = yy_cp;
 
-#define YY_NUM_RULES 34
-#define YY_END_OF_BUFFER 35
+#define YY_NUM_RULES 35
+#define YY_END_OF_BUFFER 36
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -1292,12 +1292,12 @@
 	};
 static yyconst flex_int16_t yy_accept[54] =
     {   0,
-        0,    0,    0,    0,   31,   31,   35,   34,   24,   26,
-       28,   34,   28,   28,   17,    2,   21,   22,   15,   13,
-       14,   16,   27,   19,    9,    3,    8,   18,    1,   34,
-       30,   29,   31,   32,   32,   28,   12,    0,   25,   23,
-        5,   27,   20,   11,    6,    7,   10,    4,    0,   30,
-       29,   31,   33
+        0,    0,    0,    0,   32,   32,   36,   35,   25,   27,
+       19,   35,   29,   29,   17,    2,   22,   23,   15,   13,
+       14,   16,   28,   20,    9,    3,    8,   18,    1,   35,
+       31,   30,   32,   33,   33,   29,   12,    0,   26,   24,
+        5,   28,   21,   11,    6,    7,   10,    4,    0,   31,
+       30,   32,   34
     } ;
 
 static yyconst yy_state_type yy_NUL_trans[54] =
@@ -1784,96 +1784,101 @@
 case 19:
 YY_RULE_SETUP
 #line 103 "ast_expr2.fl"
+{ SET_COLUMNS; SET_STRING; return TOK_COMPL;}
+	YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 104 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_COLON;}
 	YY_BREAK
-case 20:
-YY_RULE_SETUP
-#line 104 "ast_expr2.fl"
+case 21:
+YY_RULE_SETUP
+#line 105 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_COLONCOLON;}
 	YY_BREAK
-case 21:
-YY_RULE_SETUP
-#line 105 "ast_expr2.fl"
+case 22:
+YY_RULE_SETUP
+#line 106 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_LP;}
 	YY_BREAK
-case 22:
-YY_RULE_SETUP
-#line 106 "ast_expr2.fl"
+case 23:
+YY_RULE_SETUP
+#line 107 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_RP;}
 	YY_BREAK
-case 23:
-YY_RULE_SETUP
-#line 107 "ast_expr2.fl"
+case 24:
+YY_RULE_SETUP
+#line 108 "ast_expr2.fl"
 {/* gather the contents of ${} expressions, with trailing stuff, into a single TOKEN. They are much more complex now than they used to be */
                        curlycount = 0; BEGIN(var); yymore();}
 	YY_BREAK
-case 24:
-YY_RULE_SETUP
-#line 110 "ast_expr2.fl"
+case 25:
+YY_RULE_SETUP
+#line 111 "ast_expr2.fl"
 {}
-	YY_BREAK
-case 25:
-/* rule 25 can match eol */
-YY_RULE_SETUP
-#line 111 "ast_expr2.fl"
-{SET_COLUMNS; SET_STRING; return TOKEN;}
 	YY_BREAK
 case 26:
 /* rule 26 can match eol */
 YY_RULE_SETUP
-#line 113 "ast_expr2.fl"
+#line 112 "ast_expr2.fl"
+{SET_COLUMNS; SET_STRING; return TOKEN;}
+	YY_BREAK
+case 27:
+/* rule 27 can match eol */
+YY_RULE_SETUP
+#line 114 "ast_expr2.fl"
 {/* what to do with eol */}
 	YY_BREAK
-case 27:
-YY_RULE_SETUP
-#line 114 "ast_expr2.fl"
+case 28:
+YY_RULE_SETUP
+#line 115 "ast_expr2.fl"
 {   SET_COLUMNS;  /* the original behavior of the expression parser was to bring in numbers as a numeric string */
 				SET_NUMERIC_STRING;
 				return TOKEN;}
 	YY_BREAK
-case 28:
-YY_RULE_SETUP
-#line 117 "ast_expr2.fl"
+case 29:
+YY_RULE_SETUP
+#line 119 "ast_expr2.fl"
 {SET_COLUMNS; SET_STRING; return TOKEN;}
-	YY_BREAK
-case 29:
-/* rule 29 can match eol */
-YY_RULE_SETUP
-#line 119 "ast_expr2.fl"
-{curlycount--; if(curlycount < 0){ BEGIN(trail);  yymore();} else {  yymore();}}
 	YY_BREAK
 case 30:
 /* rule 30 can match eol */
 YY_RULE_SETUP
-#line 120 "ast_expr2.fl"
+#line 121 "ast_expr2.fl"
+{curlycount--; if(curlycount < 0){ BEGIN(trail);  yymore();} else {  yymore();}}
+	YY_BREAK
+case 31:
+/* rule 31 can match eol */
+YY_RULE_SETUP
+#line 122 "ast_expr2.fl"
 {curlycount++; yymore();  }
 	YY_BREAK
-case 31:
-YY_RULE_SETUP
-#line 121 "ast_expr2.fl"
+case 32:
+YY_RULE_SETUP
+#line 123 "ast_expr2.fl"
 {BEGIN(0); SET_COLUMNS; SET_STRING; return TOKEN;}
 	YY_BREAK
-case 32:
-/* rule 32 can match eol */
-YY_RULE_SETUP
-#line 122 "ast_expr2.fl"
+case 33:
+/* rule 33 can match eol */
+YY_RULE_SETUP
+#line 124 "ast_expr2.fl"
 {char c = yytext[yyleng-1]; BEGIN(0); unput(c); SET_COLUMNS; SET_STRING; return TOKEN;}
 	YY_BREAK
-case 33:
-YY_RULE_SETUP
-#line 123 "ast_expr2.fl"
+case 34:
+YY_RULE_SETUP
+#line 125 "ast_expr2.fl"
 {curlycount = 0; BEGIN(var); yymore();  }
 	YY_BREAK
 case YY_STATE_EOF(trail):
-#line 124 "ast_expr2.fl"
+#line 126 "ast_expr2.fl"
 {BEGIN(0); SET_COLUMNS; SET_STRING; return TOKEN; /*actually, if an expr is only a variable ref, this could happen a LOT */}
 	YY_BREAK
-case 34:
-YY_RULE_SETUP
-#line 126 "ast_expr2.fl"
+case 35:
+YY_RULE_SETUP
+#line 128 "ast_expr2.fl"
 ECHO;
 	YY_BREAK
-#line 1877 "ast_expr2f.c"
+#line 1882 "ast_expr2f.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(var):
 	yyterminate();
@@ -3006,7 +3011,7 @@
 #undef YY_DECL_IS_OURS
 #undef YY_DECL
 #endif
-#line 126 "ast_expr2.fl"
+#line 128 "ast_expr2.fl"
 
 
 
@@ -3121,7 +3126,7 @@
 	"*",
 	"/",
 	"%",
-	"~",
+	"!",
 	":",
 	"=~",
 	")",

Modified: team/murf/AEL2/utils/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/utils/Makefile?rev=8293&r1=8292&r2=8293&view=diff
==============================================================================
--- team/murf/AEL2/utils/Makefile (original)
+++ team/murf/AEL2/utils/Makefile Thu Jan 19 15:01:35 2006
@@ -71,7 +71,12 @@
 ael_main1.o : ael_main.c ../include/asterisk/ael_structs.h
 	$(CC) $(CFLAGS) -c -g  -o ael_main1.o ael_main.c
 
-
+testexpr2s: ../ast_expr2f.c ../ast_expr2.c ../ast_expr2.h
+	gcc -g -c -I../include -DSTANDALONE ../ast_expr2f.c -o ast_expr2f.o
+	gcc -g -c -I../include -DSTANDALONE ../ast_expr2.c -o ast_expr2.o
+	gcc -g -o testexpr2s ast_expr2f.o ast_expr2.o
+	rm ast_expr2.o ast_expr2f.o 
+	./testexpr2s expr2.testinput
 
 smsq: smsq.o
 	$(CC) $(CFLAGS) -o smsq ${SOL} smsq.o -lpopt

Added: team/murf/AEL2/utils/expr2.testinput
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/utils/expr2.testinput?rev=8293&view=auto
==============================================================================
--- team/murf/AEL2/utils/expr2.testinput (added)
+++ team/murf/AEL2/utils/expr2.testinput Thu Jan 19 15:01:35 2006
@@ -1,0 +1,92 @@
+2 + 2
+      2     +       2            
+
+2 - 4
+4 - 2
+-4 - -2
+4 + 2 * 8
+(4 + 2) * 8
+4 + (2 * 8)
+4 + (2 * 8) ? 3 :: 6
+4 + 8 / 2
+4 + 8 / 3
+(4+8) / 3
+4 + 8 % 3
+4 + 9 % 3
+(4+9) %3
+(4+8) %3
+(4+9) %3
+(4+8) %3
+(4+9) % 3
+(4+8) % 3
+(4+9) % 3
+(4+8) % 3
+(4+9)% 3
+(4+8)% 3
+(4+9)% 3
+(4+8)% 3
+4 & 4
+0 & 4
+0 & 0
+2 | 0
+2 | 4
+0 | 0
+!0 | 0
+!4 | 0
+4 | !0
+!4 | !0
+3 < 4
+4 < 3
+3 > 4
+4 > 3
+3 = 3
+3 = 4
+3 != 3
+3 != 4
+3 >= 4
+3 >= 3
+4 >= 3
+3 <= 4
+4 <= 3
+4 <= 4
+3 > 4 & 4 < 3
+4 > 3 & 3 < 4
+x = x
+y = x
+x != y
+x != x
+"Something interesting" =~ interesting
+"Something interesting" =~ Something
+"Something interesting" : Something
+"Something interesting" : interesting
+"Something interesting" =~ "interesting"
+"Something interesting" =~ "Something"
+"Something interesting" : "Something"
+"Something interesting" : "interesting"
+"Something interesting" =~ (interesting)
+"Something interesting" =~ (Something)
+"Something interesting" : (Something)
+"Something interesting" : (interesting)
+"Something interesting" =~ "\(interesting\)"
+"Something interesting" =~ "\(Something\)"
+"Something interesting" : "\(Something\)"
+"Something interesting" : "\(interesting\)"
+"011043567857575" : "011\(..\)"
+"9011043567857575" : "011\(..\)"
+"011043567857575" =~ "011\(..\)"
+"9011043567857575" =~ "011\(..\)"
+"Something interesting" =~ (interesting)
+"Something interesting" =~ (Something)
+"Something interesting" : (Something)
+"Something interesting" : (interesting)
+"Something interesting" =~ "(interesting)"
+"Something interesting" =~ "(Something)"
+"Something interesting" : "(Something)"
+"Something interesting" : "(interesting)"
+"011043567857575" : "011(..)"
+"9011043567857575" : "011(..)"
+"011043567857575" =~ "011(..)"
+"9011043567857575" =~ "011(..)"
+3
+something
+043



More information about the asterisk-commits mailing list