Asterisk - The Open Source Telephony Project  GIT-master-e8cda4b
ast_expr2.c
Go to the documentation of this file.
1 
2 /* A Bison parser, made by GNU Bison 2.4.1. */
3 
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 
6  Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7  Free Software Foundation, Inc.
8 
9  This program is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 
22 /* As a special exception, you may create a larger work that contains
23  part or all of the Bison parser skeleton and distribute that work
24  under terms of your choice, so long as that work isn't itself a
25  parser generator using the skeleton or a modified version thereof
26  as a parser skeleton. Alternatively, if you modify or redistribute
27  the parser skeleton itself, you may (at your option) remove this
28  special exception, which will cause the skeleton and the resulting
29  Bison output files to be licensed under the GNU General Public
30  License without this special exception.
31 
32  This special exception was added by the Free Software Foundation in
33  version 2.2 of Bison. */
34 
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36  simplifying the original so-called "semantic" parser. */
37 
38 /* All symbols defined below should begin with yy or YY, to avoid
39  infringing on user name space. This should be done even for local
40  variables, as they might otherwise be expanded by user macros.
41  There are some unavoidable exceptions within include files to
42  define necessary library symbols; they are noted "INFRINGES ON
43  USER NAME SPACE" below. */
44 
45 /* Identify Bison output. */
46 #define YYBISON 1
47 
48 /* Bison version. */
49 #define YYBISON_VERSION "2.4.1"
50 
51 /* Skeleton name. */
52 #define YYSKELETON_NAME "yacc.c"
53 
54 /* Pure parsers. */
55 #define YYPURE 1
56 
57 /* Push parsers. */
58 #define YYPUSH 0
59 
60 /* Pull parsers. */
61 #define YYPULL 1
62 
63 /* Using locations. */
64 #define YYLSP_NEEDED 1
65 
66 /* Substitute the variable and function names. */
67 #define yyparse ast_yyparse
68 #define yylex ast_yylex
69 #define yyerror ast_yyerror
70 #define yylval ast_yylval
71 #define yychar ast_yychar
72 #define yydebug ast_yydebug
73 #define yynerrs ast_yynerrs
74 #define yylloc ast_yylloc
75 
76 /* Copy the first part of user declarations. */
77 
78 /* Line 189 of yacc.c */
79 #line 1 "ast_expr2.y"
80 
81 /* Written by Pace Willisson (pace@blitz.com)
82  * and placed in the public domain.
83  *
84  * Largely rewritten by J.T. Conklin (jtc@wimsey.com)
85  *
86  * And then overhauled twice by Steve Murphy (murf@digium.com)
87  * to add double-quoted strings, allow mult. spaces, improve
88  * error messages, and then to fold in a flex scanner for the
89  * yylex operation.
90  *
91  * $FreeBSD: src/bin/expr/expr.y,v 1.16 2000/07/22 10:59:36 se Exp $
92  */
93 
94 #define ASTMM_LIBC ASTMM_REDIRECT
95 #include "asterisk.h"
96 
97 #include <sys/types.h>
98 #include <stdio.h>
99 
100 #if defined(STANDALONE) || defined(STANDALONE2)
101 #ifndef __USE_ISOC99
102 #define __USE_ISOC99 1
103 #endif
104 #endif
105 
106 #ifdef __USE_ISOC99
107 #define FP___PRINTF "%.18Lg"
108 #define FP___TYPE long double
109 #else
110 #define FP___PRINTF "%.16g"
111 #define FP___TYPE double
112 #endif
113 
114 #ifdef HAVE_COSL
115 #define FUNC_COS cosl
116 #elif defined(HAVE_COS)
117 #define FUNC_COS (long double)cos
118 #endif
119 
120 #ifdef HAVE_SINL
121 #define FUNC_SIN sinl
122 #elif defined(HAVE_SIN)
123 #define FUNC_SIN (long double)sin
124 #endif
125 
126 #ifdef HAVE_TANL
127 #define FUNC_TAN tanl
128 #elif defined(HAVE_TAN)
129 #define FUNC_TAN (long double)tan
130 #endif
131 
132 #ifdef HAVE_ACOSL
133 #define FUNC_ACOS acosl
134 #elif defined(HAVE_ACOS)
135 #define FUNC_ACOS (long double)acos
136 #endif
137 
138 #ifdef HAVE_ASINL
139 #define FUNC_ASIN asinl
140 #elif defined(HAVE_ASIN)
141 #define FUNC_ASIN (long double)asin
142 #endif
143 
144 #ifdef HAVE_ATANL
145 #define FUNC_ATAN atanl
146 #elif defined(HAVE_ATAN)
147 #define FUNC_ATAN (long double)atan
148 #endif
149 
150 #ifdef HAVE_ATAN2L
151 #define FUNC_ATAN2 atan2l
152 #elif defined(HAVE_ATAN2)
153 #define FUNC_ATAN2 (long double)atan2
154 #endif
155 
156 #ifdef HAVE_POWL
157 #define FUNC_POW powl
158 #elif defined(HAVE_POW)
159 #define FUNC_POW (long double)pow
160 #endif
161 
162 #ifdef HAVE_SQRTL
163 #define FUNC_SQRT sqrtl
164 #elif defined(HAVE_SQRT)
165 #define FUNC_SQRT (long double)sqrt
166 #endif
167 
168 #ifdef HAVE_RINTL
169 #define FUNC_RINT rintl
170 #elif defined(HAVE_RINT)
171 #define FUNC_RINT (long double)rint
172 #endif
173 
174 #ifdef HAVE_EXPL
175 #define FUNC_EXP expl
176 #elif defined(HAVE_EXP)
177 #define FUNC_EXP (long double)exp
178 #endif
179 
180 #ifdef HAVE_LOGL
181 #define FUNC_LOG logl
182 #elif defined(HAVE_LOG)
183 #define FUNC_LOG (long double)log
184 #endif
185 
186 #ifdef HAVE_REMAINDERL
187 #define FUNC_REMAINDER remainderl
188 #elif defined(HAVE_REMAINDER)
189 #define FUNC_REMAINDER (long double)remainder
190 #endif
191 
192 #ifdef HAVE_FMODL
193 #define FUNC_FMOD fmodl
194 #elif defined(HAVE_FMOD)
195 #define FUNC_FMOD (long double)fmod
196 #endif
197 
198 #ifdef HAVE_STRTOLD
199 #define FUNC_STRTOD strtold
200 #elif defined(HAVE_STRTOD)
201 #define FUNC_STRTOD (long double)strtod
202 #endif
203 
204 #ifdef HAVE_FLOORL
205 #define FUNC_FLOOR floorl
206 #elif defined(HAVE_FLOOR)
207 #define FUNC_FLOOR (long double)floor
208 #endif
209 
210 #ifdef HAVE_CEILL
211 #define FUNC_CEIL ceill
212 #elif defined(HAVE_CEIL)
213 #define FUNC_CEIL (long double)ceil
214 #endif
215 
216 #ifdef HAVE_ROUNDL
217 #define FUNC_ROUND roundl
218 #elif defined(HAVE_ROUND)
219 #define FUNC_ROUND (long double)round
220 #endif
221 
222 #ifdef HAVE_TRUNCL
223 #define FUNC_TRUNC truncl
224 #elif defined(HAVE_TRUNC)
225 #define FUNC_TRUNC (long double)trunc
226 #endif
227 
228 /*! \note
229  * Oddly enough, some platforms have some ISO C99 functions, but not others, so
230  * we define the missing functions in terms of their mathematical identities.
231  */
232 #ifdef HAVE_EXP2L
233 #define FUNC_EXP2 exp2l
234 #elif (defined(HAVE_EXPL) && defined(HAVE_LOGL))
235 #define FUNC_EXP2(x) expl((x) * logl(2.0))
236 #elif (defined(HAVE_EXP) && defined(HAVE_LOG))
237 #define FUNC_EXP2(x) (long double)exp((x) * log(2.0))
238 #endif
239 
240 #ifdef HAVE_EXP10L
241 #define FUNC_EXP10 exp10l
242 #elif (defined(HAVE_EXPL) && defined(HAVE_LOGL))
243 #define FUNC_EXP10(x) expl((x) * logl(10.0))
244 #elif (defined(HAVE_EXP) && defined(HAVE_LOG))
245 #define FUNC_EXP10(x) (long double)exp((x) * log(10.0))
246 #endif
247 
248 #ifdef HAVE_LOG2L
249 #define FUNC_LOG2 log2l
250 #elif defined(HAVE_LOGL)
251 #define FUNC_LOG2(x) (logl(x) / logl(2.0))
252 #elif defined(HAVE_LOG10L)
253 #define FUNC_LOG2(x) (log10l(x) / log10l(2.0))
254 #elif defined(HAVE_LOG2)
255 #define FUNC_LOG2 (long double)log2
256 #elif defined(HAVE_LOG)
257 #define FUNC_LOG2(x) ((long double)log(x) / log(2.0))
258 #endif
259 
260 #ifdef HAVE_LOG10L
261 #define FUNC_LOG10 log10l
262 #elif defined(HAVE_LOGL)
263 #define FUNC_LOG10(x) (logl(x) / logl(10.0))
264 #elif defined(HAVE_LOG2L)
265 #define FUNC_LOG10(x) (log2l(x) / log2l(10.0))
266 #elif defined(HAVE_LOG10)
267 #define FUNC_LOG10(x) (long double)log10(x)
268 #elif defined(HAVE_LOG)
269 #define FUNC_LOG10(x) ((long double)log(x) / log(10.0))
270 #endif
271 
272 
273 #include <stdlib.h>
274 #ifndef _GNU_SOURCE
275 #define _GNU_SOURCE
276 #endif
277 #include <string.h>
278 #include <math.h>
279 #include <locale.h>
280 #include <unistd.h>
281 #include <ctype.h>
282 #if !defined(SOLARIS) && !defined(__CYGWIN__)
283  /* #include <err.h> */
284 #else
285 #define quad_t int64_t
286 #endif
287 #include <errno.h>
288 #include <regex.h>
289 #include <limits.h>
290 
291 #include "asterisk/ast_expr.h"
292 #include "asterisk/logger.h"
293 #if !defined(STANDALONE) && !defined(STANDALONE2)
294 #include "asterisk/pbx.h"
295 #endif
296 
297 #if defined(LONG_LONG_MIN) && !defined(QUAD_MIN)
298 #define QUAD_MIN LONG_LONG_MIN
299 #endif
300 #if defined(LONG_LONG_MAX) && !defined(QUAD_MAX)
301 #define QUAD_MAX LONG_LONG_MAX
302 #endif
303 
304 # if ! defined(QUAD_MIN)
305 # define QUAD_MIN (-0x7fffffffffffffffLL-1)
306 # endif
307 # if ! defined(QUAD_MAX)
308 # define QUAD_MAX (0x7fffffffffffffffLL)
309 # endif
310 #define YYENABLE_NLS 0
311 #define YYPARSE_PARAM parseio
312 #define YYLEX_PARAM ((struct parse_io *)parseio)->scanner
313 #define YYERROR_VERBOSE 1
314 extern char extra_error_message[4095];
316 
317 enum valtype {
319 } ;
320 
321 #if defined(STANDALONE) || defined(STANDALONE2)
322 void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__ ((format (printf,5,6)));
323 #endif
324 
325 struct val {
326  enum valtype type;
327  union {
328  char *s;
329  FP___TYPE i; /* either long double, or just double, on a bad day */
330  } u;
331 } ;
332 
333 enum node_type {
335 } ;
336 
337 struct expr_node
338 {
340  struct val *val;
341  struct expr_node *left;
342  struct expr_node *right;
343 };
344 
345 
346 typedef void *yyscan_t;
347 
348 struct parse_io
349 {
350  char *string;
351  struct val *val;
352  yyscan_t scanner;
353  struct ast_channel *chan;
354 };
355 
356 static int chk_div __P((FP___TYPE, FP___TYPE));
357 static int chk_minus __P((FP___TYPE, FP___TYPE, FP___TYPE));
358 static int chk_plus __P((FP___TYPE, FP___TYPE, FP___TYPE));
359 static int chk_times __P((FP___TYPE, FP___TYPE, FP___TYPE));
360 static void free_value __P((struct val *));
361 static int is_zero_or_null __P((struct val *));
362 static int isstring __P((struct val *));
363 static struct val *make_number __P((FP___TYPE));
364 static struct val *make_str __P((const char *));
365 static struct val *op_and __P((struct val *, struct val *));
366 static struct val *op_colon __P((struct val *, struct val *));
367 static struct val *op_eqtilde __P((struct val *, struct val *));
368 static struct val *op_tildetilde __P((struct val *, struct val *));
369 static struct val *op_div __P((struct val *, struct val *));
370 static struct val *op_eq __P((struct val *, struct val *));
371 static struct val *op_ge __P((struct val *, struct val *));
372 static struct val *op_gt __P((struct val *, struct val *));
373 static struct val *op_le __P((struct val *, struct val *));
374 static struct val *op_lt __P((struct val *, struct val *));
375 static struct val *op_cond __P((struct val *, struct val *, struct val *));
376 static struct val *op_minus __P((struct val *, struct val *));
377 static struct val *op_negate __P((struct val *));
378 static struct val *op_compl __P((struct val *));
379 static struct val *op_ne __P((struct val *, struct val *));
380 static struct val *op_or __P((struct val *, struct val *));
381 static struct val *op_plus __P((struct val *, struct val *));
382 static struct val *op_rem __P((struct val *, struct val *));
383 static struct val *op_times __P((struct val *, struct val *));
384 static struct val *op_func(struct val *funcname, struct expr_node *arglist, struct ast_channel *chan);
385 static int to_number __P((struct val *));
386 static void to_string __P((struct val *));
387 static struct expr_node *alloc_expr_node(enum node_type);
388 static void destroy_arglist(struct expr_node *arglist);
389 
390 /* uh, if I want to predeclare yylex with a YYLTYPE, I have to predeclare the yyltype... sigh */
391 typedef struct yyltype
392 {
395 
398 } yyltype;
399 
400 # define YYLTYPE yyltype
401 # define YYLTYPE_IS_TRIVIAL 1
402 
403 /* we will get warning about no prototype for yylex! But we can't
404  define it here, we have no definition yet for YYSTYPE. */
405 
406 int ast_yyerror(const char *,YYLTYPE *, struct parse_io *);
407 
408 /* I wanted to add args to the yyerror routine, so I could print out
409  some useful info about the error. Not as easy as it looks, but it
410  is possible. */
411 #define ast_yyerror(x) ast_yyerror(x,&yyloc,parseio)
412 #define DESTROY(x) {if((x)->type == AST_EXPR_numeric_string || (x)->type == AST_EXPR_string) free((x)->u.s); (x)->u.s = 0; free(x);}
413 
414 
415 /* Line 189 of yacc.c */
416 #line 419 "ast_expr2.c"
417 
418 /* Enabling traces. */
419 #ifndef YYDEBUG
420 # define YYDEBUG 0
421 #endif
422 
423 /* Enabling verbose error messages. */
424 #ifdef YYERROR_VERBOSE
425 # undef YYERROR_VERBOSE
426 # define YYERROR_VERBOSE 1
427 #else
428 # define YYERROR_VERBOSE 0
429 #endif
430 
431 /* Enabling the token table. */
432 #ifndef YYTOKEN_TABLE
433 # define YYTOKEN_TABLE 0
434 #endif
435 
436 
437 /* Tokens. */
438 #ifndef YYTOKENTYPE
439 # define YYTOKENTYPE
440  /* Put the tokens into the symbol table, so that GDB and other debuggers
441  know about them. */
442  enum yytokentype {
443  TOK_COMMA = 258,
445  TOK_COND = 260,
446  TOK_OR = 261,
447  TOK_AND = 262,
448  TOK_NE = 263,
449  TOK_LE = 264,
450  TOK_GE = 265,
451  TOK_LT = 266,
452  TOK_GT = 267,
453  TOK_EQ = 268,
454  TOK_MINUS = 269,
455  TOK_PLUS = 270,
456  TOK_MOD = 271,
457  TOK_DIV = 272,
458  TOK_MULT = 273,
459  TOK_COMPL = 274,
461  TOK_EQTILDE = 276,
462  TOK_COLON = 277,
463  TOK_LP = 278,
464  TOK_RP = 279,
465  TOKEN = 280
466  };
467 #endif
468 
469 
470 
471 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
472 typedef union YYSTYPE
473 {
474 
475 /* Line 214 of yacc.c */
476 #line 345 "ast_expr2.y"
477 
478  struct val *val;
480 
481 
482 
483 /* Line 214 of yacc.c */
484 #line 487 "ast_expr2.c"
485 } YYSTYPE;
486 # define YYSTYPE_IS_TRIVIAL 1
487 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
488 # define YYSTYPE_IS_DECLARED 1
489 #endif
490 
491 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
492 typedef struct YYLTYPE
493 {
494  int first_line;
495  int first_column;
496  int last_line;
497  int last_column;
498 } YYLTYPE;
499 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
500 # define YYLTYPE_IS_DECLARED 1
501 # define YYLTYPE_IS_TRIVIAL 1
502 #endif
503 
504 
505 /* Copy the second part of user declarations. */
506 
507 /* Line 264 of yacc.c */
508 #line 350 "ast_expr2.y"
509 
510 extern int ast_yylex __P((YYSTYPE *, YYLTYPE *, yyscan_t));
511 
512 
513 /* Line 264 of yacc.c */
514 #line 517 "ast_expr2.c"
515 
516 #ifdef short
517 # undef short
518 #endif
519 
520 #ifdef YYTYPE_UINT8
521 typedef YYTYPE_UINT8 yytype_uint8;
522 #else
523 typedef unsigned char yytype_uint8;
524 #endif
525 
526 #ifdef YYTYPE_INT8
527 typedef YYTYPE_INT8 yytype_int8;
528 #elif (defined __STDC__ || defined __C99__FUNC__ \
529  || defined __cplusplus || defined _MSC_VER)
530 typedef signed char yytype_int8;
531 #else
532 typedef short int yytype_int8;
533 #endif
534 
535 #ifdef YYTYPE_UINT16
536 typedef YYTYPE_UINT16 yytype_uint16;
537 #else
538 typedef unsigned short int yytype_uint16;
539 #endif
540 
541 #ifdef YYTYPE_INT16
542 typedef YYTYPE_INT16 yytype_int16;
543 #else
544 typedef short int yytype_int16;
545 #endif
546 
547 #ifndef YYSIZE_T
548 # ifdef __SIZE_TYPE__
549 # define YYSIZE_T __SIZE_TYPE__
550 # elif defined size_t
551 # define YYSIZE_T size_t
552 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
553  || defined __cplusplus || defined _MSC_VER)
554 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
555 # define YYSIZE_T size_t
556 # else
557 # define YYSIZE_T unsigned int
558 # endif
559 #endif
560 
561 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
562 
563 #ifndef YY_
564 # if YYENABLE_NLS
565 # if ENABLE_NLS
566 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
567 # define YY_(msgid) dgettext ("bison-runtime", msgid)
568 # endif
569 # endif
570 # ifndef YY_
571 # define YY_(msgid) msgid
572 # endif
573 #endif
574 
575 /* Suppress unused-variable warnings by "using" E. */
576 #if ! defined lint || defined __GNUC__
577 # define YYUSE(e) ((void) (e))
578 #else
579 # define YYUSE(e) /* empty */
580 #endif
581 
582 /* Identity function, used to suppress warnings about constant conditions. */
583 #ifndef lint
584 # define YYID(n) (n)
585 #else
586 #if (defined __STDC__ || defined __C99__FUNC__ \
587  || defined __cplusplus || defined _MSC_VER)
588 static int
589 YYID (int yyi)
590 #else
591 static int
592 YYID (yyi)
593  int yyi;
594 #endif
595 {
596  return yyi;
597 }
598 #endif
599 
600 #if ! defined yyoverflow || YYERROR_VERBOSE
601 
602 /* The parser invokes alloca or malloc; define the necessary symbols. */
603 
604 # ifdef YYSTACK_USE_ALLOCA
605 # if YYSTACK_USE_ALLOCA
606 # ifdef __GNUC__
607 # define YYSTACK_ALLOC __builtin_alloca
608 # elif defined __BUILTIN_VA_ARG_INCR
609 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
610 # elif defined _AIX
611 # define YYSTACK_ALLOC __alloca
612 # elif defined _MSC_VER
613 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
614 # define alloca _alloca
615 # else
616 # define YYSTACK_ALLOC alloca
617 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
618  || defined __cplusplus || defined _MSC_VER)
619 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
620 # ifndef _STDLIB_H
621 # define _STDLIB_H 1
622 # endif
623 # endif
624 # endif
625 # endif
626 # endif
627 
628 # ifdef YYSTACK_ALLOC
629  /* Pacify GCC's `empty if-body' warning. */
630 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
631 # ifndef YYSTACK_ALLOC_MAXIMUM
632  /* The OS might guarantee only one guard page at the bottom of the stack,
633  and a page size can be as small as 4096 bytes. So we cannot safely
634  invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
635  to allow for a few compiler-allocated temporary stack slots. */
636 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
637 # endif
638 # else
639 # define YYSTACK_ALLOC YYMALLOC
640 # define YYSTACK_FREE YYFREE
641 # ifndef YYSTACK_ALLOC_MAXIMUM
642 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
643 # endif
644 # if (defined __cplusplus && ! defined _STDLIB_H \
645  && ! ((defined YYMALLOC || defined malloc) \
646  && (defined YYFREE || defined free)))
647 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
648 # ifndef _STDLIB_H
649 # define _STDLIB_H 1
650 # endif
651 # endif
652 # ifndef YYMALLOC
653 # define YYMALLOC malloc
654 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
655  || defined __cplusplus || defined _MSC_VER)
656 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
657 # endif
658 # endif
659 # ifndef YYFREE
660 # define YYFREE free
661 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
662  || defined __cplusplus || defined _MSC_VER)
663 void free (void *); /* INFRINGES ON USER NAME SPACE */
664 # endif
665 # endif
666 # endif
667 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
668 
669 
670 #if (! defined yyoverflow \
671  && (! defined __cplusplus \
672  || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
673  && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
674 
675 /* A type that is properly aligned for any stack member. */
676 union yyalloc
677 {
678  yytype_int16 yyss_alloc;
681 };
682 
683 /* The size of the maximum gap between one aligned stack and the next. */
684 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
685 
686 /* The size of an array large to enough to hold all stacks, each with
687  N elements. */
688 # define YYSTACK_BYTES(N) \
689  ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
690  + 2 * YYSTACK_GAP_MAXIMUM)
691 
692 /* Copy COUNT objects from FROM to TO. The source and destination do
693  not overlap. */
694 # ifndef YYCOPY
695 # if defined __GNUC__ && 1 < __GNUC__
696 # define YYCOPY(To, From, Count) \
697  __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
698 # else
699 # define YYCOPY(To, From, Count) \
700  do \
701  { \
702  YYSIZE_T yyi; \
703  for (yyi = 0; yyi < (Count); yyi++) \
704  (To)[yyi] = (From)[yyi]; \
705  } \
706  while (YYID (0))
707 # endif
708 # endif
709 
710 /* Relocate STACK from its old location to the new one. The
711  local variables YYSIZE and YYSTACKSIZE give the old and new number of
712  elements in the stack, and YYPTR gives the new location of the
713  stack. Advance YYPTR to a properly aligned location for the next
714  stack. */
715 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
716  do \
717  { \
718  YYSIZE_T yynewbytes; \
719  YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
720  Stack = &yyptr->Stack_alloc; \
721  yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
722  yyptr += yynewbytes / sizeof (*yyptr); \
723  } \
724  while (YYID (0))
725 
726 #endif
727 
728 /* YYFINAL -- State number of the termination state. */
729 #define YYFINAL 11
730 /* YYLAST -- Last index in YYTABLE. */
731 #define YYLAST 159
732 
733 /* YYNTOKENS -- Number of terminals. */
734 #define YYNTOKENS 26
735 /* YYNNTS -- Number of nonterminals. */
736 #define YYNNTS 4
737 /* YYNRULES -- Number of rules. */
738 #define YYNRULES 28
739 /* YYNRULES -- Number of states. */
740 #define YYNSTATES 54
741 
742 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
743 #define YYUNDEFTOK 2
744 #define YYMAXUTOK 280
745 
746 #define YYTRANSLATE(YYX) \
747  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
748 
749 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
750 static const yytype_uint8 yytranslate[] =
751 {
752  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
753  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
754  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
755  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
756  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
757  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
758  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
759  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
760  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
761  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
762  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
763  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
764  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
765  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
766  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
767  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
768  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
769  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
770  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
771  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
772  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
773  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
774  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
775  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
776  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
777  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
778  5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
779  15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
780  25
781 };
782 
783 #if YYDEBUG
784 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
785  YYRHS. */
786 static const yytype_uint8 yyprhs[] =
787 {
788  0, 0, 3, 5, 6, 8, 12, 15, 20, 22,
789  26, 30, 34, 38, 42, 46, 50, 54, 58, 62,
790  66, 69, 72, 76, 80, 84, 88, 92, 98
791 };
792 
793 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
794 static const yytype_int8 yyrhs[] =
795 {
796  27, 0, -1, 29, -1, -1, 29, -1, 28, 3,
797  29, -1, 28, 3, -1, 25, 23, 28, 24, -1,
798  25, -1, 23, 29, 24, -1, 29, 6, 29, -1,
799  29, 7, 29, -1, 29, 13, 29, -1, 29, 12,
800  29, -1, 29, 11, 29, -1, 29, 10, 29, -1,
801  29, 9, 29, -1, 29, 8, 29, -1, 29, 15,
802  29, -1, 29, 14, 29, -1, 14, 29, -1, 19,
803  29, -1, 29, 18, 29, -1, 29, 17, 29, -1,
804  29, 16, 29, -1, 29, 22, 29, -1, 29, 21,
805  29, -1, 29, 5, 29, 4, 29, -1, 29, 20,
806  29, -1
807 };
808 
809 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
810 static const yytype_uint16 yyrline[] =
811 {
812  0, 374, 374, 382, 389, 390, 396, 405, 411, 412,
813  416, 420, 424, 428, 432, 436, 440, 444, 448, 452,
814  456, 460, 464, 468, 472, 476, 480, 484, 489
815 };
816 #endif
817 
818 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
819 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
820  First, the terminals, then, starting at YYNTOKENS, nonterminals. */
821 static const char *const yytname[] =
822 {
823  "$end", "error", "$undefined", "TOK_COMMA", "TOK_COLONCOLON",
824  "TOK_COND", "TOK_OR", "TOK_AND", "TOK_NE", "TOK_LE", "TOK_GE", "TOK_LT",
825  "TOK_GT", "TOK_EQ", "TOK_MINUS", "TOK_PLUS", "TOK_MOD", "TOK_DIV",
826  "TOK_MULT", "TOK_COMPL", "TOK_TILDETILDE", "TOK_EQTILDE", "TOK_COLON",
827  "TOK_LP", "TOK_RP", "TOKEN", "$accept", "start", "arglist", "expr", 0
828 };
829 #endif
830 
831 # ifdef YYPRINT
832 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
833  token YYLEX-NUM. */
834 static const yytype_uint16 yytoknum[] =
835 {
836  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
837  265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
838  275, 276, 277, 278, 279, 280
839 };
840 # endif
841 
842 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
843 static const yytype_uint8 yyr1[] =
844 {
845  0, 26, 27, 27, 28, 28, 28, 29, 29, 29,
846  29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
847  29, 29, 29, 29, 29, 29, 29, 29, 29
848 };
849 
850 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
851 static const yytype_uint8 yyr2[] =
852 {
853  0, 2, 1, 0, 1, 3, 2, 4, 1, 3,
854  3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
855  2, 2, 3, 3, 3, 3, 3, 5, 3
856 };
857 
858 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
859  STATE-NUM when YYTABLE doesn't specify something else to do. Zero
860  means the default is an error. */
861 static const yytype_uint8 yydefact[] =
862 {
863  3, 0, 0, 0, 8, 0, 2, 20, 21, 0,
864  0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
865  0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
866  0, 4, 0, 10, 11, 17, 16, 15, 14, 13,
867  12, 19, 18, 24, 23, 22, 28, 26, 25, 6,
868  7, 0, 5, 27
869 };
870 
871 /* YYDEFGOTO[NTERM-NUM]. */
872 static const yytype_int8 yydefgoto[] =
873 {
874  -1, 5, 30, 6
875 };
876 
877 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
878  STATE-NUM. */
879 #define YYPACT_NINF -18
880 static const yytype_int16 yypact[] =
881 {
882  118, 118, 118, 118, -15, 6, 65, -17, -17, 25,
883  118, -18, 118, 118, 118, 118, 118, 118, 118, 118,
884  118, 118, 118, 118, 118, 118, 118, 118, 118, -18,
885  4, 65, 47, 98, 113, 130, 130, 130, 130, 130,
886  130, 137, 137, -17, -17, -17, -18, -18, -18, 118,
887  -18, 118, 65, 82
888 };
889 
890 /* YYPGOTO[NTERM-NUM]. */
891 static const yytype_int8 yypgoto[] =
892 {
893  -18, -18, -18, -1
894 };
895 
896 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
897  positive, shift that token. If negative, reduce the rule which
898  number is the opposite. If zero, do what YYDEFACT says.
899  If YYTABLE_NINF, syntax error. */
900 #define YYTABLE_NINF -1
901 static const yytype_uint8 yytable[] =
902 {
903  7, 8, 9, 26, 27, 28, 11, 49, 10, 31,
904  0, 32, 33, 34, 35, 36, 37, 38, 39, 40,
905  41, 42, 43, 44, 45, 46, 47, 48, 50, 0,
906  12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
907  22, 23, 24, 25, 0, 26, 27, 28, 52, 29,
908  53, 51, 12, 13, 14, 15, 16, 17, 18, 19,
909  20, 21, 22, 23, 24, 25, 0, 26, 27, 28,
910  12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
911  22, 23, 24, 25, 0, 26, 27, 28, 13, 14,
912  15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
913  25, 0, 26, 27, 28, 14, 15, 16, 17, 18,
914  19, 20, 21, 22, 23, 24, 25, 0, 26, 27,
915  28, 15, 16, 17, 18, 19, 20, 21, 22, 23,
916  24, 25, 1, 26, 27, 28, 0, 2, 0, 0,
917  0, 3, 0, 4, 21, 22, 23, 24, 25, 0,
918  26, 27, 28, 23, 24, 25, 0, 26, 27, 28
919 };
920 
921 static const yytype_int8 yycheck[] =
922 {
923  1, 2, 3, 20, 21, 22, 0, 3, 23, 10,
924  -1, 12, 13, 14, 15, 16, 17, 18, 19, 20,
925  21, 22, 23, 24, 25, 26, 27, 28, 24, -1,
926  5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
927  15, 16, 17, 18, -1, 20, 21, 22, 49, 24,
928  51, 4, 5, 6, 7, 8, 9, 10, 11, 12,
929  13, 14, 15, 16, 17, 18, -1, 20, 21, 22,
930  5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
931  15, 16, 17, 18, -1, 20, 21, 22, 6, 7,
932  8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
933  18, -1, 20, 21, 22, 7, 8, 9, 10, 11,
934  12, 13, 14, 15, 16, 17, 18, -1, 20, 21,
935  22, 8, 9, 10, 11, 12, 13, 14, 15, 16,
936  17, 18, 14, 20, 21, 22, -1, 19, -1, -1,
937  -1, 23, -1, 25, 14, 15, 16, 17, 18, -1,
938  20, 21, 22, 16, 17, 18, -1, 20, 21, 22
939 };
940 
941 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
942  symbol of state STATE-NUM. */
943 static const yytype_uint8 yystos[] =
944 {
945  0, 14, 19, 23, 25, 27, 29, 29, 29, 29,
946  23, 0, 5, 6, 7, 8, 9, 10, 11, 12,
947  13, 14, 15, 16, 17, 18, 20, 21, 22, 24,
948  28, 29, 29, 29, 29, 29, 29, 29, 29, 29,
949  29, 29, 29, 29, 29, 29, 29, 29, 29, 3,
950  24, 4, 29, 29
951 };
952 
953 #define yyerrok (yyerrstatus = 0)
954 #define yyclearin (yychar = YYEMPTY)
955 #define YYEMPTY (-2)
956 #define YYEOF 0
957 
958 #define YYACCEPT goto yyacceptlab
959 #define YYABORT goto yyabortlab
960 #define YYERROR goto yyerrorlab
961 
962 
963 /* Like YYERROR except do call yyerror. This remains here temporarily
964  to ease the transition to the new meaning of YYERROR, for GCC.
965  Once GCC version 2 has supplanted version 1, this can go. */
966 
967 #define YYFAIL goto yyerrlab
968 
969 #define YYRECOVERING() (!!yyerrstatus)
970 
971 #define YYBACKUP(Token, Value) \
972 do \
973  if (yychar == YYEMPTY && yylen == 1) \
974  { \
975  yychar = (Token); \
976  yylval = (Value); \
977  yytoken = YYTRANSLATE (yychar); \
978  YYPOPSTACK (1); \
979  goto yybackup; \
980  } \
981  else \
982  { \
983  yyerror (YY_("syntax error: cannot back up")); \
984  YYERROR; \
985  } \
986 while (YYID (0))
987 
988 
989 #define YYTERROR 1
990 #define YYERRCODE 256
991 
992 
993 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
994  If N is 0, then set CURRENT to the empty location which ends
995  the previous symbol: RHS[0] (always defined). */
996 
997 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
998 #ifndef YYLLOC_DEFAULT
999 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1000  do \
1001  if (YYID (N)) \
1002  { \
1003  (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1004  (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1005  (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1006  (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1007  } \
1008  else \
1009  { \
1010  (Current).first_line = (Current).last_line = \
1011  YYRHSLOC (Rhs, 0).last_line; \
1012  (Current).first_column = (Current).last_column = \
1013  YYRHSLOC (Rhs, 0).last_column; \
1014  } \
1015  while (YYID (0))
1016 #endif
1017 
1018 
1019 /* YY_LOCATION_PRINT -- Print the location on the stream.
1020  This macro was not mandated originally: define only if we know
1021  we won't break user code: when these are the locations we know. */
1022 
1023 #ifndef YY_LOCATION_PRINT
1024 # if YYLTYPE_IS_TRIVIAL
1025 # define YY_LOCATION_PRINT(File, Loc) \
1026  fprintf (File, "%d.%d-%d.%d", \
1027  (Loc).first_line, (Loc).first_column, \
1028  (Loc).last_line, (Loc).last_column)
1029 # else
1030 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1031 # endif
1032 #endif
1033 
1034 
1035 /* YYLEX -- calling `yylex' with the right arguments. */
1036 
1037 #ifdef YYLEX_PARAM
1038 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
1039 #else
1040 # define YYLEX yylex (&yylval, &yylloc)
1041 #endif
1042 
1043 /* Enable debugging if requested. */
1044 #if YYDEBUG
1045 
1046 # ifndef YYFPRINTF
1047 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1048 # define YYFPRINTF fprintf
1049 # endif
1050 
1051 # define YYDPRINTF(Args) \
1052 do { \
1053  if (yydebug) \
1054  YYFPRINTF Args; \
1055 } while (YYID (0))
1056 
1057 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1058 do { \
1059  if (yydebug) \
1060  { \
1061  YYFPRINTF (stderr, "%s ", Title); \
1062  yy_symbol_print (stderr, \
1063  Type, Value, Location); \
1064  YYFPRINTF (stderr, "\n"); \
1065  } \
1066 } while (YYID (0))
1067 
1068 
1069 /*--------------------------------.
1070 | Print this symbol on YYOUTPUT. |
1071 `--------------------------------*/
1072 
1073 /*ARGSUSED*/
1074 #if (defined __STDC__ || defined __C99__FUNC__ \
1075  || defined __cplusplus || defined _MSC_VER)
1076 static void
1077 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
1078 #else
1079 static void
1080 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
1081  FILE *yyoutput;
1082  int yytype;
1083  YYSTYPE const * const yyvaluep;
1084  YYLTYPE const * const yylocationp;
1085 #endif
1086 {
1087  if (!yyvaluep)
1088  return;
1089  YYUSE (yylocationp);
1090 # ifdef YYPRINT
1091  if (yytype < YYNTOKENS)
1092  YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1093 # else
1094  YYUSE (yyoutput);
1095 # endif
1096  switch (yytype)
1097  {
1098  default:
1099  break;
1100  }
1101 }
1102 
1103 
1104 /*--------------------------------.
1105 | Print this symbol on YYOUTPUT. |
1106 `--------------------------------*/
1107 
1108 #if (defined __STDC__ || defined __C99__FUNC__ \
1109  || defined __cplusplus || defined _MSC_VER)
1110 static void
1111 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
1112 #else
1113 static void
1114 yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
1115  FILE *yyoutput;
1116  int yytype;
1117  YYSTYPE const * const yyvaluep;
1118  YYLTYPE const * const yylocationp;
1119 #endif
1120 {
1121  if (yytype < YYNTOKENS)
1122  YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1123  else
1124  YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1125 
1126  YY_LOCATION_PRINT (yyoutput, *yylocationp);
1127  YYFPRINTF (yyoutput, ": ");
1128  yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
1129  YYFPRINTF (yyoutput, ")");
1130 }
1131 
1132 /*------------------------------------------------------------------.
1133 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1134 | TOP (included). |
1135 `------------------------------------------------------------------*/
1136 
1137 #if (defined __STDC__ || defined __C99__FUNC__ \
1138  || defined __cplusplus || defined _MSC_VER)
1139 static void
1140 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1141 #else
1142 static void
1143 yy_stack_print (yybottom, yytop)
1144  yytype_int16 *yybottom;
1145  yytype_int16 *yytop;
1146 #endif
1147 {
1148  YYFPRINTF (stderr, "Stack now");
1149  for (; yybottom <= yytop; yybottom++)
1150  {
1151  int yybot = *yybottom;
1152  YYFPRINTF (stderr, " %d", yybot);
1153  }
1154  YYFPRINTF (stderr, "\n");
1155 }
1156 
1157 # define YY_STACK_PRINT(Bottom, Top) \
1158 do { \
1159  if (yydebug) \
1160  yy_stack_print ((Bottom), (Top)); \
1161 } while (YYID (0))
1162 
1163 
1164 /*------------------------------------------------.
1165 | Report that the YYRULE is going to be reduced. |
1166 `------------------------------------------------*/
1167 
1168 #if (defined __STDC__ || defined __C99__FUNC__ \
1169  || defined __cplusplus || defined _MSC_VER)
1170 static void
1171 yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
1172 #else
1173 static void
1174 yy_reduce_print (yyvsp, yylsp, yyrule)
1175  YYSTYPE *yyvsp;
1176  YYLTYPE *yylsp;
1177  int yyrule;
1178 #endif
1179 {
1180  int yynrhs = yyr2[yyrule];
1181  int yyi;
1182  unsigned long int yylno = yyrline[yyrule];
1183  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1184  yyrule - 1, yylno);
1185  /* The symbols being reduced. */
1186  for (yyi = 0; yyi < yynrhs; yyi++)
1187  {
1188  YYFPRINTF (stderr, " $%d = ", yyi + 1);
1189  yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1190  &(yyvsp[(yyi + 1) - (yynrhs)])
1191  , &(yylsp[(yyi + 1) - (yynrhs)]) );
1192  YYFPRINTF (stderr, "\n");
1193  }
1194 }
1195 
1196 # define YY_REDUCE_PRINT(Rule) \
1197 do { \
1198  if (yydebug) \
1199  yy_reduce_print (yyvsp, yylsp, Rule); \
1200 } while (YYID (0))
1201 
1202 /* Nonzero means print parse trace. It is left uninitialized so that
1203  multiple parsers can coexist. */
1204 int yydebug;
1205 #else /* !YYDEBUG */
1206 # define YYDPRINTF(Args)
1207 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1208 # define YY_STACK_PRINT(Bottom, Top)
1209 # define YY_REDUCE_PRINT(Rule)
1210 #endif /* !YYDEBUG */
1211 
1212 
1213 /* YYINITDEPTH -- initial size of the parser's stacks. */
1214 #ifndef YYINITDEPTH
1215 # define YYINITDEPTH 200
1216 #endif
1217 
1218 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1219  if the built-in stack extension method is used).
1220 
1221  Do not make this value too large; the results are undefined if
1222  YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1223  evaluated with infinite-precision integer arithmetic. */
1224 
1225 #ifndef YYMAXDEPTH
1226 # define YYMAXDEPTH 10000
1227 #endif
1228 
1229 
1230 
1231 #if YYERROR_VERBOSE
1232 
1233 # ifndef yystrlen
1234 # if defined __GLIBC__ && defined _STRING_H
1235 # define yystrlen strlen
1236 # else
1237 /* Return the length of YYSTR. */
1238 #if (defined __STDC__ || defined __C99__FUNC__ \
1239  || defined __cplusplus || defined _MSC_VER)
1240 static YYSIZE_T
1241 yystrlen (const char *yystr)
1242 #else
1243 static YYSIZE_T
1244 yystrlen (yystr)
1245  const char *yystr;
1246 #endif
1247 {
1248  YYSIZE_T yylen;
1249  for (yylen = 0; yystr[yylen]; yylen++)
1250  continue;
1251  return yylen;
1252 }
1253 # endif
1254 # endif
1255 
1256 # ifndef yystpcpy
1257 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1258 # define yystpcpy stpcpy
1259 # else
1260 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1261  YYDEST. */
1262 #if (defined __STDC__ || defined __C99__FUNC__ \
1263  || defined __cplusplus || defined _MSC_VER)
1264 static char *
1265 yystpcpy (char *yydest, const char *yysrc)
1266 #else
1267 static char *
1268 yystpcpy (yydest, yysrc)
1269  char *yydest;
1270  const char *yysrc;
1271 #endif
1272 {
1273  char *yyd = yydest;
1274  const char *yys = yysrc;
1275 
1276  while ((*yyd++ = *yys++) != '\0')
1277  continue;
1278 
1279  return yyd - 1;
1280 }
1281 # endif
1282 # endif
1283 
1284 # ifndef yytnamerr
1285 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1286  quotes and backslashes, so that it's suitable for yyerror. The
1287  heuristic is that double-quoting is unnecessary unless the string
1288  contains an apostrophe, a comma, or backslash (other than
1289  backslash-backslash). YYSTR is taken from yytname. If YYRES is
1290  null, do not copy; instead, return the length of what the result
1291  would have been. */
1292 static YYSIZE_T
1293 yytnamerr (char *yyres, const char *yystr)
1294 {
1295  if (*yystr == '"')
1296  {
1297  YYSIZE_T yyn = 0;
1298  char const *yyp = yystr;
1299 
1300  for (;;)
1301  switch (*++yyp)
1302  {
1303  case '\'':
1304  case ',':
1305  goto do_not_strip_quotes;
1306 
1307  case '\\':
1308  if (*++yyp != '\\')
1309  goto do_not_strip_quotes;
1310  /* Fall through. */
1311  default:
1312  if (yyres)
1313  yyres[yyn] = *yyp;
1314  yyn++;
1315  break;
1316 
1317  case '"':
1318  if (yyres)
1319  yyres[yyn] = '\0';
1320  return yyn;
1321  }
1322  do_not_strip_quotes: ;
1323  }
1324 
1325  if (! yyres)
1326  return yystrlen (yystr);
1327 
1328  return yystpcpy (yyres, yystr) - yyres;
1329 }
1330 # endif
1331 
1332 /* Copy into YYRESULT an error message about the unexpected token
1333  YYCHAR while in state YYSTATE. Return the number of bytes copied,
1334  including the terminating null byte. If YYRESULT is null, do not
1335  copy anything; just return the number of bytes that would be
1336  copied. As a special case, return 0 if an ordinary "syntax error"
1337  message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1338  size calculation. */
1339 static YYSIZE_T
1340 yysyntax_error (char *yyresult, int yystate, int yychar)
1341 {
1342  int yyn = yypact[yystate];
1343 
1344  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1345  return 0;
1346  else
1347  {
1348  int yytype = YYTRANSLATE (yychar);
1349  YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1350  YYSIZE_T yysize = yysize0;
1351  YYSIZE_T yysize1;
1352  int yysize_overflow = 0;
1353  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1354  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1355  int yyx;
1356 
1357 # if 0
1358  /* This is so xgettext sees the translatable formats that are
1359  constructed on the fly. */
1360  YY_("syntax error, unexpected %s");
1361  YY_("syntax error, unexpected %s, expecting %s");
1362  YY_("syntax error, unexpected %s, expecting %s or %s");
1363  YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1364  YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1365 # endif
1366  char *yyfmt;
1367  char const *yyf;
1368  static char const yyunexpected[] = "syntax error, unexpected %s";
1369  static char const yyexpecting[] = ", expecting %s";
1370  static char const yyor[] = " or %s";
1371  char yyformat[sizeof yyunexpected
1372  + sizeof yyexpecting - 1
1373  + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1374  * (sizeof yyor - 1))];
1375  char const *yyprefix = yyexpecting;
1376 
1377  /* Start YYX at -YYN if negative to avoid negative indexes in
1378  YYCHECK. */
1379  int yyxbegin = yyn < 0 ? -yyn : 0;
1380 
1381  /* Stay within bounds of both yycheck and yytname. */
1382  int yychecklim = YYLAST - yyn + 1;
1383  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1384  int yycount = 1;
1385 
1386  yyarg[0] = yytname[yytype];
1387  yyfmt = yystpcpy (yyformat, yyunexpected);
1388 
1389  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1390  if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1391  {
1392  if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1393  {
1394  yycount = 1;
1395  yysize = yysize0;
1396  yyformat[sizeof yyunexpected - 1] = '\0';
1397  break;
1398  }
1399  yyarg[yycount++] = yytname[yyx];
1400  yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1401  yysize_overflow |= (yysize1 < yysize);
1402  yysize = yysize1;
1403  yyfmt = yystpcpy (yyfmt, yyprefix);
1404  yyprefix = yyor;
1405  }
1406 
1407  yyf = YY_(yyformat);
1408  yysize1 = yysize + yystrlen (yyf);
1409  yysize_overflow |= (yysize1 < yysize);
1410  yysize = yysize1;
1411 
1412  if (yysize_overflow)
1413  return YYSIZE_MAXIMUM;
1414 
1415  if (yyresult)
1416  {
1417  /* Avoid sprintf, as that infringes on the user's name space.
1418  Don't have undefined behavior even if the translation
1419  produced a string with the wrong number of "%s"s. */
1420  char *yyp = yyresult;
1421  int yyi = 0;
1422  while ((*yyp = *yyf) != '\0')
1423  {
1424  if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1425  {
1426  yyp += yytnamerr (yyp, yyarg[yyi++]);
1427  yyf += 2;
1428  }
1429  else
1430  {
1431  yyp++;
1432  yyf++;
1433  }
1434  }
1435  }
1436  return yysize;
1437  }
1438 }
1439 #endif /* YYERROR_VERBOSE */
1440 
1441 
1442 /*-----------------------------------------------.
1443 | Release the memory associated to this symbol. |
1444 `-----------------------------------------------*/
1445 
1446 /*ARGSUSED*/
1447 #if (defined __STDC__ || defined __C99__FUNC__ \
1448  || defined __cplusplus || defined _MSC_VER)
1449 static void
1450 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
1451 #else
1452 static void
1453 yydestruct (yymsg, yytype, yyvaluep, yylocationp)
1454  const char *yymsg;
1455  int yytype;
1456  YYSTYPE *yyvaluep;
1457  YYLTYPE *yylocationp;
1458 #endif
1459 {
1460  YYUSE (yyvaluep);
1461  YYUSE (yylocationp);
1462 
1463  if (!yymsg)
1464  yymsg = "Deleting";
1465  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1466 
1467  switch (yytype)
1468  {
1469  case 4: /* "TOK_COLONCOLON" */
1470 
1471 /* Line 1000 of yacc.c */
1472 #line 368 "ast_expr2.y"
1473  { free_value((yyvaluep->val)); };
1474 
1475 /* Line 1000 of yacc.c */
1476 #line 1479 "ast_expr2.c"
1477  break;
1478  case 5: /* "TOK_COND" */
1479 
1480 /* Line 1000 of yacc.c */
1481 #line 368 "ast_expr2.y"
1482  { free_value((yyvaluep->val)); };
1483 
1484 /* Line 1000 of yacc.c */
1485 #line 1488 "ast_expr2.c"
1486  break;
1487  case 6: /* "TOK_OR" */
1488 
1489 /* Line 1000 of yacc.c */
1490 #line 368 "ast_expr2.y"
1491  { free_value((yyvaluep->val)); };
1492 
1493 /* Line 1000 of yacc.c */
1494 #line 1497 "ast_expr2.c"
1495  break;
1496  case 7: /* "TOK_AND" */
1497 
1498 /* Line 1000 of yacc.c */
1499 #line 368 "ast_expr2.y"
1500  { free_value((yyvaluep->val)); };
1501 
1502 /* Line 1000 of yacc.c */
1503 #line 1506 "ast_expr2.c"
1504  break;
1505  case 8: /* "TOK_NE" */
1506 
1507 /* Line 1000 of yacc.c */
1508 #line 368 "ast_expr2.y"
1509  { free_value((yyvaluep->val)); };
1510 
1511 /* Line 1000 of yacc.c */
1512 #line 1515 "ast_expr2.c"
1513  break;
1514  case 9: /* "TOK_LE" */
1515 
1516 /* Line 1000 of yacc.c */
1517 #line 368 "ast_expr2.y"
1518  { free_value((yyvaluep->val)); };
1519 
1520 /* Line 1000 of yacc.c */
1521 #line 1524 "ast_expr2.c"
1522  break;
1523  case 10: /* "TOK_GE" */
1524 
1525 /* Line 1000 of yacc.c */
1526 #line 368 "ast_expr2.y"
1527  { free_value((yyvaluep->val)); };
1528 
1529 /* Line 1000 of yacc.c */
1530 #line 1533 "ast_expr2.c"
1531  break;
1532  case 11: /* "TOK_LT" */
1533 
1534 /* Line 1000 of yacc.c */
1535 #line 368 "ast_expr2.y"
1536  { free_value((yyvaluep->val)); };
1537 
1538 /* Line 1000 of yacc.c */
1539 #line 1542 "ast_expr2.c"
1540  break;
1541  case 12: /* "TOK_GT" */
1542 
1543 /* Line 1000 of yacc.c */
1544 #line 368 "ast_expr2.y"
1545  { free_value((yyvaluep->val)); };
1546 
1547 /* Line 1000 of yacc.c */
1548 #line 1551 "ast_expr2.c"
1549  break;
1550  case 13: /* "TOK_EQ" */
1551 
1552 /* Line 1000 of yacc.c */
1553 #line 368 "ast_expr2.y"
1554  { free_value((yyvaluep->val)); };
1555 
1556 /* Line 1000 of yacc.c */
1557 #line 1560 "ast_expr2.c"
1558  break;
1559  case 14: /* "TOK_MINUS" */
1560 
1561 /* Line 1000 of yacc.c */
1562 #line 368 "ast_expr2.y"
1563  { free_value((yyvaluep->val)); };
1564 
1565 /* Line 1000 of yacc.c */
1566 #line 1569 "ast_expr2.c"
1567  break;
1568  case 15: /* "TOK_PLUS" */
1569 
1570 /* Line 1000 of yacc.c */
1571 #line 368 "ast_expr2.y"
1572  { free_value((yyvaluep->val)); };
1573 
1574 /* Line 1000 of yacc.c */
1575 #line 1578 "ast_expr2.c"
1576  break;
1577  case 16: /* "TOK_MOD" */
1578 
1579 /* Line 1000 of yacc.c */
1580 #line 368 "ast_expr2.y"
1581  { free_value((yyvaluep->val)); };
1582 
1583 /* Line 1000 of yacc.c */
1584 #line 1587 "ast_expr2.c"
1585  break;
1586  case 17: /* "TOK_DIV" */
1587 
1588 /* Line 1000 of yacc.c */
1589 #line 368 "ast_expr2.y"
1590  { free_value((yyvaluep->val)); };
1591 
1592 /* Line 1000 of yacc.c */
1593 #line 1596 "ast_expr2.c"
1594  break;
1595  case 18: /* "TOK_MULT" */
1596 
1597 /* Line 1000 of yacc.c */
1598 #line 368 "ast_expr2.y"
1599  { free_value((yyvaluep->val)); };
1600 
1601 /* Line 1000 of yacc.c */
1602 #line 1605 "ast_expr2.c"
1603  break;
1604  case 19: /* "TOK_COMPL" */
1605 
1606 /* Line 1000 of yacc.c */
1607 #line 368 "ast_expr2.y"
1608  { free_value((yyvaluep->val)); };
1609 
1610 /* Line 1000 of yacc.c */
1611 #line 1614 "ast_expr2.c"
1612  break;
1613  case 20: /* "TOK_TILDETILDE" */
1614 
1615 /* Line 1000 of yacc.c */
1616 #line 368 "ast_expr2.y"
1617  { free_value((yyvaluep->val)); };
1618 
1619 /* Line 1000 of yacc.c */
1620 #line 1623 "ast_expr2.c"
1621  break;
1622  case 21: /* "TOK_EQTILDE" */
1623 
1624 /* Line 1000 of yacc.c */
1625 #line 368 "ast_expr2.y"
1626  { free_value((yyvaluep->val)); };
1627 
1628 /* Line 1000 of yacc.c */
1629 #line 1632 "ast_expr2.c"
1630  break;
1631  case 22: /* "TOK_COLON" */
1632 
1633 /* Line 1000 of yacc.c */
1634 #line 368 "ast_expr2.y"
1635  { free_value((yyvaluep->val)); };
1636 
1637 /* Line 1000 of yacc.c */
1638 #line 1641 "ast_expr2.c"
1639  break;
1640  case 23: /* "TOK_LP" */
1641 
1642 /* Line 1000 of yacc.c */
1643 #line 368 "ast_expr2.y"
1644  { free_value((yyvaluep->val)); };
1645 
1646 /* Line 1000 of yacc.c */
1647 #line 1650 "ast_expr2.c"
1648  break;
1649  case 24: /* "TOK_RP" */
1650 
1651 /* Line 1000 of yacc.c */
1652 #line 368 "ast_expr2.y"
1653  { free_value((yyvaluep->val)); };
1654 
1655 /* Line 1000 of yacc.c */
1656 #line 1659 "ast_expr2.c"
1657  break;
1658  case 25: /* "TOKEN" */
1659 
1660 /* Line 1000 of yacc.c */
1661 #line 368 "ast_expr2.y"
1662  { free_value((yyvaluep->val)); };
1663 
1664 /* Line 1000 of yacc.c */
1665 #line 1668 "ast_expr2.c"
1666  break;
1667  case 29: /* "expr" */
1668 
1669 /* Line 1000 of yacc.c */
1670 #line 368 "ast_expr2.y"
1671  { free_value((yyvaluep->val)); };
1672 
1673 /* Line 1000 of yacc.c */
1674 #line 1677 "ast_expr2.c"
1675  break;
1676 
1677  default:
1678  break;
1679  }
1680 }
1681 
1682 /* Prevent warnings from -Wmissing-prototypes. */
1683 #ifdef YYPARSE_PARAM
1684 #if defined __STDC__ || defined __cplusplus
1685 int yyparse (void *YYPARSE_PARAM);
1686 #else
1687 int yyparse ();
1688 #endif
1689 #else /* ! YYPARSE_PARAM */
1690 #if defined __STDC__ || defined __cplusplus
1691 int yyparse (void);
1692 #else
1693 int yyparse ();
1694 #endif
1695 #endif /* ! YYPARSE_PARAM */
1696 
1697 
1698 
1699 
1700 
1701 /*-------------------------.
1702 | yyparse or yypush_parse. |
1703 `-------------------------*/
1704 
1705 #ifdef YYPARSE_PARAM
1706 #if (defined __STDC__ || defined __C99__FUNC__ \
1707  || defined __cplusplus || defined _MSC_VER)
1708 int
1709 yyparse (void *YYPARSE_PARAM)
1710 #else
1711 int
1712 yyparse (YYPARSE_PARAM)
1713  void *YYPARSE_PARAM;
1714 #endif
1715 #else /* ! YYPARSE_PARAM */
1716 #if (defined __STDC__ || defined __C99__FUNC__ \
1717  || defined __cplusplus || defined _MSC_VER)
1718 int
1719 yyparse (void)
1720 #else
1721 int
1722 yyparse ()
1723 
1724 #endif
1725 #endif
1726 {
1727 /* The lookahead symbol. */
1728 int yychar;
1729 
1730 /* The semantic value of the lookahead symbol. */
1731 YYSTYPE yylval;
1732 
1733 /* Location data for the lookahead symbol. */
1734 YYLTYPE yylloc;
1735 
1736  /* Number of syntax errors so far. */
1737  int yynerrs;
1738 
1739  int yystate;
1740  /* Number of tokens to shift before error messages enabled. */
1741  int yyerrstatus;
1742 
1743  /* The stacks and their tools:
1744  `yyss': related to states.
1745  `yyvs': related to semantic values.
1746  `yyls': related to locations.
1747 
1748  Refer to the stacks thru separate pointers, to allow yyoverflow
1749  to reallocate them elsewhere. */
1750 
1751  /* The state stack. */
1752  yytype_int16 yyssa[YYINITDEPTH];
1753  yytype_int16 *yyss;
1754  yytype_int16 *yyssp;
1755 
1756  /* The semantic value stack. */
1757  YYSTYPE yyvsa[YYINITDEPTH];
1758  YYSTYPE *yyvs;
1759  YYSTYPE *yyvsp;
1760 
1761  /* The location stack. */
1762  YYLTYPE yylsa[YYINITDEPTH];
1763  YYLTYPE *yyls;
1764  YYLTYPE *yylsp;
1765 
1766  /* The locations where the error started and ended. */
1767  YYLTYPE yyerror_range[2];
1768 
1769  YYSIZE_T yystacksize;
1770 
1771  int yyn;
1772  int yyresult;
1773  /* Lookahead token as an internal (translated) token number. */
1774  int yytoken;
1775  /* The variables used to return semantic value and location from the
1776  action routines. */
1777  YYSTYPE yyval;
1778  YYLTYPE yyloc;
1779 
1780 #if YYERROR_VERBOSE
1781  /* Buffer for error messages, and its allocated size. */
1782  char yymsgbuf[128];
1783  char *yymsg = yymsgbuf;
1784  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1785 #endif
1786 
1787 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1788 
1789  /* The number of symbols on the RHS of the reduced rule.
1790  Keep to zero when no symbol should be popped. */
1791  int yylen = 0;
1792 
1793  yytoken = 0;
1794  yyss = yyssa;
1795  yyvs = yyvsa;
1796  yyls = yylsa;
1797  yystacksize = YYINITDEPTH;
1798 
1799  YYDPRINTF ((stderr, "Starting parse\n"));
1800 
1801  yystate = 0;
1802  yyerrstatus = 0;
1803  yynerrs = 0;
1804  yychar = YYEMPTY; /* Cause a token to be read. */
1805 
1806  /* Initialize stack pointers.
1807  Waste one element of value and location stack
1808  so that they stay on the same level as the state stack.
1809  The wasted elements are never initialized. */
1810  yyssp = yyss;
1811  yyvsp = yyvs;
1812  yylsp = yyls;
1813 
1814 #if YYLTYPE_IS_TRIVIAL
1815  /* Initialize the default location before parsing starts. */
1816  yylloc.first_line = yylloc.last_line = 1;
1817  yylloc.first_column = yylloc.last_column = 1;
1818 #endif
1819 
1820  goto yysetstate;
1821 
1822 /*------------------------------------------------------------.
1823 | yynewstate -- Push a new state, which is found in yystate. |
1824 `------------------------------------------------------------*/
1825  yynewstate:
1826  /* In all cases, when you get here, the value and location stacks
1827  have just been pushed. So pushing a state here evens the stacks. */
1828  yyssp++;
1829 
1830  yysetstate:
1831  *yyssp = yystate;
1832 
1833  if (yyss + yystacksize - 1 <= yyssp)
1834  {
1835  /* Get the current used size of the three stacks, in elements. */
1836  YYSIZE_T yysize = yyssp - yyss + 1;
1837 
1838 #ifdef yyoverflow
1839  {
1840  /* Give user a chance to reallocate the stack. Use copies of
1841  these so that the &'s don't force the real ones into
1842  memory. */
1843  YYSTYPE *yyvs1 = yyvs;
1844  yytype_int16 *yyss1 = yyss;
1845  YYLTYPE *yyls1 = yyls;
1846 
1847  /* Each stack pointer address is followed by the size of the
1848  data in use in that stack, in bytes. This used to be a
1849  conditional around just the two extra args, but that might
1850  be undefined if yyoverflow is a macro. */
1851  yyoverflow (YY_("memory exhausted"),
1852  &yyss1, yysize * sizeof (*yyssp),
1853  &yyvs1, yysize * sizeof (*yyvsp),
1854  &yyls1, yysize * sizeof (*yylsp),
1855  &yystacksize);
1856 
1857  yyls = yyls1;
1858  yyss = yyss1;
1859  yyvs = yyvs1;
1860  }
1861 #else /* no yyoverflow */
1862 # ifndef YYSTACK_RELOCATE
1863  goto yyexhaustedlab;
1864 # else
1865  /* Extend the stack our own way. */
1866  if (YYMAXDEPTH <= yystacksize)
1867  goto yyexhaustedlab;
1868  yystacksize *= 2;
1869  if (YYMAXDEPTH < yystacksize)
1870  yystacksize = YYMAXDEPTH;
1871 
1872  {
1873  yytype_int16 *yyss1 = yyss;
1874  union yyalloc *yyptr =
1875  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1876  if (! yyptr)
1877  goto yyexhaustedlab;
1878  YYSTACK_RELOCATE (yyss_alloc, yyss);
1879  YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1880  YYSTACK_RELOCATE (yyls_alloc, yyls);
1881 # undef YYSTACK_RELOCATE
1882  if (yyss1 != yyssa)
1883  YYSTACK_FREE (yyss1);
1884  }
1885 # endif
1886 #endif /* no yyoverflow */
1887 
1888  yyssp = yyss + yysize - 1;
1889  yyvsp = yyvs + yysize - 1;
1890  yylsp = yyls + yysize - 1;
1891 
1892  YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1893  (unsigned long int) yystacksize));
1894 
1895  if (yyss + yystacksize - 1 <= yyssp)
1896  YYABORT;
1897  }
1898 
1899  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1900 
1901  if (yystate == YYFINAL)
1902  YYACCEPT;
1903 
1904  goto yybackup;
1905 
1906 /*-----------.
1907 | yybackup. |
1908 `-----------*/
1909 yybackup:
1910 
1911  /* Do appropriate processing given the current state. Read a
1912  lookahead token if we need one and don't already have one. */
1913 
1914  /* First try to decide what to do without reference to lookahead token. */
1915  yyn = yypact[yystate];
1916  if (yyn == YYPACT_NINF)
1917  goto yydefault;
1918 
1919  /* Not known => get a lookahead token if don't already have one. */
1920 
1921  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1922  if (yychar == YYEMPTY)
1923  {
1924  YYDPRINTF ((stderr, "Reading a token: "));
1925  yychar = YYLEX;
1926  }
1927 
1928  if (yychar <= YYEOF)
1929  {
1930  yychar = yytoken = YYEOF;
1931  YYDPRINTF ((stderr, "Now at end of input.\n"));
1932  }
1933  else
1934  {
1935  yytoken = YYTRANSLATE (yychar);
1936  YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1937  }
1938 
1939  /* If the proper action on seeing token YYTOKEN is to reduce or to
1940  detect an error, take that action. */
1941  yyn += yytoken;
1942  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1943  goto yydefault;
1944  yyn = yytable[yyn];
1945  if (yyn <= 0)
1946  {
1947  if (yyn == 0 || yyn == YYTABLE_NINF)
1948  goto yyerrlab;
1949  yyn = -yyn;
1950  goto yyreduce;
1951  }
1952 
1953  /* Count tokens shifted since error; after three, turn off error
1954  status. */
1955  if (yyerrstatus)
1956  yyerrstatus--;
1957 
1958  /* Shift the lookahead token. */
1959  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1960 
1961  /* Discard the shifted token. */
1962  yychar = YYEMPTY;
1963 
1964  yystate = yyn;
1965  *++yyvsp = yylval;
1966  *++yylsp = yylloc;
1967  goto yynewstate;
1968 
1969 
1970 /*-----------------------------------------------------------.
1971 | yydefault -- do the default action for the current state. |
1972 `-----------------------------------------------------------*/
1973 yydefault:
1974  yyn = yydefact[yystate];
1975  if (yyn == 0)
1976  goto yyerrlab;
1977  goto yyreduce;
1978 
1979 
1980 /*-----------------------------.
1981 | yyreduce -- Do a reduction. |
1982 `-----------------------------*/
1983 yyreduce:
1984  /* yyn is the number of a rule to reduce with. */
1985  yylen = yyr2[yyn];
1986 
1987  /* If YYLEN is nonzero, implement the default value of the action:
1988  `$$ = $1'.
1989 
1990  Otherwise, the following line sets YYVAL to garbage.
1991  This behavior is undocumented and Bison
1992  users should not rely upon it. Assigning to YYVAL
1993  unconditionally makes the parser a bit smaller, and it avoids a
1994  GCC warning that YYVAL may be used uninitialized. */
1995  yyval = yyvsp[1-yylen];
1996 
1997  /* Default location. */
1998  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1999  YY_REDUCE_PRINT (yyn);
2000  switch (yyn)
2001  {
2002  case 2:
2003 
2004 /* Line 1455 of yacc.c */
2005 #line 374 "ast_expr2.y"
2006  { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
2007  ((struct parse_io *)parseio)->val->type = (yyvsp[(1) - (1)].val)->type;
2008  if( (yyvsp[(1) - (1)].val)->type == AST_EXPR_number )
2009  ((struct parse_io *)parseio)->val->u.i = (yyvsp[(1) - (1)].val)->u.i;
2010  else
2011  ((struct parse_io *)parseio)->val->u.s = (yyvsp[(1) - (1)].val)->u.s;
2012  free((yyvsp[(1) - (1)].val));
2013  ;}
2014  break;
2015 
2016  case 3:
2017 
2018 /* Line 1455 of yacc.c */
2019 #line 382 "ast_expr2.y"
2020  {/* nothing */ ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
2021  ((struct parse_io *)parseio)->val->type = AST_EXPR_string;
2022  ((struct parse_io *)parseio)->val->u.s = strdup("");
2023  ;}
2024  break;
2025 
2026  case 4:
2027 
2028 /* Line 1455 of yacc.c */
2029 #line 389 "ast_expr2.y"
2030  { (yyval.arglist) = alloc_expr_node(AST_EXPR_NODE_VAL); (yyval.arglist)->val = (yyvsp[(1) - (1)].val);;}
2031  break;
2032 
2033  case 5:
2034 
2035 /* Line 1455 of yacc.c */
2036 #line 390 "ast_expr2.y"
2037  {struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL);
2038  struct expr_node *t;
2039  DESTROY((yyvsp[(2) - (3)].val));
2040  for (t=(yyvsp[(1) - (3)].arglist);t->right;t=t->right)
2041  ;
2042  (yyval.arglist) = (yyvsp[(1) - (3)].arglist); t->right = x; x->val = (yyvsp[(3) - (3)].val);;}
2043  break;
2044 
2045  case 6:
2046 
2047 /* Line 1455 of yacc.c */
2048 #line 396 "ast_expr2.y"
2049  {struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL);
2050  struct expr_node *t; /* NULL args should OK */
2051  DESTROY((yyvsp[(2) - (2)].val));
2052  for (t=(yyvsp[(1) - (2)].arglist);t->right;t=t->right)
2053  ;
2054  (yyval.arglist) = (yyvsp[(1) - (2)].arglist); t->right = x; x->val = make_str("");;}
2055  break;
2056 
2057  case 7:
2058 
2059 /* Line 1455 of yacc.c */
2060 #line 405 "ast_expr2.y"
2061  { (yyval.val) = op_func((yyvsp[(1) - (4)].val),(yyvsp[(3) - (4)].arglist), ((struct parse_io *)parseio)->chan);
2062  DESTROY((yyvsp[(2) - (4)].val));
2063  DESTROY((yyvsp[(4) - (4)].val));
2064  DESTROY((yyvsp[(1) - (4)].val));
2065  destroy_arglist((yyvsp[(3) - (4)].arglist));
2066  ;}
2067  break;
2068 
2069  case 8:
2070 
2071 /* Line 1455 of yacc.c */
2072 #line 411 "ast_expr2.y"
2073  {(yyval.val) = (yyvsp[(1) - (1)].val);;}
2074  break;
2075 
2076  case 9:
2077 
2078 /* Line 1455 of yacc.c */
2079 #line 412 "ast_expr2.y"
2080  { (yyval.val) = (yyvsp[(2) - (3)].val);
2081  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2082  (yyloc).first_line=0; (yyloc).last_line=0;
2083  DESTROY((yyvsp[(1) - (3)].val)); DESTROY((yyvsp[(3) - (3)].val)); ;}
2084  break;
2085 
2086  case 10:
2087 
2088 /* Line 1455 of yacc.c */
2089 #line 416 "ast_expr2.y"
2090  { (yyval.val) = op_or ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2091  DESTROY((yyvsp[(2) - (3)].val));
2092  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2093  (yyloc).first_line=0; (yyloc).last_line=0;;}
2094  break;
2095 
2096  case 11:
2097 
2098 /* Line 1455 of yacc.c */
2099 #line 420 "ast_expr2.y"
2100  { (yyval.val) = op_and ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2101  DESTROY((yyvsp[(2) - (3)].val));
2102  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2103  (yyloc).first_line=0; (yyloc).last_line=0;;}
2104  break;
2105 
2106  case 12:
2107 
2108 /* Line 1455 of yacc.c */
2109 #line 424 "ast_expr2.y"
2110  { (yyval.val) = op_eq ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2111  DESTROY((yyvsp[(2) - (3)].val));
2112  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2113  (yyloc).first_line=0; (yyloc).last_line=0;;}
2114  break;
2115 
2116  case 13:
2117 
2118 /* Line 1455 of yacc.c */
2119 #line 428 "ast_expr2.y"
2120  { (yyval.val) = op_gt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2121  DESTROY((yyvsp[(2) - (3)].val));
2122  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2123  (yyloc).first_line=0; (yyloc).last_line=0;;}
2124  break;
2125 
2126  case 14:
2127 
2128 /* Line 1455 of yacc.c */
2129 #line 432 "ast_expr2.y"
2130  { (yyval.val) = op_lt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2131  DESTROY((yyvsp[(2) - (3)].val));
2132  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2133  (yyloc).first_line=0; (yyloc).last_line=0;;}
2134  break;
2135 
2136  case 15:
2137 
2138 /* Line 1455 of yacc.c */
2139 #line 436 "ast_expr2.y"
2140  { (yyval.val) = op_ge ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2141  DESTROY((yyvsp[(2) - (3)].val));
2142  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2143  (yyloc).first_line=0; (yyloc).last_line=0;;}
2144  break;
2145 
2146  case 16:
2147 
2148 /* Line 1455 of yacc.c */
2149 #line 440 "ast_expr2.y"
2150  { (yyval.val) = op_le ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2151  DESTROY((yyvsp[(2) - (3)].val));
2152  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2153  (yyloc).first_line=0; (yyloc).last_line=0;;}
2154  break;
2155 
2156  case 17:
2157 
2158 /* Line 1455 of yacc.c */
2159 #line 444 "ast_expr2.y"
2160  { (yyval.val) = op_ne ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2161  DESTROY((yyvsp[(2) - (3)].val));
2162  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2163  (yyloc).first_line=0; (yyloc).last_line=0;;}
2164  break;
2165 
2166  case 18:
2167 
2168 /* Line 1455 of yacc.c */
2169 #line 448 "ast_expr2.y"
2170  { (yyval.val) = op_plus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2171  DESTROY((yyvsp[(2) - (3)].val));
2172  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2173  (yyloc).first_line=0; (yyloc).last_line=0;;}
2174  break;
2175 
2176  case 19:
2177 
2178 /* Line 1455 of yacc.c */
2179 #line 452 "ast_expr2.y"
2180  { (yyval.val) = op_minus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2181  DESTROY((yyvsp[(2) - (3)].val));
2182  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2183  (yyloc).first_line=0; (yyloc).last_line=0;;}
2184  break;
2185 
2186  case 20:
2187 
2188 /* Line 1455 of yacc.c */
2189 #line 456 "ast_expr2.y"
2190  { (yyval.val) = op_negate ((yyvsp[(2) - (2)].val));
2191  DESTROY((yyvsp[(1) - (2)].val));
2192  (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column;
2193  (yyloc).first_line=0; (yyloc).last_line=0;;}
2194  break;
2195 
2196  case 21:
2197 
2198 /* Line 1455 of yacc.c */
2199 #line 460 "ast_expr2.y"
2200  { (yyval.val) = op_compl ((yyvsp[(2) - (2)].val));
2201  DESTROY((yyvsp[(1) - (2)].val));
2202  (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column;
2203  (yyloc).first_line=0; (yyloc).last_line=0;;}
2204  break;
2205 
2206  case 22:
2207 
2208 /* Line 1455 of yacc.c */
2209 #line 464 "ast_expr2.y"
2210  { (yyval.val) = op_times ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2211  DESTROY((yyvsp[(2) - (3)].val));
2212  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2213  (yyloc).first_line=0; (yyloc).last_line=0;;}
2214  break;
2215 
2216  case 23:
2217 
2218 /* Line 1455 of yacc.c */
2219 #line 468 "ast_expr2.y"
2220  { (yyval.val) = op_div ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2221  DESTROY((yyvsp[(2) - (3)].val));
2222  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2223  (yyloc).first_line=0; (yyloc).last_line=0;;}
2224  break;
2225 
2226  case 24:
2227 
2228 /* Line 1455 of yacc.c */
2229 #line 472 "ast_expr2.y"
2230  { (yyval.val) = op_rem ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2231  DESTROY((yyvsp[(2) - (3)].val));
2232  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2233  (yyloc).first_line=0; (yyloc).last_line=0;;}
2234  break;
2235 
2236  case 25:
2237 
2238 /* Line 1455 of yacc.c */
2239 #line 476 "ast_expr2.y"
2240  { (yyval.val) = op_colon ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2241  DESTROY((yyvsp[(2) - (3)].val));
2242  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2243  (yyloc).first_line=0; (yyloc).last_line=0;;}
2244  break;
2245 
2246  case 26:
2247 
2248 /* Line 1455 of yacc.c */
2249 #line 480 "ast_expr2.y"
2250  { (yyval.val) = op_eqtilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2251  DESTROY((yyvsp[(2) - (3)].val));
2252  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2253  (yyloc).first_line=0; (yyloc).last_line=0;;}
2254  break;
2255 
2256  case 27:
2257 
2258 /* Line 1455 of yacc.c */
2259 #line 484 "ast_expr2.y"
2260  { (yyval.val) = op_cond ((yyvsp[(1) - (5)].val), (yyvsp[(3) - (5)].val), (yyvsp[(5) - (5)].val));
2261  DESTROY((yyvsp[(2) - (5)].val));
2262  DESTROY((yyvsp[(4) - (5)].val));
2263  (yyloc).first_column = (yylsp[(1) - (5)]).first_column; (yyloc).last_column = (yylsp[(3) - (5)]).last_column;
2264  (yyloc).first_line=0; (yyloc).last_line=0;;}
2265  break;
2266 
2267  case 28:
2268 
2269 /* Line 1455 of yacc.c */
2270 #line 489 "ast_expr2.y"
2271  { (yyval.val) = op_tildetilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
2272  DESTROY((yyvsp[(2) - (3)].val));
2273  (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
2274  (yyloc).first_line=0; (yyloc).last_line=0;;}
2275  break;
2276 
2277 
2278 
2279 /* Line 1455 of yacc.c */
2280 #line 2283 "ast_expr2.c"
2281  default: break;
2282  }
2283  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2284 
2285  YYPOPSTACK (yylen);
2286  yylen = 0;
2287  YY_STACK_PRINT (yyss, yyssp);
2288 
2289  *++yyvsp = yyval;
2290  *++yylsp = yyloc;
2291 
2292  /* Now `shift' the result of the reduction. Determine what state
2293  that goes to, based on the state we popped back to and the rule
2294  number reduced by. */
2295 
2296  yyn = yyr1[yyn];
2297 
2298  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2299  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2300  yystate = yytable[yystate];
2301  else
2302  yystate = yydefgoto[yyn - YYNTOKENS];
2303 
2304  goto yynewstate;
2305 
2306 
2307 /*------------------------------------.
2308 | yyerrlab -- here on detecting error |
2309 `------------------------------------*/
2310 yyerrlab:
2311  /* If not already recovering from an error, report this error. */
2312  if (!yyerrstatus)
2313  {
2314  ++yynerrs;
2315 #if ! YYERROR_VERBOSE
2316  yyerror (YY_("syntax error"));
2317 #else
2318  {
2319  YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2320  if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2321  {
2322  YYSIZE_T yyalloc = 2 * yysize;
2323  if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2324  yyalloc = YYSTACK_ALLOC_MAXIMUM;
2325  if (yymsg != yymsgbuf)
2326  YYSTACK_FREE (yymsg);
2327  yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2328  if (yymsg)
2329  yymsg_alloc = yyalloc;
2330  else
2331  {
2332  yymsg = yymsgbuf;
2333  yymsg_alloc = sizeof yymsgbuf;
2334  }
2335  }
2336 
2337  if (0 < yysize && yysize <= yymsg_alloc)
2338  {
2339  (void) yysyntax_error (yymsg, yystate, yychar);
2340  yyerror (yymsg);
2341  }
2342  else
2343  {
2344  yyerror (YY_("syntax error"));
2345  if (yysize != 0)
2346  goto yyexhaustedlab;
2347  }
2348  }
2349 #endif
2350  }
2351 
2352  yyerror_range[0] = yylloc;
2353 
2354  if (yyerrstatus == 3)
2355  {
2356  /* If just tried and failed to reuse lookahead token after an
2357  error, discard it. */
2358 
2359  if (yychar <= YYEOF)
2360  {
2361  /* Return failure if at end of input. */
2362  if (yychar == YYEOF)
2363  YYABORT;
2364  }
2365  else
2366  {
2367  yydestruct ("Error: discarding",
2368  yytoken, &yylval, &yylloc);
2369  yychar = YYEMPTY;
2370  }
2371  }
2372 
2373  /* Else will try to reuse lookahead token after shifting the error
2374  token. */
2375  goto yyerrlab1;
2376 
2377 
2378 /*---------------------------------------------------.
2379 | yyerrorlab -- error raised explicitly by YYERROR. |
2380 `---------------------------------------------------*/
2381 yyerrorlab:
2382 
2383  /* Pacify compilers like GCC when the user code never invokes
2384  YYERROR and the label yyerrorlab therefore never appears in user
2385  code. */
2386  if (/*CONSTCOND*/ 0)
2387  goto yyerrorlab;
2388 
2389  yyerror_range[0] = yylsp[1-yylen];
2390  /* Do not reclaim the symbols of the rule which action triggered
2391  this YYERROR. */
2392  YYPOPSTACK (yylen);
2393  yylen = 0;
2394  YY_STACK_PRINT (yyss, yyssp);
2395  yystate = *yyssp;
2396  goto yyerrlab1;
2397 
2398 
2399 /*-------------------------------------------------------------.
2400 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2401 `-------------------------------------------------------------*/
2402 yyerrlab1:
2403  yyerrstatus = 3; /* Each real token shifted decrements this. */
2404 
2405  for (;;)
2406  {
2407  yyn = yypact[yystate];
2408  if (yyn != YYPACT_NINF)
2409  {
2410  yyn += YYTERROR;
2411  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2412  {
2413  yyn = yytable[yyn];
2414  if (0 < yyn)
2415  break;
2416  }
2417  }
2418 
2419  /* Pop the current state because it cannot handle the error token. */
2420  if (yyssp == yyss)
2421  YYABORT;
2422 
2423  yyerror_range[0] = *yylsp;
2424  yydestruct ("Error: popping",
2425  yystos[yystate], yyvsp, yylsp);
2426  YYPOPSTACK (1);
2427  yystate = *yyssp;
2428  YY_STACK_PRINT (yyss, yyssp);
2429  }
2430 
2431  *++yyvsp = yylval;
2432 
2433  yyerror_range[1] = yylloc;
2434  /* Using YYLLOC is tempting, but would change the location of
2435  the lookahead. YYLOC is available though. */
2436  YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
2437  *++yylsp = yyloc;
2438 
2439  /* Shift the error token. */
2440  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2441 
2442  yystate = yyn;
2443  goto yynewstate;
2444 
2445 
2446 /*-------------------------------------.
2447 | yyacceptlab -- YYACCEPT comes here. |
2448 `-------------------------------------*/
2449 yyacceptlab:
2450  yyresult = 0;
2451  goto yyreturn;
2452 
2453 /*-----------------------------------.
2454 | yyabortlab -- YYABORT comes here. |
2455 `-----------------------------------*/
2456 yyabortlab:
2457  yyresult = 1;
2458  goto yyreturn;
2459 
2460 #if !defined(yyoverflow) || YYERROR_VERBOSE
2461 /*-------------------------------------------------.
2462 | yyexhaustedlab -- memory exhaustion comes here. |
2463 `-------------------------------------------------*/
2464 yyexhaustedlab:
2465  yyerror (YY_("memory exhausted"));
2466  yyresult = 2;
2467  /* Fall through. */
2468 #endif
2469 
2470 yyreturn:
2471  if (yychar != YYEMPTY)
2472  yydestruct ("Cleanup: discarding lookahead",
2473  yytoken, &yylval, &yylloc);
2474  /* Do not reclaim the symbols of the rule which action triggered
2475  this YYABORT or YYACCEPT. */
2476  YYPOPSTACK (yylen);
2477  YY_STACK_PRINT (yyss, yyssp);
2478  while (yyssp != yyss)
2479  {
2480  yydestruct ("Cleanup: popping",
2481  yystos[*yyssp], yyvsp, yylsp);
2482  YYPOPSTACK (1);
2483  }
2484 #ifndef yyoverflow
2485  if (yyss != yyssa)
2486  YYSTACK_FREE (yyss);
2487 #endif
2488 #if YYERROR_VERBOSE
2489  if (yymsg != yymsgbuf)
2490  YYSTACK_FREE (yymsg);
2491 #endif
2492  /* Make sure YYID is used. */
2493  return YYID (yyresult);
2494 }
2495 
2496 
2497 
2498 /* Line 1675 of yacc.c */
2499 #line 495 "ast_expr2.y"
2500 
2501 
2502 static struct expr_node *alloc_expr_node(enum node_type nt)
2503 {
2504  struct expr_node *x = calloc(1,sizeof(struct expr_node));
2505  if (!x) {
2506  ast_log(LOG_ERROR, "Allocation for expr_node FAILED!!\n");
2507  return 0;
2508  }
2509  x->type = nt;
2510  return x;
2511 }
2512 
2513 
2514 
2515 static struct val *
2517 {
2518  struct val *vp;
2519 
2520  vp = (struct val *) malloc (sizeof (*vp));
2521  if (vp == NULL) {
2522  ast_log(LOG_WARNING, "malloc() failed\n");
2523  return(NULL);
2524  }
2525 
2526  vp->type = AST_EXPR_number;
2527  vp->u.i = i;
2528  return vp;
2529 }
2530 
2531 static struct val *
2532 make_str (const char *s)
2533 {
2534  struct val *vp;
2535  size_t i;
2536  int isint; /* this started out being a test for an integer, but then ended up being a test for a float */
2537 
2538  vp = (struct val *) malloc (sizeof (*vp));
2539  if (vp == NULL || ((vp->u.s = strdup (s)) == NULL)) {
2540  if (vp) {
2541  free(vp);
2542  }
2543  ast_log(LOG_WARNING,"malloc() failed\n");
2544  return(NULL);
2545  }
2546 
2547  for (i = 0, isint = (isdigit(s[0]) || s[0] == '-' || s[0]=='.'); isint && i < strlen(s); i++)
2548  {
2549  if (!isdigit(s[i]) && s[i] != '.') {
2550  isint = 0;
2551  break;
2552  }
2553  }
2554  if (isint)
2556  else
2557  vp->type = AST_EXPR_string;
2558 
2559  return vp;
2560 }
2561 
2562 
2563 static void
2564 free_value (struct val *vp)
2565 {
2566  if (vp==NULL) {
2567  return;
2568  }
2569  if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)
2570  free (vp->u.s);
2571  free(vp);
2572 }
2573 
2574 
2575 static int
2576 to_number (struct val *vp)
2577 {
2578  FP___TYPE i;
2579 
2580  if (vp == NULL) {
2581  ast_log(LOG_WARNING,"vp==NULL in to_number()\n");
2582  return(0);
2583  }
2584 
2585  if (vp->type == AST_EXPR_number)
2586  return 1;
2587 
2588  if (vp->type == AST_EXPR_string)
2589  return 0;
2590 
2591  /* vp->type == AST_EXPR_numeric_string, make it numeric */
2592  errno = 0;
2593  i = FUNC_STRTOD(vp->u.s, (char**)0); /* either strtod, or strtold on a good day */
2594  if (errno != 0) {
2595  ast_log(LOG_WARNING,"Conversion of %s to number under/overflowed!\n", vp->u.s);
2596  free(vp->u.s);
2597  vp->u.s = 0;
2598  return(0);
2599  }
2600  free (vp->u.s);
2601  vp->u.i = i;
2602  vp->type = AST_EXPR_number;
2603  return 1;
2604 }
2605 
2606 static void
2607 strip_quotes(struct val *vp)
2608 {
2609  if (vp->type != AST_EXPR_string && vp->type != AST_EXPR_numeric_string)
2610  return;
2611 
2612  if( vp->u.s[0] == '"' && vp->u.s[strlen(vp->u.s)-1] == '"' )
2613  {
2614  char *f, *t;
2615  f = vp->u.s;
2616  t = vp->u.s;
2617 
2618  while( *f )
2619  {
2620  if( *f && *f != '"' )
2621  *t++ = *f++;
2622  else
2623  f++;
2624  }
2625  *t = *f;
2626  }
2627 }
2628 
2629 static void
2630 to_string (struct val *vp)
2631 {
2632  char *tmp;
2633 
2634  if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)
2635  return;
2636 
2637  if (asprintf(&tmp, FP___PRINTF, vp->u.i) == -1) {
2638  ast_log(LOG_WARNING, "asprintf() failed\n");
2639  return;
2640  }
2641 
2642  vp->type = AST_EXPR_string;
2643  vp->u.s = tmp;
2644 }
2645 
2646 
2647 static int
2648 isstring (struct val *vp)
2649 {
2650  /* only TRUE if this string is not a valid number */
2651  return (vp->type == AST_EXPR_string);
2652 }
2653 
2654 
2655 static int
2656 is_zero_or_null (struct val *vp)
2657 {
2658  if (vp->type == AST_EXPR_number) {
2659  return (vp->u.i == 0);
2660  } else {
2661  return (*vp->u.s == 0 || (to_number(vp) && vp->u.i == 0));
2662  }
2663  /* NOTREACHED */
2664 }
2665 
2666 #ifdef STANDALONE2
2667 
2668 void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
2669 {
2670  va_list vars;
2671  va_start(vars,fmt);
2672 
2673  printf("LOG: lev:%d file:%s line:%d func: %s ",
2674  level, file, line, function);
2675  vprintf(fmt, vars);
2676  fflush(stdout);
2677  va_end(vars);
2678 }
2679 
2680 
2681 int main(int argc,char **argv) {
2682  char s[4096];
2683  char out[4096];
2684  FILE *infile;
2685 
2686  if( !argv[1] )
2687  exit(20);
2688 
2689  if( access(argv[1],F_OK)== 0 )
2690  {
2691  int ret;
2692 
2693  infile = fopen(argv[1],"r");
2694  if( !infile )
2695  {
2696  printf("Sorry, couldn't open %s for reading!\n", argv[1]);
2697  exit(10);
2698  }
2699  while( fgets(s,sizeof(s),infile) )
2700  {
2701  if( s[strlen(s)-1] == '\n' )
2702  s[strlen(s)-1] = 0;
2703 
2704  ret = ast_expr(s, out, sizeof(out), NULL);
2705  printf("Expression: %s Result: [%d] '%s'\n",
2706  s, ret, out);
2707  }
2708  fclose(infile);
2709  }
2710  else
2711  {
2712  if (ast_expr(argv[1], s, sizeof(s), NULL))
2713  printf("=====%s======\n",s);
2714  else
2715  printf("No result\n");
2716  }
2717  return 0;
2718 }
2719 
2720 #endif
2721 
2722 #undef ast_yyerror
2723 #define ast_yyerror(x) ast_yyerror(x, YYLTYPE *yylloc, struct parse_io *parseio)
2724 
2725 /* I put the ast_yyerror func in the flex input file,
2726  because it refers to the buffer state. Best to
2727  let it access the BUFFER stuff there and not trying
2728  define all the structs, macros etc. in this file! */
2729 
2730 static void destroy_arglist(struct expr_node *arglist)
2731 {
2732  struct expr_node *arglist_next;
2733 
2734  while (arglist)
2735  {
2736  arglist_next = arglist->right;
2737  if (arglist->val)
2738  free_value(arglist->val);
2739  arglist->val = 0;
2740  arglist->right = 0;
2741  free(arglist);
2742  arglist = arglist_next;
2743  }
2744 }
2745 
2746 #if !defined(STANDALONE) && !defined(STANDALONE2)
2747 static char *compose_func_args(struct expr_node *arglist)
2748 {
2749  struct expr_node *t = arglist;
2750  char *argbuf;
2751  int total_len = 0;
2752 
2753  while (t) {
2754  if (t != arglist)
2755  total_len += 1; /* for the sep */
2756  if (t->val) {
2757  if (t->val->type == AST_EXPR_number)
2758  total_len += 25; /* worst case */
2759  else
2760  total_len += strlen(t->val->u.s);
2761  }
2762 
2763  t = t->right;
2764  }
2765  total_len++; /* for the null */
2766  ast_log(LOG_NOTICE,"argbuf allocated %d bytes;\n", total_len);
2767  argbuf = malloc(total_len);
2768  argbuf[0] = 0;
2769  t = arglist;
2770  while (t) {
2771  char numbuf[30];
2772 
2773  if (t != arglist)
2774  strcat(argbuf,",");
2775 
2776  if (t->val) {
2777  if (t->val->type == AST_EXPR_number) {
2778  sprintf(numbuf,FP___PRINTF,t->val->u.i);
2779  strcat(argbuf,numbuf);
2780  } else
2781  strcat(argbuf,t->val->u.s);
2782  }
2783  t = t->right;
2784  }
2785  ast_log(LOG_NOTICE,"argbuf uses %d bytes;\n", (int) strlen(argbuf));
2786  return argbuf;
2787 }
2788 
2789 static int is_really_num(char *str)
2790 {
2791  if ( strspn(str,"-0123456789. ") == strlen(str))
2792  return 1;
2793  else
2794  return 0;
2795 }
2796 #endif
2797 
2798 static struct val *op_func(struct val *funcname, struct expr_node *arglist, struct ast_channel *chan)
2799 {
2800  if (strspn(funcname->u.s,"ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789") == strlen(funcname->u.s))
2801  {
2802  struct val *result;
2803  if (0) {
2804 #ifdef FUNC_COS
2805  } else if (strcmp(funcname->u.s,"COS") == 0) {
2806  if (arglist && !arglist->right && arglist->val){
2807  to_number(arglist->val);
2808  result = make_number(FUNC_COS(arglist->val->u.i));
2809  return result;
2810  } else {
2811  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2812  return make_number(0.0);
2813  }
2814 #endif
2815 #ifdef FUNC_SIN
2816  } else if (strcmp(funcname->u.s,"SIN") == 0) {
2817  if (arglist && !arglist->right && arglist->val){
2818  to_number(arglist->val);
2819  result = make_number(FUNC_SIN(arglist->val->u.i));
2820  return result;
2821  } else {
2822  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2823  return make_number(0.0);
2824  }
2825 #endif
2826 #ifdef FUNC_TAN
2827  } else if (strcmp(funcname->u.s,"TAN") == 0) {
2828  if (arglist && !arglist->right && arglist->val){
2829  to_number(arglist->val);
2830  result = make_number(FUNC_TAN(arglist->val->u.i));
2831  return result;
2832  } else {
2833  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2834  return make_number(0.0);
2835  }
2836 #endif
2837 #ifdef FUNC_ACOS
2838  } else if (strcmp(funcname->u.s,"ACOS") == 0) {
2839  if (arglist && !arglist->right && arglist->val){
2840  to_number(arglist->val);
2841  result = make_number(FUNC_ACOS(arglist->val->u.i));
2842  return result;
2843  } else {
2844  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2845  return make_number(0.0);
2846  }
2847 #endif
2848 #ifdef FUNC_ASIN
2849  } else if (strcmp(funcname->u.s,"ASIN") == 0) {
2850  if (arglist && !arglist->right && arglist->val){
2851  to_number(arglist->val);
2852  result = make_number(FUNC_ASIN(arglist->val->u.i));
2853  return result;
2854  } else {
2855  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2856  return make_number(0.0);
2857  }
2858 #endif
2859 #ifdef FUNC_ATAN
2860  } else if (strcmp(funcname->u.s,"ATAN") == 0) {
2861  if (arglist && !arglist->right && arglist->val){
2862  to_number(arglist->val);
2863  result = make_number(FUNC_ATAN(arglist->val->u.i));
2864  return result;
2865  } else {
2866  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2867  return make_number(0.0);
2868  }
2869 #endif
2870 #ifdef FUNC_ATAN2
2871  } else if (strcmp(funcname->u.s,"ATAN2") == 0) {
2872  if (arglist && arglist->right && !arglist->right->right && arglist->val && arglist->right->val){
2873  to_number(arglist->val);
2874  to_number(arglist->right->val);
2875  result = make_number(FUNC_ATAN2(arglist->val->u.i, arglist->right->val->u.i));
2876  return result;
2877  } else {
2878  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2879  return make_number(0.0);
2880  }
2881 #endif
2882 #ifdef FUNC_POW
2883  } else if (strcmp(funcname->u.s,"POW") == 0) {
2884  if (arglist && arglist->right && !arglist->right->right && arglist->val && arglist->right->val){
2885  to_number(arglist->val);
2886  to_number(arglist->right->val);
2887  result = make_number(FUNC_POW(arglist->val->u.i, arglist->right->val->u.i));
2888  return result;
2889  } else {
2890  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2891  return make_number(0.0);
2892  }
2893 #endif
2894 #ifdef FUNC_SQRT
2895  } else if (strcmp(funcname->u.s,"SQRT") == 0) {
2896  if (arglist && !arglist->right && arglist->val){
2897  to_number(arglist->val);
2898  result = make_number(FUNC_SQRT(arglist->val->u.i));
2899  return result;
2900  } else {
2901  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2902  return make_number(0.0);
2903  }
2904 #endif
2905 #ifdef FUNC_FLOOR
2906  } else if (strcmp(funcname->u.s,"FLOOR") == 0) {
2907  if (arglist && !arglist->right && arglist->val){
2908  to_number(arglist->val);
2909  result = make_number(FUNC_FLOOR(arglist->val->u.i));
2910  return result;
2911  } else {
2912  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2913  return make_number(0.0);
2914  }
2915 #endif
2916 #ifdef FUNC_CEIL
2917  } else if (strcmp(funcname->u.s,"CEIL") == 0) {
2918  if (arglist && !arglist->right && arglist->val){
2919  to_number(arglist->val);
2920  result = make_number(FUNC_CEIL(arglist->val->u.i));
2921  return result;
2922  } else {
2923  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2924  return make_number(0.0);
2925  }
2926 #endif
2927 #ifdef FUNC_ROUND
2928  } else if (strcmp(funcname->u.s,"ROUND") == 0) {
2929  if (arglist && !arglist->right && arglist->val){
2930  to_number(arglist->val);
2931  result = make_number(FUNC_ROUND(arglist->val->u.i));
2932  return result;
2933  } else {
2934  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2935  return make_number(0.0);
2936  }
2937 #endif /* defined(FUNC_ROUND) */
2938 #ifdef FUNC_RINT
2939  } else if (strcmp(funcname->u.s,"RINT") == 0) {
2940  if (arglist && !arglist->right && arglist->val){
2941  to_number(arglist->val);
2942  result = make_number(FUNC_RINT(arglist->val->u.i));
2943  return result;
2944  } else {
2945  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2946  return make_number(0.0);
2947  }
2948 #endif
2949 #ifdef FUNC_TRUNC
2950  } else if (strcmp(funcname->u.s,"TRUNC") == 0) {
2951  if (arglist && !arglist->right && arglist->val){
2952  to_number(arglist->val);
2953  result = make_number(FUNC_TRUNC(arglist->val->u.i));
2954  return result;
2955  } else {
2956  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2957  return make_number(0.0);
2958  }
2959 #endif /* defined(FUNC_TRUNC) */
2960 #ifdef FUNC_EXP
2961  } else if (strcmp(funcname->u.s,"EXP") == 0) {
2962  if (arglist && !arglist->right && arglist->val){
2963  to_number(arglist->val);
2964  result = make_number(FUNC_EXP(arglist->val->u.i));
2965  return result;
2966  } else {
2967  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2968  return make_number(0.0);
2969  }
2970 #endif
2971 #ifdef FUNC_EXP2
2972  } else if (strcmp(funcname->u.s,"EXP2") == 0) {
2973  if (arglist && !arglist->right && arglist->val){
2974  to_number(arglist->val);
2975  result = make_number(FUNC_EXP2(arglist->val->u.i));
2976  return result;
2977  } else {
2978  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2979  return make_number(0.0);
2980  }
2981 #endif
2982 #ifdef FUNC_EXP10
2983  } else if (strcmp(funcname->u.s,"EXP10") == 0) {
2984  if (arglist && !arglist->right && arglist->val){
2985  to_number(arglist->val);
2986  result = make_number(FUNC_EXP10(arglist->val->u.i));
2987  return result;
2988  } else {
2989  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
2990  return make_number(0.0);
2991  }
2992 #endif
2993 #ifdef FUNC_LOG
2994  } else if (strcmp(funcname->u.s,"LOG") == 0) {
2995  if (arglist && !arglist->right && arglist->val){
2996  to_number(arglist->val);
2997  result = make_number(FUNC_LOG(arglist->val->u.i));
2998  return result;
2999  } else {
3000  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
3001  return make_number(0.0);
3002  }
3003 #endif
3004 #ifdef FUNC_LOG2
3005  } else if (strcmp(funcname->u.s,"LOG2") == 0) {
3006  if (arglist && !arglist->right && arglist->val){
3007  to_number(arglist->val);
3008  result = make_number(FUNC_LOG2(arglist->val->u.i));
3009  return result;
3010  } else {
3011  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
3012  return make_number(0.0);
3013  }
3014 #endif
3015 #ifdef FUNC_LOG10
3016  } else if (strcmp(funcname->u.s,"LOG10") == 0) {
3017  if (arglist && !arglist->right && arglist->val){
3018  to_number(arglist->val);
3019  result = make_number(FUNC_LOG10(arglist->val->u.i));
3020  return result;
3021  } else {
3022  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
3023  return make_number(0.0);
3024  }
3025 #endif
3026 #ifdef FUNC_REMAINDER
3027  } else if (strcmp(funcname->u.s,"REMAINDER") == 0) {
3028  if (arglist && arglist->right && !arglist->right->right && arglist->val && arglist->right->val){
3029  to_number(arglist->val);
3030  to_number(arglist->right->val);
3031  result = make_number(FUNC_REMAINDER(arglist->val->u.i, arglist->right->val->u.i));
3032  return result;
3033  } else {
3034  ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
3035  return make_number(0.0);
3036  }
3037 #endif
3038  } else if (strcmp(funcname->u.s, "ABS") == 0) {
3039  if (arglist && !arglist->right && arglist->val) {
3040  to_number(arglist->val);
3041  result = make_number(arglist->val->u.i < 0 ? arglist->val->u.i * -1 : arglist->val->u.i);
3042  return result;
3043  } else {
3044  ast_log(LOG_WARNING, "Wrong args to %s() function\n", funcname->u.s);
3045  return make_number(0.0);
3046  }
3047  } else {
3048  /* is this a custom function we should execute and collect the results of? */
3049 #if !defined(STANDALONE) && !defined(STANDALONE2)
3050  struct ast_custom_function *f = ast_custom_function_find(funcname->u.s);
3051  if (!chan)
3052  ast_log(LOG_WARNING,"Hey! chan is NULL.\n");
3053  if (!f)
3054  ast_log(LOG_WARNING,"Hey! could not find func %s.\n", funcname->u.s);
3055 
3056  if (f && chan) {
3057  if (f->read) {
3058  char workspace[512];
3059  char *argbuf = compose_func_args(arglist);
3060  f->read(chan, funcname->u.s, argbuf, workspace, sizeof(workspace));
3061  free(argbuf);
3062  if (is_really_num(workspace))
3063  return make_number(FUNC_STRTOD(workspace,(char **)NULL));
3064  else
3065  return make_str(workspace);
3066  } else {
3067  ast_log(LOG_ERROR,"Error! Function '%s' cannot be read!\n", funcname->u.s);
3068  return (make_number ((FP___TYPE)0.0));
3069  }
3070 
3071  } else {
3072  ast_log(LOG_ERROR, "Error! '%s' doesn't appear to be an available function!\n", funcname->u.s);
3073  return (make_number ((FP___TYPE)0.0));
3074  }
3075 #else
3076  ast_log(LOG_ERROR, "Error! '%s' is not available in the standalone version!\n", funcname->u.s);
3077  return (make_number ((FP___TYPE)0.0));
3078 #endif
3079  }
3080  }
3081  else
3082  {
3083  ast_log(LOG_ERROR, "Error! '%s' is not possibly a function name!\n", funcname->u.s);
3084  return (make_number ((FP___TYPE)0.0));
3085  }
3086  return (make_number ((FP___TYPE)0.0));
3087 }
3088 
3089 
3090 static struct val *
3091 op_or (struct val *a, struct val *b)
3092 {
3093  if (is_zero_or_null (a)) {
3094  free_value (a);
3095  return (b);
3096  } else {
3097  free_value (b);
3098  return (a);
3099  }
3100 }
3101 
3102 static struct val *
3103 op_and (struct val *a, struct val *b)
3104 {
3105  if (is_zero_or_null (a) || is_zero_or_null (b)) {
3106  free_value (a);
3107  free_value (b);
3108  return (make_number ((FP___TYPE)0.0));
3109  } else {
3110  free_value (b);
3111  return (a);
3112  }
3113 }
3114 
3115 static struct val *
3116 op_eq (struct val *a, struct val *b)
3117 {
3118  struct val *r;
3119 
3120  if (isstring (a) || isstring (b)) {
3121  to_string (a);
3122  to_string (b);
3123  r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) == 0));
3124  } else {
3125 #ifdef DEBUG_FOR_CONVERSIONS
3126  char buffer[2000];
3127  sprintf(buffer,"Converting '%s' and '%s' ", a->u.s, b->u.s);
3128 #endif
3129  (void)to_number(a);
3130  (void)to_number(b);
3131 #ifdef DEBUG_FOR_CONVERSIONS
3132  ast_log(LOG_WARNING,"%s to '%lld' and '%lld'\n", buffer, a->u.i, b->u.i);
3133 #endif
3134  r = make_number ((FP___TYPE)(a->u.i == b->u.i));
3135  }
3136 
3137  free_value (a);
3138  free_value (b);
3139  return r;
3140 }
3141 
3142 static struct val *
3143 op_gt (struct val *a, struct val *b)
3144 {
3145  struct val *r;
3146 
3147  if (isstring (a) || isstring (b)) {
3148  to_string (a);
3149  to_string (b);
3150  r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) > 0));
3151  } else {
3152  (void)to_number(a);
3153  (void)to_number(b);
3154  r = make_number ((FP___TYPE)(a->u.i > b->u.i));
3155  }
3156 
3157  free_value (a);
3158  free_value (b);
3159  return r;
3160 }
3161 
3162 static struct val *
3163 op_lt (struct val *a, struct val *b)
3164 {
3165  struct val *r;
3166 
3167  if (isstring (a) || isstring (b)) {
3168  to_string (a);
3169  to_string (b);
3170  r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) < 0));
3171  } else {
3172  (void)to_number(a);
3173  (void)to_number(b);
3174  r = make_number ((FP___TYPE)(a->u.i < b->u.i));
3175  }
3176 
3177  free_value (a);
3178  free_value (b);
3179  return r;
3180 }
3181 
3182 static struct val *
3183 op_ge (struct val *a, struct val *b)
3184 {
3185  struct val *r;
3186 
3187  if (isstring (a) || isstring (b)) {
3188  to_string (a);
3189  to_string (b);
3190  r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) >= 0));
3191  } else {
3192  (void)to_number(a);
3193  (void)to_number(b);
3194  r = make_number ((FP___TYPE)(a->u.i >= b->u.i));
3195  }
3196 
3197  free_value (a);
3198  free_value (b);
3199  return r;
3200 }
3201 
3202 static struct val *
3203 op_le (struct val *a, struct val *b)
3204 {
3205  struct val *r;
3206 
3207  if (isstring (a) || isstring (b)) {
3208  to_string (a);
3209  to_string (b);
3210  r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) <= 0));
3211  } else {
3212  (void)to_number(a);
3213  (void)to_number(b);
3214  r = make_number ((FP___TYPE)(a->u.i <= b->u.i));
3215  }
3216 
3217  free_value (a);
3218  free_value (b);
3219  return r;
3220 }
3221 
3222 static struct val *
3223 op_cond (struct val *a, struct val *b, struct val *c)
3224 {
3225  struct val *r;
3226 
3227  if( isstring(a) )
3228  {
3229  if( strlen(a->u.s) && strcmp(a->u.s, "\"\"") != 0 && strcmp(a->u.s,"0") != 0 )
3230  {
3231  free_value(a);
3232  free_value(c);
3233  r = b;
3234  }
3235  else
3236  {
3237  free_value(a);
3238  free_value(b);
3239  r = c;
3240  }
3241  }
3242  else
3243  {
3244  (void)to_number(a);
3245  if( a->u.i )
3246  {
3247  free_value(a);
3248  free_value(c);
3249  r = b;
3250  }
3251  else
3252  {
3253  free_value(a);
3254  free_value(b);
3255  r = c;
3256  }
3257  }
3258  return r;
3259 }
3260 
3261 static struct val *
3262 op_ne (struct val *a, struct val *b)
3263 {
3264  struct val *r;
3265 
3266  if (isstring (a) || isstring (b)) {
3267  to_string (a);
3268  to_string (b);
3269  r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) != 0));
3270  } else {
3271  (void)to_number(a);
3272  (void)to_number(b);
3273  r = make_number ((FP___TYPE)(a->u.i != b->u.i));
3274  }
3275 
3276  free_value (a);
3277  free_value (b);
3278  return r;
3279 }
3280 
3281 static int
3283 {
3284  /* sum of two positive numbers must be positive */
3285  if (a > 0 && b > 0 && r <= 0)
3286  return 1;
3287  /* sum of two negative numbers must be negative */
3288  if (a < 0 && b < 0 && r >= 0)
3289  return 1;
3290  /* all other cases are OK */
3291  return 0;
3292 }
3293 
3294 static struct val *
3295 op_plus (struct val *a, struct val *b)
3296 {
3297  struct val *r;
3298 
3299  if (!to_number (a)) {
3301  ast_log(LOG_WARNING,"non-numeric argument\n");
3302  if (!to_number (b)) {
3303  free_value(a);
3304  free_value(b);
3305  return make_number(0);
3306  } else {
3307  free_value(a);
3308  return (b);
3309  }
3310  } else if (!to_number(b)) {
3311  free_value(b);
3312  return (a);
3313  }
3314 
3315  r = make_number (a->u.i + b->u.i);
3316  if (chk_plus (a->u.i, b->u.i, r->u.i)) {
3317  ast_log(LOG_WARNING,"overflow\n");
3318  }
3319  free_value (a);
3320  free_value (b);
3321  return r;
3322 }
3323 
3324 static int
3326 {
3327  /* special case subtraction of QUAD_MIN */
3328  if (b == QUAD_MIN) {
3329  if (a >= 0)
3330  return 1;
3331  else
3332  return 0;
3333  }
3334  /* this is allowed for b != QUAD_MIN */
3335  return chk_plus (a, -b, r);
3336 }
3337 
3338 static struct val *
3339 op_minus (struct val *a, struct val *b)
3340 {
3341  struct val *r;
3342 
3343  if (!to_number (a)) {
3345  ast_log(LOG_WARNING, "non-numeric argument\n");
3346  if (!to_number (b)) {
3347  free_value(a);
3348  free_value(b);
3349  return make_number(0);
3350  } else {
3351  r = make_number(0 - b->u.i);
3352  free_value(a);
3353  free_value(b);
3354  return (r);
3355  }
3356  } else if (!to_number(b)) {
3358  ast_log(LOG_WARNING, "non-numeric argument\n");
3359  free_value(b);
3360  return (a);
3361  }
3362 
3363  r = make_number (a->u.i - b->u.i);
3364  if (chk_minus (a->u.i, b->u.i, r->u.i)) {
3365  ast_log(LOG_WARNING, "overflow\n");
3366  }
3367  free_value (a);
3368  free_value (b);
3369  return r;
3370 }
3371 
3372 static struct val *
3373 op_negate (struct val *a)
3374 {
3375  struct val *r;
3376 
3377  if (!to_number (a) ) {
3378  free_value(a);
3380  ast_log(LOG_WARNING, "non-numeric argument\n");
3381  return make_number(0);
3382  }
3383 
3384  r = make_number (- a->u.i);
3385  if (chk_minus (0, a->u.i, r->u.i)) {
3386  ast_log(LOG_WARNING, "overflow\n");
3387  }
3388  free_value (a);
3389  return r;
3390 }
3391 
3392 static struct val *
3393 op_compl (struct val *a)
3394 {
3395  int v1 = 1;
3396  struct val *r;
3397 
3398  if( !a )
3399  {
3400  v1 = 0;
3401  }
3402  else
3403  {
3404  switch( a->type )
3405  {
3406  case AST_EXPR_number:
3407  if( a->u.i == 0 )
3408  v1 = 0;
3409  break;
3410 
3411  case AST_EXPR_string:
3412  if( a->u.s == 0 )
3413  v1 = 0;
3414  else
3415  {
3416  if( a->u.s[0] == 0 )
3417  v1 = 0;
3418  else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' )
3419  v1 = 0;
3420  else
3421  v1 = atoi(a->u.s);
3422  }
3423  break;
3424 
3426  if( a->u.s == 0 )
3427  v1 = 0;
3428  else
3429  {
3430  if( a->u.s[0] == 0 )
3431  v1 = 0;
3432  else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' )
3433  v1 = 0;
3434  else
3435  v1 = atoi(a->u.s);
3436  }
3437  break;
3438  }
3439  }
3440 
3441  r = make_number (!v1);
3442  free_value (a);
3443  return r;
3444 }
3445 
3446 static int
3448 {
3449  /* special case: first operand is 0, no overflow possible */
3450  if (a == 0)
3451  return 0;
3452  /* cerify that result of division matches second operand */
3453  if (r / a != b)
3454  return 1;
3455  return 0;
3456 }
3457 
3458 static struct val *
3459 op_times (struct val *a, struct val *b)
3460 {
3461  struct val *r;
3462 
3463  if (!to_number (a) || !to_number (b)) {
3464  free_value(a);
3465  free_value(b);
3467  ast_log(LOG_WARNING, "non-numeric argument\n");
3468  return(make_number(0));
3469  }
3470 
3471  r = make_number (a->u.i * b->u.i);
3472  if (chk_times (a->u.i, b->u.i, r->u.i)) {
3473  ast_log(LOG_WARNING, "overflow\n");
3474  }
3475  free_value (a);
3476  free_value (b);
3477  return (r);
3478 }
3479 
3480 static int
3482 {
3483  /* div by zero has been taken care of before */
3484  /* only QUAD_MIN / -1 causes overflow */
3485  if (a == QUAD_MIN && b == -1)
3486  return 1;
3487  /* everything else is OK */
3488  return 0;
3489 }
3490 
3491 static struct val *
3492 op_div (struct val *a, struct val *b)
3493 {
3494  struct val *r;
3495 
3496  if (!to_number (a)) {
3497  free_value(a);
3498  free_value(b);
3500  ast_log(LOG_WARNING, "non-numeric argument\n");
3501  return make_number(0);
3502  } else if (!to_number (b)) {
3503  free_value(a);
3504  free_value(b);
3506  ast_log(LOG_WARNING, "non-numeric argument\n");
3507  return make_number(INT_MAX);
3508  }
3509 
3510  if (b->u.i == 0) {
3511  ast_log(LOG_WARNING, "division by zero\n");
3512  free_value(a);
3513  free_value(b);
3514  return make_number(INT_MAX);
3515  }
3516 
3517  r = make_number (a->u.i / b->u.i);
3518  if (chk_div (a->u.i, b->u.i)) {
3519  ast_log(LOG_WARNING, "overflow\n");
3520  }
3521  free_value (a);
3522  free_value (b);
3523  return r;
3524 }
3525 
3526 static struct val *
3527 op_rem (struct val *a, struct val *b)
3528 {
3529  struct val *r;
3530 
3531  if (!to_number (a) || !to_number (b)) {
3533  ast_log(LOG_WARNING, "non-numeric argument\n");
3534  free_value(a);
3535  free_value(b);
3536  return make_number(0);
3537  }
3538 
3539  if (b->u.i == 0) {
3540  ast_log(LOG_WARNING, "div by zero\n");
3541  free_value(a);
3542  return(b);
3543  }
3544 
3545  r = make_number (FUNC_FMOD(a->u.i, b->u.i)); /* either fmod or fmodl if FP___TYPE is available */
3546  /* chk_rem necessary ??? */
3547  free_value (a);
3548  free_value (b);
3549  return r;
3550 }
3551 
3552 
3553 static struct val *
3554 op_colon (struct val *a, struct val *b)
3555 {
3556  regex_t rp;
3557  regmatch_t rm[2];
3558  char errbuf[256];
3559  int eval;
3560  struct val *v;
3561 
3562  /* coerce to both arguments to strings */
3563  to_string(a);
3564  to_string(b);
3565  /* strip double quotes from both -- they'll screw up the pattern, and the search string starting at ^ */
3566  strip_quotes(a);
3567  strip_quotes(b);
3568  /* compile regular expression */
3569  if ((eval = regcomp (&rp, b->u.s, REG_EXTENDED)) != 0) {
3570  regerror (eval, &rp, errbuf, sizeof(errbuf));
3571  ast_log(LOG_WARNING, "regcomp() error : %s\n", errbuf);
3572  free_value(a);
3573  free_value(b);
3574  return make_str("");
3575  }
3576 
3577  /* compare string against pattern */
3578  /* remember that patterns are anchored to the beginning of the line */
3579  if (regexec(&rp, a->u.s, (size_t)2, rm, 0) == 0 && rm[0].rm_so == 0) {
3580  if (rm[1].rm_so >= 0) {
3581  *(a->u.s + rm[1].rm_eo) = '\0';
3582  v = make_str (a->u.s + rm[1].rm_so);
3583 
3584  } else {
3585  v = make_number ((FP___TYPE)(rm[0].rm_eo - rm[0].rm_so));
3586  }
3587  } else {
3588  if (rp.re_nsub == 0) {
3589  v = make_number ((FP___TYPE)0);
3590  } else {
3591  v = make_str ("");
3592  }
3593  }
3594 
3595  /* free arguments and pattern buffer */
3596  free_value (a);
3597  free_value (b);
3598  regfree (&rp);
3599 
3600  return v;
3601 }
3602 
3603 
3604 static struct val *
3605 op_eqtilde (struct val *a, struct val *b)
3606 {
3607  regex_t rp;
3608  regmatch_t rm[2];
3609  char errbuf[256];
3610  int eval;
3611  struct val *v;
3612 
3613  /* coerce to both arguments to strings */
3614  to_string(a);
3615  to_string(b);
3616  /* strip double quotes from both -- they'll screw up the pattern, and the search string starting at ^ */
3617  strip_quotes(a);
3618  strip_quotes(b);
3619  /* compile regular expression */
3620  if ((eval = regcomp (&rp, b->u.s, REG_EXTENDED)) != 0) {
3621  regerror (eval, &rp, errbuf, sizeof(errbuf));
3622  ast_log(LOG_WARNING, "regcomp() error : %s\n", errbuf);
3623  free_value(a);
3624  free_value(b);
3625  return make_str("");
3626  }
3627 
3628  /* compare string against pattern */
3629  /* remember that patterns are anchored to the beginning of the line */
3630  if (regexec(&rp, a->u.s, (size_t)2, rm, 0) == 0 ) {
3631  if (rm[1].rm_so >= 0) {
3632  *(a->u.s + rm[1].rm_eo) = '\0';
3633  v = make_str (a->u.s + rm[1].rm_so);
3634 
3635  } else {
3636  v = make_number ((FP___TYPE)(rm[0].rm_eo - rm[0].rm_so));
3637  }
3638  } else {
3639  if (rp.re_nsub == 0) {
3640  v = make_number ((FP___TYPE)0.0);
3641  } else {
3642  v = make_str ("");
3643  }
3644  }
3645 
3646  /* free arguments and pattern buffer */
3647  free_value (a);
3648  free_value (b);
3649  regfree (&rp);
3650 
3651  return v;
3652 }
3653 
3654 static struct val * /* this is a string concat operator */
3655 op_tildetilde (struct val *a, struct val *b)
3656 {
3657  struct val *v;
3658  char *vs;
3659 
3660  /* coerce to both arguments to strings */
3661  to_string(a);
3662  to_string(b);
3663  /* strip double quotes from both -- */
3664  strip_quotes(a);
3665  strip_quotes(b);
3666 
3667  vs = malloc(strlen(a->u.s)+strlen(b->u.s)+1);
3668  if (vs == NULL) {
3669  ast_log(LOG_WARNING, "malloc() failed\n");
3670  free_value(a);
3671  free_value(b);
3672  return NULL;
3673  }
3674 
3675  strcpy(vs,a->u.s);
3676  strcat(vs,b->u.s);
3677 
3678  v = make_str(vs);
3679 
3680  free(vs);
3681 
3682  /* free arguments */
3683  free_value(a);
3684  free_value(b);
3685 
3686  return v;
3687 }
static const yytype_uint8 yydefact[]
Definition: ast_expr2.c:861
#define FUNC_STRTOD
Definition: ast_expr2.c:199
#define FUNC_ATAN
Definition: ast_expr2.c:145
#define FUNC_FLOOR
Definition: ast_expr2.c:205
static struct val * op_gt(struct val *a, struct val *b)
Definition: ast_expr2.c:3143
Main Channel structure associated with a channel.
#define YYSTACK_ALLOC
Definition: ast_expr2.c:639
#define YYINITDEPTH
Definition: ast_expr2.c:1215
#define FUNC_LOG2
Definition: ast_expr2.c:249
Asterisk main include file. File version handling, generic pbx functions.
#define YYUSE(e)
Definition: ast_expr2.c:577
static struct val * op_ge(struct val *a, struct val *b)
Definition: ast_expr2.c:3183
unsigned char yytype_uint8
Definition: ast_expr2.c:523
#define YYLLOC_DEFAULT(Current, Rhs, N)
Definition: ast_expr2.c:999
#define yydebug
Definition: ast_expr2.c:72
int main(int argc, char *argv[])
static struct val * op_eqtilde(struct val *a, struct val *b)
Definition: ast_expr2.c:3605
#define FUNC_CEIL
Definition: ast_expr2.c:211
#define yyerror
Definition: ast_expr2.c:69
Definition: ast_expr2.c:325
FP___TYPE i
Definition: ast_expr2.c:329
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
Definition: ast_expr2.c:1207
#define YYPOPSTACK(N)
#define FP___TYPE
Definition: ast_expr2.c:111
static const yytype_uint8 yyr1[]
Definition: ast_expr2.c:843
static struct val * op_rem(struct val *a, struct val *b)
Definition: ast_expr2.c:3527
static const yytype_uint8 yytable[]
Definition: ast_expr2.c:901
#define YYACCEPT
Definition: ast_expr2.c:958
static int chk_times(FP___TYPE a, FP___TYPE b, FP___TYPE r)
Definition: ast_expr2.c:3447
#define LOG_WARNING
Definition: logger.h:274
#define yynerrs
Definition: ast_expr2.c:73
static int tmp()
Definition: bt_open.c:389
static const yytype_int16 yypact[]
Definition: ast_expr2.c:880
#define YYABORT
Definition: ast_expr2.c:959
int last_line
Definition: ast_expr2.h:97
static char * yystpcpy(char *yydest, const char *yysrc)
Definition: ast_expr2.c:1268
#define YYTRANSLATE(YYX)
Definition: ast_expr2.c:746
#define YY_REDUCE_PRINT(Rule)
Definition: ast_expr2.c:1209
struct val * val
Definition: ast_expr2.c:478
static const yytype_int8 yydefgoto[]
Definition: ast_expr2.c:872
#define FUNC_FMOD
Definition: ast_expr2.c:193
int extra_error_message_supplied
Definition: ast_expr2f.c:2473
int last_column
Definition: ast_expr2.c:397
struct val * val
Definition: ast_expr2.c:351
static void to_string(struct val *vp)
Definition: ast_expr2.c:2630
static struct val * op_le(struct val *a, struct val *b)
Definition: ast_expr2.c:3203
static void yydestruct(char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) const
Definition: ast_expr2.c:1453
static struct test_val c
#define YYEOF
Definition: ast_expr2.c:956
enum node_type type
Definition: ast_expr2.c:339
const char * str
Definition: app_jack.c:147
int ast_yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner)
#define NULL
Definition: resample.c:96
#define YYSTACK_ALLOC_MAXIMUM
Definition: ast_expr2.c:642
static struct val * op_colon(struct val *a, struct val *b)
Definition: ast_expr2.c:3554
#define YYTABLE_NINF
Definition: ast_expr2.c:900
static YYSIZE_T yytnamerr(char *yyres, const char *yystr)
Definition: ast_expr2.c:1293
struct expr_node * arglist
Definition: ast_expr2.c:479
static struct expr_node * alloc_expr_node(enum node_type)
Definition: ast_expr2.c:2502
#define calloc(a, b)
Definition: astmm.h:157
struct ast_channel * chan
Definition: ast_expr2.c:353
#define FUNC_SIN
Definition: ast_expr2.c:121
#define ast_yyerror(x)
Definition: ast_expr2.c:2723
#define FUNC_EXP10
Definition: ast_expr2.c:241
void * yyscan_t
Definition: ast_expr2.c:346
short int yytype_int16
Definition: ast_expr2.c:544
#define YYTERROR
Definition: ast_expr2.c:989
#define YYSIZE_T
Definition: ast_expr2.c:557
enum valtype type
Definition: ast_expr2.c:326
char * s
Definition: ast_expr2.c:328
static struct val * make_str(const char *s)
Definition: ast_expr2.c:2532
union YYSTYPE YYSTYPE
struct expr_node * right
Definition: ast_expr2.c:342
char * malloc()
static struct val * op_div(struct val *a, struct val *b)
Definition: ast_expr2.c:3492
#define ast_log
Definition: astobj2.c:42
#define yychar
Definition: ast_expr2.c:71
#define FUNC_TRUNC
Definition: ast_expr2.c:223
void free()
static void destroy_arglist(struct expr_node *arglist)
Definition: ast_expr2.c:2730
static struct val * op_cond(struct val *a, struct val *b, struct val *c)
Definition: ast_expr2.c:3223
static YYSIZE_T yysyntax_error(char *yyresult, int yystate, int yychar)
Definition: ast_expr2.c:1340
#define YYID(n)
Definition: ast_expr2.c:584
#define FUNC_ATAN2
Definition: ast_expr2.c:151
Data structure associated with a custom dialplan function.
Definition: pbx.h:118
static struct val * op_and(struct val *a, struct val *b)
Definition: ast_expr2.c:3103
#define YYEMPTY
Definition: ast_expr2.c:955
#define YYSTACK_BYTES(N)
Definition: ast_expr2.c:688
#define YYLTYPE
Definition: ast_expr2.c:400
static int chk_minus(FP___TYPE a, FP___TYPE b, FP___TYPE r)
Definition: ast_expr2.c:3325
YYSTYPE yyvs_alloc
Definition: ast_expr2.c:679
node_type
Definition: ast_expr2.c:333
int first_line
Definition: ast_expr2.c:393
static int chk_div __P((FP___TYPE, FP___TYPE))
#define YYFINAL
Definition: ast_expr2.c:729
static struct val * op_tildetilde(struct val *a, struct val *b)
Definition: ast_expr2.c:3655
int last_column
Definition: ast_expr2.h:98
struct yyltype yyltype
int first_line
Definition: ast_expr2.h:95
#define FUNC_LOG
Definition: ast_expr2.c:181
Core PBX routines and definitions.
short int yytype_int8
Definition: ast_expr2.c:532
#define YYLAST
Definition: ast_expr2.c:731
static const yytype_uint8 yytranslate[]
Definition: ast_expr2.c:750
#define FUNC_ACOS
Definition: ast_expr2.c:133
struct ast_custom_function * ast_custom_function_find(const char *name)
Definition: ael_main.c:173
#define FP___PRINTF
Definition: ast_expr2.c:110
static char * compose_func_args(struct expr_node *arglist)
Definition: ast_expr2.c:2747
static int chk_div(FP___TYPE a, FP___TYPE b)
Definition: ast_expr2.c:3481
#define LOG_ERROR
Definition: logger.h:285
char extra_error_message[4095]
Definition: ast_expr2f.c:2472
static struct val * op_func(struct val *funcname, struct expr_node *arglist, struct ast_channel *chan)
Definition: ast_expr2.c:2798
unsigned short int yytype_uint16
Definition: ast_expr2.c:538
static int to_number(struct val *vp)
Definition: ast_expr2.c:2576
#define YYNTOKENS
Definition: ast_expr2.c:734
#define FUNC_ASIN
Definition: ast_expr2.c:139
int errno
#define yyparse
Definition: ast_expr2.c:67
static const yytype_uint8 yystos[]
Definition: ast_expr2.c:943
static struct val * op_compl(struct val *a)
Definition: ast_expr2.c:3393
struct val * val
Definition: ast_expr2.c:340
#define YYMAXDEPTH
Definition: ast_expr2.c:1226
#define LOG_NOTICE
Definition: logger.h:263
#define YYSIZE_MAXIMUM
Definition: ast_expr2.c:561
YYLTYPE yyls_alloc
Definition: ast_expr2.c:680
#define FUNC_RINT
Definition: ast_expr2.c:169
#define FUNC_EXP2
Definition: ast_expr2.c:233
static int isstring(struct val *vp)
Definition: ast_expr2.c:2648
static struct val * op_minus(struct val *a, struct val *b)
Definition: ast_expr2.c:3339
struct expr_node * left
Definition: ast_expr2.c:341
#define FUNC_COS
Definition: ast_expr2.c:115
static struct val * op_lt(struct val *a, struct val *b)
Definition: ast_expr2.c:3163
#define FUNC_LOG10
Definition: ast_expr2.c:261
static const char *const yytname[]
Definition: ast_expr2.c:821
#define YY_(msgid)
Definition: ast_expr2.c:571
#define YY_LOCATION_PRINT(File, Loc)
Definition: ast_expr2.c:1025
static int chk_plus(FP___TYPE a, FP___TYPE b, FP___TYPE r)
Definition: ast_expr2.c:3282
#define YYPARSE_PARAM
Definition: ast_expr2.c:311
#define YYSTACK_FREE
Definition: ast_expr2.c:640
#define YYLEX
Definition: ast_expr2.c:1038
Support for logging to various files, console and syslog Configuration in file logger.conf.
static void free_value(struct val *vp)
Definition: ast_expr2.c:2564
#define YY_STACK_PRINT(Bottom, Top)
Definition: ast_expr2.c:1208
static struct val * op_plus(struct val *a, struct val *b)
Definition: ast_expr2.c:3295
yytype_int16 yyss_alloc
Definition: ast_expr2.c:678
FILE * out
Definition: utils/frame.c:33
static const yytype_int8 yypgoto[]
Definition: ast_expr2.c:891
#define DESTROY(x)
Definition: ast_expr2.c:412
ast_acf_read_fn_t read
Definition: pbx.h:129
#define FUNC_SQRT
Definition: ast_expr2.c:163
static const yytype_int8 yycheck[]
Definition: ast_expr2.c:921
static YYSIZE_T yystrlen(char *yystr) const
Definition: ast_expr2.c:1244
int last_line
Definition: ast_expr2.c:396
int first_column
Definition: ast_expr2.c:394
static PGresult * result
Definition: cel_pgsql.c:88
#define FUNC_TAN
Definition: ast_expr2.c:127
int first_column
Definition: ast_expr2.h:96
#define yylloc
Definition: ast_expr2.c:74
yytokentype
Definition: ast_expr2.c:442
#define FUNC_POW
Definition: ast_expr2.c:157
static struct test_val b
static struct val * op_ne(struct val *a, struct val *b)
Definition: ast_expr2.c:3262
static struct val * op_negate(struct val *a)
Definition: ast_expr2.c:3373
union val::@329 u
char * string
Definition: ast_expr2.c:350
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
Definition: ast_expr2.c:715
static struct val * op_or(struct val *a, struct val *b)
Definition: ast_expr2.c:3091
static struct val * make_number(FP___TYPE i)
Definition: ast_expr2.c:2516
valtype
Definition: ast_expr2.c:317
int asprintf(char **str, const char *fmt,...)
#define QUAD_MIN
Definition: ast_expr2.c:305
#define strdup(a)
Definition: astmm.h:165
static struct val * op_times(struct val *a, struct val *b)
Definition: ast_expr2.c:3459
#define FUNC_EXP
Definition: ast_expr2.c:175
#define yylval
Definition: ast_expr2.c:70
static snd_pcm_format_t format
Definition: chan_alsa.c:102
static struct val * op_eq(struct val *a, struct val *b)
Definition: ast_expr2.c:3116
static const yytype_uint8 yyr2[]
Definition: ast_expr2.c:851
#define FUNC_ROUND
Definition: ast_expr2.c:217
int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan)
Evaluate the given expression.
Definition: ast_expr2f.c:2405
static int is_really_num(char *str)
Definition: ast_expr2.c:2789
#define YYPACT_NINF
Definition: ast_expr2.c:879
#define YYDPRINTF(Args)
Definition: ast_expr2.c:1206
static int is_zero_or_null(struct val *vp)
Definition: ast_expr2.c:2656
static void strip_quotes(struct val *vp)
Definition: ast_expr2.c:2607
#define FUNC_REMAINDER
Definition: ast_expr2.c:187
static struct test_val a