Wed Oct 28 15:48:20 2009

Asterisk developer's documentation


ast_expr2.c File Reference

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <regex.h>
#include <limits.h>
#include <asterisk/ast_expr.h>
#include <asterisk/logger.h>

Include dependency graph for ast_expr2.c:

Go to the source code of this file.

Data Structures

struct  parse_io
struct  val
union  yyalloc
struct  yyltype
union  YYSTYPE

Defines

#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)
#define QUAD_MAX   (0x7fffffffffffffffLL)
#define QUAD_MIN   (-0x7fffffffffffffffLL-1)
#define TOK_AND   261
#define TOK_COLON   275
#define TOK_COLONCOLON   258
#define TOK_COMPL   273
#define TOK_COND   259
#define TOK_DIV   271
#define TOK_EQ   267
#define TOK_EQTILDE   274
#define TOK_GE   264
#define TOK_GT   266
#define TOK_LE   263
#define TOK_LP   276
#define TOK_LT   265
#define TOK_MINUS   268
#define TOK_MOD   270
#define TOK_MULT   272
#define TOK_NE   262
#define TOK_OR   260
#define TOK_PLUS   269
#define TOK_RP   277
#define TOKEN   278
#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 yychar   ast_yychar
#define yyclearin   (yychar = YYEMPTY)
#define YYCOPY(To, From, Count)
#define YYDEBUG   0
#define yydebug   ast_yydebug
#define YYDPRINTF(Args)
#define YYEMPTY   (-2)
#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   10
#define YYFREE   free
#define YYINITDEPTH   200
#define YYLAST   140
#define YYLEX   yylex (&yylval, &yylloc, YYLEX_PARAM)
#define yylex   ast_yylex
#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   278
#define yynerrs   ast_yynerrs
#define YYNNTS   3
#define YYNRULES   22
#define YYNSTATES   46
#define YYNTOKENS   24
#define YYPACT_NINF   -13
#define yyparse   ast_yyparse
#define YYPARSE_PARAM   parseio
#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
#define YYPURE   1
#define YYRECOVERING()   (!!yyerrstatus)
#define YYRHSLOC(Rhs, K)   ((Rhs)[K])
#define YYSIZE_T   unsigned int
#define YYSKELETON_NAME   "yacc.c"
#define YYSTACK_ALLOC   YYMALLOC
#define YYSTACK_BYTES(N)
#define YYSTACK_FREE   YYFREE
#define YYSTACK_GAP_MAXIMUM   (sizeof (union yyalloc) - 1)
#define YYSTACK_RELOCATE(Stack)
#define yystype   YYSTYPE
#define YYSTYPE_IS_DECLARED   1
#define YYSTYPE_IS_TRIVIAL   1
#define YYTABLE_NINF   -1
#define YYTERROR   1
#define YYTRANSLATE(YYX)   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
#define YYUNDEFTOK   2

Typedefs

typedef void * yyscan_t
typedef short int yysigned_char

Enumerations

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

Functions

int ast_yylex __P ((YYSTYPE *, YYLTYPE *, yyscan_t))
static struct val *op_cond __P ((struct val *, struct val *, struct val *))
static struct val *op_and __P ((struct val *, struct val *))
static struct val *make_str __P ((const char *))
static struct val *make_integer __P ((quad_t))
static void free_value __P ((struct val *))
static int chk_minus __P ((quad_t, quad_t, quad_t))
static int chk_div __P ((quad_t, quad_t))
int ast_yyerror (const char *, YYLTYPE *, struct parse_io *)
static int chk_div (quad_t a, quad_t b)
static int chk_minus (quad_t a, quad_t b, quad_t r)
static int chk_plus (quad_t a, quad_t b, quad_t r)
static int chk_times (quad_t a, quad_t b, quad_t r)
static void free_value (struct val *vp)
static int is_zero_or_null (struct val *vp)
static int isstring (struct val *vp)
static struct valmake_integer (quad_t 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_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_times (struct val *a, struct val *b)
static void strip_quotes (struct val *vp)
static quad_t to_integer (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

Variables

static const yysigned_char yycheck []
static const unsigned char yydefact []
static const yysigned_char yydefgoto []
static const yysigned_char yypact []
static const yysigned_char yypgoto []
static const unsigned char yyr1 []
static const unsigned char yyr2 []
static const unsigned char yystos []
static const unsigned char yytable []
static const char *const yytname []
static const unsigned char yytranslate []


Define Documentation

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

Definition at line 1860 of file ast_expr2.c.

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

Definition at line 1860 of file ast_expr2.c.

#define DESTROY (  ) 

Definition at line 240 of file ast_expr2.c.

Referenced by yyparse().

#define QUAD_MAX   (0x7fffffffffffffffLL)

Definition at line 156 of file ast_expr2.c.

#define QUAD_MIN   (-0x7fffffffffffffffLL-1)

Definition at line 153 of file ast_expr2.c.

Referenced by chk_div(), and chk_minus().

#define TOK_AND   261

Definition at line 90 of file ast_expr2.c.

#define TOK_COLON   275

Definition at line 104 of file ast_expr2.c.

#define TOK_COLONCOLON   258

Definition at line 87 of file ast_expr2.c.

#define TOK_COMPL   273

Definition at line 102 of file ast_expr2.c.

#define TOK_COND   259

Definition at line 88 of file ast_expr2.c.

#define TOK_DIV   271

Definition at line 100 of file ast_expr2.c.

#define TOK_EQ   267

Definition at line 96 of file ast_expr2.c.

#define TOK_EQTILDE   274

Definition at line 103 of file ast_expr2.c.

#define TOK_GE   264

Definition at line 93 of file ast_expr2.c.

#define TOK_GT   266

Definition at line 95 of file ast_expr2.c.

#define TOK_LE   263

Definition at line 92 of file ast_expr2.c.

#define TOK_LP   276

Definition at line 105 of file ast_expr2.c.

#define TOK_LT   265

Definition at line 94 of file ast_expr2.c.

#define TOK_MINUS   268

Definition at line 97 of file ast_expr2.c.

#define TOK_MOD   270

Definition at line 99 of file ast_expr2.c.

#define TOK_MULT   272

Definition at line 101 of file ast_expr2.c.

#define TOK_NE   262

Definition at line 91 of file ast_expr2.c.

#define TOK_OR   260

Definition at line 89 of file ast_expr2.c.

#define TOK_PLUS   269

Definition at line 98 of file ast_expr2.c.

#define TOK_RP   277

Definition at line 106 of file ast_expr2.c.

#define TOKEN   278

Definition at line 107 of file ast_expr2.c.

#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 700 of file ast_expr2.c.

#define YY_REDUCE_PRINT ( Rule   ) 

Definition at line 807 of file ast_expr2.c.

Referenced by yyparse().

#define YY_STACK_PRINT ( Bottom,
Top   ) 

Definition at line 806 of file ast_expr2.c.

Referenced by yyparse().

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

Definition at line 805 of file ast_expr2.c.

Referenced by yydestruct(), and yyparse().

#define YYABORT   goto yyabortlab

Definition at line 634 of file ast_expr2.c.

Referenced by yyparse().

#define YYACCEPT   goto yyacceptlab

Definition at line 633 of file ast_expr2.c.

Referenced by yyparse().

#define YYBACKUP ( Token,
Value   ) 

Definition at line 646 of file ast_expr2.c.

#define YYBISON   1

Definition at line 37 of file ast_expr2.c.

#define yychar   ast_yychar

Definition at line 53 of file ast_expr2.c.

Referenced by yyparse().

#define yyclearin   (yychar = YYEMPTY)

Definition at line 629 of file ast_expr2.c.

#define YYCOPY ( To,
From,
Count   ) 

Definition at line 360 of file ast_expr2.c.

#define YYDEBUG   0

Definition at line 250 of file ast_expr2.c.

#define yydebug   ast_yydebug

Definition at line 54 of file ast_expr2.c.

#define YYDPRINTF ( Args   ) 

Definition at line 804 of file ast_expr2.c.

Referenced by yyparse().

#define YYEMPTY   (-2)

Definition at line 630 of file ast_expr2.c.

Referenced by yyparse().

#define YYEOF   0

Definition at line 631 of file ast_expr2.c.

Referenced by yyparse().

#define YYERRCODE   256

Definition at line 665 of file ast_expr2.c.

#define yyerrok   (yyerrstatus = 0)

Definition at line 628 of file ast_expr2.c.

#define YYERROR   goto yyerrorlab

Definition at line 635 of file ast_expr2.c.

#define yyerror   ast_yyerror

Definition at line 51 of file ast_expr2.c.

Referenced by yyparse().

#define YYERROR_VERBOSE   1

Definition at line 256 of file ast_expr2.c.

#define YYERROR_VERBOSE   1

Definition at line 256 of file ast_expr2.c.

#define YYFAIL   goto yyerrlab

Definition at line 642 of file ast_expr2.c.

#define YYFINAL   10

Definition at line 396 of file ast_expr2.c.

Referenced by yyparse().

#define YYFREE   free

Definition at line 299 of file ast_expr2.c.

#define YYINITDEPTH   200

Definition at line 813 of file ast_expr2.c.

Referenced by yyparse().

#define YYLAST   140

Definition at line 398 of file ast_expr2.c.

Referenced by yyparse().

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

Definition at line 713 of file ast_expr2.c.

Referenced by yyparse().

#define yylex   ast_yylex

Definition at line 50 of file ast_expr2.c.

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

Definition at line 160 of file ast_expr2.c.

#define yylloc   ast_yylloc

Definition at line 56 of file ast_expr2.c.

Referenced by ast_yyget_lloc(), ast_yyset_lloc(), and yyparse().

#define YYLLOC_DEFAULT ( Current,
Rhs,
 ) 

Definition at line 674 of file ast_expr2.c.

Referenced by yyparse().

#define YYLSP_NEEDED   1

Definition at line 46 of file ast_expr2.c.

#define YYLTYPE   yyltype

Definition at line 228 of file ast_expr2.c.

#define YYLTYPE_IS_TRIVIAL   1

Definition at line 229 of file ast_expr2.c.

#define yylval   ast_yylval

Definition at line 52 of file ast_expr2.c.

Referenced by ast_yyget_lval(), ast_yyset_lval(), and yyparse().

#define YYMALLOC   malloc

Definition at line 302 of file ast_expr2.c.

#define YYMAXDEPTH   10000

Definition at line 824 of file ast_expr2.c.

Referenced by yyparse().

#define YYMAXUTOK   278

Definition at line 411 of file ast_expr2.c.

#define yynerrs   ast_yynerrs

Definition at line 55 of file ast_expr2.c.

Referenced by yyparse().

#define YYNNTS   3

Definition at line 403 of file ast_expr2.c.

#define YYNRULES   22

Definition at line 405 of file ast_expr2.c.

#define YYNSTATES   46

Definition at line 407 of file ast_expr2.c.

#define YYNTOKENS   24

Definition at line 401 of file ast_expr2.c.

Referenced by yyparse().

#define YYPACT_NINF   -13

Definition at line 542 of file ast_expr2.c.

Referenced by yyparse().

#define yyparse   ast_yyparse

Definition at line 49 of file ast_expr2.c.

#define YYPARSE_PARAM   parseio

Definition at line 159 of file ast_expr2.c.

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

Referenced by yyparse().

#define YYPURE   1

Definition at line 43 of file ast_expr2.c.

 
#define YYRECOVERING (  )     (!!yyerrstatus)

Definition at line 644 of file ast_expr2.c.

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

Definition at line 672 of file ast_expr2.c.

#define YYSIZE_T   unsigned int

Definition at line 625 of file ast_expr2.c.

Referenced by yyparse().

#define YYSKELETON_NAME   "yacc.c"

Definition at line 40 of file ast_expr2.c.

#define YYSTACK_ALLOC   YYMALLOC

Definition at line 325 of file ast_expr2.c.

Referenced by yyparse().

#define YYSTACK_BYTES (  ) 

Value:

((N) * (sizeof (short int) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
      + 2 * YYSTACK_GAP_MAXIMUM)

Definition at line 349 of file ast_expr2.c.

Referenced by yyparse().

#define YYSTACK_FREE   YYFREE

Definition at line 326 of file ast_expr2.c.

Referenced by yyparse().

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

Definition at line 345 of file ast_expr2.c.

#define YYSTACK_RELOCATE ( Stack   ) 

Definition at line 376 of file ast_expr2.c.

Referenced by yyparse().

#define yystype   YYSTYPE

Definition at line 268 of file ast_expr2.c.

#define YYSTYPE_IS_DECLARED   1

Definition at line 269 of file ast_expr2.c.

#define YYSTYPE_IS_TRIVIAL   1

Definition at line 270 of file ast_expr2.c.

#define YYTABLE_NINF   -1

Definition at line 562 of file ast_expr2.c.

Referenced by yyparse().

#define YYTERROR   1

Definition at line 664 of file ast_expr2.c.

Referenced by yyparse().

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

Definition at line 413 of file ast_expr2.c.

Referenced by yyparse().

#define YYUNDEFTOK   2

Definition at line 410 of file ast_expr2.c.


Typedef Documentation

typedef void* yyscan_t

Definition at line 179 of file ast_expr2.c.

typedef short int yysigned_char

Definition at line 392 of file ast_expr2.c.


Enumeration Type Documentation

enum valtype

Enumerator:
AST_EXPR_integer 
AST_EXPR_numeric_string 
AST_EXPR_string 
AST_EXPR_integer 
AST_EXPR_numeric_string 
AST_EXPR_string 

Definition at line 163 of file ast_expr2.c.

Enumerator:
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_EQTILDE 
TOK_COLON 
TOK_LP 
TOK_RP 
TOKEN 
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_EQTILDE 
TOK_COLON 
TOK_LP 
TOK_RP 
TOKEN 

Definition at line 63 of file ast_expr2.c.

00063                     {
00064      TOK_COLONCOLON = 258,
00065      TOK_COND = 259,
00066      TOK_OR = 260,
00067      TOK_AND = 261,
00068      TOK_NE = 262,
00069      TOK_LE = 263,
00070      TOK_GE = 264,
00071      TOK_LT = 265,
00072      TOK_GT = 266,
00073      TOK_EQ = 267,
00074      TOK_MINUS = 268,
00075      TOK_PLUS = 269,
00076      TOK_MOD = 270,
00077      TOK_DIV = 271,
00078      TOK_MULT = 272,
00079      TOK_COMPL = 273,
00080      TOK_EQTILDE = 274,
00081      TOK_COLON = 275,
00082      TOK_LP = 276,
00083      TOK_RP = 277,
00084      TOKEN = 278
00085    };


Function Documentation

int ast_yylex __P ( (YYSTYPE *, YYLTYPE *, yyscan_t  ) 

static struct val* op_cond __P ( (struct val *, struct val *, struct val *)   )  [static, read]

static struct val *op_times __P ( (struct val *, struct val *)   )  [static, read]

static struct val* make_str __P ( (const char *)   )  [static, read]

static struct val* make_integer __P ( (quad_t)   )  [static, read]

static void to_string __P ( (struct val *)   )  [static, read]

static int chk_times __P ( (quad_t, quad_t, quad_t)   )  [static]

static int chk_div __P ( (quad_t, quad_t)   )  [static]

int ast_yyerror ( const char *  ,
YYLTYPE ,
struct parse_io  
)

static int chk_div ( quad_t  a,
quad_t  b 
) [static]

Definition at line 2250 of file ast_expr2.c.

References QUAD_MIN.

Referenced by op_div().

02251 {
02252    /* div by zero has been taken care of before */
02253    /* only QUAD_MIN / -1 causes overflow */
02254    if (a == QUAD_MIN && b == -1)
02255       return 1;
02256    /* everything else is OK */
02257    return 0;
02258 }

static int chk_minus ( quad_t  a,
quad_t  b,
quad_t  r 
) [static]

Definition at line 2102 of file ast_expr2.c.

References chk_plus(), and QUAD_MIN.

Referenced by op_minus(), and op_negate().

02103 {
02104    /* special case subtraction of QUAD_MIN */
02105    if (b == QUAD_MIN) {
02106       if (a >= 0)
02107          return 1;
02108       else
02109          return 0;
02110    }
02111    /* this is allowed for b != QUAD_MIN */
02112    return chk_plus (a, -b, r);
02113 }

static int chk_plus ( quad_t  a,
quad_t  b,
quad_t  r 
) [static]

Definition at line 2060 of file ast_expr2.c.

Referenced by chk_minus(), and op_plus().

02061 {
02062    /* sum of two positive numbers must be positive */
02063    if (a > 0 && b > 0 && r <= 0)
02064       return 1;
02065    /* sum of two negative numbers must be negative */
02066    if (a < 0 && b < 0 && r >= 0)
02067       return 1;
02068    /* all other cases are OK */
02069    return 0;
02070 }

static int chk_times ( quad_t  a,
quad_t  b,
quad_t  r 
) [static]

Definition at line 2217 of file ast_expr2.c.

Referenced by op_times().

02218 {
02219    /* special case: first operand is 0, no overflow possible */
02220    if (a == 0)
02221       return 0;
02222    /* cerify that result of division matches second operand */
02223    if (r / a != b)
02224       return 1;
02225    return 0;
02226 }

static void free_value ( struct val vp  )  [static]

Definition at line 1729 of file ast_expr2.c.

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

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

01730 {  
01731    if (vp==NULL) {
01732       return;
01733    }
01734    if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)
01735       free (vp->u.s);   
01736    free(vp);
01737 }

static int is_zero_or_null ( struct val vp  )  [static]

Definition at line 1823 of file ast_expr2.c.

References AST_EXPR_integer, val::i, val::s, to_integer(), val::type, and val::u.

Referenced by op_and(), and op_or().

01824 {
01825    if (vp->type == AST_EXPR_integer) {
01826       return (vp->u.i == 0);
01827    } else {
01828       return (*vp->u.s == 0 || (to_integer (vp) && vp->u.i == 0));
01829    }
01830    /* NOTREACHED */
01831 }

static int isstring ( struct val vp  )  [static]

Definition at line 1815 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().

01816 {
01817    /* only TRUE if this string is not a valid integer */
01818    return (vp->type == AST_EXPR_string);
01819 }

static struct val* make_integer ( quad_t  i  )  [static, read]

Definition at line 1683 of file ast_expr2.c.

References AST_EXPR_integer, 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_ge(), op_gt(), op_le(), op_lt(), op_minus(), op_ne(), op_negate(), op_plus(), op_rem(), and op_times().

01684 {
01685    struct val *vp;
01686 
01687    vp = (struct val *) malloc (sizeof (*vp));
01688    if (vp == NULL) {
01689       ast_log(LOG_WARNING, "malloc() failed\n");
01690       return(NULL);
01691    }
01692 
01693    vp->type = AST_EXPR_integer;
01694    vp->u.i  = i;
01695    return vp; 
01696 }

static struct val* make_str ( const char *  s  )  [static, read]

Definition at line 1699 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(), and op_eqtilde().

01700 {
01701    struct val *vp;
01702    size_t i;
01703    int isint;
01704 
01705    vp = (struct val *) malloc (sizeof (*vp));
01706    if (vp == NULL || ((vp->u.s = strdup (s)) == NULL)) {
01707       ast_log(LOG_WARNING,"malloc() failed\n");
01708       return(NULL);
01709    }
01710 
01711    for(i = 1, isint = isdigit(s[0]) || s[0] == '-';
01712        isint && i < strlen(s);
01713        i++)
01714    {
01715       if(!isdigit(s[i]))
01716           isint = 0;
01717    }
01718 
01719    if (isint)
01720       vp->type = AST_EXPR_numeric_string;
01721    else  
01722       vp->type = AST_EXPR_string;
01723 
01724    return vp;
01725 }

static struct val* op_and ( struct val a,
struct val b 
) [static, read]

Definition at line 1881 of file ast_expr2.c.

References free_value(), is_zero_or_null(), and make_integer().

Referenced by yyparse().

01882 {
01883    if (is_zero_or_null (a) || is_zero_or_null (b)) {
01884       free_value (a);
01885       free_value (b);
01886       return (make_integer ((quad_t)0));
01887    } else {
01888       free_value (b);
01889       return (a);
01890    }
01891 }

static struct val* op_colon ( struct val a,
struct val b 
) [static, read]

Definition at line 2320 of file ast_expr2.c.

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

Referenced by yyparse().

02321 {
02322    regex_t rp;
02323    regmatch_t rm[2];
02324    char errbuf[256];
02325    int eval;
02326    struct val *v;
02327 
02328    /* coerce to both arguments to strings */
02329    to_string(a);
02330    to_string(b);
02331    /* strip double quotes from both -- they'll screw up the pattern, and the search string starting at ^ */
02332    strip_quotes(a);
02333    strip_quotes(b);
02334    /* compile regular expression */
02335    if ((eval = regcomp (&rp, b->u.s, REG_EXTENDED)) != 0) {
02336       regerror (eval, &rp, errbuf, sizeof(errbuf));
02337       ast_log(LOG_WARNING,"regcomp() error : %s",errbuf);
02338       free_value(a);
02339       free_value(b);
02340       return make_str("");    
02341    }
02342 
02343    /* compare string against pattern */
02344    /* remember that patterns are anchored to the beginning of the line */
02345    if (regexec(&rp, a->u.s, (size_t)2, rm, 0) == 0 && rm[0].rm_so == 0) {
02346       if (rm[1].rm_so >= 0) {
02347          *(a->u.s + rm[1].rm_eo) = '\0';
02348          v = make_str (a->u.s + rm[1].rm_so);
02349 
02350       } else {
02351          v = make_integer ((quad_t)(rm[0].rm_eo - rm[0].rm_so));
02352       }
02353    } else {
02354       if (rp.re_nsub == 0) {
02355          v = make_integer ((quad_t)0);
02356       } else {
02357          v = make_str ("");
02358       }
02359    }
02360 
02361    /* free arguments and pattern buffer */
02362    free_value (a);
02363    free_value (b);
02364    regfree (&rp);
02365 
02366    return v;
02367 }

static struct val* op_compl ( struct val a  )  [static, read]

Definition at line 2167 of file ast_expr2.c.

References AST_EXPR_integer, AST_EXPR_numeric_string, AST_EXPR_string, free_value(), val::i, make_integer(), val::s, val::type, and val::u.

Referenced by yyparse().

02168 {
02169    int v1 = 1;
02170    struct val *r;
02171    
02172    if( !a )
02173    {
02174       v1 = 0;
02175    }
02176    else
02177    {
02178       switch( a->type )
02179       {
02180       case AST_EXPR_integer:
02181          if( a->u.i == 0 )
02182             v1 = 0;
02183          break;
02184          
02185       case AST_EXPR_string:
02186          if( a->u.s == 0 )
02187             v1 = 0;
02188          else
02189          {
02190             if( a->u.s[0] == 0 )
02191                v1 = 0;
02192             else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' )
02193                v1 = 0;
02194          }
02195          break;
02196          
02197       case AST_EXPR_numeric_string:
02198          if( a->u.s == 0 )
02199             v1 = 0;
02200          else
02201          {
02202             if( a->u.s[0] == 0 )
02203                v1 = 0;
02204             else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' )
02205                v1 = 0;
02206          }
02207          break;
02208       }
02209    }
02210    
02211    r = make_integer (!v1);
02212    free_value (a);
02213    return r;
02214 }

static struct val* op_cond ( struct val a,
struct val b,
struct val c 
) [static, read]

Definition at line 2001 of file ast_expr2.c.

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

Referenced by yyparse().

02002 {
02003    struct val *r;
02004 
02005    if( isstring(a) )
02006    {
02007       if( strlen(a->u.s) && strcmp(a->u.s, "\"\"") != 0 && strcmp(a->u.s,"0") != 0 )
02008       {
02009          free_value(a);
02010          free_value(c);
02011          r = b;
02012       }
02013       else
02014       {
02015          free_value(a);
02016          free_value(b);
02017          r = c;
02018       }
02019    }
02020    else
02021    {
02022       (void)to_integer(a);
02023       if( a->u.i )
02024       {
02025          free_value(a);
02026          free_value(c);
02027          r = b;
02028       }
02029       else
02030       {
02031          free_value(a);
02032          free_value(b);
02033          r = c;
02034       }
02035    }
02036    return r;
02037 }

static struct val* op_div ( struct val a,
struct val b 
) [static, read]

Definition at line 2261 of file ast_expr2.c.

References ast_log(), chk_div(), free_value(), val::i, LOG_WARNING, make_integer(), to_integer(), and val::u.

Referenced by yyparse().

02262 {
02263    struct val *r;
02264 
02265    if (!to_integer (a)) {
02266       free_value(a);
02267       free_value(b);
02268       ast_log(LOG_WARNING, "non-numeric argument\n");
02269       return make_integer(0);
02270    } else if (!to_integer (b)) {
02271       free_value(a);
02272       free_value(b);
02273       ast_log(LOG_WARNING, "non-numeric argument\n");
02274       return make_integer(INT_MAX);
02275    }
02276 
02277    if (b->u.i == 0) {
02278       ast_log(LOG_WARNING, "division by zero\n");     
02279       free_value(a);
02280       free_value(b);
02281       return make_integer(INT_MAX);
02282    }
02283 
02284    r = make_integer (/*(quad_t)*/(a->u.i / b->u.i));
02285    if (chk_div (a->u.i, b->u.i)) {
02286       ast_log(LOG_WARNING, "overflow\n");
02287    }
02288    free_value (a);
02289    free_value (b);
02290    return r;
02291 }

static struct val* op_eq ( struct val a,
struct val b 
) [static, read]

Definition at line 1894 of file ast_expr2.c.

References ast_log(), free_value(), val::i, isstring(), LOG_WARNING, make_integer(), val::s, to_integer(), to_string(), and val::u.

Referenced by yyparse().

01895 {
01896    struct val *r; 
01897 
01898    if (isstring (a) || isstring (b)) {
01899       to_string (a);
01900       to_string (b); 
01901       r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) == 0));
01902    } else {
01903 #ifdef DEBUG_FOR_CONVERSIONS
01904       char buffer[2000];
01905       sprintf(buffer,"Converting '%s' and '%s' ", a->u.s, b->u.s);
01906 #endif
01907       (void)to_integer(a);
01908       (void)to_integer(b);
01909 #ifdef DEBUG_FOR_CONVERSIONS
01910       ast_log(LOG_WARNING,"%s to '%lld' and '%lld'\n", buffer, a->u.i, b->u.i);
01911 #endif
01912       r = make_integer ((quad_t)(a->u.i == b->u.i));
01913    }
01914 
01915    free_value (a);
01916    free_value (b);
01917    return r;
01918 }

static struct val* op_eqtilde ( struct val a,
struct val b 
) [static, read]

Definition at line 2371 of file ast_expr2.c.

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

Referenced by yyparse().

02372 {
02373    regex_t rp;
02374    regmatch_t rm[2];
02375    char errbuf[256];
02376    int eval;
02377    struct val *v;
02378 
02379    /* coerce to both arguments to strings */
02380    to_string(a);
02381    to_string(b);
02382    /* strip double quotes from both -- they'll screw up the pattern, and the search string starting at ^ */
02383    strip_quotes(a);
02384    strip_quotes(b);
02385    /* compile regular expression */
02386    if ((eval = regcomp (&rp, b->u.s, REG_EXTENDED)) != 0) {
02387       regerror (eval, &rp, errbuf, sizeof(errbuf));
02388       ast_log(LOG_WARNING,"regcomp() error : %s",errbuf);
02389       free_value(a);
02390       free_value(b);
02391       return make_str("");    
02392    }
02393 
02394    /* compare string against pattern */
02395    /* remember that patterns are anchored to the beginning of the line */
02396    if (regexec(&rp, a->u.s, (size_t)2, rm, 0) == 0 ) {
02397       if (rm[1].rm_so >= 0) {
02398          *(a->u.s + rm[1].rm_eo) = '\0';
02399          v = make_str (a->u.s + rm[1].rm_so);
02400 
02401       } else {
02402          v = make_integer ((quad_t)(rm[0].rm_eo - rm[0].rm_so));
02403       }
02404    } else {
02405       if (rp.re_nsub == 0) {
02406          v = make_integer ((quad_t)0);
02407       } else {
02408          v = make_str ("");
02409       }
02410    }
02411 
02412    /* free arguments and pattern buffer */
02413    free_value (a);
02414    free_value (b);
02415    regfree (&rp);
02416 
02417    return v;
02418 }

static struct val* op_ge ( struct val a,
struct val b 
) [static, read]

Definition at line 1961 of file ast_expr2.c.

References free_value(), val::i, isstring(), make_integer(), val::s, to_integer(), to_string(), and val::u.

Referenced by yyparse().

01962 {
01963    struct val *r;
01964 
01965    if (isstring (a) || isstring (b)) {
01966       to_string (a);
01967       to_string (b);
01968       r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) >= 0));
01969    } else {
01970       (void)to_integer(a);
01971       (void)to_integer(b);
01972       r = make_integer ((quad_t)(a->u.i >= b->u.i));
01973    }
01974 
01975    free_value (a);
01976    free_value (b);
01977    return r;
01978 }

static struct val* op_gt ( struct val a,
struct val b 
) [static, read]

Definition at line 1921 of file ast_expr2.c.

References free_value(), val::i, isstring(), make_integer(), val::s, to_integer(), to_string(), and val::u.

Referenced by yyparse().

01922 {
01923    struct val *r;
01924 
01925    if (isstring (a) || isstring (b)) {
01926       to_string (a);
01927       to_string (b);
01928       r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) > 0));
01929    } else {
01930       (void)to_integer(a);
01931       (void)to_integer(b);
01932       r = make_integer ((quad_t)(a->u.i > b->u.i));
01933    }
01934 
01935    free_value (a);
01936    free_value (b);
01937    return r;
01938 }

static struct val* op_le ( struct val a,
struct val b 
) [static, read]

Definition at line 1981 of file ast_expr2.c.

References free_value(), val::i, isstring(), make_integer(), val::s, to_integer(), to_string(), and val::u.

Referenced by yyparse().

01982 {
01983    struct val *r;
01984 
01985    if (isstring (a) || isstring (b)) {
01986       to_string (a);
01987       to_string (b);
01988       r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) <= 0));
01989    } else {
01990       (void)to_integer(a);
01991       (void)to_integer(b);
01992       r = make_integer ((quad_t)(a->u.i <= b->u.i));
01993    }
01994 
01995    free_value (a);
01996    free_value (b);
01997    return r;
01998 }

static struct val* op_lt ( struct val a,
struct val b 
) [static, read]

Definition at line 1941 of file ast_expr2.c.

References free_value(), val::i, isstring(), make_integer(), val::s, to_integer(), to_string(), and val::u.

Referenced by yyparse().

01942 {
01943    struct val *r;
01944 
01945    if (isstring (a) || isstring (b)) {
01946       to_string (a);
01947       to_string (b);
01948       r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) < 0));
01949    } else {
01950       (void)to_integer(a);
01951       (void)to_integer(b);
01952       r = make_integer ((quad_t)(a->u.i < b->u.i));
01953    }
01954 
01955    free_value (a);
01956    free_value (b);
01957    return r;
01958 }

static struct val* op_minus ( struct val a,
struct val b 
) [static, read]

Definition at line 2116 of file ast_expr2.c.

References ast_log(), chk_minus(), free_value(), val::i, LOG_WARNING, make_integer(), to_integer(), and val::u.

Referenced by yyparse().

02117 {
02118    struct val *r;
02119 
02120    if (!to_integer (a)) {
02121       ast_log(LOG_WARNING, "non-numeric argument\n");
02122       if (!to_integer (b)) {
02123          free_value(a);
02124          free_value(b);
02125          return make_integer(0);
02126       } else {
02127          r = make_integer(0 - b->u.i);
02128          free_value(a);
02129          free_value(b);
02130          return (r);
02131       }
02132    } else if (!to_integer(b)) {
02133       ast_log(LOG_WARNING, "non-numeric argument\n");
02134       free_value(b);
02135       return (a);
02136    }
02137 
02138    r = make_integer (/*(quad_t)*/(a->u.i - b->u.i));
02139    if (chk_minus (a->u.i, b->u.i, r->u.i)) {
02140       ast_log(LOG_WARNING, "overflow\n");
02141    }
02142    free_value (a);
02143    free_value (b);
02144    return r;
02145 }

static struct val* op_ne ( struct val a,
struct val b 
) [static, read]

Definition at line 2040 of file ast_expr2.c.

References free_value(), val::i, isstring(), make_integer(), val::s, to_integer(), to_string(), and val::u.

Referenced by yyparse().

02041 {
02042    struct val *r;
02043 
02044    if (isstring (a) || isstring (b)) {
02045       to_string (a);
02046       to_string (b);
02047       r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) != 0));
02048    } else {
02049       (void)to_integer(a);
02050       (void)to_integer(b);
02051       r = make_integer ((quad_t)(a->u.i != b->u.i));
02052    }
02053 
02054    free_value (a);
02055    free_value (b);
02056    return r;
02057 }

static struct val* op_negate ( struct val a  )  [static, read]

Definition at line 2148 of file ast_expr2.c.

References ast_log(), chk_minus(), free_value(), val::i, LOG_WARNING, make_integer(), to_integer(), and val::u.

Referenced by yyparse().

02149 {
02150    struct val *r;
02151 
02152    if (!to_integer (a) ) {
02153       free_value(a);
02154       ast_log(LOG_WARNING, "non-numeric argument\n");
02155       return make_integer(0);
02156    }
02157 
02158    r = make_integer (/*(quad_t)*/(- a->u.i));
02159    if (chk_minus (0, a->u.i, r->u.i)) {
02160       ast_log(LOG_WARNING, "overflow\n");
02161    }
02162    free_value (a);
02163    return r;
02164 }

static struct val* op_or ( struct val a,
struct val b 
) [static, read]

Definition at line 1869 of file ast_expr2.c.

References free_value(), and is_zero_or_null().

Referenced by yyparse().

01870 {
01871    if (is_zero_or_null (a)) {
01872       free_value (a);
01873       return (b);
01874    } else {
01875       free_value (b);
01876       return (a);
01877    }
01878 }

static struct val* op_plus ( struct val a,
struct val b 
) [static, read]

Definition at line 2073 of file ast_expr2.c.

References ast_log(), chk_plus(), free_value(), val::i, LOG_WARNING, make_integer(), to_integer(), and val::u.

Referenced by yyparse().

02074 {
02075    struct val *r;
02076 
02077    if (!to_integer (a)) {
02078       ast_log(LOG_WARNING,"non-numeric argument\n");
02079       if (!to_integer (b)) {
02080          free_value(a);
02081          free_value(b);
02082          return make_integer(0);
02083       } else {
02084          free_value(a);
02085          return (b);
02086       }
02087    } else if (!to_integer(b)) {
02088       free_value(b);
02089       return (a);
02090    }
02091 
02092    r = make_integer (/*(quad_t)*/(a->u.i + b->u.i));
02093    if (chk_plus (a->u.i, b->u.i, r->u.i)) {
02094       ast_log(LOG_WARNING,"overflow\n");
02095    }
02096    free_value (a);
02097    free_value (b);
02098    return r;
02099 }

static struct val* op_rem ( struct val a,
struct val b 
) [static, read]

Definition at line 2294 of file ast_expr2.c.

References ast_log(), free_value(), val::i, LOG_WARNING, make_integer(), to_integer(), and val::u.

Referenced by yyparse().

02295 {
02296    struct val *r;
02297 
02298    if (!to_integer (a) || !to_integer (b)) {
02299       ast_log(LOG_WARNING, "non-numeric argument\n");
02300       free_value(a);
02301       free_value(b);
02302       return make_integer(0);
02303    }
02304 
02305    if (b->u.i == 0) {
02306       ast_log(LOG_WARNING, "div by zero\n");
02307       free_value(a);
02308       return(b);
02309    }
02310 
02311    r = make_integer (/*(quad_t)*/(a->u.i % b->u.i));
02312    /* chk_rem necessary ??? */
02313    free_value (a);
02314    free_value (b);
02315    return r;
02316 }

static struct val* op_times ( struct val a,
struct val b 
) [static, read]

Definition at line 2229 of file ast_expr2.c.

References ast_log(), chk_times(), free_value(), val::i, LOG_WARNING, make_integer(), to_integer(), and val::u.

Referenced by yyparse().

02230 {
02231    struct val *r;
02232 
02233    if (!to_integer (a) || !to_integer (b)) {
02234       free_value(a);
02235       free_value(b);
02236       ast_log(LOG_WARNING, "non-numeric argument\n");
02237       return(make_integer(0));
02238    }
02239 
02240    r = make_integer (/*(quad_t)*/(a->u.i * b->u.i));
02241    if (chk_times (a->u.i, b->u.i, r->u.i)) {
02242       ast_log(LOG_WARNING, "overflow\n");
02243    }
02244    free_value (a);
02245    free_value (b);
02246    return (r);
02247 }

static void strip_quotes ( struct val vp  )  [static]

Definition at line 1772 of file ast_expr2.c.

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

Referenced by op_colon(), and op_eqtilde().

01773 {
01774    if (vp->type != AST_EXPR_string && vp->type != AST_EXPR_numeric_string)
01775       return;
01776    
01777    if( vp->u.s[0] == '"' && vp->u.s[strlen(vp->u.s)-1] == '"' )
01778    {
01779       char *f, *t;
01780       f = vp->u.s;
01781       t = vp->u.s;
01782       
01783       while( *f )
01784       {
01785          if( *f  && *f != '"' )
01786             *t++ = *f++;
01787          else
01788             f++;
01789       }
01790       *t = *f;
01791    }
01792 }

static quad_t to_integer ( struct val vp  )  [static]

Definition at line 1741 of file ast_expr2.c.

References AST_EXPR_integer, AST_EXPR_string, ast_log(), 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_ge(), op_gt(), op_le(), op_lt(), op_minus(), op_ne(), op_negate(), op_plus(), op_rem(), and op_times().

01742 {
01743    quad_t i;
01744    
01745    if (vp == NULL) {
01746       ast_log(LOG_WARNING,"vp==NULL in to_integer()\n");
01747       return(0);
01748    }
01749 
01750    if (vp->type == AST_EXPR_integer)
01751       return 1;
01752 
01753    if (vp->type == AST_EXPR_string)
01754       return 0;
01755 
01756    /* vp->type == AST_EXPR_numeric_string, make it numeric */
01757    errno = 0;
01758    i  = strtoll(vp->u.s, (char**)NULL, 10);
01759    if (errno != 0) {
01760       ast_log(LOG_WARNING,"Conversion of %s to integer under/overflowed!\n", vp->u.s);
01761       free(vp->u.s);
01762       vp->u.s = 0;
01763       return(0);
01764    }
01765    free (vp->u.s);
01766    vp->u.i = i;
01767    vp->type = AST_EXPR_integer;
01768    return 1;
01769 }

static void to_string ( struct val vp  )  [static]

Definition at line 1795 of file ast_expr2.c.

References AST_EXPR_numeric_string, AST_EXPR_string, ast_log(), 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(), and op_ne().

01796 {
01797    char *tmp;
01798 
01799    if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)
01800       return;
01801 
01802    tmp = malloc ((size_t)25);
01803    if (tmp == NULL) {
01804       ast_log(LOG_WARNING,"malloc() failed\n");
01805       return;
01806    }
01807 
01808    sprintf(tmp, "%ld", (long int) vp->u.i);
01809    vp->type = AST_EXPR_string;
01810    vp->u.s  = tmp;
01811 }

static void yydestruct ( char *  yymsg,
int  yytype,
YYSTYPE yyvaluep,
YYLTYPE yylocationp 
) const [static]

Definition at line 935 of file ast_expr2.c.

References YY_SYMBOL_PRINT.

Referenced by yyparse().

00941 {
00942   /* Pacify ``unused variable'' warnings.  */
00943   (void) yyvaluep;
00944   (void) yylocationp;
00945 
00946   if (!yymsg)
00947     yymsg = "Deleting";
00948   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
00949 
00950   switch (yytype)
00951     {
00952 
00953       default:
00954         break;
00955     }
00956 }

int yyparse ( void *  YYPARSE_PARAM  ) 

Definition at line 988 of file ast_expr2.c.

References AST_EXPR_integer, calloc, DESTROY, YYLTYPE::first_column, YYLTYPE::first_line, free, YYLTYPE::last_column, YYLTYPE::last_line, op_and(), op_colon(), op_compl(), op_cond(), op_div(), op_eq(), op_eqtilde(), op_ge(), op_gt(), op_le(), op_lt(), op_minus(), op_ne(), op_negate(), op_or(), op_plus(), op_rem(), op_times(), type, YYSTYPE::val, YY_REDUCE_PRINT, YY_STACK_PRINT, YY_SYMBOL_PRINT, YYABORT, YYACCEPT, yychar, yydestruct(), YYDPRINTF, YYEMPTY, YYEOF, yyerror, YYFINAL, YYINITDEPTH, YYLAST, YYLEX, yylloc, YYLLOC_DEFAULT, yylval, YYMAXDEPTH, yynerrs, YYNTOKENS, YYPACT_NINF, YYPOPSTACK, YYSIZE_T, YYSTACK_ALLOC, YYSTACK_BYTES, YYSTACK_FREE, YYSTACK_RELOCATE, yystpcpy(), yystrlen(), YYTABLE_NINF, YYTERROR, and YYTRANSLATE.

01001 {
01002   /* The look-ahead symbol.  */
01003 int yychar;
01004 
01005 /* The semantic value of the look-ahead symbol.  */
01006 YYSTYPE yylval;
01007 
01008 /* Number of syntax errors so far.  */
01009 int yynerrs;
01010 /* Location data for the look-ahead symbol.  */
01011 YYLTYPE yylloc;
01012 
01013   register int yystate;
01014   register int yyn;
01015   int yyresult;
01016   /* Number of tokens to shift before error messages enabled.  */
01017   int yyerrstatus;
01018   /* Look-ahead token as an internal (translated) token number.  */
01019   int yytoken = 0;
01020 
01021   /* Three stacks and their tools:
01022      `yyss': related to states,
01023      `yyvs': related to semantic values,
01024      `yyls': related to locations.
01025 
01026      Refer to the stacks thru separate pointers, to allow yyoverflow
01027      to reallocate them elsewhere.  */
01028 
01029   /* The state stack.  */
01030   short int yyssa[YYINITDEPTH];
01031   short int *yyss = yyssa;
01032   register short int *yyssp;
01033 
01034   /* The semantic value stack.  */
01035   YYSTYPE yyvsa[YYINITDEPTH];
01036   YYSTYPE *yyvs = yyvsa;
01037   register YYSTYPE *yyvsp;
01038 
01039   /* The location stack.  */
01040   YYLTYPE yylsa[YYINITDEPTH];
01041   YYLTYPE *yyls = yylsa;
01042   YYLTYPE *yylsp;
01043   /* The locations where the error started and ended. */
01044   YYLTYPE yyerror_range[2];
01045 
01046 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
01047 
01048   YYSIZE_T yystacksize = YYINITDEPTH;
01049 
01050   /* The variables used to return semantic value and location from the
01051      action routines.  */
01052   YYSTYPE yyval;
01053   YYLTYPE yyloc;
01054 
01055   /* When reducing, the number of symbols on the RHS of the reduced
01056      rule.  */
01057   int yylen;
01058 
01059   YYDPRINTF ((stderr, "Starting parse\n"));
01060 
01061   yystate = 0;
01062   yyerrstatus = 0;
01063   yynerrs = 0;
01064   yychar = YYEMPTY;     /* Cause a token to be read.  */
01065 
01066   /* Initialize stack pointers.
01067      Waste one element of value and location stack
01068      so that they stay on the same level as the state stack.
01069      The wasted elements are never initialized.  */
01070 
01071   yyssp = yyss;
01072   yyvsp = yyvs;
01073   yylsp = yyls;
01074 #if YYLTYPE_IS_TRIVIAL
01075   /* Initialize the default location before parsing starts.  */
01076   yylloc.first_line   = yylloc.last_line   = 1;
01077   yylloc.first_column = yylloc.last_column = 0;
01078 #endif
01079 
01080 
01081   yyvsp[0] = yylval;
01082     yylsp[0] = yylloc;
01083 
01084   goto yysetstate;
01085 
01086 /*------------------------------------------------------------.
01087 | yynewstate -- Push a new state, which is found in yystate.  |
01088 `------------------------------------------------------------*/
01089  yynewstate:
01090   /* In all cases, when you get here, the value and location stacks
01091      have just been pushed. so pushing a state here evens the stacks.
01092      */
01093   yyssp++;
01094 
01095  yysetstate:
01096   *yyssp = yystate;
01097 
01098   if (yyss + yystacksize - 1 <= yyssp)
01099     {
01100       /* Get the current used size of the three stacks, in elements.  */
01101       YYSIZE_T yysize = yyssp - yyss + 1;
01102 
01103 #ifdef yyoverflow
01104       {
01105    /* Give user a chance to reallocate the stack. Use copies of
01106       these so that the &'s don't force the real ones into
01107       memory.  */
01108    YYSTYPE *yyvs1 = yyvs;
01109    short int *yyss1 = yyss;
01110    YYLTYPE *yyls1 = yyls;
01111 
01112    /* Each stack pointer address is followed by the size of the
01113       data in use in that stack, in bytes.  This used to be a
01114       conditional around just the two extra args, but that might
01115       be undefined if yyoverflow is a macro.  */
01116    yyoverflow ("parser stack overflow",
01117           &yyss1, yysize * sizeof (*yyssp),
01118           &yyvs1, yysize * sizeof (*yyvsp),
01119           &yyls1, yysize * sizeof (*yylsp),
01120           &yystacksize);
01121    yyls = yyls1;
01122    yyss = yyss1;
01123    yyvs = yyvs1;
01124       }
01125 #else /* no yyoverflow */
01126 # ifndef YYSTACK_RELOCATE
01127       goto yyoverflowlab;
01128 # else
01129       /* Extend the stack our own way.  */
01130       if (YYMAXDEPTH <= yystacksize)
01131    goto yyoverflowlab;
01132       yystacksize *= 2;
01133       if (YYMAXDEPTH < yystacksize)
01134    yystacksize = YYMAXDEPTH;
01135 
01136       {
01137    short int *yyss1 = yyss;
01138    union yyalloc *yyptr =
01139      (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01140    if (! yyptr)
01141      goto yyoverflowlab;
01142    YYSTACK_RELOCATE (yyss);
01143    YYSTACK_RELOCATE (yyvs);
01144    YYSTACK_RELOCATE (yyls);
01145 #  undef YYSTACK_RELOCATE
01146    if (yyss1 != yyssa)
01147      YYSTACK_FREE (yyss1);
01148       }
01149 # endif
01150 #endif /* no yyoverflow */
01151 
01152       yyssp = yyss + yysize - 1;
01153       yyvsp = yyvs + yysize - 1;
01154       yylsp = yyls + yysize - 1;
01155 
01156       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01157         (unsigned long int) yystacksize));
01158 
01159       if (yyss + yystacksize - 1 <= yyssp)
01160    YYABORT;
01161     }
01162 
01163   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01164 
01165   goto yybackup;
01166 
01167 /*-----------.
01168 | yybackup.  |
01169 `-----------*/
01170 yybackup:
01171 
01172 /* Do appropriate processing given the current state.  */
01173 /* Read a look-ahead token if we need one and don't already have one.  */
01174 /* yyresume: */
01175 
01176   /* First try to decide what to do without reference to look-ahead token.  */
01177 
01178   yyn = yypact[yystate];
01179   if (yyn == YYPACT_NINF)
01180     goto yydefault;
01181 
01182   /* Not known => get a look-ahead token if don't already have one.  */
01183 
01184   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
01185   if (yychar == YYEMPTY)
01186     {
01187       YYDPRINTF ((stderr, "Reading a token: "));
01188       yychar = YYLEX;
01189     }
01190 
01191   if (yychar <= YYEOF)
01192     {
01193       yychar = yytoken = YYEOF;
01194       YYDPRINTF ((stderr, "Now at end of input.\n"));
01195     }
01196   else
01197     {
01198       yytoken = YYTRANSLATE (yychar);
01199       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
01200     }
01201 
01202   /* If the proper action on seeing token YYTOKEN is to reduce or to
01203      detect an error, take that action.  */
01204   yyn += yytoken;
01205   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01206     goto yydefault;
01207   yyn = yytable[yyn];
01208   if (yyn <= 0)
01209     {
01210       if (yyn == 0 || yyn == YYTABLE_NINF)
01211    goto yyerrlab;
01212       yyn = -yyn;
01213       goto yyreduce;
01214     }
01215 
01216   if (yyn == YYFINAL)
01217     YYACCEPT;
01218 
01219   /* Shift the look-ahead token.  */
01220   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
01221 
01222   /* Discard the token being shifted unless it is eof.  */
01223   if (yychar != YYEOF)
01224     yychar = YYEMPTY;
01225 
01226   *++yyvsp = yylval;
01227   *++yylsp = yylloc;
01228 
01229   /* Count tokens shifted since error; after three, turn off error
01230      status.  */
01231   if (yyerrstatus)
01232     yyerrstatus--;
01233 
01234   yystate = yyn;
01235   goto yynewstate;
01236 
01237 
01238 /*-----------------------------------------------------------.
01239 | yydefault -- do the default action for the current state.  |
01240 `-----------------------------------------------------------*/
01241 yydefault:
01242   yyn = yydefact[yystate];
01243   if (yyn == 0)
01244     goto yyerrlab;
01245   goto yyreduce;
01246 
01247 
01248 /*-----------------------------.
01249 | yyreduce -- Do a reduction.  |
01250 `-----------------------------*/
01251 yyreduce:
01252   /* yyn is the number of a rule to reduce with.  */
01253   yylen = yyr2[yyn];
01254 
01255   /* If YYLEN is nonzero, implement the default value of the action:
01256      `$$ = $1'.
01257 
01258      Otherwise, the following line sets YYVAL to garbage.
01259      This behavior is undocumented and Bison
01260      users should not rely upon it.  Assigning to YYVAL
01261      unconditionally makes the parser a bit smaller, and it avoids a
01262      GCC warning that YYVAL may be used uninitialized.  */
01263   yyval = yyvsp[1-yylen];
01264 
01265   /* Default location. */
01266   YYLLOC_DEFAULT (yyloc, yylsp - yylen, yylen);
01267   YY_REDUCE_PRINT (yyn);
01268   switch (yyn)
01269     {
01270         case 2:
01271 #line 165 "ast_expr2.y"
01272     { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
01273               ((struct parse_io *)parseio)->val->type = (yyvsp[0].val)->type;
01274               if( (yyvsp[0].val)->type == AST_EXPR_integer )
01275               ((struct parse_io *)parseio)->val->u.i = (yyvsp[0].val)->u.i;
01276               else
01277               ((struct parse_io *)parseio)->val->u.s = (yyvsp[0].val)->u.s; 
01278            free((yyvsp[0].val));
01279          ;}
01280     break;
01281 
01282   case 3:
01283 #line 175 "ast_expr2.y"
01284     { (yyval.val)= (yyvsp[0].val);;}
01285     break;
01286 
01287   case 4:
01288 #line 176 "ast_expr2.y"
01289     { (yyval.val) = (yyvsp[-1].val); 
01290                           (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01291                      (yyloc).first_line=0; (yyloc).last_line=0;
01292                      DESTROY((yyvsp[-2].val)); DESTROY((yyvsp[0].val)); ;}
01293     break;
01294 
01295   case 5:
01296 #line 180 "ast_expr2.y"
01297     { (yyval.val) = op_or ((yyvsp[-2].val), (yyvsp[0].val));
01298                   DESTROY((yyvsp[-1].val));  
01299                          (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01300                    (yyloc).first_line=0; (yyloc).last_line=0;;}
01301     break;
01302 
01303   case 6:
01304 #line 184 "ast_expr2.y"
01305     { (yyval.val) = op_and ((yyvsp[-2].val), (yyvsp[0].val)); 
01306                   DESTROY((yyvsp[-1].val));  
01307                          (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01308                           (yyloc).first_line=0; (yyloc).last_line=0;;}
01309     break;
01310 
01311   case 7:
01312 #line 188 "ast_expr2.y"
01313     { (yyval.val) = op_eq ((yyvsp[-2].val), (yyvsp[0].val));
01314                   DESTROY((yyvsp[-1].val));  
01315                         (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column;
01316                    (yyloc).first_line=0; (yyloc).last_line=0;;}
01317     break;
01318 
01319   case 8:
01320 #line 192 "ast_expr2.y"
01321     { (yyval.val) = op_gt ((yyvsp[-2].val), (yyvsp[0].val));
01322                   DESTROY((yyvsp[-1].val));  
01323                          (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column;
01324                    (yyloc).first_line=0; (yyloc).last_line=0;;}
01325     break;
01326 
01327   case 9:
01328 #line 196 "ast_expr2.y"
01329     { (yyval.val) = op_lt ((yyvsp[-2].val), (yyvsp[0].val)); 
01330                   DESTROY((yyvsp[-1].val));  
01331                         (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01332                    (yyloc).first_line=0; (yyloc).last_line=0;;}
01333     break;
01334 
01335   case 10:
01336 #line 200 "ast_expr2.y"
01337     { (yyval.val) = op_ge ((yyvsp[-2].val), (yyvsp[0].val)); 
01338                   DESTROY((yyvsp[-1].val));  
01339                          (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01340                     (yyloc).first_line=0; (yyloc).last_line=0;;}
01341     break;
01342 
01343   case 11:
01344 #line 204 "ast_expr2.y"
01345     { (yyval.val) = op_le ((yyvsp[-2].val), (yyvsp[0].val)); 
01346                   DESTROY((yyvsp[-1].val));  
01347                          (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01348                     (yyloc).first_line=0; (yyloc).last_line=0;;}
01349     break;
01350 
01351   case 12:
01352 #line 208 "ast_expr2.y"
01353     { (yyval.val) = op_ne ((yyvsp[-2].val), (yyvsp[0].val)); 
01354                   DESTROY((yyvsp[-1].val));  
01355                          (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01356                     (yyloc).first_line=0; (yyloc).last_line=0;;}
01357     break;
01358 
01359   case 13:
01360 #line 212 "ast_expr2.y"
01361     { (yyval.val) = op_plus ((yyvsp[-2].val), (yyvsp[0].val)); 
01362                   DESTROY((yyvsp[-1].val));  
01363                           (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01364                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01365     break;
01366 
01367   case 14:
01368 #line 216 "ast_expr2.y"
01369     { (yyval.val) = op_minus ((yyvsp[-2].val), (yyvsp[0].val)); 
01370                   DESTROY((yyvsp[-1].val));  
01371                            (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01372                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01373     break;
01374 
01375   case 15:
01376 #line 220 "ast_expr2.y"
01377     { (yyval.val) = op_negate ((yyvsp[0].val)); 
01378                   DESTROY((yyvsp[-1].val));  
01379                            (yyloc).first_column = (yylsp[-1]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01380                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01381     break;
01382 
01383   case 16:
01384 #line 224 "ast_expr2.y"
01385     { (yyval.val) = op_compl ((yyvsp[0].val)); 
01386                   DESTROY((yyvsp[-1].val));  
01387                            (yyloc).first_column = (yylsp[-1]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01388                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01389     break;
01390 
01391   case 17:
01392 #line 228 "ast_expr2.y"
01393     { (yyval.val) = op_times ((yyvsp[-2].val), (yyvsp[0].val)); 
01394                   DESTROY((yyvsp[-1].val));  
01395                           (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01396                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01397     break;
01398 
01399   case 18:
01400 #line 232 "ast_expr2.y"
01401     { (yyval.val) = op_div ((yyvsp[-2].val), (yyvsp[0].val)); 
01402                   DESTROY((yyvsp[-1].val));  
01403                          (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01404                     (yyloc).first_line=0; (yyloc).last_line=0;;}
01405     break;
01406 
01407   case 19:
01408 #line 236 "ast_expr2.y"
01409     { (yyval.val) = op_rem ((yyvsp[-2].val), (yyvsp[0].val)); 
01410                   DESTROY((yyvsp[-1].val));  
01411                          (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01412                     (yyloc).first_line=0; (yyloc).last_line=0;;}
01413     break;
01414 
01415   case 20:
01416 #line 240 "ast_expr2.y"
01417     { (yyval.val) = op_colon ((yyvsp[-2].val), (yyvsp[0].val)); 
01418                   DESTROY((yyvsp[-1].val));  
01419                            (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01420                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01421     break;
01422 
01423   case 21:
01424 #line 244 "ast_expr2.y"
01425     { (yyval.val) = op_eqtilde ((yyvsp[-2].val), (yyvsp[0].val)); 
01426                   DESTROY((yyvsp[-1].val));  
01427                            (yyloc).first_column = (yylsp[-2]).first_column; (yyloc).last_column = (yylsp[0]).last_column; 
01428                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01429     break;
01430 
01431   case 22:
01432 #line 248 "ast_expr2.y"
01433     { (yyval.val) = op_cond ((yyvsp[-4].val), (yyvsp[-2].val), (yyvsp[0].val)); 
01434                   DESTROY((yyvsp[-3].val));  
01435                   DESTROY((yyvsp[-1].val));  
01436                            (yyloc).first_column = (yylsp[-4]).first_column; (yyloc).last_column = (yylsp[-2]).last_column; 
01437                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01438     break;
01439 
01440 
01441     }
01442 
01443 /* Line 1037 of yacc.c.  */
01444 #line 1445 "ast_expr2.c"
01445 
01446   yyvsp -= yylen;
01447   yyssp -= yylen;
01448   yylsp -= yylen;
01449 
01450   YY_STACK_PRINT (yyss, yyssp);
01451 
01452   *++yyvsp = yyval;
01453   *++yylsp = yyloc;
01454 
01455   /* Now `shift' the result of the reduction.  Determine what state
01456      that goes to, based on the state we popped back to and the rule
01457      number reduced by.  */
01458 
01459   yyn = yyr1[yyn];
01460 
01461   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
01462   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01463     yystate = yytable[yystate];
01464   else
01465     yystate = yydefgoto[yyn - YYNTOKENS];
01466 
01467   goto yynewstate;
01468 
01469 
01470 /*------------------------------------.
01471 | yyerrlab -- here on detecting error |
01472 `------------------------------------*/
01473 yyerrlab:
01474   /* If not already recovering from an error, report this error.  */
01475   if (!yyerrstatus)
01476     {
01477       ++yynerrs;
01478 #if YYERROR_VERBOSE
01479       yyn = yypact[yystate];
01480 
01481       if (YYPACT_NINF < yyn && yyn < YYLAST)
01482    {
01483      YYSIZE_T yysize = 0;
01484      int yytype = YYTRANSLATE (yychar);
01485      const char* yyprefix;
01486      char *yymsg;
01487      int yyx;
01488 
01489      /* Start YYX at -YYN if negative to avoid negative indexes in
01490         YYCHECK.  */
01491      int yyxbegin = yyn < 0 ? -yyn : 0;
01492 
01493      /* Stay within bounds of both yycheck and yytname.  */
01494      int yychecklim = YYLAST - yyn;
01495      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
01496      int yycount = 0;
01497 
01498      yyprefix = ", expecting ";
01499      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01500        if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01501          {
01502       yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
01503       yycount += 1;
01504       if (yycount == 5)
01505         {
01506           yysize = 0;
01507           break;
01508         }
01509          }
01510      yysize += (sizeof ("syntax error, unexpected ")
01511            + yystrlen (yytname[yytype]));
01512      yymsg = (char *) YYSTACK_ALLOC (yysize);
01513      if (yymsg != 0)
01514        {
01515          char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
01516          yyp = yystpcpy (yyp, yytname[yytype]);
01517 
01518          if (yycount < 5)
01519       {
01520         yyprefix = ", expecting ";
01521         for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01522           if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01523             {
01524          yyp = yystpcpy (yyp, yyprefix);
01525          yyp = yystpcpy (yyp, yytname[yyx]);
01526          yyprefix = " or ";
01527             }
01528       }
01529          yyerror (yymsg);
01530          YYSTACK_FREE (yymsg);
01531        }
01532      else
01533        yyerror ("syntax error; also virtual memory exhausted");
01534    }
01535       else
01536 #endif /* YYERROR_VERBOSE */
01537    yyerror ("syntax error");
01538     }
01539 
01540   yyerror_range[0] = yylloc;
01541 
01542   if (yyerrstatus == 3)
01543     {
01544       /* If just tried and failed to reuse look-ahead token after an
01545     error, discard it.  */
01546 
01547       if (yychar <= YYEOF)
01548         {
01549           /* If at end of input, pop the error token,
01550         then the rest of the stack, then return failure.  */
01551      if (yychar == YYEOF)
01552         for (;;)
01553           {
01554                  yyerror_range[0] = *yylsp;
01555        YYPOPSTACK;
01556        if (yyssp == yyss)
01557          YYABORT;
01558        yydestruct ("Error: popping",
01559                              yystos[*yyssp], yyvsp, yylsp);
01560           }
01561         }
01562       else
01563    {
01564      yydestruct ("Error: discarding", yytoken, &yylval, &yylloc);
01565      yychar = YYEMPTY;
01566    }
01567     }
01568 
01569   /* Else will try to reuse look-ahead token after shifting the error
01570      token.  */
01571   goto yyerrlab1;
01572 
01573 
01574 /*---------------------------------------------------.
01575 | yyerrorlab -- error raised explicitly by YYERROR.  |
01576 `---------------------------------------------------*/
01577 yyerrorlab:
01578 
01579 #ifdef __GNUC__
01580   /* Pacify GCC when the user code never invokes YYERROR and the label
01581      yyerrorlab therefore never appears in user code.  */
01582   if (0)
01583      goto yyerrorlab;
01584 #endif
01585 
01586   yyerror_range[0] = yylsp[1-yylen];
01587   yylsp -= yylen;
01588   yyvsp -= yylen;
01589   yyssp -= yylen;
01590   yystate = *yyssp;
01591   goto yyerrlab1;
01592 
01593 
01594 /*-------------------------------------------------------------.
01595 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
01596 `-------------------------------------------------------------*/
01597 yyerrlab1:
01598   yyerrstatus = 3;   /* Each real token shifted decrements this.  */
01599 
01600   for (;;)
01601     {
01602       yyn = yypact[yystate];
01603       if (yyn != YYPACT_NINF)
01604    {
01605      yyn += YYTERROR;
01606      if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
01607        {
01608          yyn = yytable[yyn];
01609          if (0 < yyn)
01610       break;
01611        }
01612    }
01613 
01614       /* Pop the current state because it cannot handle the error token.  */
01615       if (yyssp == yyss)
01616    YYABORT;
01617 
01618       yyerror_range[0] = *yylsp;
01619       yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp);
01620       YYPOPSTACK;
01621       yystate = *yyssp;
01622       YY_STACK_PRINT (yyss, yyssp);
01623     }
01624 
01625   if (yyn == YYFINAL)
01626     YYACCEPT;
01627 
01628   *++yyvsp = yylval;
01629 
01630   yyerror_range[1] = yylloc;
01631   /* Using YYLLOC is tempting, but would change the location of
01632      the look-ahead.  YYLOC is available though. */
01633   YYLLOC_DEFAULT (yyloc, yyerror_range - 1, 2);
01634   *++yylsp = yyloc;
01635 
01636   /* Shift the error token. */
01637   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
01638 
01639   yystate = yyn;
01640   goto yynewstate;
01641 
01642 
01643 /*-------------------------------------.
01644 | yyacceptlab -- YYACCEPT comes here.  |
01645 `-------------------------------------*/
01646 yyacceptlab:
01647   yyresult = 0;
01648   goto yyreturn;
01649 
01650 /*-----------------------------------.
01651 | yyabortlab -- YYABORT comes here.  |
01652 `-----------------------------------*/
01653 yyabortlab:
01654   yydestruct ("Error: discarding lookahead",
01655               yytoken, &yylval, &yylloc);
01656   yychar = YYEMPTY;
01657   yyresult = 1;
01658   goto yyreturn;
01659 
01660 #ifndef yyoverflow
01661 /*----------------------------------------------.
01662 | yyoverflowlab -- parser overflow comes here.  |
01663 `----------------------------------------------*/
01664 yyoverflowlab:
01665   yyerror ("parser stack overflow");
01666   yyresult = 2;
01667   /* Fall through.  */
01668 #endif
01669 
01670 yyreturn:
01671 #ifndef yyoverflow
01672   if (yyss != yyssa)
01673     YYSTACK_FREE (yyss);
01674 #endif
01675   return yyresult;
01676 }

int yyparse (  ) 

static char* yystpcpy ( char *  yydest,
const char *  yysrc 
) [static]

Definition at line 864 of file ast_expr2.c.

Referenced by yyparse().

00868 {
00869   register char *yyd = yydest;
00870   register const char *yys = yysrc;
00871 
00872   while ((*yyd++ = *yys++) != '\0')
00873     continue;
00874 
00875   return yyd - 1;
00876 }

static YYSIZE_T yystrlen ( char *  yystr  )  const [static]

Definition at line 840 of file ast_expr2.c.

Referenced by yyparse().

00843 {
00844   register const char *yys = yystr;
00845 
00846   while (*yys++ != '\0')
00847     continue;
00848 
00849   return yys - yystr - 1;
00850 }


Variable Documentation

const yysigned_char yycheck[] [static]

Definition at line 582 of file ast_expr2.c.

const unsigned char yydefact[] [static]

Definition at line 525 of file ast_expr2.c.

const yysigned_char yydefgoto[] [static]

Initial value:

{
      -1,     5,     6
}

Definition at line 535 of file ast_expr2.c.

const yysigned_char yypact[] [static]

Definition at line 543 of file ast_expr2.c.

const yysigned_char yypgoto[] [static]

Initial value:

{
     -13,   -13,    -1
}

Definition at line 553 of file ast_expr2.c.

const unsigned char yyr1[] [static]

Definition at line 507 of file ast_expr2.c.

const unsigned char yyr2[] [static]

Definition at line 515 of file ast_expr2.c.

const unsigned char yystos[] [static]

Definition at line 603 of file ast_expr2.c.

const unsigned char yytable[] [static]

Definition at line 563 of file ast_expr2.c.

const char* const yytname[] [static]

Definition at line 485 of file ast_expr2.c.

const unsigned char yytranslate[] [static]

Definition at line 417 of file ast_expr2.c.


Generated on Wed Oct 28 15:48:20 2009 for Asterisk - the Open Source PBX by  doxygen 1.5.6