Thu Apr 28 2011 17:15:35

Asterisk developer's documentation


ast_expr2.c File Reference

#include "asterisk.h"
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <locale.h>
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
#include <regex.h>
#include <limits.h>
#include "asterisk/ast_expr.h"
#include "asterisk/logger.h"
#include "asterisk/pbx.h"
Include dependency graph for ast_expr2.c:

Go to the source code of this file.

Data Structures

struct  expr_node
struct  parse_io
struct  val
union  yyalloc
struct  yyltype
union  YYSTYPE

Defines

#define _GNU_SOURCE
#define ast_yyerror(x)   ast_yyerror(x, YYLTYPE *yylloc, struct parse_io *parseio)
#define ast_yyerror(x)   ast_yyerror(x,&yyloc,parseio)
#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);}
#define FP___PRINTF   "%.16g"
#define FP___TYPE   double
#define QUAD_MAX   (0x7fffffffffffffffLL)
#define QUAD_MIN   (-0x7fffffffffffffffLL-1)
#define YY_(msgid)   msgid
#define YY_LOCATION_PRINT(File, Loc)
#define YY_REDUCE_PRINT(Rule)
#define YY_STACK_PRINT(Bottom, Top)
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
#define YYABORT   goto yyabortlab
#define YYACCEPT   goto yyacceptlab
#define YYBACKUP(Token, Value)
#define YYBISON   1
#define YYBISON_VERSION   "2.4.1"
#define yychar   ast_yychar
#define yyclearin   (yychar = YYEMPTY)
#define YYCOPY(To, From, Count)
#define yydebug   ast_yydebug
#define YYDEBUG   0
#define YYDPRINTF(Args)
#define YYEMPTY   (-2)
#define YYENABLE_NLS   0
#define YYEOF   0
#define YYERRCODE   256
#define yyerrok   (yyerrstatus = 0)
#define YYERROR   goto yyerrorlab
#define yyerror   ast_yyerror
#define YYERROR_VERBOSE   1
#define YYERROR_VERBOSE   1
#define YYFAIL   goto yyerrlab
#define YYFINAL   11
#define YYFREE   free
#define YYID(n)   (n)
#define YYINITDEPTH   200
#define YYLAST   159
#define yylex   ast_yylex
#define YYLEX   yylex (&yylval, &yylloc, YYLEX_PARAM)
#define YYLEX_PARAM   ((struct parse_io *)parseio)->scanner
#define yylloc   ast_yylloc
#define YYLLOC_DEFAULT(Current, Rhs, N)
#define YYLSP_NEEDED   1
#define YYLTYPE   yyltype
#define YYLTYPE_IS_TRIVIAL   1
#define yylval   ast_yylval
#define YYMALLOC   malloc
#define YYMAXDEPTH   10000
#define YYMAXUTOK   280
#define yynerrs   ast_yynerrs
#define YYNNTS   4
#define YYNRULES   28
#define YYNSTATES   54
#define YYNTOKENS   26
#define YYPACT_NINF   -18
#define yyparse   ast_yyparse
#define YYPARSE_PARAM   parseio
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
#define YYPULL   1
#define YYPURE   1
#define YYPUSH   0
#define YYRECOVERING()   (!!yyerrstatus)
#define YYRHSLOC(Rhs, K)   ((Rhs)[K])
#define YYSIZE_MAXIMUM   ((YYSIZE_T) -1)
#define YYSIZE_T   unsigned int
#define YYSKELETON_NAME   "yacc.c"
#define YYSTACK_ALLOC   YYMALLOC
#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM
#define YYSTACK_BYTES(N)
#define YYSTACK_FREE   YYFREE
#define YYSTACK_GAP_MAXIMUM   (sizeof (union yyalloc) - 1)
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
#define yystype   YYSTYPE
#define YYSTYPE_IS_DECLARED   1
#define YYSTYPE_IS_TRIVIAL   1
#define YYTABLE_NINF   -1
#define YYTERROR   1
#define YYTOKEN_TABLE   0
#define YYTOKENTYPE
#define YYTRANSLATE(YYX)   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
#define YYUNDEFTOK   2
#define YYUSE(e)   ((void) (e))

Typedefs

typedef struct yyltype yyltype
typedef void * yyscan_t
typedef union YYSTYPE YYSTYPE
typedef short int yytype_int16
typedef short int yytype_int8
typedef unsigned short int yytype_uint16
typedef unsigned char yytype_uint8

Enumerations

enum  node_type { AST_EXPR_NODE_COMMA, AST_EXPR_NODE_STRING, AST_EXPR_NODE_VAL }
enum  valtype {
  AST_EXPR_number, AST_EXPR_numeric_string, AST_EXPR_string, AST_EXPR_number,
  AST_EXPR_numeric_string, AST_EXPR_string
}
enum  yytokentype {
  TOK_COMMA = 258, TOK_COLONCOLON = 259, TOK_COND = 260, TOK_OR = 261,
  TOK_AND = 262, TOK_NE = 263, TOK_LE = 264, TOK_GE = 265,
  TOK_LT = 266, TOK_GT = 267, TOK_EQ = 268, TOK_MINUS = 269,
  TOK_PLUS = 270, TOK_MOD = 271, TOK_DIV = 272, TOK_MULT = 273,
  TOK_COMPL = 274, TOK_TILDETILDE = 275, TOK_EQTILDE = 276, TOK_COLON = 277,
  TOK_LP = 278, TOK_RP = 279, TOKEN = 280, TOK_COMMA = 258,
  TOK_COLONCOLON = 259, TOK_COND = 260, TOK_OR = 261, TOK_AND = 262,
  TOK_NE = 263, TOK_LE = 264, TOK_GE = 265, TOK_LT = 266,
  TOK_GT = 267, TOK_EQ = 268, TOK_MINUS = 269, TOK_PLUS = 270,
  TOK_MOD = 271, TOK_DIV = 272, TOK_MULT = 273, TOK_COMPL = 274,
  TOK_TILDETILDE = 275, TOK_EQTILDE = 276, TOK_COLON = 277, TOK_LP = 278,
  TOK_RP = 279, TOKEN = 280, KW_CONTEXT = 258, LC = 259,
  RC = 260, LP = 261, RP = 262, SEMI = 263,
  EQ = 264, COMMA = 265, COLON = 266, AMPER = 267,
  BAR = 268, AT = 269, KW_MACRO = 270, KW_GLOBALS = 271,
  KW_IGNOREPAT = 272, KW_SWITCH = 273, KW_IF = 274, KW_IFTIME = 275,
  KW_ELSE = 276, KW_RANDOM = 277, KW_ABSTRACT = 278, KW_EXTEND = 279,
  EXTENMARK = 280, KW_GOTO = 281, KW_JUMP = 282, KW_RETURN = 283,
  KW_BREAK = 284, KW_CONTINUE = 285, KW_REGEXTEN = 286, KW_HINT = 287,
  KW_FOR = 288, KW_WHILE = 289, KW_CASE = 290, KW_PATTERN = 291,
  KW_DEFAULT = 292, KW_CATCH = 293, KW_SWITCHES = 294, KW_ESWITCHES = 295,
  KW_INCLUDES = 296, KW_LOCAL = 297, word = 298, KW_CONTEXT = 258,
  LC = 259, RC = 260, LP = 261, RP = 262,
  SEMI = 263, EQ = 264, COMMA = 265, COLON = 266,
  AMPER = 267, BAR = 268, AT = 269, KW_MACRO = 270,
  KW_GLOBALS = 271, KW_IGNOREPAT = 272, KW_SWITCH = 273, KW_IF = 274,
  KW_IFTIME = 275, KW_ELSE = 276, KW_RANDOM = 277, KW_ABSTRACT = 278,
  KW_EXTEND = 279, EXTENMARK = 280, KW_GOTO = 281, KW_JUMP = 282,
  KW_RETURN = 283, KW_BREAK = 284, KW_CONTINUE = 285, KW_REGEXTEN = 286,
  KW_HINT = 287, KW_FOR = 288, KW_WHILE = 289, KW_CASE = 290,
  KW_PATTERN = 291, KW_DEFAULT = 292, KW_CATCH = 293, KW_SWITCHES = 294,
  KW_ESWITCHES = 295, KW_INCLUDES = 296, KW_LOCAL = 297, word = 298
}

Functions

static int chk_div __P ((FP___TYPE, FP___TYPE))
static int chk_minus __P ((FP___TYPE, FP___TYPE, FP___TYPE))
static struct val *make_number __P ((FP___TYPE))
static struct val *make_str __P ((const char *))
static void free_value __P ((struct val *))
static struct val *op_and __P ((struct val *, struct val *))
int ast_yylex __P ((YYSTYPE *, YYLTYPE *, yyscan_t))
static struct val *op_cond __P ((struct val *, struct val *, struct val *))
static struct expr_nodealloc_expr_node (enum node_type)
int ast_yyerror (const char *, YYLTYPE *, struct parse_io *)
static int chk_div (FP___TYPE a, FP___TYPE b)
static int chk_minus (FP___TYPE a, FP___TYPE b, FP___TYPE r)
static int chk_plus (FP___TYPE a, FP___TYPE b, FP___TYPE r)
static int chk_times (FP___TYPE a, FP___TYPE b, FP___TYPE r)
static char * compose_func_args (struct expr_node *arglist)
static void destroy_arglist (struct expr_node *arglist)
static void free_value (struct val *vp)
static int is_really_num (char *str)
static int is_zero_or_null (struct val *vp)
static int isstring (struct val *vp)
static struct valmake_number (FP___TYPE i)
static struct valmake_str (const char *s)
static struct valop_and (struct val *a, struct val *b)
static struct valop_colon (struct val *a, struct val *b)
static struct valop_compl (struct val *a)
static struct valop_cond (struct val *a, struct val *b, struct val *c)
static struct valop_div (struct val *a, struct val *b)
static struct valop_eq (struct val *a, struct val *b)
static struct valop_eqtilde (struct val *a, struct val *b)
static struct valop_func (struct val *funcname, struct expr_node *arglist, struct ast_channel *chan)
static struct valop_ge (struct val *a, struct val *b)
static struct valop_gt (struct val *a, struct val *b)
static struct valop_le (struct val *a, struct val *b)
static struct valop_lt (struct val *a, struct val *b)
static struct valop_minus (struct val *a, struct val *b)
static struct valop_ne (struct val *a, struct val *b)
static struct valop_negate (struct val *a)
static struct valop_or (struct val *a, struct val *b)
static struct valop_plus (struct val *a, struct val *b)
static struct valop_rem (struct val *a, struct val *b)
static struct valop_tildetilde (struct val *a, struct val *b)
static struct valop_times (struct val *a, struct val *b)
static void strip_quotes (struct val *vp)
static int to_number (struct val *vp)
static void to_string (struct val *vp)
static void yydestruct (char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) const
int yyparse (void *YYPARSE_PARAM)
int yyparse ()
static char * yystpcpy (char *yydest, const char *yysrc)
static YYSIZE_T yystrlen (char *yystr) const
static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar)
static YYSIZE_T yytnamerr (char *yyres, const char *yystr)

Variables

char extra_error_message [4095]
int extra_error_message_supplied
static const yytype_int8 yycheck []
static const yytype_uint8 yydefact []
static const yytype_int8 yydefgoto []
static const yytype_int16 yypact []
static const yytype_int8 yypgoto []
static const yytype_uint8 yyr1 []
static const yytype_uint8 yyr2 []
static const yytype_uint8 yystos []
static const yytype_uint8 yytable []
static const char *const yytname []
static const yytype_uint8 yytranslate []

Define Documentation

#define _GNU_SOURCE
Note:
Oddly enough, some platforms have some ISO C99 functions, but not others, so we define the missing functions in terms of their mathematical identities.

Definition at line 277 of file ast_expr2.c.

#define ast_yyerror (   x)    ast_yyerror(x, YYLTYPE *yylloc, struct parse_io *parseio)

Definition at line 2724 of file ast_expr2.c.

#define ast_yyerror (   x)    ast_yyerror(x,&yyloc,parseio)

Definition at line 2724 of file ast_expr2.c.

#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);}

Definition at line 414 of file ast_expr2.c.

Referenced by yyparse().

#define FP___PRINTF   "%.16g"

Definition at line 112 of file ast_expr2.c.

Referenced by compose_func_args(), and to_string().

#define FP___TYPE   double

Definition at line 113 of file ast_expr2.c.

Referenced by op_and(), op_colon(), op_eq(), op_eqtilde(), op_func(), op_ge(), op_gt(), op_le(), op_lt(), op_ne(), and to_number().

#define QUAD_MAX   (0x7fffffffffffffffLL)

Definition at line 310 of file ast_expr2.c.

#define QUAD_MIN   (-0x7fffffffffffffffLL-1)

Definition at line 307 of file ast_expr2.c.

Referenced by chk_div(), and chk_minus().

#define YY_ (   msgid)    msgid

Definition at line 573 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YY_LOCATION_PRINT (   File,
  Loc 
)
Value:
fprintf (File, "%d.%d-%d.%d",       \
         (Loc).first_line, (Loc).first_column,  \
         (Loc).last_line,  (Loc).last_column)

Definition at line 1027 of file ast_expr2.c.

#define YY_REDUCE_PRINT (   Rule)

Definition at line 1211 of file ast_expr2.c.

Referenced by yyparse().

#define YY_STACK_PRINT (   Bottom,
  Top 
)

Definition at line 1210 of file ast_expr2.c.

Referenced by yyparse().

#define YY_SYMBOL_PRINT (   Title,
  Type,
  Value,
  Location 
)

Definition at line 1209 of file ast_expr2.c.

Referenced by yydestruct(), and yyparse().

#define YYABORT   goto yyabortlab

Definition at line 961 of file ast_expr2.c.

Referenced by yyparse().

#define YYACCEPT   goto yyacceptlab

Definition at line 960 of file ast_expr2.c.

Referenced by yyparse().

#define YYBACKUP (   Token,
  Value 
)

Definition at line 973 of file ast_expr2.c.

#define YYBISON   1

Definition at line 46 of file ast_expr2.c.

#define YYBISON_VERSION   "2.4.1"

Definition at line 49 of file ast_expr2.c.

#define yychar   ast_yychar

Definition at line 71 of file ast_expr2.c.

Referenced by yyparse().

#define yyclearin   (yychar = YYEMPTY)

Definition at line 956 of file ast_expr2.c.

#define YYCOPY (   To,
  From,
  Count 
)

Definition at line 701 of file ast_expr2.c.

#define yydebug   ast_yydebug

Definition at line 72 of file ast_expr2.c.

#define YYDEBUG   0

Definition at line 422 of file ast_expr2.c.

#define YYDPRINTF (   Args)

Definition at line 1208 of file ast_expr2.c.

Referenced by yyparse().

#define YYEMPTY   (-2)

Definition at line 957 of file ast_expr2.c.

Referenced by yyparse().

#define YYENABLE_NLS   0

Definition at line 312 of file ast_expr2.c.

#define YYEOF   0

Definition at line 958 of file ast_expr2.c.

Referenced by yyparse().

#define YYERRCODE   256

Definition at line 992 of file ast_expr2.c.

#define yyerrok   (yyerrstatus = 0)

Definition at line 955 of file ast_expr2.c.

#define YYERROR   goto yyerrorlab

Definition at line 962 of file ast_expr2.c.

#define yyerror   ast_yyerror

Definition at line 69 of file ast_expr2.c.

Referenced by yyparse().

#define YYERROR_VERBOSE   1

Definition at line 428 of file ast_expr2.c.

#define YYERROR_VERBOSE   1

Definition at line 428 of file ast_expr2.c.

#define YYFAIL   goto yyerrlab

Definition at line 969 of file ast_expr2.c.

#define YYFINAL   11

Definition at line 731 of file ast_expr2.c.

Referenced by yyparse().

#define YYFREE   free

Definition at line 662 of file ast_expr2.c.

#define YYID (   n)    (n)

Definition at line 586 of file ast_expr2.c.

Referenced by yyparse().

#define YYINITDEPTH   200

Definition at line 1217 of file ast_expr2.c.

Referenced by yyparse().

#define YYLAST   159

Definition at line 733 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define yylex   ast_yylex

Definition at line 68 of file ast_expr2.c.

#define YYLEX   yylex (&yylval, &yylloc, YYLEX_PARAM)

Definition at line 1040 of file ast_expr2.c.

Referenced by yyparse().

#define YYLEX_PARAM   ((struct parse_io *)parseio)->scanner

Definition at line 314 of file ast_expr2.c.

#define yylloc   ast_yylloc

Definition at line 74 of file ast_expr2.c.

Referenced by yyparse().

#define YYLLOC_DEFAULT (   Current,
  Rhs,
 
)

Definition at line 1001 of file ast_expr2.c.

Referenced by yyparse().

#define YYLSP_NEEDED   1

Definition at line 64 of file ast_expr2.c.

#define YYLTYPE   yyltype

Definition at line 402 of file ast_expr2.c.

#define YYLTYPE_IS_TRIVIAL   1

Definition at line 403 of file ast_expr2.c.

#define yylval   ast_yylval

Definition at line 70 of file ast_expr2.c.

Referenced by yyparse().

#define YYMALLOC   malloc

Definition at line 655 of file ast_expr2.c.

#define YYMAXDEPTH   10000

Definition at line 1228 of file ast_expr2.c.

Referenced by yyparse().

#define YYMAXUTOK   280

Definition at line 746 of file ast_expr2.c.

#define yynerrs   ast_yynerrs

Definition at line 73 of file ast_expr2.c.

Referenced by yyparse().

#define YYNNTS   4

Definition at line 738 of file ast_expr2.c.

#define YYNRULES   28

Definition at line 740 of file ast_expr2.c.

#define YYNSTATES   54

Definition at line 742 of file ast_expr2.c.

#define YYNTOKENS   26

Definition at line 736 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYPACT_NINF   -18

Definition at line 881 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define yyparse   ast_yyparse

Definition at line 67 of file ast_expr2.c.

#define YYPARSE_PARAM   parseio

Definition at line 313 of file ast_expr2.c.

#define YYPOPSTACK (   N)    (yyvsp -= (N), yyssp -= (N), yylsp -= (N))

Referenced by yyparse().

#define YYPULL   1

Definition at line 61 of file ast_expr2.c.

#define YYPURE   1

Definition at line 55 of file ast_expr2.c.

#define YYPUSH   0

Definition at line 58 of file ast_expr2.c.

#define YYRECOVERING ( )    (!!yyerrstatus)

Definition at line 971 of file ast_expr2.c.

#define YYRHSLOC (   Rhs,
 
)    ((Rhs)[K])

Definition at line 999 of file ast_expr2.c.

#define YYSIZE_MAXIMUM   ((YYSIZE_T) -1)

Definition at line 563 of file ast_expr2.c.

Referenced by yysyntax_error().

#define YYSIZE_T   unsigned int

Definition at line 559 of file ast_expr2.c.

Referenced by yyparse(), yystrlen(), yysyntax_error(), and yytnamerr().

#define YYSKELETON_NAME   "yacc.c"

Definition at line 52 of file ast_expr2.c.

#define YYSTACK_ALLOC   YYMALLOC

Definition at line 641 of file ast_expr2.c.

Referenced by yyparse().

#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM

Definition at line 644 of file ast_expr2.c.

Referenced by yyparse().

#define YYSTACK_BYTES (   N)
Value:
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
      + 2 * YYSTACK_GAP_MAXIMUM)

Definition at line 690 of file ast_expr2.c.

Referenced by yyparse().

#define YYSTACK_FREE   YYFREE

Definition at line 642 of file ast_expr2.c.

Referenced by yyparse().

#define YYSTACK_GAP_MAXIMUM   (sizeof (union yyalloc) - 1)

Definition at line 686 of file ast_expr2.c.

#define YYSTACK_RELOCATE (   Stack_alloc,
  Stack 
)

Definition at line 717 of file ast_expr2.c.

Referenced by yyparse().

#define yystype   YYSTYPE

Definition at line 489 of file ast_expr2.c.

#define YYSTYPE_IS_DECLARED   1

Definition at line 490 of file ast_expr2.c.

#define YYSTYPE_IS_TRIVIAL   1

Definition at line 488 of file ast_expr2.c.

#define YYTABLE_NINF   -1

Definition at line 902 of file ast_expr2.c.

Referenced by yyparse().

#define YYTERROR   1

Definition at line 991 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYTOKEN_TABLE   0

Definition at line 435 of file ast_expr2.c.

#define YYTOKENTYPE

Definition at line 441 of file ast_expr2.c.

#define YYTRANSLATE (   YYX)    ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

Definition at line 748 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYUNDEFTOK   2

Definition at line 745 of file ast_expr2.c.

#define YYUSE (   e)    ((void) (e))

Definition at line 579 of file ast_expr2.c.

Referenced by yydestruct().


Typedef Documentation

typedef struct yyltype yyltype
typedef void* yyscan_t

Definition at line 348 of file ast_expr2.c.

typedef union YYSTYPE YYSTYPE
typedef short int yytype_int16

Definition at line 546 of file ast_expr2.c.

typedef short int yytype_int8

Definition at line 534 of file ast_expr2.c.

typedef unsigned short int yytype_uint16

Definition at line 540 of file ast_expr2.c.

typedef unsigned char yytype_uint8

Definition at line 525 of file ast_expr2.c.


Enumeration Type Documentation

enum node_type
Enumerator:
AST_EXPR_NODE_COMMA 
AST_EXPR_NODE_STRING 
AST_EXPR_NODE_VAL 

Definition at line 335 of file ast_expr2.c.

enum valtype
Enumerator:
AST_EXPR_number 
AST_EXPR_numeric_string 
AST_EXPR_string 
AST_EXPR_number 
AST_EXPR_numeric_string 
AST_EXPR_string 

Definition at line 319 of file ast_expr2.c.

Enumerator:
TOK_COMMA 
TOK_COLONCOLON 
TOK_COND 
TOK_OR 
TOK_AND 
TOK_NE 
TOK_LE 
TOK_GE 
TOK_LT 
TOK_GT 
TOK_EQ 
TOK_MINUS 
TOK_PLUS 
TOK_MOD 
TOK_DIV 
TOK_MULT 
TOK_COMPL 
TOK_TILDETILDE 
TOK_EQTILDE 
TOK_COLON 
TOK_LP 
TOK_RP 
TOKEN 
TOK_COMMA 
TOK_COLONCOLON 
TOK_COND 
TOK_OR 
TOK_AND 
TOK_NE 
TOK_LE 
TOK_GE 
TOK_LT 
TOK_GT 
TOK_EQ 
TOK_MINUS 
TOK_PLUS 
TOK_MOD 
TOK_DIV 
TOK_MULT 
TOK_COMPL 
TOK_TILDETILDE 
TOK_EQTILDE 
TOK_COLON 
TOK_LP 
TOK_RP 
TOKEN 
KW_CONTEXT 
LC 
RC 
LP 
RP 
SEMI 
EQ 
COMMA 
COLON 
AMPER 
BAR 
AT 
KW_MACRO 
KW_GLOBALS 
KW_IGNOREPAT 
KW_SWITCH 
KW_IF 
KW_IFTIME 
KW_ELSE 
KW_RANDOM 
KW_ABSTRACT 
KW_EXTEND 
EXTENMARK 
KW_GOTO 
KW_JUMP 
KW_RETURN 
KW_BREAK 
KW_CONTINUE 
KW_REGEXTEN 
KW_HINT 
KW_FOR 
KW_WHILE 
KW_CASE 
KW_PATTERN 
KW_DEFAULT 
KW_CATCH 
KW_SWITCHES 
KW_ESWITCHES 
KW_INCLUDES 
KW_LOCAL 
word 
KW_CONTEXT 
LC 
RC 
LP 
RP 
SEMI 
EQ 
COMMA 
COLON 
AMPER 
BAR 
AT 
KW_MACRO 
KW_GLOBALS 
KW_IGNOREPAT 
KW_SWITCH 
KW_IF 
KW_IFTIME 
KW_ELSE 
KW_RANDOM 
KW_ABSTRACT 
KW_EXTEND 
EXTENMARK 
KW_GOTO 
KW_JUMP 
KW_RETURN 
KW_BREAK 
KW_CONTINUE 
KW_REGEXTEN 
KW_HINT 
KW_FOR 
KW_WHILE 
KW_CASE 
KW_PATTERN 
KW_DEFAULT 
KW_CATCH 
KW_SWITCHES 
KW_ESWITCHES 
KW_INCLUDES 
KW_LOCAL 
word 

Definition at line 444 of file ast_expr2.c.

                    {
     TOK_COMMA = 258,
     TOK_COLONCOLON = 259,
     TOK_COND = 260,
     TOK_OR = 261,
     TOK_AND = 262,
     TOK_NE = 263,
     TOK_LE = 264,
     TOK_GE = 265,
     TOK_LT = 266,
     TOK_GT = 267,
     TOK_EQ = 268,
     TOK_MINUS = 269,
     TOK_PLUS = 270,
     TOK_MOD = 271,
     TOK_DIV = 272,
     TOK_MULT = 273,
     TOK_COMPL = 274,
     TOK_TILDETILDE = 275,
     TOK_EQTILDE = 276,
     TOK_COLON = 277,
     TOK_LP = 278,
     TOK_RP = 279,
     TOKEN = 280
   };

Function Documentation

static int chk_div __P ( (FP___TYPE, FP___TYPE)  ) [static]
static int chk_times __P ( (FP___TYPE, FP___TYPE, FP___TYPE)  ) [static]
static struct val* make_number __P ( (FP___TYPE)  ) [static, read]
static struct val* make_str __P ( (const char *)  ) [static, read]
static void to_string __P ( (struct val *)  ) [static, read]
static struct val *op_times __P ( (struct val *, struct val *)  ) [static, read]
int ast_yylex __P ( (YYSTYPE *, YYLTYPE *, yyscan_t )
static struct val* op_cond __P ( (struct val *, struct val *, struct val *)  ) [static, read]
static struct expr_node * alloc_expr_node ( enum node_type  nt) [static, read]

Definition at line 2504 of file ast_expr2.c.

References ast_log(), calloc, LOG_ERROR, and expr_node::type.

Referenced by yyparse().

{
   struct expr_node *x = calloc(1,sizeof(struct expr_node));
   if (!x) {
      ast_log(LOG_ERROR, "Allocation for expr_node FAILED!!\n");
      return 0;
   }
   x->type = nt;
   return x;
}
int ast_yyerror ( const char *  ,
YYLTYPE ,
struct parse_io  
)
static int chk_div ( FP___TYPE  a,
FP___TYPE  b 
) [static]

Definition at line 3473 of file ast_expr2.c.

References QUAD_MIN.

Referenced by op_div().

{
   /* div by zero has been taken care of before */
   /* only QUAD_MIN / -1 causes overflow */
   if (a == QUAD_MIN && b == -1)
      return 1;
   /* everything else is OK */
   return 0;
}
static int chk_minus ( FP___TYPE  a,
FP___TYPE  b,
FP___TYPE  r 
) [static]

Definition at line 3317 of file ast_expr2.c.

References chk_plus(), and QUAD_MIN.

Referenced by op_minus(), and op_negate().

{
   /* special case subtraction of QUAD_MIN */
   if (b == QUAD_MIN) {
      if (a >= 0)
         return 1;
      else
         return 0;
   }
   /* this is allowed for b != QUAD_MIN */
   return chk_plus (a, -b, r);
}
static int chk_plus ( FP___TYPE  a,
FP___TYPE  b,
FP___TYPE  r 
) [static]

Definition at line 3274 of file ast_expr2.c.

Referenced by chk_minus(), and op_plus().

{
   /* sum of two positive numbers must be positive */
   if (a > 0 && b > 0 && r <= 0)
      return 1;
   /* sum of two negative numbers must be negative */
   if (a < 0 && b < 0 && r >= 0)
      return 1;
   /* all other cases are OK */
   return 0;
}
static int chk_times ( FP___TYPE  a,
FP___TYPE  b,
FP___TYPE  r 
) [static]

Definition at line 3439 of file ast_expr2.c.

Referenced by op_times().

{
   /* special case: first operand is 0, no overflow possible */
   if (a == 0)
      return 0;
   /* cerify that result of division matches second operand */
   if (r / a != b)
      return 1;
   return 0;
}
static char* compose_func_args ( struct expr_node arglist) [static]

Definition at line 2748 of file ast_expr2.c.

References AST_EXPR_number, ast_log(), FP___PRINTF, val::i, LOG_NOTICE, malloc, expr_node::right, val::s, val::type, val::u, and expr_node::val.

Referenced by op_func().

{
   struct expr_node *t = arglist;
   char *argbuf;
   int total_len = 0;
   
   while (t) {
      if (t != arglist)
         total_len += 1; /* for the sep */
      if (t->val) {
         if (t->val->type == AST_EXPR_number)
            total_len += 25; /* worst case */
         else
            total_len += strlen(t->val->u.s);
      }
      
      t = t->right;
   }
   total_len++; /* for the null */
   ast_log(LOG_NOTICE,"argbuf allocated %d bytes;\n", total_len);
   argbuf = malloc(total_len);
   argbuf[0] = 0;
   t = arglist;
   while (t) {
      char numbuf[30];
      
      if (t != arglist)
         strcat(argbuf,",");
      
      if (t->val) {
         if (t->val->type == AST_EXPR_number) {
            sprintf(numbuf,FP___PRINTF,t->val->u.i);
            strcat(argbuf,numbuf);
         } else
            strcat(argbuf,t->val->u.s);
      }
      t = t->right;
   }
   ast_log(LOG_NOTICE,"argbuf uses %d bytes;\n", (int) strlen(argbuf));
   return argbuf;
}
static void destroy_arglist ( struct expr_node arglist) [static]

Definition at line 2731 of file ast_expr2.c.

References free, free_value(), expr_node::right, and expr_node::val.

Referenced by yyparse().

{
   struct expr_node *arglist_next;
   
   while (arglist)
   {
      arglist_next = arglist->right;
      if (arglist->val)
         free_value(arglist->val);
      arglist->val = 0;
      arglist->right = 0;
      free(arglist);
      arglist = arglist_next;
   }
}
static void free_value ( struct val vp) [static]
static int is_really_num ( char *  str) [static]

Definition at line 2790 of file ast_expr2.c.

Referenced by op_func().

{
   if ( strspn(str,"-0123456789.    ") == strlen(str))
      return 1;
   else
      return 0;
}
static int is_zero_or_null ( struct val vp) [static]

Definition at line 2657 of file ast_expr2.c.

References AST_EXPR_number, val::i, val::s, to_number(), val::type, and val::u.

Referenced by op_and(), and op_or().

{
   if (vp->type == AST_EXPR_number) {
      return (vp->u.i == 0);
   } else {
      return (*vp->u.s == 0 || (to_number(vp) && vp->u.i == 0));
   }
   /* NOTREACHED */
}
static int isstring ( struct val vp) [static]

Definition at line 2649 of file ast_expr2.c.

References AST_EXPR_string, and val::type.

Referenced by op_cond(), op_eq(), op_ge(), op_gt(), op_le(), op_lt(), and op_ne().

{
   /* only TRUE if this string is not a valid number */
   return (vp->type == AST_EXPR_string);
}
static struct val* make_number ( FP___TYPE  i) [static, read]

Definition at line 2518 of file ast_expr2.c.

References AST_EXPR_number, ast_log(), val::i, LOG_WARNING, malloc, val::type, and val::u.

Referenced by op_and(), op_colon(), op_compl(), op_div(), op_eq(), op_eqtilde(), op_func(), op_ge(), op_gt(), op_le(), op_lt(), op_minus(), op_ne(), op_negate(), op_plus(), op_rem(), and op_times().

{
   struct val *vp;

   vp = (struct val *) malloc (sizeof (*vp));
   if (vp == NULL) {
      ast_log(LOG_WARNING, "malloc() failed\n");
      return(NULL);
   }

   vp->type = AST_EXPR_number;
   vp->u.i  = i;
   return vp; 
}
static struct val* make_str ( const char *  s) [static, read]

Definition at line 2534 of file ast_expr2.c.

References AST_EXPR_numeric_string, AST_EXPR_string, ast_log(), val::i, LOG_WARNING, malloc, val::s, strdup, val::type, and val::u.

Referenced by op_colon(), op_eqtilde(), op_func(), op_tildetilde(), and yyparse().

{
   struct val *vp;
   size_t i;
   int isint; /* this started out being a test for an integer, but then ended up being a test for a float */

   vp = (struct val *) malloc (sizeof (*vp));
   if (vp == NULL || ((vp->u.s = strdup (s)) == NULL)) {
      ast_log(LOG_WARNING,"malloc() failed\n");
      return(NULL);
   }

   for (i = 0, isint = (isdigit(s[0]) || s[0] == '-' || s[0]=='.'); isint && i < strlen(s); i++)
   {
      if (!isdigit(s[i]) && s[i] != '.') {
         isint = 0;
         break;
      }
   }
   if (isint)
      vp->type = AST_EXPR_numeric_string;
   else  
      vp->type = AST_EXPR_string;

   return vp;
}
static struct val* op_and ( struct val a,
struct val b 
) [static, read]

Definition at line 3095 of file ast_expr2.c.

References FP___TYPE, free_value(), is_zero_or_null(), and make_number().

Referenced by yyparse().

{
   if (is_zero_or_null (a) || is_zero_or_null (b)) {
      free_value (a);
      free_value (b);
      return (make_number ((FP___TYPE)0.0));
   } else {
      free_value (b);
      return (a);
   }
}
static struct val* op_colon ( struct val a,
struct val b 
) [static, read]

Definition at line 3546 of file ast_expr2.c.

References ast_log(), FP___TYPE, free_value(), LOG_WARNING, make_number(), make_str(), val::s, strip_quotes(), to_string(), and val::u.

Referenced by yyparse().

{
   regex_t rp;
   regmatch_t rm[2];
   char errbuf[256];
   int eval;
   struct val *v;

   /* coerce to both arguments to strings */
   to_string(a);
   to_string(b);
   /* strip double quotes from both -- they'll screw up the pattern, and the search string starting at ^ */
   strip_quotes(a);
   strip_quotes(b);
   /* compile regular expression */
   if ((eval = regcomp (&rp, b->u.s, REG_EXTENDED)) != 0) {
      regerror (eval, &rp, errbuf, sizeof(errbuf));
      ast_log(LOG_WARNING, "regcomp() error : %s\n", errbuf);
      free_value(a);
      free_value(b);
      return make_str("");    
   }

   /* compare string against pattern */
   /* remember that patterns are anchored to the beginning of the line */
   if (regexec(&rp, a->u.s, (size_t)2, rm, 0) == 0 && rm[0].rm_so == 0) {
      if (rm[1].rm_so >= 0) {
         *(a->u.s + rm[1].rm_eo) = '\0';
         v = make_str (a->u.s + rm[1].rm_so);

      } else {
         v = make_number ((FP___TYPE)(rm[0].rm_eo - rm[0].rm_so));
      }
   } else {
      if (rp.re_nsub == 0) {
         v = make_number ((FP___TYPE)0);
      } else {
         v = make_str ("");
      }
   }

   /* free arguments and pattern buffer */
   free_value (a);
   free_value (b);
   regfree (&rp);

   return v;
}
static struct val* op_compl ( struct val a) [static, read]

Definition at line 3385 of file ast_expr2.c.

References AST_EXPR_number, AST_EXPR_numeric_string, AST_EXPR_string, free_value(), val::i, make_number(), val::s, val::type, and val::u.

Referenced by yyparse().

{
   int v1 = 1;
   struct val *r;
   
   if( !a )
   {
      v1 = 0;
   }
   else
   {
      switch( a->type )
      {
      case AST_EXPR_number:
         if( a->u.i == 0 )
            v1 = 0;
         break;
         
      case AST_EXPR_string:
         if( a->u.s == 0 )
            v1 = 0;
         else
         {
            if( a->u.s[0] == 0 )
               v1 = 0;
            else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' )
               v1 = 0;
            else
               v1 = atoi(a->u.s);
         }
         break;
         
      case AST_EXPR_numeric_string:
         if( a->u.s == 0 )
            v1 = 0;
         else
         {
            if( a->u.s[0] == 0 )
               v1 = 0;
            else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' )
               v1 = 0;
            else
               v1 = atoi(a->u.s);
         }
         break;
      }
   }
   
   r = make_number (!v1);
   free_value (a);
   return r;
}
static struct val* op_cond ( struct val a,
struct val b,
struct val c 
) [static, read]

Definition at line 3215 of file ast_expr2.c.

References free_value(), val::i, isstring(), val::s, to_number(), and val::u.

Referenced by yyparse().

{
   struct val *r;

   if( isstring(a) )
   {
      if( strlen(a->u.s) && strcmp(a->u.s, "\"\"") != 0 && strcmp(a->u.s,"0") != 0 )
      {
         free_value(a);
         free_value(c);
         r = b;
      }
      else
      {
         free_value(a);
         free_value(b);
         r = c;
      }
   }
   else
   {
      (void)to_number(a);
      if( a->u.i )
      {
         free_value(a);
         free_value(c);
         r = b;
      }
      else
      {
         free_value(a);
         free_value(b);
         r = c;
      }
   }
   return r;
}
static struct val* op_div ( struct val a,
struct val b 
) [static, read]

Definition at line 3484 of file ast_expr2.c.

References ast_log(), chk_div(), free_value(), val::i, LOG_WARNING, make_number(), to_number(), and val::u.

Referenced by yyparse().

{
   struct val *r;

   if (!to_number (a)) {
      free_value(a);
      free_value(b);
      if( !extra_error_message_supplied )
         ast_log(LOG_WARNING, "non-numeric argument\n");
      return make_number(0);
   } else if (!to_number (b)) {
      free_value(a);
      free_value(b);
      if( !extra_error_message_supplied )
         ast_log(LOG_WARNING, "non-numeric argument\n");
      return make_number(INT_MAX);
   }

   if (b->u.i == 0) {
      ast_log(LOG_WARNING, "division by zero\n");     
      free_value(a);
      free_value(b);
      return make_number(INT_MAX);
   }

   r = make_number (a->u.i / b->u.i);
   if (chk_div (a->u.i, b->u.i)) {
      ast_log(LOG_WARNING, "overflow\n");
   }
   free_value (a);
   free_value (b);
   return r;
}
static struct val* op_eq ( struct val a,
struct val b 
) [static, read]

Definition at line 3108 of file ast_expr2.c.

References ast_log(), FP___TYPE, free_value(), val::i, isstring(), LOG_WARNING, make_number(), val::s, to_number(), to_string(), and val::u.

Referenced by yyparse().

{
   struct val *r; 

   if (isstring (a) || isstring (b)) {
      to_string (a);
      to_string (b); 
      r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) == 0));
   } else {
#ifdef DEBUG_FOR_CONVERSIONS
      char buffer[2000];
      sprintf(buffer,"Converting '%s' and '%s' ", a->u.s, b->u.s);
#endif
      (void)to_number(a);
      (void)to_number(b);
#ifdef DEBUG_FOR_CONVERSIONS
      ast_log(LOG_WARNING,"%s to '%lld' and '%lld'\n", buffer, a->u.i, b->u.i);
#endif
      r = make_number ((FP___TYPE)(a->u.i == b->u.i));
   }

   free_value (a);
   free_value (b);
   return r;
}
static struct val* op_eqtilde ( struct val a,
struct val b 
) [static, read]

Definition at line 3597 of file ast_expr2.c.

References ast_log(), FP___TYPE, free_value(), LOG_WARNING, make_number(), make_str(), val::s, strip_quotes(), to_string(), and val::u.

Referenced by yyparse().

{
   regex_t rp;
   regmatch_t rm[2];
   char errbuf[256];
   int eval;
   struct val *v;

   /* coerce to both arguments to strings */
   to_string(a);
   to_string(b);
   /* strip double quotes from both -- they'll screw up the pattern, and the search string starting at ^ */
   strip_quotes(a);
   strip_quotes(b);
   /* compile regular expression */
   if ((eval = regcomp (&rp, b->u.s, REG_EXTENDED)) != 0) {
      regerror (eval, &rp, errbuf, sizeof(errbuf));
      ast_log(LOG_WARNING, "regcomp() error : %s\n", errbuf);
      free_value(a);
      free_value(b);
      return make_str("");    
   }

   /* compare string against pattern */
   /* remember that patterns are anchored to the beginning of the line */
   if (regexec(&rp, a->u.s, (size_t)2, rm, 0) == 0 ) {
      if (rm[1].rm_so >= 0) {
         *(a->u.s + rm[1].rm_eo) = '\0';
         v = make_str (a->u.s + rm[1].rm_so);

      } else {
         v = make_number ((FP___TYPE)(rm[0].rm_eo - rm[0].rm_so));
      }
   } else {
      if (rp.re_nsub == 0) {
         v = make_number ((FP___TYPE)0.0);
      } else {
         v = make_str ("");
      }
   }

   /* free arguments and pattern buffer */
   free_value (a);
   free_value (b);
   regfree (&rp);

   return v;
}
static struct val * op_func ( struct val funcname,
struct expr_node arglist,
struct ast_channel chan 
) [static, read]

Definition at line 2799 of file ast_expr2.c.

References ast_custom_function_find(), ast_log(), compose_func_args(), f, FP___TYPE, free, val::i, is_really_num(), LOG_ERROR, LOG_WARNING, make_number(), make_str(), ast_custom_function::read, expr_node::right, val::s, to_number(), val::u, and expr_node::val.

Referenced by yyparse().

{
   if (strspn(funcname->u.s,"ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789") == strlen(funcname->u.s))
   {
      struct val *result;
      if (0) {
#ifdef FUNC_COS
      } else if (strcmp(funcname->u.s,"COS") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_COS(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_SIN
      } else if (strcmp(funcname->u.s,"SIN") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_SIN(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_TAN
      } else if (strcmp(funcname->u.s,"TAN") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_TAN(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_ACOS
      } else if (strcmp(funcname->u.s,"ACOS") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_ACOS(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_ASIN
      } else if (strcmp(funcname->u.s,"ASIN") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_ASIN(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_ATAN
      } else if (strcmp(funcname->u.s,"ATAN") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_ATAN(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_ATAN2
      } else if (strcmp(funcname->u.s,"ATAN2") == 0) {
         if (arglist && arglist->right && !arglist->right->right && arglist->val && arglist->right->val){
            to_number(arglist->val);
            to_number(arglist->right->val);
            result = make_number(FUNC_ATAN2(arglist->val->u.i, arglist->right->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_POW
      } else if (strcmp(funcname->u.s,"POW") == 0) {
         if (arglist && arglist->right && !arglist->right->right && arglist->val && arglist->right->val){
            to_number(arglist->val);
            to_number(arglist->right->val);
            result = make_number(FUNC_POW(arglist->val->u.i, arglist->right->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_SQRT
      } else if (strcmp(funcname->u.s,"SQRT") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_SQRT(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_FLOOR
      } else if (strcmp(funcname->u.s,"FLOOR") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_FLOOR(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_CEIL
      } else if (strcmp(funcname->u.s,"CEIL") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_CEIL(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_ROUND
      } else if (strcmp(funcname->u.s,"ROUND") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_ROUND(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif /* defined(FUNC_ROUND) */
#ifdef FUNC_RINT
      } else if (strcmp(funcname->u.s,"RINT") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_RINT(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_TRUNC
      } else if (strcmp(funcname->u.s,"TRUNC") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_TRUNC(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif /* defined(FUNC_TRUNC) */
#ifdef FUNC_EXP
      } else if (strcmp(funcname->u.s,"EXP") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_EXP(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_EXP2
      } else if (strcmp(funcname->u.s,"EXP2") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_EXP2(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_EXP10
      } else if (strcmp(funcname->u.s,"EXP10") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_EXP10(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_LOG
      } else if (strcmp(funcname->u.s,"LOG") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_LOG(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_LOG2
      } else if (strcmp(funcname->u.s,"LOG2") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_LOG2(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_LOG10
      } else if (strcmp(funcname->u.s,"LOG10") == 0) {
         if (arglist && !arglist->right && arglist->val){
            to_number(arglist->val);
            result = make_number(FUNC_LOG10(arglist->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
#ifdef FUNC_REMAINDER
      } else if (strcmp(funcname->u.s,"REMAINDER") == 0) {
         if (arglist && arglist->right && !arglist->right->right && arglist->val && arglist->right->val){
            to_number(arglist->val);
            to_number(arglist->right->val);
            result = make_number(FUNC_REMAINDER(arglist->val->u.i, arglist->right->val->u.i));
            return result;
         } else {
            ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
            return make_number(0.0);
         }
#endif
      } else {
         /* is this a custom function we should execute and collect the results of? */
#if !defined(STANDALONE) && !defined(STANDALONE2)
         struct ast_custom_function *f = ast_custom_function_find(funcname->u.s);
         if (!chan)
            ast_log(LOG_WARNING,"Hey! chan is NULL.\n");
         if (!f)
            ast_log(LOG_WARNING,"Hey! could not find func %s.\n", funcname->u.s);
         
         if (f && chan) {
            if (f->read) {
               char workspace[512];
               char *argbuf = compose_func_args(arglist);
               f->read(chan, funcname->u.s, argbuf, workspace, sizeof(workspace));
               free(argbuf);
               if (is_really_num(workspace))
                  return make_number(FUNC_STRTOD(workspace,(char **)NULL));
               else
                  return make_str(workspace);
            } else {
               ast_log(LOG_ERROR,"Error! Function '%s' cannot be read!\n", funcname->u.s);
               return (make_number ((FP___TYPE)0.0));
            }
            
         } else {
            ast_log(LOG_ERROR, "Error! '%s' doesn't appear to be an available function!\n", funcname->u.s);
            return (make_number ((FP___TYPE)0.0));
         }
#else
         ast_log(LOG_ERROR, "Error! '%s' is not available in the standalone version!\n", funcname->u.s);
         return (make_number ((FP___TYPE)0.0));
#endif
      }
   }
   else
   {
      ast_log(LOG_ERROR, "Error! '%s' is not possibly a function name!\n", funcname->u.s);
      return (make_number ((FP___TYPE)0.0));
   }
   return (make_number ((FP___TYPE)0.0));
}
static struct val* op_ge ( struct val a,
struct val b 
) [static, read]

Definition at line 3175 of file ast_expr2.c.

References FP___TYPE, free_value(), val::i, isstring(), make_number(), val::s, to_number(), to_string(), and val::u.

Referenced by yyparse().

{
   struct val *r;

   if (isstring (a) || isstring (b)) {
      to_string (a);
      to_string (b);
      r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) >= 0));
   } else {
      (void)to_number(a);
      (void)to_number(b);
      r = make_number ((FP___TYPE)(a->u.i >= b->u.i));
   }

   free_value (a);
   free_value (b);
   return r;
}
static struct val* op_gt ( struct val a,
struct val b 
) [static, read]

Definition at line 3135 of file ast_expr2.c.

References FP___TYPE, free_value(), val::i, isstring(), make_number(), val::s, to_number(), to_string(), and val::u.

Referenced by yyparse().

{
   struct val *r;

   if (isstring (a) || isstring (b)) {
      to_string (a);
      to_string (b);
      r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) > 0));
   } else {
      (void)to_number(a);
      (void)to_number(b);
      r = make_number ((FP___TYPE)(a->u.i > b->u.i));
   }

   free_value (a);
   free_value (b);
   return r;
}
static struct val* op_le ( struct val a,
struct val b 
) [static, read]

Definition at line 3195 of file ast_expr2.c.

References FP___TYPE, free_value(), val::i, isstring(), make_number(), val::s, to_number(), to_string(), and val::u.

Referenced by yyparse().

{
   struct val *r;

   if (isstring (a) || isstring (b)) {
      to_string (a);
      to_string (b);
      r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) <= 0));
   } else {
      (void)to_number(a);
      (void)to_number(b);
      r = make_number ((FP___TYPE)(a->u.i <= b->u.i));
   }

   free_value (a);
   free_value (b);
   return r;
}
static struct val* op_lt ( struct val a,
struct val b 
) [static, read]

Definition at line 3155 of file ast_expr2.c.

References FP___TYPE, free_value(), val::i, isstring(), make_number(), val::s, to_number(), to_string(), and val::u.

Referenced by yyparse().

{
   struct val *r;

   if (isstring (a) || isstring (b)) {
      to_string (a);
      to_string (b);
      r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) < 0));
   } else {
      (void)to_number(a);
      (void)to_number(b);
      r = make_number ((FP___TYPE)(a->u.i < b->u.i));
   }

   free_value (a);
   free_value (b);
   return r;
}
static struct val* op_minus ( struct val a,
struct val b 
) [static, read]

Definition at line 3331 of file ast_expr2.c.

References ast_log(), chk_minus(), free_value(), val::i, LOG_WARNING, make_number(), to_number(), and val::u.

Referenced by yyparse().

{
   struct val *r;

   if (!to_number (a)) {
      if( !extra_error_message_supplied )
         ast_log(LOG_WARNING, "non-numeric argument\n");
      if (!to_number (b)) {
         free_value(a);
         free_value(b);
         return make_number(0);
      } else {
         r = make_number(0 - b->u.i);
         free_value(a);
         free_value(b);
         return (r);
      }
   } else if (!to_number(b)) {
      if( !extra_error_message_supplied )
         ast_log(LOG_WARNING, "non-numeric argument\n");
      free_value(b);
      return (a);
   }

   r = make_number (a->u.i - b->u.i);
   if (chk_minus (a->u.i, b->u.i, r->u.i)) {
      ast_log(LOG_WARNING, "overflow\n");
   }
   free_value (a);
   free_value (b);
   return r;
}
static struct val* op_ne ( struct val a,
struct val b 
) [static, read]

Definition at line 3254 of file ast_expr2.c.

References FP___TYPE, free_value(), val::i, isstring(), make_number(), val::s, to_number(), to_string(), and val::u.

Referenced by yyparse().

{
   struct val *r;

   if (isstring (a) || isstring (b)) {
      to_string (a);
      to_string (b);
      r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) != 0));
   } else {
      (void)to_number(a);
      (void)to_number(b);
      r = make_number ((FP___TYPE)(a->u.i != b->u.i));
   }

   free_value (a);
   free_value (b);
   return r;
}
static struct val* op_negate ( struct val a) [static, read]

Definition at line 3365 of file ast_expr2.c.

References ast_log(), chk_minus(), free_value(), val::i, LOG_WARNING, make_number(), to_number(), and val::u.

Referenced by yyparse().

{
   struct val *r;

   if (!to_number (a) ) {
      free_value(a);
      if( !extra_error_message_supplied )
         ast_log(LOG_WARNING, "non-numeric argument\n");
      return make_number(0);
   }

   r = make_number (- a->u.i);
   if (chk_minus (0, a->u.i, r->u.i)) {
      ast_log(LOG_WARNING, "overflow\n");
   }
   free_value (a);
   return r;
}
static struct val* op_or ( struct val a,
struct val b 
) [static, read]

Definition at line 3083 of file ast_expr2.c.

References free_value(), and is_zero_or_null().

Referenced by yyparse().

{
   if (is_zero_or_null (a)) {
      free_value (a);
      return (b);
   } else {
      free_value (b);
      return (a);
   }
}
static struct val* op_plus ( struct val a,
struct val b 
) [static, read]

Definition at line 3287 of file ast_expr2.c.

References ast_log(), chk_plus(), free_value(), val::i, LOG_WARNING, make_number(), to_number(), and val::u.

Referenced by yyparse().

{
   struct val *r;

   if (!to_number (a)) {
      if( !extra_error_message_supplied )
         ast_log(LOG_WARNING,"non-numeric argument\n");
      if (!to_number (b)) {
         free_value(a);
         free_value(b);
         return make_number(0);
      } else {
         free_value(a);
         return (b);
      }
   } else if (!to_number(b)) {
      free_value(b);
      return (a);
   }

   r = make_number (a->u.i + b->u.i);
   if (chk_plus (a->u.i, b->u.i, r->u.i)) {
      ast_log(LOG_WARNING,"overflow\n");
   }
   free_value (a);
   free_value (b);
   return r;
}
static struct val* op_rem ( struct val a,
struct val b 
) [static, read]

Definition at line 3519 of file ast_expr2.c.

References ast_log(), free_value(), val::i, LOG_WARNING, make_number(), to_number(), and val::u.

Referenced by yyparse().

{
   struct val *r;

   if (!to_number (a) || !to_number (b)) {
      if( !extra_error_message_supplied )
         ast_log(LOG_WARNING, "non-numeric argument\n");
      free_value(a);
      free_value(b);
      return make_number(0);
   }

   if (b->u.i == 0) {
      ast_log(LOG_WARNING, "div by zero\n");
      free_value(a);
      return(b);
   }

   r = make_number (FUNC_FMOD(a->u.i, b->u.i)); /* either fmod or fmodl if FP___TYPE is available */
   /* chk_rem necessary ??? */
   free_value (a);
   free_value (b);
   return r;
}
static struct val* op_tildetilde ( struct val a,
struct val b 
) [static, read]

Definition at line 3647 of file ast_expr2.c.

References free_value(), make_str(), malloc, val::s, strip_quotes(), to_string(), and val::u.

Referenced by yyparse().

{
   struct val *v;
   char *vs;

   /* coerce to both arguments to strings */
   to_string(a);
   to_string(b);
   /* strip double quotes from both -- */
   strip_quotes(a);
   strip_quotes(b);
   
   vs = malloc(strlen(a->u.s)+strlen(b->u.s)+1);
   strcpy(vs,a->u.s);
   strcat(vs,b->u.s);

   v = make_str(vs);

   /* free arguments */
   free_value(a);
   free_value(b);

   return v;
}
static struct val* op_times ( struct val a,
struct val b 
) [static, read]

Definition at line 3451 of file ast_expr2.c.

References ast_log(), chk_times(), free_value(), val::i, LOG_WARNING, make_number(), to_number(), and val::u.

Referenced by yyparse().

{
   struct val *r;

   if (!to_number (a) || !to_number (b)) {
      free_value(a);
      free_value(b);
      if( !extra_error_message_supplied )
         ast_log(LOG_WARNING, "non-numeric argument\n");
      return(make_number(0));
   }

   r = make_number (a->u.i * b->u.i);
   if (chk_times (a->u.i, b->u.i, r->u.i)) {
      ast_log(LOG_WARNING, "overflow\n");
   }
   free_value (a);
   free_value (b);
   return (r);
}
static void strip_quotes ( struct val vp) [static]

Definition at line 2606 of file ast_expr2.c.

References AST_EXPR_numeric_string, AST_EXPR_string, f, val::s, val::type, and val::u.

Referenced by op_colon(), op_eqtilde(), and op_tildetilde().

{
   if (vp->type != AST_EXPR_string && vp->type != AST_EXPR_numeric_string)
      return;
   
   if( vp->u.s[0] == '"' && vp->u.s[strlen(vp->u.s)-1] == '"' )
   {
      char *f, *t;
      f = vp->u.s;
      t = vp->u.s;
      
      while( *f )
      {
         if( *f  && *f != '"' )
            *t++ = *f++;
         else
            f++;
      }
      *t = *f;
   }
}
static int to_number ( struct val vp) [static]

Definition at line 2575 of file ast_expr2.c.

References AST_EXPR_number, AST_EXPR_string, ast_log(), errno, FP___TYPE, free, val::i, LOG_WARNING, val::s, val::type, and val::u.

Referenced by is_zero_or_null(), op_cond(), op_div(), op_eq(), op_func(), op_ge(), op_gt(), op_le(), op_lt(), op_minus(), op_ne(), op_negate(), op_plus(), op_rem(), and op_times().

{
   FP___TYPE i;
   
   if (vp == NULL) {
      ast_log(LOG_WARNING,"vp==NULL in to_number()\n");
      return(0);
   }

   if (vp->type == AST_EXPR_number)
      return 1;

   if (vp->type == AST_EXPR_string)
      return 0;

   /* vp->type == AST_EXPR_numeric_string, make it numeric */
   errno = 0;
   i  = FUNC_STRTOD(vp->u.s, (char**)0); /* either strtod, or strtold on a good day */
   if (errno != 0) {
      ast_log(LOG_WARNING,"Conversion of %s to number under/overflowed!\n", vp->u.s);
      free(vp->u.s);
      vp->u.s = 0;
      return(0);
   }
   free (vp->u.s);
   vp->u.i = i;
   vp->type = AST_EXPR_number;
   return 1;
}
static void to_string ( struct val vp) [static]

Definition at line 2629 of file ast_expr2.c.

References AST_EXPR_numeric_string, AST_EXPR_string, ast_log(), FP___PRINTF, val::i, LOG_WARNING, malloc, val::s, val::type, and val::u.

Referenced by op_colon(), op_eq(), op_eqtilde(), op_ge(), op_gt(), op_le(), op_lt(), op_ne(), and op_tildetilde().

{
   char *tmp;

   if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)
      return;

   tmp = malloc ((size_t)25);
   if (tmp == NULL) {
      ast_log(LOG_WARNING,"malloc() failed\n");
      return;
   }

   sprintf(tmp, FP___PRINTF, vp->u.i);
   vp->type = AST_EXPR_string;
   vp->u.s  = tmp;
}
static void yydestruct ( char *  yymsg,
int  yytype,
YYSTYPE yyvaluep,
YYLTYPE yylocationp 
) const [static]

Definition at line 1455 of file ast_expr2.c.

References free_value(), YYSTYPE::val, YY_SYMBOL_PRINT, and YYUSE.

Referenced by yyparse().

{
  YYUSE (yyvaluep);
  YYUSE (yylocationp);

  if (!yymsg)
    yymsg = "Deleting";
  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);

  switch (yytype)
    {
      case 4: /* "TOK_COLONCOLON" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1479 "ast_expr2.c"
   break;
      case 5: /* "TOK_COND" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1488 "ast_expr2.c"
   break;
      case 6: /* "TOK_OR" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1497 "ast_expr2.c"
   break;
      case 7: /* "TOK_AND" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1506 "ast_expr2.c"
   break;
      case 8: /* "TOK_NE" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1515 "ast_expr2.c"
   break;
      case 9: /* "TOK_LE" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1524 "ast_expr2.c"
   break;
      case 10: /* "TOK_GE" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1533 "ast_expr2.c"
   break;
      case 11: /* "TOK_LT" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1542 "ast_expr2.c"
   break;
      case 12: /* "TOK_GT" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1551 "ast_expr2.c"
   break;
      case 13: /* "TOK_EQ" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1560 "ast_expr2.c"
   break;
      case 14: /* "TOK_MINUS" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1569 "ast_expr2.c"
   break;
      case 15: /* "TOK_PLUS" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1578 "ast_expr2.c"
   break;
      case 16: /* "TOK_MOD" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1587 "ast_expr2.c"
   break;
      case 17: /* "TOK_DIV" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1596 "ast_expr2.c"
   break;
      case 18: /* "TOK_MULT" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1605 "ast_expr2.c"
   break;
      case 19: /* "TOK_COMPL" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1614 "ast_expr2.c"
   break;
      case 20: /* "TOK_TILDETILDE" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1623 "ast_expr2.c"
   break;
      case 21: /* "TOK_EQTILDE" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1632 "ast_expr2.c"
   break;
      case 22: /* "TOK_COLON" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1641 "ast_expr2.c"
   break;
      case 23: /* "TOK_LP" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1650 "ast_expr2.c"
   break;
      case 24: /* "TOK_RP" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1659 "ast_expr2.c"
   break;
      case 25: /* "TOKEN" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1668 "ast_expr2.c"
   break;
      case 29: /* "expr" */

/* Line 1000 of yacc.c  */
#line 368 "ast_expr2.y"
   {  free_value((yyvaluep->val)); };

/* Line 1000 of yacc.c  */
#line 1677 "ast_expr2.c"
   break;

      default:
   break;
    }
}
int yyparse ( void *  YYPARSE_PARAM)

Definition at line 1714 of file ast_expr2.c.

References alloc_expr_node(), YYSTYPE::arglist, AST_EXPR_NODE_VAL, AST_EXPR_number, AST_EXPR_string, calloc, chan, DESTROY, destroy_arglist(), YYLTYPE::first_column, YYLTYPE::first_line, free, val::i, YYLTYPE::last_column, YYLTYPE::last_line, make_str(), op_and(), op_colon(), op_compl(), op_cond(), op_div(), op_eq(), op_eqtilde(), op_func(), op_ge(), op_gt(), op_le(), op_lt(), op_minus(), op_ne(), op_negate(), op_or(), op_plus(), op_rem(), op_tildetilde(), op_times(), expr_node::right, val::s, strdup, type, val::u, expr_node::val, YYSTYPE::val, YY_, YY_REDUCE_PRINT, YY_STACK_PRINT, YY_SYMBOL_PRINT, YYABORT, YYACCEPT, yychar, yydestruct(), YYDPRINTF, YYEMPTY, YYEOF, yyerror, YYFINAL, YYID, YYINITDEPTH, YYLAST, YYLEX, yylloc, YYLLOC_DEFAULT, yyalloc::yyls_alloc, yylval, YYMAXDEPTH, yynerrs, YYNTOKENS, YYPACT_NINF, YYPOPSTACK, YYSIZE_T, yyalloc::yyss_alloc, YYSTACK_ALLOC, YYSTACK_ALLOC_MAXIMUM, YYSTACK_BYTES, YYSTACK_FREE, YYSTACK_RELOCATE, yysyntax_error(), YYTABLE_NINF, YYTERROR, YYTRANSLATE, and yyalloc::yyvs_alloc.

{
/* The lookahead symbol.  */
int yychar;

/* The semantic value of the lookahead symbol.  */
YYSTYPE yylval;

/* Location data for the lookahead symbol.  */
YYLTYPE yylloc;

    /* Number of syntax errors so far.  */
    int yynerrs;

    int yystate;
    /* Number of tokens to shift before error messages enabled.  */
    int yyerrstatus;

    /* The stacks and their tools:
       `yyss': related to states.
       `yyvs': related to semantic values.
       `yyls': related to locations.

       Refer to the stacks thru separate pointers, to allow yyoverflow
       to reallocate them elsewhere.  */

    /* The state stack.  */
    yytype_int16 yyssa[YYINITDEPTH];
    yytype_int16 *yyss;
    yytype_int16 *yyssp;

    /* The semantic value stack.  */
    YYSTYPE yyvsa[YYINITDEPTH];
    YYSTYPE *yyvs;
    YYSTYPE *yyvsp;

    /* The location stack.  */
    YYLTYPE yylsa[YYINITDEPTH];
    YYLTYPE *yyls;
    YYLTYPE *yylsp;

    /* The locations where the error started and ended.  */
    YYLTYPE yyerror_range[2];

    YYSIZE_T yystacksize;

  int yyn;
  int yyresult;
  /* Lookahead token as an internal (translated) token number.  */
  int yytoken;
  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;
  YYLTYPE yyloc;

#if YYERROR_VERBOSE
  /* Buffer for error messages, and its allocated size.  */
  char yymsgbuf[128];
  char *yymsg = yymsgbuf;
  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif

#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))

  /* The number of symbols on the RHS of the reduced rule.
     Keep to zero when no symbol should be popped.  */
  int yylen = 0;

  yytoken = 0;
  yyss = yyssa;
  yyvs = yyvsa;
  yyls = yylsa;
  yystacksize = YYINITDEPTH;

  YYDPRINTF ((stderr, "Starting parse\n"));

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY; /* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */
  yyssp = yyss;
  yyvsp = yyvs;
  yylsp = yyls;

#if YYLTYPE_IS_TRIVIAL
  /* Initialize the default location before parsing starts.  */
  yylloc.first_line   = yylloc.last_line   = 1;
  yylloc.first_column = yylloc.last_column = 1;
#endif

  goto yysetstate;

/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate.  |
`------------------------------------------------------------*/
 yynewstate:
  /* In all cases, when you get here, the value and location stacks
     have just been pushed.  So pushing a state here evens the stacks.  */
  yyssp++;

 yysetstate:
  *yyssp = yystate;

  if (yyss + yystacksize - 1 <= yyssp)
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYSIZE_T yysize = yyssp - yyss + 1;

#ifdef yyoverflow
      {
   /* Give user a chance to reallocate the stack.  Use copies of
      these so that the &'s don't force the real ones into
      memory.  */
   YYSTYPE *yyvs1 = yyvs;
   yytype_int16 *yyss1 = yyss;
   YYLTYPE *yyls1 = yyls;

   /* Each stack pointer address is followed by the size of the
      data in use in that stack, in bytes.  This used to be a
      conditional around just the two extra args, but that might
      be undefined if yyoverflow is a macro.  */
   yyoverflow (YY_("memory exhausted"),
          &yyss1, yysize * sizeof (*yyssp),
          &yyvs1, yysize * sizeof (*yyvsp),
          &yyls1, yysize * sizeof (*yylsp),
          &yystacksize);

   yyls = yyls1;
   yyss = yyss1;
   yyvs = yyvs1;
      }
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
      goto yyexhaustedlab;
# else
      /* Extend the stack our own way.  */
      if (YYMAXDEPTH <= yystacksize)
   goto yyexhaustedlab;
      yystacksize *= 2;
      if (YYMAXDEPTH < yystacksize)
   yystacksize = YYMAXDEPTH;

      {
   yytype_int16 *yyss1 = yyss;
   union yyalloc *yyptr =
     (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
   if (! yyptr)
     goto yyexhaustedlab;
   YYSTACK_RELOCATE (yyss_alloc, yyss);
   YYSTACK_RELOCATE (yyvs_alloc, yyvs);
   YYSTACK_RELOCATE (yyls_alloc, yyls);
#  undef YYSTACK_RELOCATE
   if (yyss1 != yyssa)
     YYSTACK_FREE (yyss1);
      }
# endif
#endif /* no yyoverflow */

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;
      yylsp = yyls + yysize - 1;

      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
        (unsigned long int) yystacksize));

      if (yyss + yystacksize - 1 <= yyssp)
   YYABORT;
    }

  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

  if (yystate == YYFINAL)
    YYACCEPT;

  goto yybackup;

/*-----------.
| yybackup.  |
`-----------*/
yybackup:

  /* Do appropriate processing given the current state.  Read a
     lookahead token if we need one and don't already have one.  */

  /* First try to decide what to do without reference to lookahead token.  */
  yyn = yypact[yystate];
  if (yyn == YYPACT_NINF)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = YYLEX;
    }

  if (yychar <= YYEOF)
    {
      yychar = yytoken = YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
    }

  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yyn == 0 || yyn == YYTABLE_NINF)
   goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;

  /* Shift the lookahead token.  */
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);

  /* Discard the shifted token.  */
  yychar = YYEMPTY;

  yystate = yyn;
  *++yyvsp = yylval;
  *++yylsp = yylloc;
  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- Do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     `$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];

  /* Default location.  */
  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
        case 2:

/* Line 1455 of yacc.c  */
#line 374 "ast_expr2.y"
    { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
              ((struct parse_io *)parseio)->val->type = (yyvsp[(1) - (1)].val)->type;
              if( (yyvsp[(1) - (1)].val)->type == AST_EXPR_number )
              ((struct parse_io *)parseio)->val->u.i = (yyvsp[(1) - (1)].val)->u.i;
              else
              ((struct parse_io *)parseio)->val->u.s = (yyvsp[(1) - (1)].val)->u.s; 
           free((yyvsp[(1) - (1)].val));
         ;}
    break;

  case 3:

/* Line 1455 of yacc.c  */
#line 382 "ast_expr2.y"
    {/* nothing */ ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
              ((struct parse_io *)parseio)->val->type = AST_EXPR_string;
           ((struct parse_io *)parseio)->val->u.s = strdup(""); 
         ;}
    break;

  case 4:

/* Line 1455 of yacc.c  */
#line 389 "ast_expr2.y"
    { (yyval.arglist) = alloc_expr_node(AST_EXPR_NODE_VAL); (yyval.arglist)->val = (yyvsp[(1) - (1)].val);;}
    break;

  case 5:

/* Line 1455 of yacc.c  */
#line 390 "ast_expr2.y"
    {struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL);
                                 struct expr_node *t;
                         DESTROY((yyvsp[(2) - (3)].val));
                                 for (t=(yyvsp[(1) - (3)].arglist);t->right;t=t->right)
                                ;
                                 (yyval.arglist) = (yyvsp[(1) - (3)].arglist); t->right = x; x->val = (yyvsp[(3) - (3)].val);;}
    break;

  case 6:

/* Line 1455 of yacc.c  */
#line 396 "ast_expr2.y"
    {struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL);
                                 struct expr_node *t;  /* NULL args should OK */
                         DESTROY((yyvsp[(2) - (2)].val));
                                 for (t=(yyvsp[(1) - (2)].arglist);t->right;t=t->right)
                                ;
                                 (yyval.arglist) = (yyvsp[(1) - (2)].arglist); t->right = x; x->val = make_str("");;}
    break;

  case 7:

/* Line 1455 of yacc.c  */
#line 405 "ast_expr2.y"
    { (yyval.val) = op_func((yyvsp[(1) - (4)].val),(yyvsp[(3) - (4)].arglist), ((struct parse_io *)parseio)->chan);
                                  DESTROY((yyvsp[(2) - (4)].val));
                           DESTROY((yyvsp[(4) - (4)].val));
                           DESTROY((yyvsp[(1) - (4)].val));
                           destroy_arglist((yyvsp[(3) - (4)].arglist));
                                  ;}
    break;

  case 8:

/* Line 1455 of yacc.c  */
#line 411 "ast_expr2.y"
    {(yyval.val) = (yyvsp[(1) - (1)].val);;}
    break;

  case 9:

/* Line 1455 of yacc.c  */
#line 412 "ast_expr2.y"
    { (yyval.val) = (yyvsp[(2) - (3)].val);
                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
                     (yyloc).first_line=0; (yyloc).last_line=0;
                     DESTROY((yyvsp[(1) - (3)].val)); DESTROY((yyvsp[(3) - (3)].val)); ;}
    break;

  case 10:

/* Line 1455 of yacc.c  */
#line 416 "ast_expr2.y"
    { (yyval.val) = op_or ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
                  DESTROY((yyvsp[(2) - (3)].val)); 
                         (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
                   (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 11:

/* Line 1455 of yacc.c  */
#line 420 "ast_expr2.y"
    { (yyval.val) = op_and ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
                  DESTROY((yyvsp[(2) - (3)].val)); 
                         (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
                          (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 12:

/* Line 1455 of yacc.c  */
#line 424 "ast_expr2.y"
    { (yyval.val) = op_eq ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
                  DESTROY((yyvsp[(2) - (3)].val)); 
                        (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
                   (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 13:

/* Line 1455 of yacc.c  */
#line 428 "ast_expr2.y"
    { (yyval.val) = op_gt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
                  DESTROY((yyvsp[(2) - (3)].val)); 
                         (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
                   (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 14:

/* Line 1455 of yacc.c  */
#line 432 "ast_expr2.y"
    { (yyval.val) = op_lt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
                  DESTROY((yyvsp[(2) - (3)].val)); 
                        (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
                   (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 15:

/* Line 1455 of yacc.c  */
#line 436 "ast_expr2.y"
    { (yyval.val) = op_ge ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
                  DESTROY((yyvsp[(2) - (3)].val)); 
                         (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
                    (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 16:

/* Line 1455 of yacc.c  */
#line 440 "ast_expr2.y"
    { (yyval.val) = op_le ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
                  DESTROY((yyvsp[(2) - (3)].val)); 
                         (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
                    (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 17:

/* Line 1455 of yacc.c  */
#line 444 "ast_expr2.y"
    { (yyval.val) = op_ne ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
                  DESTROY((yyvsp[(2) - (3)].val)); 
                         (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
                    (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 18:

/* Line 1455 of yacc.c  */
#line 448 "ast_expr2.y"
    { (yyval.val) = op_plus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
                  DESTROY((yyvsp[(2) - (3)].val)); 
                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
                     (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 19:

/* Line 1455 of yacc.c  */
#line 452 "ast_expr2.y"
    { (yyval.val) = op_minus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
                  DESTROY((yyvsp[(2) - (3)].val)); 
                           (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
                     (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 20:

/* Line 1455 of yacc.c  */
#line 456 "ast_expr2.y"
    { (yyval.val) = op_negate ((yyvsp[(2) - (2)].val)); 
                  DESTROY((yyvsp[(1) - (2)].val)); 
                           (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column; 
                     (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 21:

/* Line 1455 of yacc.c  */
#line 460 "ast_expr2.y"
    { (yyval.val) = op_compl ((yyvsp[(2) - (2)].val)); 
                  DESTROY((yyvsp[(1) - (2)].val)); 
                           (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column; 
                     (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 22:

/* Line 1455 of yacc.c  */
#line 464 "ast_expr2.y"
    { (yyval.val) = op_times ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
                  DESTROY((yyvsp[(2) - (3)].val)); 
                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
                     (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 23:

/* Line 1455 of yacc.c  */
#line 468 "ast_expr2.y"
    { (yyval.val) = op_div ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
                  DESTROY((yyvsp[(2) - (3)].val)); 
                         (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
                    (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 24:

/* Line 1455 of yacc.c  */
#line 472 "ast_expr2.y"
    { (yyval.val) = op_rem ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
                  DESTROY((yyvsp[(2) - (3)].val)); 
                         (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
                    (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 25:

/* Line 1455 of yacc.c  */
#line 476 "ast_expr2.y"
    { (yyval.val) = op_colon ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
                  DESTROY((yyvsp[(2) - (3)].val)); 
                           (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
                     (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 26:

/* Line 1455 of yacc.c  */
#line 480 "ast_expr2.y"
    { (yyval.val) = op_eqtilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
                  DESTROY((yyvsp[(2) - (3)].val)); 
                           (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
                     (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 27:

/* Line 1455 of yacc.c  */
#line 484 "ast_expr2.y"
    { (yyval.val) = op_cond ((yyvsp[(1) - (5)].val), (yyvsp[(3) - (5)].val), (yyvsp[(5) - (5)].val)); 
                  DESTROY((yyvsp[(2) - (5)].val)); 
                  DESTROY((yyvsp[(4) - (5)].val)); 
                           (yyloc).first_column = (yylsp[(1) - (5)]).first_column; (yyloc).last_column = (yylsp[(3) - (5)]).last_column; 
                     (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;

  case 28:

/* Line 1455 of yacc.c  */
#line 489 "ast_expr2.y"
    { (yyval.val) = op_tildetilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
                  DESTROY((yyvsp[(2) - (3)].val)); 
                           (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
                     (yyloc).first_line=0; (yyloc).last_line=0;;}
    break;



/* Line 1455 of yacc.c  */
#line 2283 "ast_expr2.c"
      default: break;
    }
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);

  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);

  *++yyvsp = yyval;
  *++yylsp = yyloc;

  /* Now `shift' the result of the reduction.  Determine what state
     that goes to, based on the state we popped back to and the rule
     number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTOKENS];

  goto yynewstate;


/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
#if ! YYERROR_VERBOSE
      yyerror (YY_("syntax error"));
#else
      {
   YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
   if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
     {
       YYSIZE_T yyalloc = 2 * yysize;
       if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
         yyalloc = YYSTACK_ALLOC_MAXIMUM;
       if (yymsg != yymsgbuf)
         YYSTACK_FREE (yymsg);
       yymsg = (char *) YYSTACK_ALLOC (yyalloc);
       if (yymsg)
         yymsg_alloc = yyalloc;
       else
         {
      yymsg = yymsgbuf;
      yymsg_alloc = sizeof yymsgbuf;
         }
     }

   if (0 < yysize && yysize <= yymsg_alloc)
     {
       (void) yysyntax_error (yymsg, yystate, yychar);
       yyerror (yymsg);
     }
   else
     {
       yyerror (YY_("syntax error"));
       if (yysize != 0)
         goto yyexhaustedlab;
     }
      }
#endif
    }

  yyerror_range[0] = yylloc;

  if (yyerrstatus == 3)
    {
      /* If just tried and failed to reuse lookahead token after an
    error, discard it.  */

      if (yychar <= YYEOF)
   {
     /* Return failure if at end of input.  */
     if (yychar == YYEOF)
       YYABORT;
   }
      else
   {
     yydestruct ("Error: discarding",
            yytoken, &yylval, &yylloc);
     yychar = YYEMPTY;
   }
    }

  /* Else will try to reuse lookahead token after shifting the error
     token.  */
  goto yyerrlab1;


/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:

  /* Pacify compilers like GCC when the user code never invokes
     YYERROR and the label yyerrorlab therefore never appears in user
     code.  */
  if (/*CONSTCOND*/ 0)
     goto yyerrorlab;

  yyerror_range[0] = yylsp[1-yylen];
  /* Do not reclaim the symbols of the rule which action triggered
     this YYERROR.  */
  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);
  yystate = *yyssp;
  goto yyerrlab1;


/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
`-------------------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;   /* Each real token shifted decrements this.  */

  for (;;)
    {
      yyn = yypact[yystate];
      if (yyn != YYPACT_NINF)
   {
     yyn += YYTERROR;
     if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
       {
         yyn = yytable[yyn];
         if (0 < yyn)
      break;
       }
   }

      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
   YYABORT;

      yyerror_range[0] = *yylsp;
      yydestruct ("Error: popping",
        yystos[yystate], yyvsp, yylsp);
      YYPOPSTACK (1);
      yystate = *yyssp;
      YY_STACK_PRINT (yyss, yyssp);
    }

  *++yyvsp = yylval;

  yyerror_range[1] = yylloc;
  /* Using YYLLOC is tempting, but would change the location of
     the lookahead.  YYLOC is available though.  */
  YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
  *++yylsp = yyloc;

  /* Shift the error token.  */
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);

  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;

/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;

#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here.  |
`-------------------------------------------------*/
yyexhaustedlab:
  yyerror (YY_("memory exhausted"));
  yyresult = 2;
  /* Fall through.  */
#endif

yyreturn:
  if (yychar != YYEMPTY)
     yydestruct ("Cleanup: discarding lookahead",
       yytoken, &yylval, &yylloc);
  /* Do not reclaim the symbols of the rule which action triggered
     this YYABORT or YYACCEPT.  */
  YYPOPSTACK (yylen);
  YY_STACK_PRINT (yyss, yyssp);
  while (yyssp != yyss)
    {
      yydestruct ("Cleanup: popping",
        yystos[*yyssp], yyvsp, yylsp);
      YYPOPSTACK (1);
    }
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
  if (yymsg != yymsgbuf)
    YYSTACK_FREE (yymsg);
#endif
  /* Make sure YYID is used.  */
  return YYID (yyresult);
}
int yyparse ( )
static char* yystpcpy ( char *  yydest,
const char *  yysrc 
) [static]

Definition at line 1270 of file ast_expr2.c.

Referenced by yysyntax_error(), and yytnamerr().

{
  char *yyd = yydest;
  const char *yys = yysrc;

  while ((*yyd++ = *yys++) != '\0')
    continue;

  return yyd - 1;
}
static YYSIZE_T yystrlen ( char *  yystr) const [static]

Definition at line 1246 of file ast_expr2.c.

References YYSIZE_T.

Referenced by yysyntax_error(), and yytnamerr().

{
  YYSIZE_T yylen;
  for (yylen = 0; yystr[yylen]; yylen++)
    continue;
  return yylen;
}
static YYSIZE_T yysyntax_error ( char *  yyresult,
int  yystate,
int  yychar 
) [static]

Definition at line 1342 of file ast_expr2.c.

References YY_, YYLAST, YYNTOKENS, YYPACT_NINF, YYSIZE_MAXIMUM, YYSIZE_T, yystpcpy(), yystrlen(), YYTERROR, yytnamerr(), and YYTRANSLATE.

Referenced by yyparse().

{
  int yyn = yypact[yystate];

  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
    return 0;
  else
    {
      int yytype = YYTRANSLATE (yychar);
      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
      YYSIZE_T yysize = yysize0;
      YYSIZE_T yysize1;
      int yysize_overflow = 0;
      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
      int yyx;

# if 0
      /* This is so xgettext sees the translatable formats that are
    constructed on the fly.  */
      YY_("syntax error, unexpected %s");
      YY_("syntax error, unexpected %s, expecting %s");
      YY_("syntax error, unexpected %s, expecting %s or %s");
      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
# endif
      char *yyfmt;
      char const *yyf;
      static char const yyunexpected[] = "syntax error, unexpected %s";
      static char const yyexpecting[] = ", expecting %s";
      static char const yyor[] = " or %s";
      char yyformat[sizeof yyunexpected
          + sizeof yyexpecting - 1
          + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
             * (sizeof yyor - 1))];
      char const *yyprefix = yyexpecting;

      /* Start YYX at -YYN if negative to avoid negative indexes in
    YYCHECK.  */
      int yyxbegin = yyn < 0 ? -yyn : 0;

      /* Stay within bounds of both yycheck and yytname.  */
      int yychecklim = YYLAST - yyn + 1;
      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
      int yycount = 1;

      yyarg[0] = yytname[yytype];
      yyfmt = yystpcpy (yyformat, yyunexpected);

      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
   if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
     {
       if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
         {
      yycount = 1;
      yysize = yysize0;
      yyformat[sizeof yyunexpected - 1] = '\0';
      break;
         }
       yyarg[yycount++] = yytname[yyx];
       yysize1 = yysize + yytnamerr (0, yytname[yyx]);
       yysize_overflow |= (yysize1 < yysize);
       yysize = yysize1;
       yyfmt = yystpcpy (yyfmt, yyprefix);
       yyprefix = yyor;
     }

      yyf = YY_(yyformat);
      yysize1 = yysize + yystrlen (yyf);
      yysize_overflow |= (yysize1 < yysize);
      yysize = yysize1;

      if (yysize_overflow)
   return YYSIZE_MAXIMUM;

      if (yyresult)
   {
     /* Avoid sprintf, as that infringes on the user's name space.
        Don't have undefined behavior even if the translation
        produced a string with the wrong number of "%s"s.  */
     char *yyp = yyresult;
     int yyi = 0;
     while ((*yyp = *yyf) != '\0')
       {
         if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
      {
        yyp += yytnamerr (yyp, yyarg[yyi++]);
        yyf += 2;
      }
         else
      {
        yyp++;
        yyf++;
      }
       }
   }
      return yysize;
    }
}
static YYSIZE_T yytnamerr ( char *  yyres,
const char *  yystr 
) [static]

Definition at line 1295 of file ast_expr2.c.

References YYSIZE_T, yystpcpy(), and yystrlen().

Referenced by yysyntax_error().

{
  if (*yystr == '"')
    {
      YYSIZE_T yyn = 0;
      char const *yyp = yystr;

      for (;;)
   switch (*++yyp)
     {
     case '\'':
     case ',':
       goto do_not_strip_quotes;

     case '\\':
       if (*++yyp != '\\')
         goto do_not_strip_quotes;
       /* Fall through.  */
     default:
       if (yyres)
         yyres[yyn] = *yyp;
       yyn++;
       break;

     case '"':
       if (yyres)
         yyres[yyn] = '\0';
       return yyn;
     }
    do_not_strip_quotes: ;
    }

  if (! yyres)
    return yystrlen (yystr);

  return yystpcpy (yyres, yystr) - yyres;
}

Variable Documentation

char extra_error_message[4095]

Definition at line 2445 of file ast_expr2f.c.

Definition at line 2446 of file ast_expr2f.c.

const yytype_int8 yycheck[] [static]

Definition at line 923 of file ast_expr2.c.

const yytype_uint8 yydefact[] [static]

Definition at line 863 of file ast_expr2.c.

const yytype_int8 yydefgoto[] [static]
Initial value:
{
      -1,     5,    30,     6
}

Definition at line 874 of file ast_expr2.c.

const yytype_int16 yypact[] [static]

Definition at line 882 of file ast_expr2.c.

const yytype_int8 yypgoto[] [static]
Initial value:
{
     -18,   -18,   -18,    -1
}

Definition at line 893 of file ast_expr2.c.

const yytype_uint8 yyr1[] [static]

Definition at line 845 of file ast_expr2.c.

const yytype_uint8 yyr2[] [static]

Definition at line 853 of file ast_expr2.c.

const yytype_uint8 yystos[] [static]

Definition at line 945 of file ast_expr2.c.

const yytype_uint8 yytable[] [static]

Definition at line 903 of file ast_expr2.c.

const char* const yytname[] [static]

Definition at line 823 of file ast_expr2.c.

const yytype_uint8 yytranslate[] [static]

Definition at line 752 of file ast_expr2.c.