mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 18:55:19 +00:00 
			
		
		
		
	Merged revisions 168737 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r168737 | murf | 2009-01-15 13:54:59 -0700 (Thu, 15 Jan 2009) | 16 lines This patch allows null args in ast_expr2 func calls, and fixes commas being converted to pipes, which was 1.4 type stuff. If the user says count=ENUMLOOKUP(${EXTEN},ALL,c,,enum.mydomain.tld); then it won't complain about the empty arg (c,,...) and fabled's patch won't let it swap the commas for pipes. Ran it thru my dialplan and no complaints. (closes issue #14169) Reported by: fabled Patches: function-argument-separator-fix.diff uploaded by fabled (license 448) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@168739 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		
							
								
								
									
										265
									
								
								main/ast_expr2.c
									
									
									
									
									
								
							
							
						
						
									
										265
									
								
								main/ast_expr2.c
									
									
									
									
									
								
							| @@ -372,7 +372,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 { | ||||
| @@ -485,13 +485,13 @@ int		ast_yyerror(const char *,YYLTYPE *, struct parse_io *); | ||||
|  | ||||
| #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | ||||
| typedef union YYSTYPE | ||||
| #line 342 "ast_expr2.y" | ||||
| #line 344 "ast_expr2.y" | ||||
| { | ||||
| 	struct val *val; | ||||
| 	struct expr_node *arglist; | ||||
| } | ||||
| /* Line 187 of yacc.c.  */ | ||||
| #line 493 "ast_expr2.c" | ||||
| #line 495 "ast_expr2.c" | ||||
| 	YYSTYPE; | ||||
| # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | ||||
| # define YYSTYPE_IS_DECLARED 1 | ||||
| @@ -513,13 +513,13 @@ typedef struct YYLTYPE | ||||
|  | ||||
|  | ||||
| /* Copy the second part of user declarations.  */ | ||||
| #line 347 "ast_expr2.y" | ||||
| #line 349 "ast_expr2.y" | ||||
|  | ||||
| extern int		ast_yylex __P((YYSTYPE *, YYLTYPE *, yyscan_t)); | ||||
|  | ||||
|  | ||||
| /* Line 216 of yacc.c.  */ | ||||
| #line 521 "ast_expr2.c" | ||||
| #line 523 "ast_expr2.c" | ||||
|  | ||||
| #ifdef short | ||||
| # undef short | ||||
| @@ -743,7 +743,7 @@ union yyalloc | ||||
| /* YYNNTS -- Number of nonterminals.  */ | ||||
| #define YYNNTS  4 | ||||
| /* YYNRULES -- Number of rules.  */ | ||||
| #define YYNRULES  27 | ||||
| #define YYNRULES  28 | ||||
| /* YYNRULES -- Number of states.  */ | ||||
| #define YYNSTATES  54 | ||||
|  | ||||
| @@ -793,32 +793,33 @@ static const yytype_uint8 yytranslate[] = | ||||
|    YYRHS.  */ | ||||
| static const yytype_uint8 yyprhs[] = | ||||
| { | ||||
|        0,     0,     3,     5,     6,     8,    12,    17,    19,    23, | ||||
|       27,    31,    35,    39,    43,    47,    51,    55,    59,    63, | ||||
|       66,    69,    73,    77,    81,    85,    89,    95 | ||||
|        0,     0,     3,     5,     6,     8,    12,    15,    20,    22, | ||||
|       26,    30,    34,    38,    42,    46,    50,    54,    58,    62, | ||||
|       66,    69,    72,    76,    80,    84,    88,    92,    98 | ||||
| }; | ||||
|  | ||||
| /* YYRHS -- A `-1'-separated list of the rules' RHS.  */ | ||||
| static const yytype_int8 yyrhs[] = | ||||
| { | ||||
|       27,     0,    -1,    29,    -1,    -1,    29,    -1,    28,     3, | ||||
|       29,    -1,    25,    23,    28,    24,    -1,    25,    -1,    23, | ||||
|       29,    24,    -1,    29,     6,    29,    -1,    29,     7,    29, | ||||
|       -1,    29,    13,    29,    -1,    29,    12,    29,    -1,    29, | ||||
|       11,    29,    -1,    29,    10,    29,    -1,    29,     9,    29, | ||||
|       -1,    29,     8,    29,    -1,    29,    15,    29,    -1,    29, | ||||
|       14,    29,    -1,    14,    29,    -1,    19,    29,    -1,    29, | ||||
|       18,    29,    -1,    29,    17,    29,    -1,    29,    16,    29, | ||||
|       -1,    29,    22,    29,    -1,    29,    21,    29,    -1,    29, | ||||
|        5,    29,     4,    29,    -1,    29,    20,    29,    -1 | ||||
|       29,    -1,    28,     3,    -1,    25,    23,    28,    24,    -1, | ||||
|       25,    -1,    23,    29,    24,    -1,    29,     6,    29,    -1, | ||||
|       29,     7,    29,    -1,    29,    13,    29,    -1,    29,    12, | ||||
|       29,    -1,    29,    11,    29,    -1,    29,    10,    29,    -1, | ||||
|       29,     9,    29,    -1,    29,     8,    29,    -1,    29,    15, | ||||
|       29,    -1,    29,    14,    29,    -1,    14,    29,    -1,    19, | ||||
|       29,    -1,    29,    18,    29,    -1,    29,    17,    29,    -1, | ||||
|       29,    16,    29,    -1,    29,    22,    29,    -1,    29,    21, | ||||
|       29,    -1,    29,     5,    29,     4,    29,    -1,    29,    20, | ||||
|       29,    -1 | ||||
| }; | ||||
|  | ||||
| /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */ | ||||
| static const yytype_uint16 yyrline[] = | ||||
| { | ||||
|        0,   371,   371,   379,   386,   387,   396,   402,   403,   407, | ||||
|      411,   415,   419,   423,   427,   431,   435,   439,   443,   447, | ||||
|      451,   455,   459,   463,   467,   471,   475,   480 | ||||
|        0,   373,   373,   381,   388,   389,   395,   404,   410,   411, | ||||
|      415,   419,   423,   427,   431,   435,   439,   443,   447,   451, | ||||
|      455,   459,   463,   467,   471,   475,   479,   483,   488 | ||||
| }; | ||||
| #endif | ||||
|  | ||||
| @@ -849,17 +850,17 @@ static const yytype_uint16 yytoknum[] = | ||||
| /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */ | ||||
| static const yytype_uint8 yyr1[] = | ||||
| { | ||||
|        0,    26,    27,    27,    28,    28,    29,    29,    29,    29, | ||||
|        0,    26,    27,    27,    28,    28,    28,    29,    29,    29, | ||||
|       29,    29,    29,    29,    29,    29,    29,    29,    29,    29, | ||||
|       29,    29,    29,    29,    29,    29,    29,    29 | ||||
|       29,    29,    29,    29,    29,    29,    29,    29,    29 | ||||
| }; | ||||
|  | ||||
| /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */ | ||||
| static const yytype_uint8 yyr2[] = | ||||
| { | ||||
|        0,     2,     1,     0,     1,     3,     4,     1,     3,     3, | ||||
|        3,     3,     3,     3,     3,     3,     3,     3,     3,     2, | ||||
|        2,     3,     3,     3,     3,     3,     5,     3 | ||||
|        0,     2,     1,     0,     1,     3,     2,     4,     1,     3, | ||||
|        3,     3,     3,     3,     3,     3,     3,     3,     3,     3, | ||||
|        2,     2,     3,     3,     3,     3,     3,     5,     3 | ||||
| }; | ||||
|  | ||||
| /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | ||||
| @@ -867,12 +868,12 @@ static const yytype_uint8 yyr2[] = | ||||
|    means the default is an error.  */ | ||||
| static const yytype_uint8 yydefact[] = | ||||
| { | ||||
|        3,     0,     0,     0,     7,     0,     2,    19,    20,     0, | ||||
|        3,     0,     0,     0,     8,     0,     2,    20,    21,     0, | ||||
|        0,     1,     0,     0,     0,     0,     0,     0,     0,     0, | ||||
|        0,     0,     0,     0,     0,     0,     0,     0,     0,     8, | ||||
|        0,     4,     0,     9,    10,    16,    15,    14,    13,    12, | ||||
|       11,    18,    17,    23,    22,    21,    27,    25,    24,     0, | ||||
|        6,     0,     5,    26 | ||||
|        0,     0,     0,     0,     0,     0,     0,     0,     0,     9, | ||||
|        0,     4,     0,    10,    11,    17,    16,    15,    14,    13, | ||||
|       12,    19,    18,    24,    23,    22,    28,    26,    25,     6, | ||||
|        7,     0,     5,    27 | ||||
| }; | ||||
|  | ||||
| /* YYDEFGOTO[NTERM-NUM].  */ | ||||
| @@ -1471,119 +1472,119 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp) | ||||
|   switch (yytype) | ||||
|     { | ||||
|       case 4: /* "TOK_COLONCOLON" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1475 "ast_expr2.c" | ||||
| #line 1478 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 5: /* "TOK_COND" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1480 "ast_expr2.c" | ||||
| #line 1483 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 6: /* "TOK_OR" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1485 "ast_expr2.c" | ||||
| #line 1488 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 7: /* "TOK_AND" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1490 "ast_expr2.c" | ||||
| #line 1493 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 8: /* "TOK_NE" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1495 "ast_expr2.c" | ||||
| #line 1498 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 9: /* "TOK_LE" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1500 "ast_expr2.c" | ||||
| #line 1503 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 10: /* "TOK_GE" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1505 "ast_expr2.c" | ||||
| #line 1508 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 11: /* "TOK_LT" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1510 "ast_expr2.c" | ||||
| #line 1513 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 12: /* "TOK_GT" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1515 "ast_expr2.c" | ||||
| #line 1518 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 13: /* "TOK_EQ" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1520 "ast_expr2.c" | ||||
| #line 1523 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 14: /* "TOK_MINUS" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1525 "ast_expr2.c" | ||||
| #line 1528 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 15: /* "TOK_PLUS" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1530 "ast_expr2.c" | ||||
| #line 1533 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 16: /* "TOK_MOD" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1535 "ast_expr2.c" | ||||
| #line 1538 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 17: /* "TOK_DIV" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1540 "ast_expr2.c" | ||||
| #line 1543 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 18: /* "TOK_MULT" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1545 "ast_expr2.c" | ||||
| #line 1548 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 19: /* "TOK_COMPL" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1550 "ast_expr2.c" | ||||
| #line 1553 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 20: /* "TOK_TILDETILDE" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1555 "ast_expr2.c" | ||||
| #line 1558 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 21: /* "TOK_EQTILDE" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1560 "ast_expr2.c" | ||||
| #line 1563 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 22: /* "TOK_COLON" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1565 "ast_expr2.c" | ||||
| #line 1568 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 23: /* "TOK_LP" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1570 "ast_expr2.c" | ||||
| #line 1573 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 24: /* "TOK_RP" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1575 "ast_expr2.c" | ||||
| #line 1578 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 25: /* "TOKEN" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1580 "ast_expr2.c" | ||||
| #line 1583 "ast_expr2.c" | ||||
| 	break; | ||||
|       case 29: /* "expr" */ | ||||
| #line 365 "ast_expr2.y" | ||||
| #line 367 "ast_expr2.y" | ||||
| 	{  free_value((yyvaluep->val)); }; | ||||
| #line 1585 "ast_expr2.c" | ||||
| #line 1588 "ast_expr2.c" | ||||
| 	break; | ||||
|  | ||||
|       default: | ||||
| @@ -1906,7 +1907,7 @@ yyreduce: | ||||
|   switch (yyn) | ||||
|     { | ||||
|         case 2: | ||||
| #line 371 "ast_expr2.y" | ||||
| #line 373 "ast_expr2.y" | ||||
|     { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1); | ||||
|               ((struct parse_io *)parseio)->val->type = (yyvsp[(1) - (1)].val)->type; | ||||
|               if( (yyvsp[(1) - (1)].val)->type == AST_EXPR_number ) | ||||
| @@ -1918,7 +1919,7 @@ yyreduce: | ||||
|     break; | ||||
|  | ||||
|   case 3: | ||||
| #line 379 "ast_expr2.y" | ||||
| #line 381 "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("");  | ||||
| @@ -1926,12 +1927,12 @@ yyreduce: | ||||
|     break; | ||||
|  | ||||
|   case 4: | ||||
| #line 386 "ast_expr2.y" | ||||
| #line 388 "ast_expr2.y" | ||||
|     { (yyval.arglist) = alloc_expr_node(AST_EXPR_NODE_VAL); (yyval.arglist)->val = (yyvsp[(1) - (1)].val);;} | ||||
|     break; | ||||
|  | ||||
|   case 5: | ||||
| #line 387 "ast_expr2.y" | ||||
| #line 389 "ast_expr2.y" | ||||
|     {struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL); | ||||
|                                  struct expr_node *t; | ||||
| 								 DESTROY((yyvsp[(2) - (3)].val)); | ||||
| @@ -1941,7 +1942,17 @@ yyreduce: | ||||
|     break; | ||||
|  | ||||
|   case 6: | ||||
| #line 396 "ast_expr2.y" | ||||
| #line 395 "ast_expr2.y" | ||||
|     {struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL); | ||||
|                                  struct expr_node *t;  /* NULL args should OK */ | ||||
| 								 DESTROY((yyvsp[(2) - (2)].val)); | ||||
|                                  for (t=(yyvsp[(1) - (2)].arglist);t->right;t=t->right) | ||||
| 						         	  ; | ||||
|                                  (yyval.arglist) = (yyvsp[(1) - (2)].arglist); t->right = x; x->val = make_str("");;} | ||||
|     break; | ||||
|  | ||||
|   case 7: | ||||
| #line 404 "ast_expr2.y" | ||||
|     { (yyval.val) = op_func((yyvsp[(1) - (4)].val),(yyvsp[(3) - (4)].arglist), ((struct parse_io *)parseio)->chan); | ||||
| 		                            DESTROY((yyvsp[(2) - (4)].val)); | ||||
| 									DESTROY((yyvsp[(4) - (4)].val)); | ||||
| @@ -1950,157 +1961,157 @@ yyreduce: | ||||
|                                   ;} | ||||
|     break; | ||||
|  | ||||
|   case 7: | ||||
| #line 402 "ast_expr2.y" | ||||
|   case 8: | ||||
| #line 410 "ast_expr2.y" | ||||
|     {(yyval.val) = (yyvsp[(1) - (1)].val);;} | ||||
|     break; | ||||
|  | ||||
|   case 8: | ||||
| #line 403 "ast_expr2.y" | ||||
|   case 9: | ||||
| #line 411 "ast_expr2.y" | ||||
|     { (yyval.val) = (yyvsp[(2) - (3)].val); | ||||
| 	                       (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;  | ||||
| 						   (yyloc).first_line=0; (yyloc).last_line=0; | ||||
| 							DESTROY((yyvsp[(1) - (3)].val)); DESTROY((yyvsp[(3) - (3)].val)); ;} | ||||
|     break; | ||||
|  | ||||
|   case 9: | ||||
| #line 407 "ast_expr2.y" | ||||
|   case 10: | ||||
| #line 415 "ast_expr2.y" | ||||
|     { (yyval.val) = op_or ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
|                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;  | ||||
| 						 (yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 10: | ||||
| #line 411 "ast_expr2.y" | ||||
|   case 11: | ||||
| #line 419 "ast_expr2.y" | ||||
|     { (yyval.val) = op_and ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));  | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
| 	                      (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;  | ||||
|                           (yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 11: | ||||
| #line 415 "ast_expr2.y" | ||||
|   case 12: | ||||
| #line 423 "ast_expr2.y" | ||||
|     { (yyval.val) = op_eq ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
| 	                     (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; | ||||
| 						 (yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 12: | ||||
| #line 419 "ast_expr2.y" | ||||
|   case 13: | ||||
| #line 427 "ast_expr2.y" | ||||
|     { (yyval.val) = op_gt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
|                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; | ||||
| 						 (yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 13: | ||||
| #line 423 "ast_expr2.y" | ||||
|   case 14: | ||||
| #line 431 "ast_expr2.y" | ||||
|     { (yyval.val) = op_lt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));  | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
| 	                     (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;  | ||||
| 						 (yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 14: | ||||
| #line 427 "ast_expr2.y" | ||||
|   case 15: | ||||
| #line 435 "ast_expr2.y" | ||||
|     { (yyval.val) = op_ge ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));  | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
| 	                      (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;  | ||||
| 						  (yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 15: | ||||
| #line 431 "ast_expr2.y" | ||||
|   case 16: | ||||
| #line 439 "ast_expr2.y" | ||||
|     { (yyval.val) = op_le ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));  | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
| 	                      (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;  | ||||
| 						  (yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 16: | ||||
| #line 435 "ast_expr2.y" | ||||
|   case 17: | ||||
| #line 443 "ast_expr2.y" | ||||
|     { (yyval.val) = op_ne ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));  | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
| 	                      (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;  | ||||
| 						  (yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 17: | ||||
| #line 439 "ast_expr2.y" | ||||
|   case 18: | ||||
| #line 447 "ast_expr2.y" | ||||
|     { (yyval.val) = op_plus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));  | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
| 	                       (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;  | ||||
| 						   (yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 18: | ||||
| #line 443 "ast_expr2.y" | ||||
|   case 19: | ||||
| #line 451 "ast_expr2.y" | ||||
|     { (yyval.val) = op_minus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));  | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
| 	                        (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;  | ||||
| 							(yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 19: | ||||
| #line 447 "ast_expr2.y" | ||||
|   case 20: | ||||
| #line 455 "ast_expr2.y" | ||||
|     { (yyval.val) = op_negate ((yyvsp[(2) - (2)].val));  | ||||
| 						DESTROY((yyvsp[(1) - (2)].val));	 | ||||
| 	                        (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column;  | ||||
| 							(yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 20: | ||||
| #line 451 "ast_expr2.y" | ||||
|   case 21: | ||||
| #line 459 "ast_expr2.y" | ||||
|     { (yyval.val) = op_compl ((yyvsp[(2) - (2)].val));  | ||||
| 						DESTROY((yyvsp[(1) - (2)].val));	 | ||||
| 	                        (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column;  | ||||
| 							(yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 21: | ||||
| #line 455 "ast_expr2.y" | ||||
|   case 22: | ||||
| #line 463 "ast_expr2.y" | ||||
|     { (yyval.val) = op_times ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));  | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
| 	                       (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;  | ||||
| 						   (yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 22: | ||||
| #line 459 "ast_expr2.y" | ||||
|   case 23: | ||||
| #line 467 "ast_expr2.y" | ||||
|     { (yyval.val) = op_div ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));  | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
| 	                      (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;  | ||||
| 						  (yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 23: | ||||
| #line 463 "ast_expr2.y" | ||||
|   case 24: | ||||
| #line 471 "ast_expr2.y" | ||||
|     { (yyval.val) = op_rem ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));  | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
| 	                      (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;  | ||||
| 						  (yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 24: | ||||
| #line 467 "ast_expr2.y" | ||||
|   case 25: | ||||
| #line 475 "ast_expr2.y" | ||||
|     { (yyval.val) = op_colon ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));  | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
| 	                        (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;  | ||||
| 							(yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 25: | ||||
| #line 471 "ast_expr2.y" | ||||
|   case 26: | ||||
| #line 479 "ast_expr2.y" | ||||
|     { (yyval.val) = op_eqtilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));  | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
| 	                        (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;  | ||||
| 							(yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 26: | ||||
| #line 475 "ast_expr2.y" | ||||
|   case 27: | ||||
| #line 483 "ast_expr2.y" | ||||
|     { (yyval.val) = op_cond ((yyvsp[(1) - (5)].val), (yyvsp[(3) - (5)].val), (yyvsp[(5) - (5)].val));  | ||||
| 						DESTROY((yyvsp[(2) - (5)].val));	 | ||||
| 						DESTROY((yyvsp[(4) - (5)].val));	 | ||||
| @@ -2108,8 +2119,8 @@ yyreduce: | ||||
| 							(yyloc).first_line=0; (yyloc).last_line=0;;} | ||||
|     break; | ||||
|  | ||||
|   case 27: | ||||
| #line 480 "ast_expr2.y" | ||||
|   case 28: | ||||
| #line 488 "ast_expr2.y" | ||||
|     { (yyval.val) = op_tildetilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));  | ||||
| 						DESTROY((yyvsp[(2) - (3)].val));	 | ||||
| 	                        (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;  | ||||
| @@ -2118,7 +2129,7 @@ yyreduce: | ||||
|  | ||||
|  | ||||
| /* Line 1267 of yacc.c.  */ | ||||
| #line 2120 "ast_expr2.c" | ||||
| #line 2133 "ast_expr2.c" | ||||
|       default: break; | ||||
|     } | ||||
|   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); | ||||
| @@ -2338,7 +2349,7 @@ yyreturn: | ||||
| } | ||||
|  | ||||
|  | ||||
| #line 486 "ast_expr2.y" | ||||
| #line 494 "ast_expr2.y" | ||||
|  | ||||
|  | ||||
| static struct expr_node *alloc_expr_node(enum node_type nt) | ||||
| @@ -2556,7 +2567,7 @@ static char *compose_func_args(struct expr_node *arglist) | ||||
| 		char numbuf[30]; | ||||
| 		 | ||||
| 		if (t != arglist) | ||||
| 			strcat(argbuf,"|"); | ||||
| 			strcat(argbuf,","); | ||||
| 		 | ||||
| 		if (t->val) { | ||||
| 			if (t->val->type == AST_EXPR_number) { | ||||
|   | ||||
| @@ -94,7 +94,7 @@ | ||||
|  | ||||
| #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | ||||
| typedef union YYSTYPE | ||||
| #line 342 "ast_expr2.y" | ||||
| #line 344 "ast_expr2.y" | ||||
| { | ||||
| 	struct val *val; | ||||
| 	struct expr_node *arglist; | ||||
|   | ||||
| @@ -386,12 +386,18 @@ start: expr { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(st | ||||
| 	; | ||||
|  | ||||
| arglist: expr { $$ = alloc_expr_node(AST_EXPR_NODE_VAL); $$->val = $1;} | ||||
|        | arglist TOK_COMMA expr %prec TOK_RP{struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL); | ||||
|        | arglist TOK_COMMA expr %prec TOK_RP {struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL); | ||||
|                                  struct expr_node *t; | ||||
| 								 DESTROY($2); | ||||
|                                  for (t=$1;t->right;t=t->right) | ||||
| 						         	  ; | ||||
|                                  $$ = $1; t->right = x; x->val = $3;} | ||||
|        | arglist TOK_COMMA %prec TOK_RP {struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL); | ||||
|                                  struct expr_node *t;  /* NULL args should OK */ | ||||
| 								 DESTROY($2); | ||||
|                                  for (t=$1;t->right;t=t->right) | ||||
| 						         	  ; | ||||
|                                  $$ = $1; t->right = x; x->val = make_str("");} | ||||
|        ; | ||||
|  | ||||
| expr:  | ||||
| @@ -702,7 +708,7 @@ static char *compose_func_args(struct expr_node *arglist) | ||||
| 		char numbuf[30]; | ||||
| 		 | ||||
| 		if (t != arglist) | ||||
| 			strcat(argbuf,"|"); | ||||
| 			strcat(argbuf,","); | ||||
| 		 | ||||
| 		if (t->val) { | ||||
| 			if (t->val->type == AST_EXPR_number) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user