#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"
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 | ast_yyerror(x) ast_yyerror(x,&yyloc,parseio) |
| #define | ast_yyerror(x) ast_yyerror(x, YYLTYPE *yylloc, struct parse_io *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 | FUNC_ACOS acosl |
| #define | FUNC_ASIN asinl |
| #define | FUNC_ATAN atanl |
| #define | FUNC_ATAN2 atan2l |
| #define | FUNC_CEIL ceill |
| #define | FUNC_COS cosl |
| #define | FUNC_EXP expl |
| #define | FUNC_EXP10 exp10l |
| #define | FUNC_EXP2 exp2l |
| #define | FUNC_FLOOR floorl |
| #define | FUNC_FMOD fmodl |
| #define | FUNC_LOG logl |
| #define | FUNC_LOG10 log10l |
| #define | FUNC_LOG2 log2l |
| #define | FUNC_POW powl |
| #define | FUNC_REMAINDER remainderl |
| #define | FUNC_RINT rintl |
| #define | FUNC_ROUND roundl |
| #define | FUNC_SIN sinl |
| #define | FUNC_SQRT sqrtl |
| #define | FUNC_STRTOD strtold |
| #define | FUNC_TAN tanl |
| #define | FUNC_TRUNC truncl |
| #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.5" |
| #define | YYCASE_(N, S) |
| #define | yychar ast_yychar |
| #define | yyclearin (yychar = YYEMPTY) |
| #define | YYCOPY(To, From, Count) |
| #define | YYCOPY_NEEDED 1 |
| #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 ast_yyerror |
| #define | YYERROR goto yyerrorlab |
| #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 | yypact_value_is_default(yystate) ((yystate) == (-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 /* obsolescent; will be withdrawn */ |
| #define | YYSTYPE_IS_DECLARED 1 |
| #define | YYSTYPE_IS_TRIVIAL 1 |
| #define | YYSYNTAX_ERROR |
| #define | YYTABLE_NINF -1 |
| #define | yytable_value_is_error(yytable_value) YYID (0) |
| #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 void free_value | __P ((struct val *)) |
| static struct val *make_number | __P ((FP___TYPE)) |
| static struct val *make_str | __P ((const char *)) |
| static struct val *op_and | __P ((struct val *, struct val *)) |
| static struct val *op_cond | __P ((struct val *, struct val *, struct val *)) |
| int ast_yylex | __P ((YYSTYPE *, YYLTYPE *, yyscan_t)) |
| static struct expr_node * | alloc_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 val * | make_number (FP___TYPE i) |
| static struct val * | make_str (const char *s) |
| static struct val * | op_and (struct val *a, struct val *b) |
| static struct val * | op_colon (struct val *a, struct val *b) |
| static struct val * | op_compl (struct val *a) |
| static struct val * | op_cond (struct val *a, struct val *b, struct val *c) |
| static struct val * | op_div (struct val *a, struct val *b) |
| static struct val * | op_eq (struct val *a, struct val *b) |
| static struct val * | op_eqtilde (struct val *a, struct val *b) |
| static struct val * | op_func (struct val *funcname, struct expr_node *arglist, struct ast_channel *chan) |
| static struct val * | op_ge (struct val *a, struct val *b) |
| static struct val * | op_gt (struct val *a, struct val *b) |
| static struct val * | op_le (struct val *a, struct val *b) |
| static struct val * | op_lt (struct val *a, struct val *b) |
| static struct val * | op_minus (struct val *a, struct val *b) |
| static struct val * | op_ne (struct val *a, struct val *b) |
| static struct val * | op_negate (struct val *a) |
| static struct val * | op_or (struct val *a, struct val *b) |
| static struct val * | op_plus (struct val *a, struct val *b) |
| static struct val * | op_rem (struct val *a, struct val *b) |
| static struct val * | op_tildetilde (struct val *a, struct val *b) |
| static struct val * | op_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 () |
| int | yyparse (void *YYPARSE_PARAM) |
| static char * | yystpcpy (char *yydest, const char *yysrc) |
| static YYSIZE_T | yystrlen (char *yystr) const |
| static int | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) |
| 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 ast_yyerror | ( | x | ) | ast_yyerror(x,&yyloc,parseio) |
Definition at line 2785 of file ast_expr2.c.
| #define ast_yyerror | ( | x | ) | ast_yyerror(x, YYLTYPE *yylloc, struct parse_io *parseio) |
Definition at line 2785 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 412 of file ast_expr2.c.
Referenced by yyparse().
| #define FP___PRINTF "%.16g" |
Definition at line 110 of file ast_expr2.c.
Referenced by compose_func_args(), and to_string().
| #define FP___TYPE double |
Definition at line 111 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 FUNC_ACOS acosl |
Definition at line 133 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_ASIN asinl |
Definition at line 139 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_ATAN atanl |
Definition at line 145 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_ATAN2 atan2l |
Definition at line 151 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_CEIL ceill |
Definition at line 211 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_COS cosl |
Definition at line 115 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_EXP expl |
Definition at line 175 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_EXP10 exp10l |
Definition at line 241 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_EXP2 exp2l |
Definition at line 233 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_FLOOR floorl |
Definition at line 205 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_FMOD fmodl |
Definition at line 193 of file ast_expr2.c.
Referenced by op_rem().
| #define FUNC_LOG logl |
Definition at line 181 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_LOG10 log10l |
Definition at line 261 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_LOG2 log2l |
Definition at line 249 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_POW powl |
Definition at line 157 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_REMAINDER remainderl |
Definition at line 187 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_RINT rintl |
Definition at line 169 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_ROUND roundl |
Definition at line 217 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_SIN sinl |
Definition at line 121 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_SQRT sqrtl |
Definition at line 163 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_STRTOD strtold |
Definition at line 199 of file ast_expr2.c.
Referenced by op_func(), and to_number().
| #define FUNC_TAN tanl |
Definition at line 127 of file ast_expr2.c.
Referenced by op_func().
| #define FUNC_TRUNC truncl |
Definition at line 223 of file ast_expr2.c.
Referenced by op_func().
| #define QUAD_MAX (0x7fffffffffffffffLL) |
Definition at line 308 of file ast_expr2.c.
| #define QUAD_MIN (-0x7fffffffffffffffLL-1) |
Definition at line 305 of file ast_expr2.c.
Referenced by chk_div(), and chk_minus().
| #define YY_ | ( | msgid | ) | msgid |
Definition at line 571 of file ast_expr2.c.
Referenced by yyparse(), and yysyntax_error().
| #define YY_LOCATION_PRINT | ( | File, | |
| Loc | |||
| ) |
fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \
(Loc).last_line, (Loc).last_column)
Definition at line 1042 of file ast_expr2.c.
| #define YY_REDUCE_PRINT | ( | Rule | ) |
Definition at line 1226 of file ast_expr2.c.
Referenced by yyparse().
| #define YY_STACK_PRINT | ( | Bottom, | |
| Top | |||
| ) |
Definition at line 1225 of file ast_expr2.c.
Referenced by yyparse().
| #define YY_SYMBOL_PRINT | ( | Title, | |
| Type, | |||
| Value, | |||
| Location | |||
| ) |
Definition at line 1224 of file ast_expr2.c.
Referenced by yydestruct(), and yyparse().
| #define YYABORT goto yyabortlab |
Definition at line 968 of file ast_expr2.c.
Referenced by yyparse().
| #define YYACCEPT goto yyacceptlab |
Definition at line 967 of file ast_expr2.c.
Referenced by yyparse().
| #define YYBACKUP | ( | Token, | |
| Value | |||
| ) |
Definition at line 989 of file ast_expr2.c.
| #define YYBISON 1 |
Definition at line 44 of file ast_expr2.c.
| #define YYBISON_VERSION "2.5" |
Definition at line 47 of file ast_expr2.c.
case N: \ yyformat = S; \ break
Referenced by yysyntax_error().
| #define yychar ast_yychar |
Definition at line 69 of file ast_expr2.c.
Referenced by yyparse().
Definition at line 963 of file ast_expr2.c.
| #define YYCOPY | ( | To, | |
| From, | |||
| Count | |||
| ) |
Definition at line 720 of file ast_expr2.c.
| #define YYCOPY_NEEDED 1 |
Definition at line 692 of file ast_expr2.c.
| #define yydebug ast_yydebug |
Definition at line 70 of file ast_expr2.c.
| #define YYDEBUG 0 |
Definition at line 420 of file ast_expr2.c.
| #define YYDPRINTF | ( | Args | ) |
Definition at line 1223 of file ast_expr2.c.
Referenced by yyparse().
| #define YYEMPTY (-2) |
Definition at line 964 of file ast_expr2.c.
Referenced by yyparse(), and yysyntax_error().
| #define YYENABLE_NLS 0 |
Definition at line 310 of file ast_expr2.c.
| #define YYEOF 0 |
Definition at line 965 of file ast_expr2.c.
Referenced by yyparse().
| #define YYERRCODE 256 |
Definition at line 1007 of file ast_expr2.c.
| #define yyerrok (yyerrstatus = 0) |
Definition at line 962 of file ast_expr2.c.
| #define yyerror ast_yyerror |
Definition at line 67 of file ast_expr2.c.
Referenced by yyparse().
| #define YYERROR goto yyerrorlab |
Definition at line 969 of file ast_expr2.c.
| #define YYERROR_VERBOSE 1 |
Definition at line 426 of file ast_expr2.c.
| #define YYERROR_VERBOSE 1 |
Definition at line 426 of file ast_expr2.c.
| #define YYFAIL goto yyerrlab |
Definition at line 979 of file ast_expr2.c.
| #define YYFINAL 11 |
Definition at line 733 of file ast_expr2.c.
Referenced by yyparse().
Definition at line 660 of file ast_expr2.c.
| #define YYID | ( | n | ) | (n) |
Definition at line 584 of file ast_expr2.c.
Referenced by yyparse().
| #define YYINITDEPTH 200 |
Definition at line 1232 of file ast_expr2.c.
Referenced by yyparse().
| #define YYLAST 159 |
Definition at line 735 of file ast_expr2.c.
Referenced by yyparse(), and yysyntax_error().
Definition at line 66 of file ast_expr2.c.
| #define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) |
Definition at line 1055 of file ast_expr2.c.
Referenced by yyparse().
| #define YYLEX_PARAM ((struct parse_io *)parseio)->scanner |
Definition at line 312 of file ast_expr2.c.
| #define yylloc ast_yylloc |
Definition at line 72 of file ast_expr2.c.
Referenced by yyparse().
| #define YYLLOC_DEFAULT | ( | Current, | |
| Rhs, | |||
| N | |||
| ) |
Definition at line 1016 of file ast_expr2.c.
Referenced by yyparse().
| #define YYLSP_NEEDED 1 |
Definition at line 62 of file ast_expr2.c.
Definition at line 400 of file ast_expr2.c.
| #define YYLTYPE_IS_TRIVIAL 1 |
Definition at line 401 of file ast_expr2.c.
| #define yylval ast_yylval |
Definition at line 68 of file ast_expr2.c.
Referenced by yyparse().
Definition at line 653 of file ast_expr2.c.
| #define YYMAXDEPTH 10000 |
Definition at line 1243 of file ast_expr2.c.
Referenced by yyparse().
| #define YYMAXUTOK 280 |
Definition at line 748 of file ast_expr2.c.
| #define yynerrs ast_yynerrs |
Definition at line 71 of file ast_expr2.c.
Referenced by yyparse().
| #define YYNNTS 4 |
Definition at line 740 of file ast_expr2.c.
| #define YYNRULES 28 |
Definition at line 742 of file ast_expr2.c.
| #define YYNSTATES 54 |
Definition at line 744 of file ast_expr2.c.
| #define YYNTOKENS 26 |
Definition at line 738 of file ast_expr2.c.
Referenced by yyparse(), and yysyntax_error().
| #define YYPACT_NINF -18 |
Definition at line 883 of file ast_expr2.c.
| #define yypact_value_is_default | ( | yystate | ) | ((yystate) == (-18)) |
Definition at line 924 of file ast_expr2.c.
Referenced by yyparse(), and yysyntax_error().
| #define yyparse ast_yyparse |
Definition at line 65 of file ast_expr2.c.
| #define YYPARSE_PARAM parseio |
Definition at line 311 of file ast_expr2.c.
| #define YYPOPSTACK | ( | N | ) | (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) |
Referenced by yyparse().
| #define YYPULL 1 |
Definition at line 59 of file ast_expr2.c.
| #define YYPURE 1 |
Definition at line 53 of file ast_expr2.c.
| #define YYPUSH 0 |
Definition at line 56 of file ast_expr2.c.
| #define YYRECOVERING | ( | ) | (!!yyerrstatus) |
Definition at line 987 of file ast_expr2.c.
| #define YYRHSLOC | ( | Rhs, | |
| K | |||
| ) | ((Rhs)[K]) |
Definition at line 1014 of file ast_expr2.c.
| #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
Definition at line 561 of file ast_expr2.c.
| #define YYSIZE_T unsigned int |
Definition at line 557 of file ast_expr2.c.
Referenced by yyparse(), yystrlen(), yysyntax_error(), and yytnamerr().
| #define YYSKELETON_NAME "yacc.c" |
Definition at line 50 of file ast_expr2.c.
| #define YYSTACK_ALLOC YYMALLOC |
Definition at line 639 of file ast_expr2.c.
Referenced by yyparse().
| #define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
Definition at line 642 of file ast_expr2.c.
Referenced by yysyntax_error().
| #define YYSTACK_BYTES | ( | N | ) |
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAXIMUM)
Definition at line 688 of file ast_expr2.c.
Referenced by yyparse().
| #define YYSTACK_FREE YYFREE |
Definition at line 640 of file ast_expr2.c.
Referenced by yyparse().
| #define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
Definition at line 684 of file ast_expr2.c.
| #define YYSTACK_RELOCATE | ( | Stack_alloc, | |
| Stack | |||
| ) |
Definition at line 699 of file ast_expr2.c.
Referenced by yyparse().
Definition at line 487 of file ast_expr2.c.
| #define YYSTYPE_IS_DECLARED 1 |
Definition at line 488 of file ast_expr2.c.
| #define YYSTYPE_IS_TRIVIAL 1 |
Definition at line 486 of file ast_expr2.c.
| #define YYSYNTAX_ERROR |
yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken)
Referenced by yyparse().
| #define YYTABLE_NINF -1 |
Definition at line 903 of file ast_expr2.c.
| #define yytable_value_is_error | ( | yytable_value | ) | YYID (0) |
Definition at line 927 of file ast_expr2.c.
Referenced by yyparse(), and yysyntax_error().
| #define YYTERROR 1 |
Definition at line 1006 of file ast_expr2.c.
Referenced by yyparse(), and yysyntax_error().
| #define YYTOKEN_TABLE 0 |
Definition at line 433 of file ast_expr2.c.
| #define YYTOKENTYPE |
Definition at line 439 of file ast_expr2.c.
| #define YYTRANSLATE | ( | YYX | ) | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
Definition at line 750 of file ast_expr2.c.
Referenced by yyparse().
| #define YYUNDEFTOK 2 |
Definition at line 747 of file ast_expr2.c.
| #define YYUSE | ( | e | ) | ((void) (e)) |
Definition at line 577 of file ast_expr2.c.
Referenced by yydestruct().
| typedef void* yyscan_t |
Definition at line 346 of file ast_expr2.c.
| typedef short int yytype_int16 |
Definition at line 544 of file ast_expr2.c.
| typedef short int yytype_int8 |
Definition at line 532 of file ast_expr2.c.
| typedef unsigned short int yytype_uint16 |
Definition at line 538 of file ast_expr2.c.
| typedef unsigned char yytype_uint8 |
Definition at line 523 of file ast_expr2.c.
| enum node_type |
Definition at line 333 of file ast_expr2.c.
| enum valtype |
| AST_EXPR_number | |
| AST_EXPR_numeric_string | |
| AST_EXPR_string | |
| AST_EXPR_number | |
| AST_EXPR_numeric_string | |
| AST_EXPR_string |
Definition at line 317 of file ast_expr2.c.
| enum yytokentype |
Definition at line 442 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
};
| static struct val* make_number __P | ( | (FP___TYPE) | ) | [static, read] |
| static struct expr_node * alloc_expr_node | ( | enum node_type | nt | ) | [static, read] |
| int ast_yyerror | ( | const char * | , |
| YYLTYPE * | , | ||
| struct parse_io * | |||
| ) |
Definition at line 3534 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;
}
Definition at line 3378 of file ast_expr2.c.
References chk_plus(), and QUAD_MIN.
Referenced by op_minus(), and op_negate().
Definition at line 3335 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;
}
Definition at line 3500 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 2809 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 2792 of file ast_expr2.c.
References free, free_value(), expr_node::right, and expr_node::val.
Referenced by yyparse().
| static void free_value | ( | struct val * | vp | ) | [static] |
Definition at line 2624 of file ast_expr2.c.
References AST_EXPR_numeric_string, AST_EXPR_string, free, val::s, val::type, and val::u.
Referenced by destroy_arglist(), 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_tildetilde(), op_times(), and yydestruct().
{
if (vp==NULL) {
return;
}
if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)
free (vp->u.s);
free(vp);
}
| static int is_really_num | ( | char * | str | ) | [static] |
Definition at line 2851 of file ast_expr2.c.
Referenced by op_func().
| static int is_zero_or_null | ( | struct val * | vp | ) | [static] |
Definition at line 2718 of file ast_expr2.c.
References AST_EXPR_number, val::i, val::s, to_number(), val::type, and val::u.
Definition at line 2710 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 2576 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;
}
Definition at line 2592 of file ast_expr2.c.
References AST_EXPR_numeric_string, AST_EXPR_string, ast_log(), free, 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)) {
if (vp) {
free(vp);
}
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;
}
Definition at line 3156 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);
}
}
Definition at line 3607 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;
}
Definition at line 3446 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;
}
Definition at line 3276 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;
}
Definition at line 3545 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;
}
Definition at line 3169 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 3658 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 2860 of file ast_expr2.c.
References ast_custom_function_find(), ast_log(), compose_func_args(), f, FP___TYPE, free, FUNC_ACOS, FUNC_ASIN, FUNC_ATAN, FUNC_ATAN2, FUNC_CEIL, FUNC_COS, FUNC_EXP, FUNC_EXP10, FUNC_EXP2, FUNC_FLOOR, FUNC_LOG, FUNC_LOG10, FUNC_LOG2, FUNC_POW, FUNC_REMAINDER, FUNC_RINT, FUNC_ROUND, FUNC_SIN, FUNC_SQRT, FUNC_STRTOD, FUNC_TAN, FUNC_TRUNC, 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));
}
Definition at line 3236 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().
Definition at line 3196 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().
Definition at line 3256 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().
Definition at line 3216 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().
Definition at line 3392 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;
}
Definition at line 3315 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().
Definition at line 3426 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;
}
Definition at line 3144 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);
}
}
Definition at line 3348 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;
}
Definition at line 3580 of file ast_expr2.c.
References ast_log(), free_value(), FUNC_FMOD, 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 3708 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;
}
Definition at line 3512 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 2667 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().
Definition at line 2636 of file ast_expr2.c.
References AST_EXPR_number, AST_EXPR_string, ast_log(), errno, FP___TYPE, free, FUNC_STRTOD, 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;
}
Definition at line 2690 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 1496 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 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1520 "ast_expr2.c"
break;
case 5: /* "TOK_COND" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1529 "ast_expr2.c"
break;
case 6: /* "TOK_OR" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1538 "ast_expr2.c"
break;
case 7: /* "TOK_AND" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1547 "ast_expr2.c"
break;
case 8: /* "TOK_NE" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1556 "ast_expr2.c"
break;
case 9: /* "TOK_LE" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1565 "ast_expr2.c"
break;
case 10: /* "TOK_GE" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1574 "ast_expr2.c"
break;
case 11: /* "TOK_LT" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1583 "ast_expr2.c"
break;
case 12: /* "TOK_GT" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1592 "ast_expr2.c"
break;
case 13: /* "TOK_EQ" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1601 "ast_expr2.c"
break;
case 14: /* "TOK_MINUS" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1610 "ast_expr2.c"
break;
case 15: /* "TOK_PLUS" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1619 "ast_expr2.c"
break;
case 16: /* "TOK_MOD" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1628 "ast_expr2.c"
break;
case 17: /* "TOK_DIV" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1637 "ast_expr2.c"
break;
case 18: /* "TOK_MULT" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1646 "ast_expr2.c"
break;
case 19: /* "TOK_COMPL" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1655 "ast_expr2.c"
break;
case 20: /* "TOK_TILDETILDE" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1664 "ast_expr2.c"
break;
case 21: /* "TOK_EQTILDE" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1673 "ast_expr2.c"
break;
case 22: /* "TOK_COLON" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1682 "ast_expr2.c"
break;
case 23: /* "TOK_LP" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1691 "ast_expr2.c"
break;
case 24: /* "TOK_RP" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1700 "ast_expr2.c"
break;
case 25: /* "TOKEN" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1709 "ast_expr2.c"
break;
case 29: /* "expr" */
/* Line 1391 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
/* Line 1391 of yacc.c */
#line 1718 "ast_expr2.c"
break;
default:
break;
}
}
| int yyparse | ( | ) |
| int yyparse | ( | void * | YYPARSE_PARAM | ) |
Definition at line 1753 of file ast_expr2.c.
References alloc_expr_node(), YYSTYPE::arglist, AST_EXPR_NODE_VAL, AST_EXPR_number, AST_EXPR_string, calloc, 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_value_is_default, YYPOPSTACK, YYSIZE_T, yyalloc::yyss_alloc, YYSTACK_ALLOC, YYSTACK_BYTES, YYSTACK_FREE, YYSTACK_RELOCATE, YYSYNTAX_ERROR, yytable_value_is_error, 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[3];
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 defined YYLTYPE_IS_TRIVIAL && 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 (yypact_value_is_default (yyn))
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 (yytable_value_is_error (yyn))
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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 of yacc.c */
#line 411 "ast_expr2.y"
{(yyval.val) = (yyvsp[(1) - (1)].val);}
break;
case 9:
/* Line 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 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 1806 of yacc.c */
#line 2322 "ast_expr2.c"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
that yytoken be updated with the new translation. We take the
approach of translating immediately before every use of yytoken.
One alternative is translating here after every semantic action,
but that translation would be missed if the semantic action invokes
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
incorrect destructor might then be invoked immediately. In the
case of YYERROR or YYBACKUP, subsequent parser actions might lead
to an incorrect destructor call or verbose syntax error message
before the lookahead is translated. */
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:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
#if ! YYERROR_VERBOSE
yyerror (YY_("syntax error"));
#else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
yyssp, yytoken)
{
char const *yymsgp = YY_("syntax error");
int yysyntax_error_status;
yysyntax_error_status = YYSYNTAX_ERROR;
if (yysyntax_error_status == 0)
yymsgp = yymsg;
else if (yysyntax_error_status == 1)
{
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
if (!yymsg)
{
yymsg = yymsgbuf;
yymsg_alloc = sizeof yymsgbuf;
yysyntax_error_status = 2;
}
else
{
yysyntax_error_status = YYSYNTAX_ERROR;
yymsgp = yymsg;
}
}
yyerror (yymsgp);
if (yysyntax_error_status == 2)
goto yyexhaustedlab;
}
# undef YYSYNTAX_ERROR
#endif
}
yyerror_range[1] = 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[1] = 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 (!yypact_value_is_default (yyn))
{
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[1] = *yylsp;
yydestruct ("Error: popping",
yystos[yystate], yyvsp, yylsp);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
*++yyvsp = yylval;
yyerror_range[2] = yylloc;
/* Using YYLLOC is tempting, but would change the location of
the lookahead. YYLOC is available though. */
YYLLOC_DEFAULT (yyloc, yyerror_range, 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)
{
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = YYTRANSLATE (yychar);
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);
}
| static char* yystpcpy | ( | char * | yydest, |
| const char * | yysrc | ||
| ) | [static] |
Definition at line 1284 of file ast_expr2.c.
Referenced by yytnamerr().
{
char *yyd = yydest;
const char *yys = yysrc;
while ((*yyd++ = *yys++) != '\0')
continue;
return yyd - 1;
}
Definition at line 1260 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 int yysyntax_error | ( | YYSIZE_T * | yymsg_alloc, |
| char ** | yymsg, | ||
| yytype_int16 * | yyssp, | ||
| int | yytoken | ||
| ) | [static] |
Definition at line 1357 of file ast_expr2.c.
References YY_, YYCASE_, YYEMPTY, YYLAST, YYNTOKENS, yypact_value_is_default, YYSIZE_T, YYSTACK_ALLOC_MAXIMUM, yystrlen(), yytable_value_is_error, YYTERROR, and yytnamerr().
{
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
YYSIZE_T yysize1;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = 0;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
/* There are many possibilities here to consider:
- Assume YYFAIL is not used. It's too flawed to consider. See
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
for details. YYERROR is fine as it does not invoke this
function.
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount++] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
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 yyx;
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
break;
}
yyarg[yycount++] = yytname[yyx];
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* 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 = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
}
Definition at line 1309 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;
}
| char extra_error_message[4095] |
Definition at line 2464 of file ast_expr2f.c.
Definition at line 2465 of file ast_expr2f.c.
const yytype_int8 yycheck[] [static] |
Definition at line 930 of file ast_expr2.c.
const yytype_uint8 yydefact[] [static] |
Definition at line 865 of file ast_expr2.c.
const yytype_int8 yydefgoto[] [static] |
{
-1, 5, 30, 6
}
Definition at line 876 of file ast_expr2.c.
const yytype_int16 yypact[] [static] |
Definition at line 884 of file ast_expr2.c.
const yytype_int8 yypgoto[] [static] |
{
-18, -18, -18, -1
}
Definition at line 895 of file ast_expr2.c.
const yytype_uint8 yyr1[] [static] |
Definition at line 847 of file ast_expr2.c.
const yytype_uint8 yyr2[] [static] |
Definition at line 855 of file ast_expr2.c.
const yytype_uint8 yystos[] [static] |
Definition at line 952 of file ast_expr2.c.
const yytype_uint8 yytable[] [static] |
Definition at line 904 of file ast_expr2.c.
const char* const yytname[] [static] |
Definition at line 825 of file ast_expr2.c.
const yytype_uint8 yytranslate[] [static] |
Definition at line 754 of file ast_expr2.c.