?? risk-parser.c
字號(hào):
/* A Bison parser, made from risk-parser.y, by GNU bison 1.75. *//* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *//* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. *//* Written by Richard Stallman by simplifying the original so called ``semantic'' parser. *//* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. *//* Identify Bison output. */#define YYBISON 1/* Pure parsers. */#define YYPURE 0/* Using locations. */#define YYLSP_NEEDED 0/* Tokens. */#ifndef YYTOKENTYPE# define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { tCATEGORIES = 258, tPRIOR = 259, tLOSS = 260, tEXP = 261, tLOG = 262, tNUMBER = 263, tMATCH = 264, tCOMPLEXITY = 265, tNAME = 266, tREGEX = 267, tVEC = 268 };#endif#define tCATEGORIES 258#define tPRIOR 259#define tLOSS 260#define tEXP 261#define tLOG 262#define tNUMBER 263#define tMATCH 264#define tCOMPLEXITY 265#define tNAME 266#define tREGEX 267#define tVEC 268/* Copy the first part of user declarations. */#line 1 "risk-parser.y"/* * Copyright (C) 2002 Laird Breyer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Author: Laird Breyer <laird@lbreyer.com> */#define YYDEBUG 0#include <stdlib.h>#include <stdio.h>#include <string.h>#include <math.h>#include "bayesol.h" extern char *yytext; extern FILE *yyin; extern int current_lineno; extern int yylex(void); extern void reset_lexer(); extern void lexer_prepare_string(char *buf); extern void lexer_free_string(); extern Spec spec; /* defined here */ void set_loss_and_increment(real_value_t v); int parse_loss_vec(category_count_t i, char *buf); int parse_risk_spec(FILE *input); int yyerror(char *s); void add_prior_weight(real_value_t w); void add_cat_name(char *n); void attach_cat_vec(char *n, char *r, char *v); category_count_t x, y; /* Enabling traces. */#ifndef YYDEBUG# define YYDEBUG 0#endif/* Enabling verbose error messages. */#ifdef YYERROR_VERBOSE# undef YYERROR_VERBOSE# define YYERROR_VERBOSE 1#else# define YYERROR_VERBOSE 0#endif#ifndef YYSTYPE#line 51 "risk-parser.y"typedef union { real_value_t numval; char *strval;} yystype;/* Line 193 of /usr/share/bison/yacc.c. */#line 154 "y.tab.c"# define YYSTYPE yystype# define YYSTYPE_IS_TRIVIAL 1#endif#ifndef YYLTYPEtypedef struct yyltype{ int first_line; int first_column; int last_line; int last_column;} yyltype;# define YYLTYPE yyltype# define YYLTYPE_IS_TRIVIAL 1#endif/* Copy the second part of user declarations. *//* Line 213 of /usr/share/bison/yacc.c. */#line 175 "y.tab.c"#if ! defined (yyoverflow) || YYERROR_VERBOSE/* The parser invokes alloca or malloc; define the necessary symbols. */# if YYSTACK_USE_ALLOCA# define YYSTACK_ALLOC alloca# else# ifndef YYSTACK_USE_ALLOCA# if defined (alloca) || defined (_ALLOCA_H)# define YYSTACK_ALLOC alloca# else# ifdef __GNUC__# define YYSTACK_ALLOC __builtin_alloca# endif# endif# endif# endif# ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)# else# if defined (__STDC__) || defined (__cplusplus)# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */# define YYSIZE_T size_t# endif# define YYSTACK_ALLOC malloc# define YYSTACK_FREE free# endif#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */#if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))/* A type that is properly aligned for any stack member. */union yyalloc{ short yyss; YYSTYPE yyvs; };/* The size of the maximum gap between one aligned stack and the next. */# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)/* The size of an array large to enough to hold all stacks, each with N elements. */# define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAX)/* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */# ifndef YYCOPY# if 1 < __GNUC__# define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))# else# define YYCOPY(To, From, Count) \ do \ { \ register YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (0)# endif# endif/* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */# define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0)#endif#if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char;#else typedef short yysigned_char;#endif/* YYFINAL -- State number of the termination state. */#define YYFINAL 16#define YYLAST 83/* YYNTOKENS -- Number of terminals. */#define YYNTOKENS 24/* YYNNTS -- Number of nonterminals. */#define YYNNTS 10/* YYNRULES -- Number of rules. */#define YYNRULES 25/* YYNRULES -- Number of states. */#define YYNSTATES 58/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */#define YYUNDEFTOK 2#define YYMAXUTOK 268#define YYTRANSLATE(X) \ ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */static const unsigned char yytranslate[] ={ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 22, 23, 16, 14, 21, 15, 2, 17, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 19, 2, 20, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};#if YYDEBUG/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */static const unsigned char yyprhs[] ={ 0, 0, 3, 7, 9, 14, 16, 20, 25, 27, 31, 36, 40, 45, 47, 51, 53, 55, 57, 61, 65, 69, 73, 77, 81, 86};/* YYRHS -- A `-1'-separated list of the rules' RHS. */static const yysigned_char yyrhs[] ={ 25, 0, -1, 26, 28, 30, -1, 32, -1, 3, 19, 27, 20, -1, 11, -1, 27, 21, 11, -1, 4, 19, 29, 20, -1, 8, -1, 29, 21, 8, -1, 5, 19, 31, 20, -1, 12, 11, 13, -1, 31, 12, 11, 13, -1, 33, -1, 32, 21, 33, -1, 8, -1, 9, -1, 10, -1, 33, 14, 33, -1, 33, 15, 33, -1, 33, 16, 33, -1, 33, 17, 33, -1, 33, 18, 33, -1, 22, 33, 23, -1, 6, 22, 33, 23, -1, 7, 22, 33, 23, -1};/* YYRLINE[YYN] -- source line where rule number YYN was defined. */static const unsigned char yyrline[] ={ 0, 80, 80, 81, 84, 87, 88, 91, 94, 95, 98, 101, 102, 105, 106, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119};#endif#if YYDEBUG || YYERROR_VERBOSE/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */static const char *const yytname[] ={ "$end", "error", "$undefined", "tCATEGORIES", "tPRIOR", "tLOSS", "tEXP", "tLOG", "tNUMBER", "tMATCH", "tCOMPLEXITY", "tNAME", "tREGEX", "tVEC", "'+'", "'-'", "'*'", "'/'", "'^'", "'{'", "'}'", "','", "'('", "')'", "$accept", "spec", "catlist", "catvec", "priorlist", "priorvec", "lossmat", "multivec", "flist", "formula", 0};#endif# ifdef YYPRINT/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */static const unsigned short yytoknum[] ={ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 43, 45, 42, 47, 94, 123, 125, 44, 40, 41};# endif/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */static const unsigned char yyr1[] ={ 0, 24, 25, 25, 26, 27, 27, 28, 29, 29, 30, 31, 31, 32, 32, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33};/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */static const unsigned char yyr2[] ={ 0, 2, 3, 1, 4, 1, 3, 4, 1, 3, 4, 3, 4, 1, 3, 1, 1, 1, 3, 3, 3, 3, 3, 3, 4, 4};/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */static const unsigned char yydefact[] ={ 0, 0, 0, 0, 15, 16, 17, 0, 0, 0, 3, 13, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 23, 0, 0, 2, 14, 18, 19, 20, 21, 22, 4, 0, 24, 25, 8, 0, 0, 6, 7, 0, 0, 0, 9, 0, 0, 10, 11, 0, 12};/* YYDEFGOTO[NTERM-NUM]. */static const yysigned_char yydefgoto[] ={ -1, 8, 9, 26, 18, 44, 32, 50, 10, 11};/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */#define YYPACT_NINF -20static const yysigned_char yypact[] ={ -3, 22, 31, 40, -20, -20, -20, 20, 63, 60, 44, 43, 55, 20, 20, -5, -20, 48, 64, 20, 20, 20, 20, 20, 20, -20, -19, 17, 29, -20, 62, 49, -20, 43, 21, 33, -1, 53, 53, -20, 61, -20, -20, -20, 34, 65, -20, -20, 66, 67, 36, -20, 68, 69, -20, -20, 70, -20};/* YYPGOTO[NTERM-NUM]. */static const yysigned_char yypgoto[] ={ -20, -20, -20, -20, -20, -20, -20, -20, -20, 1};/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, parse error. */#define YYTABLE_NINF -1static const unsigned char yytable[] ={ 1, 39, 40, 2, 3, 4, 5, 6, 15, 20, 21, 22, 23, 24, 27, 28, 23, 24, 29, 7, 33, 34, 35, 36, 37, 38, 2, 3, 4, 5, 6, 20, 21, 22, 23, 24, 21, 22, 23, 24, 41, 12, 7, 20, 21, 22, 23, 24, 53, 22, 23, 24, 42, 13, 47, 48, 54, 20, 21, 22, 23, 24, 14, 16, 17, 19, 25, 30, 45, 31, 43, 24, 46, 0, 51, 0, 0, 49, 52, 0, 56, 55, 0, 57};static const yysigned_char yycheck[] ={ 3, 20, 21, 6, 7, 8, 9, 10, 7, 14, 15, 16, 17, 18, 13, 14, 17, 18, 23, 22, 19, 20, 21, 22, 23, 24, 6, 7, 8, 9, 10, 14, 15, 16, 17, 18, 15, 16, 17, 18, 23, 19, 22, 14, 15, 16, 17, 18, 12, 16, 17, 18, 23, 22, 20, 21, 20, 14, 15, 16, 17, 18, 22, 0, 4, 21, 11, 19, 19, 5, 8, 18, 11, -1, 8, -1, -1, 12, 11, -1, 11, 13, -1, 13};/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */static const unsigned char yystos[] ={ 0, 3, 6, 7, 8, 9, 10, 22, 25, 26, 32, 33, 19, 22, 22, 33, 0, 4, 28, 21, 14, 15, 16, 17, 18, 11, 27, 33, 33, 23, 19, 5, 30, 33, 33, 33, 33, 33, 33, 20, 21, 23, 23, 8, 29, 19, 11, 20, 21, 12, 31, 8, 11, 12, 20, 13, 11, 13};#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)# define YYSIZE_T __SIZE_TYPE__#endif#if ! defined (YYSIZE_T) && defined (size_t)# define YYSIZE_T size_t#endif#if ! defined (YYSIZE_T)
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -