b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | /* A Bison parser, made by GNU Bison 2.5. */ |
| 2 | |
| 3 | /* Bison implementation for Yacc-like parsers in C |
| 4 | |
| 5 | Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. |
| 6 | |
| 7 | This program is free software: you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation, either version 3 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | |
| 20 | /* As a special exception, you may create a larger work that contains |
| 21 | part or all of the Bison parser skeleton and distribute that work |
| 22 | under terms of your choice, so long as that work isn't itself a |
| 23 | parser generator using the skeleton or a modified version thereof |
| 24 | as a parser skeleton. Alternatively, if you modify or redistribute |
| 25 | the parser skeleton itself, you may (at your option) remove this |
| 26 | special exception, which will cause the skeleton and the resulting |
| 27 | Bison output files to be licensed under the GNU General Public |
| 28 | License without this special exception. |
| 29 | |
| 30 | This special exception was added by the Free Software Foundation in |
| 31 | version 2.2 of Bison. */ |
| 32 | |
| 33 | /* C LALR(1) parser skeleton written by Richard Stallman, by |
| 34 | simplifying the original so-called "semantic" parser. */ |
| 35 | |
| 36 | /* All symbols defined below should begin with yy or YY, to avoid |
| 37 | infringing on user name space. This should be done even for local |
| 38 | variables, as they might otherwise be expanded by user macros. |
| 39 | There are some unavoidable exceptions within include files to |
| 40 | define necessary library symbols; they are noted "INFRINGES ON |
| 41 | USER NAME SPACE" below. */ |
| 42 | |
| 43 | /* Identify Bison output. */ |
| 44 | #define YYBISON 1 |
| 45 | |
| 46 | /* Bison version. */ |
| 47 | #define YYBISON_VERSION "2.5" |
| 48 | |
| 49 | /* Skeleton name. */ |
| 50 | #define YYSKELETON_NAME "yacc.c" |
| 51 | |
| 52 | /* Pure parsers. */ |
| 53 | #define YYPURE 0 |
| 54 | |
| 55 | /* Push parsers. */ |
| 56 | #define YYPUSH 0 |
| 57 | |
| 58 | /* Pull parsers. */ |
| 59 | #define YYPULL 1 |
| 60 | |
| 61 | /* Using locations. */ |
| 62 | #define YYLSP_NEEDED 0 |
| 63 | |
| 64 | /* Substitute the variable and function names. */ |
| 65 | #define yyparse sensors_yyparse |
| 66 | #define yylex sensors_yylex |
| 67 | #define yyerror sensors_yyerror |
| 68 | #define yylval sensors_yylval |
| 69 | #define yychar sensors_yychar |
| 70 | #define yydebug sensors_yydebug |
| 71 | #define yynerrs sensors_yynerrs |
| 72 | |
| 73 | |
| 74 | /* Copy the first part of user declarations. */ |
| 75 | |
| 76 | /* Line 268 of yacc.c */ |
| 77 | #line 1 "lib/conf-parse.y" |
| 78 | |
| 79 | /* |
| 80 | conf-parse.y - Part of libsensors, a Linux library for reading sensor data. |
| 81 | Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl> |
| 82 | |
| 83 | This library is free software; you can redistribute it and/or |
| 84 | modify it under the terms of the GNU Lesser General Public |
| 85 | License as published by the Free Software Foundation; either |
| 86 | version 2.1 of the License, or (at your option) any later version. |
| 87 | |
| 88 | This library is distributed in the hope that it will be useful, |
| 89 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 90 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 91 | GNU Lesser General Public License for more details. |
| 92 | |
| 93 | You should have received a copy of the GNU General Public License |
| 94 | along with this program; if not, write to the Free Software |
| 95 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| 96 | MA 02110-1301 USA. |
| 97 | */ |
| 98 | |
| 99 | #define YYERROR_VERBOSE |
| 100 | |
| 101 | #include <stdio.h> |
| 102 | #include <string.h> |
| 103 | #include <stdlib.h> |
| 104 | |
| 105 | #include "data.h" |
| 106 | #include "general.h" |
| 107 | #include "error.h" |
| 108 | #include "conf.h" |
| 109 | #include "access.h" |
| 110 | #include "init.h" |
| 111 | |
| 112 | static void sensors_yyerror(const char *err); |
| 113 | static sensors_expr *malloc_expr(void); |
| 114 | |
| 115 | static sensors_chip *current_chip = NULL; |
| 116 | |
| 117 | #define bus_add_el(el) sensors_add_array_el(el,\ |
| 118 | &sensors_config_busses,\ |
| 119 | &sensors_config_busses_count,\ |
| 120 | &sensors_config_busses_max,\ |
| 121 | sizeof(sensors_bus)) |
| 122 | #define label_add_el(el) sensors_add_array_el(el,\ |
| 123 | ¤t_chip->labels,\ |
| 124 | ¤t_chip->labels_count,\ |
| 125 | ¤t_chip->labels_max,\ |
| 126 | sizeof(sensors_label)); |
| 127 | #define set_add_el(el) sensors_add_array_el(el,\ |
| 128 | ¤t_chip->sets,\ |
| 129 | ¤t_chip->sets_count,\ |
| 130 | ¤t_chip->sets_max,\ |
| 131 | sizeof(sensors_set)); |
| 132 | #define compute_add_el(el) sensors_add_array_el(el,\ |
| 133 | ¤t_chip->computes,\ |
| 134 | ¤t_chip->computes_count,\ |
| 135 | ¤t_chip->computes_max,\ |
| 136 | sizeof(sensors_compute)); |
| 137 | #define ignore_add_el(el) sensors_add_array_el(el,\ |
| 138 | ¤t_chip->ignores,\ |
| 139 | ¤t_chip->ignores_count,\ |
| 140 | ¤t_chip->ignores_max,\ |
| 141 | sizeof(sensors_ignore)); |
| 142 | #define chip_add_el(el) sensors_add_array_el(el,\ |
| 143 | &sensors_config_chips,\ |
| 144 | &sensors_config_chips_count,\ |
| 145 | &sensors_config_chips_max,\ |
| 146 | sizeof(sensors_chip)); |
| 147 | |
| 148 | #define fits_add_el(el,list) sensors_add_array_el(el,\ |
| 149 | &(list).fits,\ |
| 150 | &(list).fits_count,\ |
| 151 | &(list).fits_max, \ |
| 152 | sizeof(sensors_chip_name)); |
| 153 | |
| 154 | |
| 155 | |
| 156 | /* Line 268 of yacc.c */ |
| 157 | #line 158 "lib/conf-parse.c" |
| 158 | |
| 159 | /* Enabling traces. */ |
| 160 | #ifndef YYDEBUG |
| 161 | # define YYDEBUG 0 |
| 162 | #endif |
| 163 | |
| 164 | /* Enabling verbose error messages. */ |
| 165 | #ifdef YYERROR_VERBOSE |
| 166 | # undef YYERROR_VERBOSE |
| 167 | # define YYERROR_VERBOSE 1 |
| 168 | #else |
| 169 | # define YYERROR_VERBOSE 0 |
| 170 | #endif |
| 171 | |
| 172 | /* Enabling the token table. */ |
| 173 | #ifndef YYTOKEN_TABLE |
| 174 | # define YYTOKEN_TABLE 0 |
| 175 | #endif |
| 176 | |
| 177 | |
| 178 | /* Tokens. */ |
| 179 | #ifndef YYTOKENTYPE |
| 180 | # define YYTOKENTYPE |
| 181 | /* Put the tokens into the symbol table, so that GDB and other debuggers |
| 182 | know about them. */ |
| 183 | enum yytokentype { |
| 184 | NEG = 258, |
| 185 | EOL = 259, |
| 186 | BUS = 260, |
| 187 | LABEL = 261, |
| 188 | SET = 262, |
| 189 | CHIP = 263, |
| 190 | COMPUTE = 264, |
| 191 | IGNORE = 265, |
| 192 | FLOAT = 266, |
| 193 | NAME = 267, |
| 194 | ERROR = 268 |
| 195 | }; |
| 196 | #endif |
| 197 | |
| 198 | |
| 199 | |
| 200 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
| 201 | typedef union YYSTYPE |
| 202 | { |
| 203 | |
| 204 | /* Line 293 of yacc.c */ |
| 205 | #line 79 "lib/conf-parse.y" |
| 206 | |
| 207 | double value; |
| 208 | char *name; |
| 209 | void *nothing; |
| 210 | sensors_chip_name_list chips; |
| 211 | sensors_expr *expr; |
| 212 | sensors_bus_id bus; |
| 213 | sensors_chip_name chip; |
| 214 | sensors_config_line line; |
| 215 | |
| 216 | |
| 217 | |
| 218 | /* Line 293 of yacc.c */ |
| 219 | #line 220 "lib/conf-parse.c" |
| 220 | } YYSTYPE; |
| 221 | # define YYSTYPE_IS_TRIVIAL 1 |
| 222 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 223 | # define YYSTYPE_IS_DECLARED 1 |
| 224 | #endif |
| 225 | |
| 226 | |
| 227 | /* Copy the second part of user declarations. */ |
| 228 | |
| 229 | |
| 230 | /* Line 343 of yacc.c */ |
| 231 | #line 232 "lib/conf-parse.c" |
| 232 | |
| 233 | #ifdef short |
| 234 | # undef short |
| 235 | #endif |
| 236 | |
| 237 | #ifdef YYTYPE_UINT8 |
| 238 | typedef YYTYPE_UINT8 yytype_uint8; |
| 239 | #else |
| 240 | typedef unsigned char yytype_uint8; |
| 241 | #endif |
| 242 | |
| 243 | #ifdef YYTYPE_INT8 |
| 244 | typedef YYTYPE_INT8 yytype_int8; |
| 245 | #elif (defined __STDC__ || defined __C99__FUNC__ \ |
| 246 | || defined __cplusplus || defined _MSC_VER) |
| 247 | typedef signed char yytype_int8; |
| 248 | #else |
| 249 | typedef short int yytype_int8; |
| 250 | #endif |
| 251 | |
| 252 | #ifdef YYTYPE_UINT16 |
| 253 | typedef YYTYPE_UINT16 yytype_uint16; |
| 254 | #else |
| 255 | typedef unsigned short int yytype_uint16; |
| 256 | #endif |
| 257 | |
| 258 | #ifdef YYTYPE_INT16 |
| 259 | typedef YYTYPE_INT16 yytype_int16; |
| 260 | #else |
| 261 | typedef short int yytype_int16; |
| 262 | #endif |
| 263 | |
| 264 | #ifndef YYSIZE_T |
| 265 | # ifdef __SIZE_TYPE__ |
| 266 | # define YYSIZE_T __SIZE_TYPE__ |
| 267 | # elif defined size_t |
| 268 | # define YYSIZE_T size_t |
| 269 | # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ |
| 270 | || defined __cplusplus || defined _MSC_VER) |
| 271 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 272 | # define YYSIZE_T size_t |
| 273 | # else |
| 274 | # define YYSIZE_T unsigned int |
| 275 | # endif |
| 276 | #endif |
| 277 | |
| 278 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
| 279 | |
| 280 | #ifndef YY_ |
| 281 | # if defined YYENABLE_NLS && YYENABLE_NLS |
| 282 | # if ENABLE_NLS |
| 283 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 284 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 285 | # endif |
| 286 | # endif |
| 287 | # ifndef YY_ |
| 288 | # define YY_(msgid) msgid |
| 289 | # endif |
| 290 | #endif |
| 291 | |
| 292 | /* Suppress unused-variable warnings by "using" E. */ |
| 293 | #if ! defined lint || defined __GNUC__ |
| 294 | # define YYUSE(e) ((void) (e)) |
| 295 | #else |
| 296 | # define YYUSE(e) /* empty */ |
| 297 | #endif |
| 298 | |
| 299 | /* Identity function, used to suppress warnings about constant conditions. */ |
| 300 | #ifndef lint |
| 301 | # define YYID(n) (n) |
| 302 | #else |
| 303 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 304 | || defined __cplusplus || defined _MSC_VER) |
| 305 | static int |
| 306 | YYID (int yyi) |
| 307 | #else |
| 308 | static int |
| 309 | YYID (yyi) |
| 310 | int yyi; |
| 311 | #endif |
| 312 | { |
| 313 | return yyi; |
| 314 | } |
| 315 | #endif |
| 316 | |
| 317 | #if ! defined yyoverflow || YYERROR_VERBOSE |
| 318 | |
| 319 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 320 | |
| 321 | # ifdef YYSTACK_USE_ALLOCA |
| 322 | # if YYSTACK_USE_ALLOCA |
| 323 | # ifdef __GNUC__ |
| 324 | # define YYSTACK_ALLOC __builtin_alloca |
| 325 | # elif defined __BUILTIN_VA_ARG_INCR |
| 326 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
| 327 | # elif defined _AIX |
| 328 | # define YYSTACK_ALLOC __alloca |
| 329 | # elif defined _MSC_VER |
| 330 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
| 331 | # define alloca _alloca |
| 332 | # else |
| 333 | # define YYSTACK_ALLOC alloca |
| 334 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ |
| 335 | || defined __cplusplus || defined _MSC_VER) |
| 336 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 337 | # ifndef EXIT_SUCCESS |
| 338 | # define EXIT_SUCCESS 0 |
| 339 | # endif |
| 340 | # endif |
| 341 | # endif |
| 342 | # endif |
| 343 | # endif |
| 344 | |
| 345 | # ifdef YYSTACK_ALLOC |
| 346 | /* Pacify GCC's `empty if-body' warning. */ |
| 347 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) |
| 348 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 349 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 350 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 351 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 352 | to allow for a few compiler-allocated temporary stack slots. */ |
| 353 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
| 354 | # endif |
| 355 | # else |
| 356 | # define YYSTACK_ALLOC YYMALLOC |
| 357 | # define YYSTACK_FREE YYFREE |
| 358 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 359 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
| 360 | # endif |
| 361 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
| 362 | && ! ((defined YYMALLOC || defined malloc) \ |
| 363 | && (defined YYFREE || defined free))) |
| 364 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 365 | # ifndef EXIT_SUCCESS |
| 366 | # define EXIT_SUCCESS 0 |
| 367 | # endif |
| 368 | # endif |
| 369 | # ifndef YYMALLOC |
| 370 | # define YYMALLOC malloc |
| 371 | # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ |
| 372 | || defined __cplusplus || defined _MSC_VER) |
| 373 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 374 | # endif |
| 375 | # endif |
| 376 | # ifndef YYFREE |
| 377 | # define YYFREE free |
| 378 | # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ |
| 379 | || defined __cplusplus || defined _MSC_VER) |
| 380 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 381 | # endif |
| 382 | # endif |
| 383 | # endif |
| 384 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ |
| 385 | |
| 386 | |
| 387 | #if (! defined yyoverflow \ |
| 388 | && (! defined __cplusplus \ |
| 389 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
| 390 | |
| 391 | /* A type that is properly aligned for any stack member. */ |
| 392 | union yyalloc |
| 393 | { |
| 394 | yytype_int16 yyss_alloc; |
| 395 | YYSTYPE yyvs_alloc; |
| 396 | }; |
| 397 | |
| 398 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 399 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 400 | |
| 401 | /* The size of an array large to enough to hold all stacks, each with |
| 402 | N elements. */ |
| 403 | # define YYSTACK_BYTES(N) \ |
| 404 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ |
| 405 | + YYSTACK_GAP_MAXIMUM) |
| 406 | |
| 407 | # define YYCOPY_NEEDED 1 |
| 408 | |
| 409 | /* Relocate STACK from its old location to the new one. The |
| 410 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 411 | elements in the stack, and YYPTR gives the new location of the |
| 412 | stack. Advance YYPTR to a properly aligned location for the next |
| 413 | stack. */ |
| 414 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
| 415 | do \ |
| 416 | { \ |
| 417 | YYSIZE_T yynewbytes; \ |
| 418 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
| 419 | Stack = &yyptr->Stack_alloc; \ |
| 420 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 421 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 422 | } \ |
| 423 | while (YYID (0)) |
| 424 | |
| 425 | #endif |
| 426 | |
| 427 | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
| 428 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 429 | not overlap. */ |
| 430 | # ifndef YYCOPY |
| 431 | # if defined __GNUC__ && 1 < __GNUC__ |
| 432 | # define YYCOPY(To, From, Count) \ |
| 433 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 434 | # else |
| 435 | # define YYCOPY(To, From, Count) \ |
| 436 | do \ |
| 437 | { \ |
| 438 | YYSIZE_T yyi; \ |
| 439 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 440 | (To)[yyi] = (From)[yyi]; \ |
| 441 | } \ |
| 442 | while (YYID (0)) |
| 443 | # endif |
| 444 | # endif |
| 445 | #endif /* !YYCOPY_NEEDED */ |
| 446 | |
| 447 | /* YYFINAL -- State number of the termination state. */ |
| 448 | #define YYFINAL 2 |
| 449 | /* YYLAST -- Last index in YYTABLE. */ |
| 450 | #define YYLAST 58 |
| 451 | |
| 452 | /* YYNTOKENS -- Number of terminals. */ |
| 453 | #define YYNTOKENS 24 |
| 454 | /* YYNNTS -- Number of nonterminals. */ |
| 455 | #define YYNNTS 16 |
| 456 | /* YYNRULES -- Number of rules. */ |
| 457 | #define YYNRULES 34 |
| 458 | /* YYNRULES -- Number of states. */ |
| 459 | #define YYNSTATES 63 |
| 460 | |
| 461 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 462 | #define YYUNDEFTOK 2 |
| 463 | #define YYMAXUTOK 268 |
| 464 | |
| 465 | #define YYTRANSLATE(YYX) \ |
| 466 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 467 | |
| 468 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 469 | static const yytype_uint8 yytranslate[] = |
| 470 | { |
| 471 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 472 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 473 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 474 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 475 | 22, 23, 5, 4, 10, 3, 2, 6, 2, 2, |
| 476 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 477 | 2, 2, 2, 2, 21, 2, 2, 2, 2, 2, |
| 478 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 479 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 480 | 2, 2, 2, 2, 8, 2, 9, 2, 2, 2, |
| 481 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 482 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 483 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 484 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 485 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 486 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 487 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 488 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 489 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 490 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 491 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 492 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 493 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 494 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 495 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 496 | 2, 2, 2, 2, 2, 2, 1, 2, 7, 11, |
| 497 | 12, 13, 14, 15, 16, 17, 18, 19, 20 |
| 498 | }; |
| 499 | |
| 500 | #if YYDEBUG |
| 501 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 502 | YYRHS. */ |
| 503 | static const yytype_uint8 yyprhs[] = |
| 504 | { |
| 505 | 0, 0, 3, 4, 7, 10, 13, 16, 19, 22, |
| 506 | 25, 28, 32, 36, 40, 46, 49, 52, 54, 57, |
| 507 | 59, 61, 63, 67, 71, 75, 79, 82, 86, 89, |
| 508 | 92, 94, 96, 98, 100 |
| 509 | }; |
| 510 | |
| 511 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 512 | static const yytype_int8 yyrhs[] = |
| 513 | { |
| 514 | 25, 0, -1, -1, 25, 26, -1, 27, 11, -1, |
| 515 | 28, 11, -1, 29, 11, -1, 32, 11, -1, 30, |
| 516 | 11, -1, 31, 11, -1, 1, 11, -1, 12, 35, |
| 517 | 36, -1, 13, 37, 38, -1, 14, 37, 34, -1, |
| 518 | 16, 37, 34, 10, 34, -1, 17, 37, -1, 15, |
| 519 | 33, -1, 39, -1, 33, 39, -1, 18, -1, 19, |
| 520 | -1, 21, -1, 34, 4, 34, -1, 34, 3, 34, |
| 521 | -1, 34, 5, 34, -1, 34, 6, 34, -1, 3, |
| 522 | 34, -1, 22, 34, 23, -1, 8, 34, -1, 9, |
| 523 | 34, -1, 19, -1, 19, -1, 19, -1, 19, -1, |
| 524 | 19, -1 |
| 525 | }; |
| 526 | |
| 527 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 528 | static const yytype_uint16 yyrline[] = |
| 529 | { |
| 530 | 0, 119, 119, 120, 123, 124, 125, 126, 127, 128, |
| 531 | 129, 132, 141, 156, 171, 188, 201, 219, 225, 231, |
| 532 | 236, 241, 245, 252, 259, 266, 273, 280, 282, 289, |
| 533 | 298, 308, 312, 316, 320 |
| 534 | }; |
| 535 | #endif |
| 536 | |
| 537 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 538 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 539 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 540 | static const char *const yytname[] = |
| 541 | { |
| 542 | "$end", "error", "$undefined", "'-'", "'+'", "'*'", "'/'", "NEG", "'^'", |
| 543 | "'`'", "','", "EOL", "BUS", "LABEL", "SET", "CHIP", "COMPUTE", "IGNORE", |
| 544 | "FLOAT", "NAME", "ERROR", "'@'", "'('", "')'", "$accept", "input", |
| 545 | "line", "bus_statement", "label_statement", "set_statement", |
| 546 | "compute_statement", "ignore_statement", "chip_statement", |
| 547 | "chip_name_list", "expression", "bus_id", "adapter_name", |
| 548 | "function_name", "string", "chip_name", 0 |
| 549 | }; |
| 550 | #endif |
| 551 | |
| 552 | # ifdef YYPRINT |
| 553 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 554 | token YYLEX-NUM. */ |
| 555 | static const yytype_uint16 yytoknum[] = |
| 556 | { |
| 557 | 0, 256, 257, 45, 43, 42, 47, 258, 94, 96, |
| 558 | 44, 259, 260, 261, 262, 263, 264, 265, 266, 267, |
| 559 | 268, 64, 40, 41 |
| 560 | }; |
| 561 | # endif |
| 562 | |
| 563 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 564 | static const yytype_uint8 yyr1[] = |
| 565 | { |
| 566 | 0, 24, 25, 25, 26, 26, 26, 26, 26, 26, |
| 567 | 26, 27, 28, 29, 30, 31, 32, 33, 33, 34, |
| 568 | 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, |
| 569 | 35, 36, 37, 38, 39 |
| 570 | }; |
| 571 | |
| 572 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 573 | static const yytype_uint8 yyr2[] = |
| 574 | { |
| 575 | 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, |
| 576 | 2, 3, 3, 3, 5, 2, 2, 1, 2, 1, |
| 577 | 1, 1, 3, 3, 3, 3, 2, 3, 2, 2, |
| 578 | 1, 1, 1, 1, 1 |
| 579 | }; |
| 580 | |
| 581 | /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. |
| 582 | Performed when YYTABLE doesn't specify something else to do. Zero |
| 583 | means the default is an error. */ |
| 584 | static const yytype_uint8 yydefact[] = |
| 585 | { |
| 586 | 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, |
| 587 | 3, 0, 0, 0, 0, 0, 0, 10, 30, 0, |
| 588 | 32, 0, 0, 34, 16, 17, 0, 15, 4, 5, |
| 589 | 6, 8, 9, 7, 31, 11, 33, 12, 0, 0, |
| 590 | 0, 19, 20, 21, 0, 13, 18, 0, 26, 28, |
| 591 | 29, 0, 0, 0, 0, 0, 0, 27, 23, 22, |
| 592 | 24, 25, 14 |
| 593 | }; |
| 594 | |
| 595 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 596 | static const yytype_int8 yydefgoto[] = |
| 597 | { |
| 598 | -1, 1, 10, 11, 12, 13, 14, 15, 16, 24, |
| 599 | 45, 19, 35, 21, 37, 25 |
| 600 | }; |
| 601 | |
| 602 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 603 | STATE-NUM. */ |
| 604 | #define YYPACT_NINF -27 |
| 605 | static const yytype_int8 yypact[] = |
| 606 | { |
| 607 | -27, 37, -27, -4, -3, 1, 1, 6, 1, 1, |
| 608 | -27, 8, 13, 20, 23, 32, 34, -27, -27, 29, |
| 609 | -27, 39, 14, -27, 6, -27, 14, -27, -27, -27, |
| 610 | -27, -27, -27, -27, -27, -27, -27, -27, 14, 14, |
| 611 | 14, -27, -27, -27, 14, 36, -27, 5, -27, -27, |
| 612 | -27, -2, 14, 14, 14, 14, 14, -27, 0, 0, |
| 613 | -27, -27, 36 |
| 614 | }; |
| 615 | |
| 616 | /* YYPGOTO[NTERM-NUM]. */ |
| 617 | static const yytype_int8 yypgoto[] = |
| 618 | { |
| 619 | -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, |
| 620 | -26, -27, -27, 38, -27, 31 |
| 621 | }; |
| 622 | |
| 623 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 624 | positive, shift that token. If negative, reduce the rule which |
| 625 | number is the opposite. If YYTABLE_NINF, syntax error. */ |
| 626 | #define YYTABLE_NINF -1 |
| 627 | static const yytype_uint8 yytable[] = |
| 628 | { |
| 629 | 47, 52, 53, 54, 55, 54, 55, 17, 52, 53, |
| 630 | 54, 55, 48, 49, 50, 56, 18, 38, 51, 28, |
| 631 | 20, 57, 39, 40, 29, 23, 58, 59, 60, 61, |
| 632 | 62, 30, 41, 42, 31, 43, 44, 2, 3, 52, |
| 633 | 53, 54, 55, 32, 22, 33, 26, 27, 34, 4, |
| 634 | 5, 6, 7, 8, 9, 46, 0, 0, 36 |
| 635 | }; |
| 636 | |
| 637 | #define yypact_value_is_default(yystate) \ |
| 638 | ((yystate) == (-27)) |
| 639 | |
| 640 | #define yytable_value_is_error(yytable_value) \ |
| 641 | YYID (0) |
| 642 | |
| 643 | static const yytype_int8 yycheck[] = |
| 644 | { |
| 645 | 26, 3, 4, 5, 6, 5, 6, 11, 3, 4, |
| 646 | 5, 6, 38, 39, 40, 10, 19, 3, 44, 11, |
| 647 | 19, 23, 8, 9, 11, 19, 52, 53, 54, 55, |
| 648 | 56, 11, 18, 19, 11, 21, 22, 0, 1, 3, |
| 649 | 4, 5, 6, 11, 6, 11, 8, 9, 19, 12, |
| 650 | 13, 14, 15, 16, 17, 24, -1, -1, 19 |
| 651 | }; |
| 652 | |
| 653 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 654 | symbol of state STATE-NUM. */ |
| 655 | static const yytype_uint8 yystos[] = |
| 656 | { |
| 657 | 0, 25, 0, 1, 12, 13, 14, 15, 16, 17, |
| 658 | 26, 27, 28, 29, 30, 31, 32, 11, 19, 35, |
| 659 | 19, 37, 37, 19, 33, 39, 37, 37, 11, 11, |
| 660 | 11, 11, 11, 11, 19, 36, 19, 38, 3, 8, |
| 661 | 9, 18, 19, 21, 22, 34, 39, 34, 34, 34, |
| 662 | 34, 34, 3, 4, 5, 6, 10, 23, 34, 34, |
| 663 | 34, 34, 34 |
| 664 | }; |
| 665 | |
| 666 | #define yyerrok (yyerrstatus = 0) |
| 667 | #define yyclearin (yychar = YYEMPTY) |
| 668 | #define YYEMPTY (-2) |
| 669 | #define YYEOF 0 |
| 670 | |
| 671 | #define YYACCEPT goto yyacceptlab |
| 672 | #define YYABORT goto yyabortlab |
| 673 | #define YYERROR goto yyerrorlab |
| 674 | |
| 675 | |
| 676 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 677 | to ease the transition to the new meaning of YYERROR, for GCC. |
| 678 | Once GCC version 2 has supplanted version 1, this can go. However, |
| 679 | YYFAIL appears to be in use. Nevertheless, it is formally deprecated |
| 680 | in Bison 2.4.2's NEWS entry, where a plan to phase it out is |
| 681 | discussed. */ |
| 682 | |
| 683 | #define YYFAIL goto yyerrlab |
| 684 | #if defined YYFAIL |
| 685 | /* This is here to suppress warnings from the GCC cpp's |
| 686 | -Wunused-macros. Normally we don't worry about that warning, but |
| 687 | some users do, and we want to make it easy for users to remove |
| 688 | YYFAIL uses, which will produce warnings from Bison 2.5. */ |
| 689 | #endif |
| 690 | |
| 691 | #define YYRECOVERING() (!!yyerrstatus) |
| 692 | |
| 693 | #define YYBACKUP(Token, Value) \ |
| 694 | do \ |
| 695 | if (yychar == YYEMPTY && yylen == 1) \ |
| 696 | { \ |
| 697 | yychar = (Token); \ |
| 698 | yylval = (Value); \ |
| 699 | YYPOPSTACK (1); \ |
| 700 | goto yybackup; \ |
| 701 | } \ |
| 702 | else \ |
| 703 | { \ |
| 704 | yyerror (YY_("syntax error: cannot back up")); \ |
| 705 | YYERROR; \ |
| 706 | } \ |
| 707 | while (YYID (0)) |
| 708 | |
| 709 | |
| 710 | #define YYTERROR 1 |
| 711 | #define YYERRCODE 256 |
| 712 | |
| 713 | |
| 714 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 715 | If N is 0, then set CURRENT to the empty location which ends |
| 716 | the previous symbol: RHS[0] (always defined). */ |
| 717 | |
| 718 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 719 | #ifndef YYLLOC_DEFAULT |
| 720 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 721 | do \ |
| 722 | if (YYID (N)) \ |
| 723 | { \ |
| 724 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 725 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 726 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 727 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 728 | } \ |
| 729 | else \ |
| 730 | { \ |
| 731 | (Current).first_line = (Current).last_line = \ |
| 732 | YYRHSLOC (Rhs, 0).last_line; \ |
| 733 | (Current).first_column = (Current).last_column = \ |
| 734 | YYRHSLOC (Rhs, 0).last_column; \ |
| 735 | } \ |
| 736 | while (YYID (0)) |
| 737 | #endif |
| 738 | |
| 739 | |
| 740 | /* This macro is provided for backward compatibility. */ |
| 741 | |
| 742 | #ifndef YY_LOCATION_PRINT |
| 743 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 744 | #endif |
| 745 | |
| 746 | |
| 747 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 748 | |
| 749 | #ifdef YYLEX_PARAM |
| 750 | # define YYLEX yylex (YYLEX_PARAM) |
| 751 | #else |
| 752 | # define YYLEX yylex () |
| 753 | #endif |
| 754 | |
| 755 | /* Enable debugging if requested. */ |
| 756 | #if YYDEBUG |
| 757 | |
| 758 | # ifndef YYFPRINTF |
| 759 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 760 | # define YYFPRINTF fprintf |
| 761 | # endif |
| 762 | |
| 763 | # define YYDPRINTF(Args) \ |
| 764 | do { \ |
| 765 | if (yydebug) \ |
| 766 | YYFPRINTF Args; \ |
| 767 | } while (YYID (0)) |
| 768 | |
| 769 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 770 | do { \ |
| 771 | if (yydebug) \ |
| 772 | { \ |
| 773 | YYFPRINTF (stderr, "%s ", Title); \ |
| 774 | yy_symbol_print (stderr, \ |
| 775 | Type, Value); \ |
| 776 | YYFPRINTF (stderr, "\n"); \ |
| 777 | } \ |
| 778 | } while (YYID (0)) |
| 779 | |
| 780 | |
| 781 | /*--------------------------------. |
| 782 | | Print this symbol on YYOUTPUT. | |
| 783 | `--------------------------------*/ |
| 784 | |
| 785 | /*ARGSUSED*/ |
| 786 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 787 | || defined __cplusplus || defined _MSC_VER) |
| 788 | static void |
| 789 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
| 790 | #else |
| 791 | static void |
| 792 | yy_symbol_value_print (yyoutput, yytype, yyvaluep) |
| 793 | FILE *yyoutput; |
| 794 | int yytype; |
| 795 | YYSTYPE const * const yyvaluep; |
| 796 | #endif |
| 797 | { |
| 798 | if (!yyvaluep) |
| 799 | return; |
| 800 | # ifdef YYPRINT |
| 801 | if (yytype < YYNTOKENS) |
| 802 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 803 | # else |
| 804 | YYUSE (yyoutput); |
| 805 | # endif |
| 806 | switch (yytype) |
| 807 | { |
| 808 | default: |
| 809 | break; |
| 810 | } |
| 811 | } |
| 812 | |
| 813 | |
| 814 | /*--------------------------------. |
| 815 | | Print this symbol on YYOUTPUT. | |
| 816 | `--------------------------------*/ |
| 817 | |
| 818 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 819 | || defined __cplusplus || defined _MSC_VER) |
| 820 | static void |
| 821 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
| 822 | #else |
| 823 | static void |
| 824 | yy_symbol_print (yyoutput, yytype, yyvaluep) |
| 825 | FILE *yyoutput; |
| 826 | int yytype; |
| 827 | YYSTYPE const * const yyvaluep; |
| 828 | #endif |
| 829 | { |
| 830 | if (yytype < YYNTOKENS) |
| 831 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 832 | else |
| 833 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
| 834 | |
| 835 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); |
| 836 | YYFPRINTF (yyoutput, ")"); |
| 837 | } |
| 838 | |
| 839 | /*------------------------------------------------------------------. |
| 840 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 841 | | TOP (included). | |
| 842 | `------------------------------------------------------------------*/ |
| 843 | |
| 844 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 845 | || defined __cplusplus || defined _MSC_VER) |
| 846 | static void |
| 847 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) |
| 848 | #else |
| 849 | static void |
| 850 | yy_stack_print (yybottom, yytop) |
| 851 | yytype_int16 *yybottom; |
| 852 | yytype_int16 *yytop; |
| 853 | #endif |
| 854 | { |
| 855 | YYFPRINTF (stderr, "Stack now"); |
| 856 | for (; yybottom <= yytop; yybottom++) |
| 857 | { |
| 858 | int yybot = *yybottom; |
| 859 | YYFPRINTF (stderr, " %d", yybot); |
| 860 | } |
| 861 | YYFPRINTF (stderr, "\n"); |
| 862 | } |
| 863 | |
| 864 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 865 | do { \ |
| 866 | if (yydebug) \ |
| 867 | yy_stack_print ((Bottom), (Top)); \ |
| 868 | } while (YYID (0)) |
| 869 | |
| 870 | |
| 871 | /*------------------------------------------------. |
| 872 | | Report that the YYRULE is going to be reduced. | |
| 873 | `------------------------------------------------*/ |
| 874 | |
| 875 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 876 | || defined __cplusplus || defined _MSC_VER) |
| 877 | static void |
| 878 | yy_reduce_print (YYSTYPE *yyvsp, int yyrule) |
| 879 | #else |
| 880 | static void |
| 881 | yy_reduce_print (yyvsp, yyrule) |
| 882 | YYSTYPE *yyvsp; |
| 883 | int yyrule; |
| 884 | #endif |
| 885 | { |
| 886 | int yynrhs = yyr2[yyrule]; |
| 887 | int yyi; |
| 888 | unsigned long int yylno = yyrline[yyrule]; |
| 889 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", |
| 890 | yyrule - 1, yylno); |
| 891 | /* The symbols being reduced. */ |
| 892 | for (yyi = 0; yyi < yynrhs; yyi++) |
| 893 | { |
| 894 | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
| 895 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], |
| 896 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
| 897 | ); |
| 898 | YYFPRINTF (stderr, "\n"); |
| 899 | } |
| 900 | } |
| 901 | |
| 902 | # define YY_REDUCE_PRINT(Rule) \ |
| 903 | do { \ |
| 904 | if (yydebug) \ |
| 905 | yy_reduce_print (yyvsp, Rule); \ |
| 906 | } while (YYID (0)) |
| 907 | |
| 908 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 909 | multiple parsers can coexist. */ |
| 910 | int yydebug; |
| 911 | #else /* !YYDEBUG */ |
| 912 | # define YYDPRINTF(Args) |
| 913 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 914 | # define YY_STACK_PRINT(Bottom, Top) |
| 915 | # define YY_REDUCE_PRINT(Rule) |
| 916 | #endif /* !YYDEBUG */ |
| 917 | |
| 918 | |
| 919 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
| 920 | #ifndef YYINITDEPTH |
| 921 | # define YYINITDEPTH 200 |
| 922 | #endif |
| 923 | |
| 924 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 925 | if the built-in stack extension method is used). |
| 926 | |
| 927 | Do not make this value too large; the results are undefined if |
| 928 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 929 | evaluated with infinite-precision integer arithmetic. */ |
| 930 | |
| 931 | #ifndef YYMAXDEPTH |
| 932 | # define YYMAXDEPTH 10000 |
| 933 | #endif |
| 934 | |
| 935 | |
| 936 | #if YYERROR_VERBOSE |
| 937 | |
| 938 | # ifndef yystrlen |
| 939 | # if defined __GLIBC__ && defined _STRING_H |
| 940 | # define yystrlen strlen |
| 941 | # else |
| 942 | /* Return the length of YYSTR. */ |
| 943 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 944 | || defined __cplusplus || defined _MSC_VER) |
| 945 | static YYSIZE_T |
| 946 | yystrlen (const char *yystr) |
| 947 | #else |
| 948 | static YYSIZE_T |
| 949 | yystrlen (yystr) |
| 950 | const char *yystr; |
| 951 | #endif |
| 952 | { |
| 953 | YYSIZE_T yylen; |
| 954 | for (yylen = 0; yystr[yylen]; yylen++) |
| 955 | continue; |
| 956 | return yylen; |
| 957 | } |
| 958 | # endif |
| 959 | # endif |
| 960 | |
| 961 | # ifndef yystpcpy |
| 962 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
| 963 | # define yystpcpy stpcpy |
| 964 | # else |
| 965 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 966 | YYDEST. */ |
| 967 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 968 | || defined __cplusplus || defined _MSC_VER) |
| 969 | static char * |
| 970 | yystpcpy (char *yydest, const char *yysrc) |
| 971 | #else |
| 972 | static char * |
| 973 | yystpcpy (yydest, yysrc) |
| 974 | char *yydest; |
| 975 | const char *yysrc; |
| 976 | #endif |
| 977 | { |
| 978 | char *yyd = yydest; |
| 979 | const char *yys = yysrc; |
| 980 | |
| 981 | while ((*yyd++ = *yys++) != '\0') |
| 982 | continue; |
| 983 | |
| 984 | return yyd - 1; |
| 985 | } |
| 986 | # endif |
| 987 | # endif |
| 988 | |
| 989 | # ifndef yytnamerr |
| 990 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 991 | quotes and backslashes, so that it's suitable for yyerror. The |
| 992 | heuristic is that double-quoting is unnecessary unless the string |
| 993 | contains an apostrophe, a comma, or backslash (other than |
| 994 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 995 | null, do not copy; instead, return the length of what the result |
| 996 | would have been. */ |
| 997 | static YYSIZE_T |
| 998 | yytnamerr (char *yyres, const char *yystr) |
| 999 | { |
| 1000 | if (*yystr == '"') |
| 1001 | { |
| 1002 | YYSIZE_T yyn = 0; |
| 1003 | char const *yyp = yystr; |
| 1004 | |
| 1005 | for (;;) |
| 1006 | switch (*++yyp) |
| 1007 | { |
| 1008 | case '\'': |
| 1009 | case ',': |
| 1010 | goto do_not_strip_quotes; |
| 1011 | |
| 1012 | case '\\': |
| 1013 | if (*++yyp != '\\') |
| 1014 | goto do_not_strip_quotes; |
| 1015 | /* Fall through. */ |
| 1016 | default: |
| 1017 | if (yyres) |
| 1018 | yyres[yyn] = *yyp; |
| 1019 | yyn++; |
| 1020 | break; |
| 1021 | |
| 1022 | case '"': |
| 1023 | if (yyres) |
| 1024 | yyres[yyn] = '\0'; |
| 1025 | return yyn; |
| 1026 | } |
| 1027 | do_not_strip_quotes: ; |
| 1028 | } |
| 1029 | |
| 1030 | if (! yyres) |
| 1031 | return yystrlen (yystr); |
| 1032 | |
| 1033 | return yystpcpy (yyres, yystr) - yyres; |
| 1034 | } |
| 1035 | # endif |
| 1036 | |
| 1037 | /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message |
| 1038 | about the unexpected token YYTOKEN for the state stack whose top is |
| 1039 | YYSSP. |
| 1040 | |
| 1041 | Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is |
| 1042 | not large enough to hold the message. In that case, also set |
| 1043 | *YYMSG_ALLOC to the required number of bytes. Return 2 if the |
| 1044 | required number of bytes is too large to store. */ |
| 1045 | static int |
| 1046 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, |
| 1047 | yytype_int16 *yyssp, int yytoken) |
| 1048 | { |
| 1049 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); |
| 1050 | YYSIZE_T yysize = yysize0; |
| 1051 | YYSIZE_T yysize1; |
| 1052 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
| 1053 | /* Internationalized format string. */ |
| 1054 | const char *yyformat = 0; |
| 1055 | /* Arguments of yyformat. */ |
| 1056 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 1057 | /* Number of reported tokens (one for the "unexpected", one per |
| 1058 | "expected"). */ |
| 1059 | int yycount = 0; |
| 1060 | |
| 1061 | /* There are many possibilities here to consider: |
| 1062 | - Assume YYFAIL is not used. It's too flawed to consider. See |
| 1063 | <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> |
| 1064 | for details. YYERROR is fine as it does not invoke this |
| 1065 | function. |
| 1066 | - If this state is a consistent state with a default action, then |
| 1067 | the only way this function was invoked is if the default action |
| 1068 | is an error action. In that case, don't check for expected |
| 1069 | tokens because there are none. |
| 1070 | - The only way there can be no lookahead present (in yychar) is if |
| 1071 | this state is a consistent state with a default action. Thus, |
| 1072 | detecting the absence of a lookahead is sufficient to determine |
| 1073 | that there is no unexpected or expected token to report. In that |
| 1074 | case, just report a simple "syntax error". |
| 1075 | - Don't assume there isn't a lookahead just because this state is a |
| 1076 | consistent state with a default action. There might have been a |
| 1077 | previous inconsistent state, consistent state with a non-default |
| 1078 | action, or user semantic action that manipulated yychar. |
| 1079 | - Of course, the expected token list depends on states to have |
| 1080 | correct lookahead information, and it depends on the parser not |
| 1081 | to perform extra reductions after fetching a lookahead from the |
| 1082 | scanner and before detecting a syntax error. Thus, state merging |
| 1083 | (from LALR or IELR) and default reductions corrupt the expected |
| 1084 | token list. However, the list is correct for canonical LR with |
| 1085 | one exception: it will still contain any token that will not be |
| 1086 | accepted due to an error action in a later state. |
| 1087 | */ |
| 1088 | if (yytoken != YYEMPTY) |
| 1089 | { |
| 1090 | int yyn = yypact[*yyssp]; |
| 1091 | yyarg[yycount++] = yytname[yytoken]; |
| 1092 | if (!yypact_value_is_default (yyn)) |
| 1093 | { |
| 1094 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 1095 | YYCHECK. In other words, skip the first -YYN actions for |
| 1096 | this state because they are default actions. */ |
| 1097 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 1098 | /* Stay within bounds of both yycheck and yytname. */ |
| 1099 | int yychecklim = YYLAST - yyn + 1; |
| 1100 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 1101 | int yyx; |
| 1102 | |
| 1103 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 1104 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR |
| 1105 | && !yytable_value_is_error (yytable[yyx + yyn])) |
| 1106 | { |
| 1107 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 1108 | { |
| 1109 | yycount = 1; |
| 1110 | yysize = yysize0; |
| 1111 | break; |
| 1112 | } |
| 1113 | yyarg[yycount++] = yytname[yyx]; |
| 1114 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 1115 | if (! (yysize <= yysize1 |
| 1116 | && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
| 1117 | return 2; |
| 1118 | yysize = yysize1; |
| 1119 | } |
| 1120 | } |
| 1121 | } |
| 1122 | |
| 1123 | switch (yycount) |
| 1124 | { |
| 1125 | # define YYCASE_(N, S) \ |
| 1126 | case N: \ |
| 1127 | yyformat = S; \ |
| 1128 | break |
| 1129 | YYCASE_(0, YY_("syntax error")); |
| 1130 | YYCASE_(1, YY_("syntax error, unexpected %s")); |
| 1131 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); |
| 1132 | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); |
| 1133 | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); |
| 1134 | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); |
| 1135 | # undef YYCASE_ |
| 1136 | } |
| 1137 | |
| 1138 | yysize1 = yysize + yystrlen (yyformat); |
| 1139 | if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
| 1140 | return 2; |
| 1141 | yysize = yysize1; |
| 1142 | |
| 1143 | if (*yymsg_alloc < yysize) |
| 1144 | { |
| 1145 | *yymsg_alloc = 2 * yysize; |
| 1146 | if (! (yysize <= *yymsg_alloc |
| 1147 | && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
| 1148 | *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
| 1149 | return 1; |
| 1150 | } |
| 1151 | |
| 1152 | /* Avoid sprintf, as that infringes on the user's name space. |
| 1153 | Don't have undefined behavior even if the translation |
| 1154 | produced a string with the wrong number of "%s"s. */ |
| 1155 | { |
| 1156 | char *yyp = *yymsg; |
| 1157 | int yyi = 0; |
| 1158 | while ((*yyp = *yyformat) != '\0') |
| 1159 | if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) |
| 1160 | { |
| 1161 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 1162 | yyformat += 2; |
| 1163 | } |
| 1164 | else |
| 1165 | { |
| 1166 | yyp++; |
| 1167 | yyformat++; |
| 1168 | } |
| 1169 | } |
| 1170 | return 0; |
| 1171 | } |
| 1172 | #endif /* YYERROR_VERBOSE */ |
| 1173 | |
| 1174 | /*-----------------------------------------------. |
| 1175 | | Release the memory associated to this symbol. | |
| 1176 | `-----------------------------------------------*/ |
| 1177 | |
| 1178 | /*ARGSUSED*/ |
| 1179 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1180 | || defined __cplusplus || defined _MSC_VER) |
| 1181 | static void |
| 1182 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 1183 | #else |
| 1184 | static void |
| 1185 | yydestruct (yymsg, yytype, yyvaluep) |
| 1186 | const char *yymsg; |
| 1187 | int yytype; |
| 1188 | YYSTYPE *yyvaluep; |
| 1189 | #endif |
| 1190 | { |
| 1191 | YYUSE (yyvaluep); |
| 1192 | |
| 1193 | if (!yymsg) |
| 1194 | yymsg = "Deleting"; |
| 1195 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 1196 | |
| 1197 | switch (yytype) |
| 1198 | { |
| 1199 | |
| 1200 | default: |
| 1201 | break; |
| 1202 | } |
| 1203 | } |
| 1204 | |
| 1205 | |
| 1206 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 1207 | #ifdef YYPARSE_PARAM |
| 1208 | #if defined __STDC__ || defined __cplusplus |
| 1209 | int yyparse (void *YYPARSE_PARAM); |
| 1210 | #else |
| 1211 | int yyparse (); |
| 1212 | #endif |
| 1213 | #else /* ! YYPARSE_PARAM */ |
| 1214 | #if defined __STDC__ || defined __cplusplus |
| 1215 | int yyparse (void); |
| 1216 | #else |
| 1217 | int yyparse (); |
| 1218 | #endif |
| 1219 | #endif /* ! YYPARSE_PARAM */ |
| 1220 | |
| 1221 | |
| 1222 | /* The lookahead symbol. */ |
| 1223 | int yychar; |
| 1224 | |
| 1225 | /* The semantic value of the lookahead symbol. */ |
| 1226 | YYSTYPE yylval; |
| 1227 | |
| 1228 | /* Number of syntax errors so far. */ |
| 1229 | int yynerrs; |
| 1230 | |
| 1231 | |
| 1232 | /*----------. |
| 1233 | | yyparse. | |
| 1234 | `----------*/ |
| 1235 | |
| 1236 | #ifdef YYPARSE_PARAM |
| 1237 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1238 | || defined __cplusplus || defined _MSC_VER) |
| 1239 | int |
| 1240 | yyparse (void *YYPARSE_PARAM) |
| 1241 | #else |
| 1242 | int |
| 1243 | yyparse (YYPARSE_PARAM) |
| 1244 | void *YYPARSE_PARAM; |
| 1245 | #endif |
| 1246 | #else /* ! YYPARSE_PARAM */ |
| 1247 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1248 | || defined __cplusplus || defined _MSC_VER) |
| 1249 | int |
| 1250 | yyparse (void) |
| 1251 | #else |
| 1252 | int |
| 1253 | yyparse () |
| 1254 | |
| 1255 | #endif |
| 1256 | #endif |
| 1257 | { |
| 1258 | int yystate; |
| 1259 | /* Number of tokens to shift before error messages enabled. */ |
| 1260 | int yyerrstatus; |
| 1261 | |
| 1262 | /* The stacks and their tools: |
| 1263 | `yyss': related to states. |
| 1264 | `yyvs': related to semantic values. |
| 1265 | |
| 1266 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 1267 | to reallocate them elsewhere. */ |
| 1268 | |
| 1269 | /* The state stack. */ |
| 1270 | yytype_int16 yyssa[YYINITDEPTH]; |
| 1271 | yytype_int16 *yyss; |
| 1272 | yytype_int16 *yyssp; |
| 1273 | |
| 1274 | /* The semantic value stack. */ |
| 1275 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 1276 | YYSTYPE *yyvs; |
| 1277 | YYSTYPE *yyvsp; |
| 1278 | |
| 1279 | YYSIZE_T yystacksize; |
| 1280 | |
| 1281 | int yyn; |
| 1282 | int yyresult; |
| 1283 | /* Lookahead token as an internal (translated) token number. */ |
| 1284 | int yytoken; |
| 1285 | /* The variables used to return semantic value and location from the |
| 1286 | action routines. */ |
| 1287 | YYSTYPE yyval; |
| 1288 | |
| 1289 | #if YYERROR_VERBOSE |
| 1290 | /* Buffer for error messages, and its allocated size. */ |
| 1291 | char yymsgbuf[128]; |
| 1292 | char *yymsg = yymsgbuf; |
| 1293 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
| 1294 | #endif |
| 1295 | |
| 1296 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
| 1297 | |
| 1298 | /* The number of symbols on the RHS of the reduced rule. |
| 1299 | Keep to zero when no symbol should be popped. */ |
| 1300 | int yylen = 0; |
| 1301 | |
| 1302 | yytoken = 0; |
| 1303 | yyss = yyssa; |
| 1304 | yyvs = yyvsa; |
| 1305 | yystacksize = YYINITDEPTH; |
| 1306 | |
| 1307 | YYDPRINTF ((stderr, "Starting parse\n")); |
| 1308 | |
| 1309 | yystate = 0; |
| 1310 | yyerrstatus = 0; |
| 1311 | yynerrs = 0; |
| 1312 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 1313 | |
| 1314 | /* Initialize stack pointers. |
| 1315 | Waste one element of value and location stack |
| 1316 | so that they stay on the same level as the state stack. |
| 1317 | The wasted elements are never initialized. */ |
| 1318 | yyssp = yyss; |
| 1319 | yyvsp = yyvs; |
| 1320 | |
| 1321 | goto yysetstate; |
| 1322 | |
| 1323 | /*------------------------------------------------------------. |
| 1324 | | yynewstate -- Push a new state, which is found in yystate. | |
| 1325 | `------------------------------------------------------------*/ |
| 1326 | yynewstate: |
| 1327 | /* In all cases, when you get here, the value and location stacks |
| 1328 | have just been pushed. So pushing a state here evens the stacks. */ |
| 1329 | yyssp++; |
| 1330 | |
| 1331 | yysetstate: |
| 1332 | *yyssp = yystate; |
| 1333 | |
| 1334 | if (yyss + yystacksize - 1 <= yyssp) |
| 1335 | { |
| 1336 | /* Get the current used size of the three stacks, in elements. */ |
| 1337 | YYSIZE_T yysize = yyssp - yyss + 1; |
| 1338 | |
| 1339 | #ifdef yyoverflow |
| 1340 | { |
| 1341 | /* Give user a chance to reallocate the stack. Use copies of |
| 1342 | these so that the &'s don't force the real ones into |
| 1343 | memory. */ |
| 1344 | YYSTYPE *yyvs1 = yyvs; |
| 1345 | yytype_int16 *yyss1 = yyss; |
| 1346 | |
| 1347 | /* Each stack pointer address is followed by the size of the |
| 1348 | data in use in that stack, in bytes. This used to be a |
| 1349 | conditional around just the two extra args, but that might |
| 1350 | be undefined if yyoverflow is a macro. */ |
| 1351 | yyoverflow (YY_("memory exhausted"), |
| 1352 | &yyss1, yysize * sizeof (*yyssp), |
| 1353 | &yyvs1, yysize * sizeof (*yyvsp), |
| 1354 | &yystacksize); |
| 1355 | |
| 1356 | yyss = yyss1; |
| 1357 | yyvs = yyvs1; |
| 1358 | } |
| 1359 | #else /* no yyoverflow */ |
| 1360 | # ifndef YYSTACK_RELOCATE |
| 1361 | goto yyexhaustedlab; |
| 1362 | # else |
| 1363 | /* Extend the stack our own way. */ |
| 1364 | if (YYMAXDEPTH <= yystacksize) |
| 1365 | goto yyexhaustedlab; |
| 1366 | yystacksize *= 2; |
| 1367 | if (YYMAXDEPTH < yystacksize) |
| 1368 | yystacksize = YYMAXDEPTH; |
| 1369 | |
| 1370 | { |
| 1371 | yytype_int16 *yyss1 = yyss; |
| 1372 | union yyalloc *yyptr = |
| 1373 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 1374 | if (! yyptr) |
| 1375 | goto yyexhaustedlab; |
| 1376 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
| 1377 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
| 1378 | # undef YYSTACK_RELOCATE |
| 1379 | if (yyss1 != yyssa) |
| 1380 | YYSTACK_FREE (yyss1); |
| 1381 | } |
| 1382 | # endif |
| 1383 | #endif /* no yyoverflow */ |
| 1384 | |
| 1385 | yyssp = yyss + yysize - 1; |
| 1386 | yyvsp = yyvs + yysize - 1; |
| 1387 | |
| 1388 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 1389 | (unsigned long int) yystacksize)); |
| 1390 | |
| 1391 | if (yyss + yystacksize - 1 <= yyssp) |
| 1392 | YYABORT; |
| 1393 | } |
| 1394 | |
| 1395 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
| 1396 | |
| 1397 | if (yystate == YYFINAL) |
| 1398 | YYACCEPT; |
| 1399 | |
| 1400 | goto yybackup; |
| 1401 | |
| 1402 | /*-----------. |
| 1403 | | yybackup. | |
| 1404 | `-----------*/ |
| 1405 | yybackup: |
| 1406 | |
| 1407 | /* Do appropriate processing given the current state. Read a |
| 1408 | lookahead token if we need one and don't already have one. */ |
| 1409 | |
| 1410 | /* First try to decide what to do without reference to lookahead token. */ |
| 1411 | yyn = yypact[yystate]; |
| 1412 | if (yypact_value_is_default (yyn)) |
| 1413 | goto yydefault; |
| 1414 | |
| 1415 | /* Not known => get a lookahead token if don't already have one. */ |
| 1416 | |
| 1417 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
| 1418 | if (yychar == YYEMPTY) |
| 1419 | { |
| 1420 | YYDPRINTF ((stderr, "Reading a token: ")); |
| 1421 | yychar = YYLEX; |
| 1422 | } |
| 1423 | |
| 1424 | if (yychar <= YYEOF) |
| 1425 | { |
| 1426 | yychar = yytoken = YYEOF; |
| 1427 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
| 1428 | } |
| 1429 | else |
| 1430 | { |
| 1431 | yytoken = YYTRANSLATE (yychar); |
| 1432 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
| 1433 | } |
| 1434 | |
| 1435 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 1436 | detect an error, take that action. */ |
| 1437 | yyn += yytoken; |
| 1438 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
| 1439 | goto yydefault; |
| 1440 | yyn = yytable[yyn]; |
| 1441 | if (yyn <= 0) |
| 1442 | { |
| 1443 | if (yytable_value_is_error (yyn)) |
| 1444 | goto yyerrlab; |
| 1445 | yyn = -yyn; |
| 1446 | goto yyreduce; |
| 1447 | } |
| 1448 | |
| 1449 | /* Count tokens shifted since error; after three, turn off error |
| 1450 | status. */ |
| 1451 | if (yyerrstatus) |
| 1452 | yyerrstatus--; |
| 1453 | |
| 1454 | /* Shift the lookahead token. */ |
| 1455 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
| 1456 | |
| 1457 | /* Discard the shifted token. */ |
| 1458 | yychar = YYEMPTY; |
| 1459 | |
| 1460 | yystate = yyn; |
| 1461 | *++yyvsp = yylval; |
| 1462 | |
| 1463 | goto yynewstate; |
| 1464 | |
| 1465 | |
| 1466 | /*-----------------------------------------------------------. |
| 1467 | | yydefault -- do the default action for the current state. | |
| 1468 | `-----------------------------------------------------------*/ |
| 1469 | yydefault: |
| 1470 | yyn = yydefact[yystate]; |
| 1471 | if (yyn == 0) |
| 1472 | goto yyerrlab; |
| 1473 | goto yyreduce; |
| 1474 | |
| 1475 | |
| 1476 | /*-----------------------------. |
| 1477 | | yyreduce -- Do a reduction. | |
| 1478 | `-----------------------------*/ |
| 1479 | yyreduce: |
| 1480 | /* yyn is the number of a rule to reduce with. */ |
| 1481 | yylen = yyr2[yyn]; |
| 1482 | |
| 1483 | /* If YYLEN is nonzero, implement the default value of the action: |
| 1484 | `$$ = $1'. |
| 1485 | |
| 1486 | Otherwise, the following line sets YYVAL to garbage. |
| 1487 | This behavior is undocumented and Bison |
| 1488 | users should not rely upon it. Assigning to YYVAL |
| 1489 | unconditionally makes the parser a bit smaller, and it avoids a |
| 1490 | GCC warning that YYVAL may be used uninitialized. */ |
| 1491 | yyval = yyvsp[1-yylen]; |
| 1492 | |
| 1493 | |
| 1494 | YY_REDUCE_PRINT (yyn); |
| 1495 | switch (yyn) |
| 1496 | { |
| 1497 | case 11: |
| 1498 | |
| 1499 | /* Line 1806 of yacc.c */ |
| 1500 | #line 133 "lib/conf-parse.y" |
| 1501 | { sensors_bus new_el; |
| 1502 | new_el.line = (yyvsp[(1) - (3)].line); |
| 1503 | new_el.bus = (yyvsp[(2) - (3)].bus); |
| 1504 | new_el.adapter = (yyvsp[(3) - (3)].name); |
| 1505 | bus_add_el(&new_el); |
| 1506 | } |
| 1507 | break; |
| 1508 | |
| 1509 | case 12: |
| 1510 | |
| 1511 | /* Line 1806 of yacc.c */ |
| 1512 | #line 142 "lib/conf-parse.y" |
| 1513 | { sensors_label new_el; |
| 1514 | if (!current_chip) { |
| 1515 | sensors_yyerror("Label statement before first chip statement"); |
| 1516 | free((yyvsp[(2) - (3)].name)); |
| 1517 | free((yyvsp[(3) - (3)].name)); |
| 1518 | YYERROR; |
| 1519 | } |
| 1520 | new_el.line = (yyvsp[(1) - (3)].line); |
| 1521 | new_el.name = (yyvsp[(2) - (3)].name); |
| 1522 | new_el.value = (yyvsp[(3) - (3)].name); |
| 1523 | label_add_el(&new_el); |
| 1524 | } |
| 1525 | break; |
| 1526 | |
| 1527 | case 13: |
| 1528 | |
| 1529 | /* Line 1806 of yacc.c */ |
| 1530 | #line 157 "lib/conf-parse.y" |
| 1531 | { sensors_set new_el; |
| 1532 | if (!current_chip) { |
| 1533 | sensors_yyerror("Set statement before first chip statement"); |
| 1534 | free((yyvsp[(2) - (3)].name)); |
| 1535 | sensors_free_expr((yyvsp[(3) - (3)].expr)); |
| 1536 | YYERROR; |
| 1537 | } |
| 1538 | new_el.line = (yyvsp[(1) - (3)].line); |
| 1539 | new_el.name = (yyvsp[(2) - (3)].name); |
| 1540 | new_el.value = (yyvsp[(3) - (3)].expr); |
| 1541 | set_add_el(&new_el); |
| 1542 | } |
| 1543 | break; |
| 1544 | |
| 1545 | case 14: |
| 1546 | |
| 1547 | /* Line 1806 of yacc.c */ |
| 1548 | #line 172 "lib/conf-parse.y" |
| 1549 | { sensors_compute new_el; |
| 1550 | if (!current_chip) { |
| 1551 | sensors_yyerror("Compute statement before first chip statement"); |
| 1552 | free((yyvsp[(2) - (5)].name)); |
| 1553 | sensors_free_expr((yyvsp[(3) - (5)].expr)); |
| 1554 | sensors_free_expr((yyvsp[(5) - (5)].expr)); |
| 1555 | YYERROR; |
| 1556 | } |
| 1557 | new_el.line = (yyvsp[(1) - (5)].line); |
| 1558 | new_el.name = (yyvsp[(2) - (5)].name); |
| 1559 | new_el.from_proc = (yyvsp[(3) - (5)].expr); |
| 1560 | new_el.to_proc = (yyvsp[(5) - (5)].expr); |
| 1561 | compute_add_el(&new_el); |
| 1562 | } |
| 1563 | break; |
| 1564 | |
| 1565 | case 15: |
| 1566 | |
| 1567 | /* Line 1806 of yacc.c */ |
| 1568 | #line 189 "lib/conf-parse.y" |
| 1569 | { sensors_ignore new_el; |
| 1570 | if (!current_chip) { |
| 1571 | sensors_yyerror("Ignore statement before first chip statement"); |
| 1572 | free((yyvsp[(2) - (2)].name)); |
| 1573 | YYERROR; |
| 1574 | } |
| 1575 | new_el.line = (yyvsp[(1) - (2)].line); |
| 1576 | new_el.name = (yyvsp[(2) - (2)].name); |
| 1577 | ignore_add_el(&new_el); |
| 1578 | } |
| 1579 | break; |
| 1580 | |
| 1581 | case 16: |
| 1582 | |
| 1583 | /* Line 1806 of yacc.c */ |
| 1584 | #line 202 "lib/conf-parse.y" |
| 1585 | { sensors_chip new_el; |
| 1586 | new_el.line = (yyvsp[(1) - (2)].line); |
| 1587 | new_el.labels = NULL; |
| 1588 | new_el.sets = NULL; |
| 1589 | new_el.computes = NULL; |
| 1590 | new_el.ignores = NULL; |
| 1591 | new_el.labels_count = new_el.labels_max = 0; |
| 1592 | new_el.sets_count = new_el.sets_max = 0; |
| 1593 | new_el.computes_count = new_el.computes_max = 0; |
| 1594 | new_el.ignores_count = new_el.ignores_max = 0; |
| 1595 | new_el.chips = (yyvsp[(2) - (2)].chips); |
| 1596 | chip_add_el(&new_el); |
| 1597 | current_chip = sensors_config_chips + |
| 1598 | sensors_config_chips_count - 1; |
| 1599 | } |
| 1600 | break; |
| 1601 | |
| 1602 | case 17: |
| 1603 | |
| 1604 | /* Line 1806 of yacc.c */ |
| 1605 | #line 220 "lib/conf-parse.y" |
| 1606 | { |
| 1607 | (yyval.chips).fits = NULL; |
| 1608 | (yyval.chips).fits_count = (yyval.chips).fits_max = 0; |
| 1609 | fits_add_el(&(yyvsp[(1) - (1)].chip),(yyval.chips)); |
| 1610 | } |
| 1611 | break; |
| 1612 | |
| 1613 | case 18: |
| 1614 | |
| 1615 | /* Line 1806 of yacc.c */ |
| 1616 | #line 226 "lib/conf-parse.y" |
| 1617 | { (yyval.chips) = (yyvsp[(1) - (2)].chips); |
| 1618 | fits_add_el(&(yyvsp[(2) - (2)].chip),(yyval.chips)); |
| 1619 | } |
| 1620 | break; |
| 1621 | |
| 1622 | case 19: |
| 1623 | |
| 1624 | /* Line 1806 of yacc.c */ |
| 1625 | #line 232 "lib/conf-parse.y" |
| 1626 | { (yyval.expr) = malloc_expr(); |
| 1627 | (yyval.expr)->data.val = (yyvsp[(1) - (1)].value); |
| 1628 | (yyval.expr)->kind = sensors_kind_val; |
| 1629 | } |
| 1630 | break; |
| 1631 | |
| 1632 | case 20: |
| 1633 | |
| 1634 | /* Line 1806 of yacc.c */ |
| 1635 | #line 237 "lib/conf-parse.y" |
| 1636 | { (yyval.expr) = malloc_expr(); |
| 1637 | (yyval.expr)->data.var = (yyvsp[(1) - (1)].name); |
| 1638 | (yyval.expr)->kind = sensors_kind_var; |
| 1639 | } |
| 1640 | break; |
| 1641 | |
| 1642 | case 21: |
| 1643 | |
| 1644 | /* Line 1806 of yacc.c */ |
| 1645 | #line 242 "lib/conf-parse.y" |
| 1646 | { (yyval.expr) = malloc_expr(); |
| 1647 | (yyval.expr)->kind = sensors_kind_source; |
| 1648 | } |
| 1649 | break; |
| 1650 | |
| 1651 | case 22: |
| 1652 | |
| 1653 | /* Line 1806 of yacc.c */ |
| 1654 | #line 246 "lib/conf-parse.y" |
| 1655 | { (yyval.expr) = malloc_expr(); |
| 1656 | (yyval.expr)->kind = sensors_kind_sub; |
| 1657 | (yyval.expr)->data.subexpr.op = sensors_add; |
| 1658 | (yyval.expr)->data.subexpr.sub1 = (yyvsp[(1) - (3)].expr); |
| 1659 | (yyval.expr)->data.subexpr.sub2 = (yyvsp[(3) - (3)].expr); |
| 1660 | } |
| 1661 | break; |
| 1662 | |
| 1663 | case 23: |
| 1664 | |
| 1665 | /* Line 1806 of yacc.c */ |
| 1666 | #line 253 "lib/conf-parse.y" |
| 1667 | { (yyval.expr) = malloc_expr(); |
| 1668 | (yyval.expr)->kind = sensors_kind_sub; |
| 1669 | (yyval.expr)->data.subexpr.op = sensors_sub; |
| 1670 | (yyval.expr)->data.subexpr.sub1 = (yyvsp[(1) - (3)].expr); |
| 1671 | (yyval.expr)->data.subexpr.sub2 = (yyvsp[(3) - (3)].expr); |
| 1672 | } |
| 1673 | break; |
| 1674 | |
| 1675 | case 24: |
| 1676 | |
| 1677 | /* Line 1806 of yacc.c */ |
| 1678 | #line 260 "lib/conf-parse.y" |
| 1679 | { (yyval.expr) = malloc_expr(); |
| 1680 | (yyval.expr)->kind = sensors_kind_sub; |
| 1681 | (yyval.expr)->data.subexpr.op = sensors_multiply; |
| 1682 | (yyval.expr)->data.subexpr.sub1 = (yyvsp[(1) - (3)].expr); |
| 1683 | (yyval.expr)->data.subexpr.sub2 = (yyvsp[(3) - (3)].expr); |
| 1684 | } |
| 1685 | break; |
| 1686 | |
| 1687 | case 25: |
| 1688 | |
| 1689 | /* Line 1806 of yacc.c */ |
| 1690 | #line 267 "lib/conf-parse.y" |
| 1691 | { (yyval.expr) = malloc_expr(); |
| 1692 | (yyval.expr)->kind = sensors_kind_sub; |
| 1693 | (yyval.expr)->data.subexpr.op = sensors_divide; |
| 1694 | (yyval.expr)->data.subexpr.sub1 = (yyvsp[(1) - (3)].expr); |
| 1695 | (yyval.expr)->data.subexpr.sub2 = (yyvsp[(3) - (3)].expr); |
| 1696 | } |
| 1697 | break; |
| 1698 | |
| 1699 | case 26: |
| 1700 | |
| 1701 | /* Line 1806 of yacc.c */ |
| 1702 | #line 274 "lib/conf-parse.y" |
| 1703 | { (yyval.expr) = malloc_expr(); |
| 1704 | (yyval.expr)->kind = sensors_kind_sub; |
| 1705 | (yyval.expr)->data.subexpr.op = sensors_negate; |
| 1706 | (yyval.expr)->data.subexpr.sub1 = (yyvsp[(2) - (2)].expr); |
| 1707 | (yyval.expr)->data.subexpr.sub2 = NULL; |
| 1708 | } |
| 1709 | break; |
| 1710 | |
| 1711 | case 27: |
| 1712 | |
| 1713 | /* Line 1806 of yacc.c */ |
| 1714 | #line 281 "lib/conf-parse.y" |
| 1715 | { (yyval.expr) = (yyvsp[(2) - (3)].expr); } |
| 1716 | break; |
| 1717 | |
| 1718 | case 28: |
| 1719 | |
| 1720 | /* Line 1806 of yacc.c */ |
| 1721 | #line 283 "lib/conf-parse.y" |
| 1722 | { (yyval.expr) = malloc_expr(); |
| 1723 | (yyval.expr)->kind = sensors_kind_sub; |
| 1724 | (yyval.expr)->data.subexpr.op = sensors_exp; |
| 1725 | (yyval.expr)->data.subexpr.sub1 = (yyvsp[(2) - (2)].expr); |
| 1726 | (yyval.expr)->data.subexpr.sub2 = NULL; |
| 1727 | } |
| 1728 | break; |
| 1729 | |
| 1730 | case 29: |
| 1731 | |
| 1732 | /* Line 1806 of yacc.c */ |
| 1733 | #line 290 "lib/conf-parse.y" |
| 1734 | { (yyval.expr) = malloc_expr(); |
| 1735 | (yyval.expr)->kind = sensors_kind_sub; |
| 1736 | (yyval.expr)->data.subexpr.op = sensors_log; |
| 1737 | (yyval.expr)->data.subexpr.sub1 = (yyvsp[(2) - (2)].expr); |
| 1738 | (yyval.expr)->data.subexpr.sub2 = NULL; |
| 1739 | } |
| 1740 | break; |
| 1741 | |
| 1742 | case 30: |
| 1743 | |
| 1744 | /* Line 1806 of yacc.c */ |
| 1745 | #line 299 "lib/conf-parse.y" |
| 1746 | { int res = sensors_parse_bus_id((yyvsp[(1) - (1)].name),&(yyval.bus)); |
| 1747 | free((yyvsp[(1) - (1)].name)); |
| 1748 | if (res) { |
| 1749 | sensors_yyerror("Parse error in bus id"); |
| 1750 | YYERROR; |
| 1751 | } |
| 1752 | } |
| 1753 | break; |
| 1754 | |
| 1755 | case 31: |
| 1756 | |
| 1757 | /* Line 1806 of yacc.c */ |
| 1758 | #line 309 "lib/conf-parse.y" |
| 1759 | { (yyval.name) = (yyvsp[(1) - (1)].name); } |
| 1760 | break; |
| 1761 | |
| 1762 | case 32: |
| 1763 | |
| 1764 | /* Line 1806 of yacc.c */ |
| 1765 | #line 313 "lib/conf-parse.y" |
| 1766 | { (yyval.name) = (yyvsp[(1) - (1)].name); } |
| 1767 | break; |
| 1768 | |
| 1769 | case 33: |
| 1770 | |
| 1771 | /* Line 1806 of yacc.c */ |
| 1772 | #line 317 "lib/conf-parse.y" |
| 1773 | { (yyval.name) = (yyvsp[(1) - (1)].name); } |
| 1774 | break; |
| 1775 | |
| 1776 | case 34: |
| 1777 | |
| 1778 | /* Line 1806 of yacc.c */ |
| 1779 | #line 321 "lib/conf-parse.y" |
| 1780 | { int res = sensors_parse_chip_name((yyvsp[(1) - (1)].name),&(yyval.chip)); |
| 1781 | free((yyvsp[(1) - (1)].name)); |
| 1782 | if (res) { |
| 1783 | sensors_yyerror("Parse error in chip name"); |
| 1784 | YYERROR; |
| 1785 | } |
| 1786 | } |
| 1787 | break; |
| 1788 | |
| 1789 | |
| 1790 | |
| 1791 | /* Line 1806 of yacc.c */ |
| 1792 | #line 1793 "lib/conf-parse.c" |
| 1793 | default: break; |
| 1794 | } |
| 1795 | /* User semantic actions sometimes alter yychar, and that requires |
| 1796 | that yytoken be updated with the new translation. We take the |
| 1797 | approach of translating immediately before every use of yytoken. |
| 1798 | One alternative is translating here after every semantic action, |
| 1799 | but that translation would be missed if the semantic action invokes |
| 1800 | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or |
| 1801 | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
| 1802 | incorrect destructor might then be invoked immediately. In the |
| 1803 | case of YYERROR or YYBACKUP, subsequent parser actions might lead |
| 1804 | to an incorrect destructor call or verbose syntax error message |
| 1805 | before the lookahead is translated. */ |
| 1806 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
| 1807 | |
| 1808 | YYPOPSTACK (yylen); |
| 1809 | yylen = 0; |
| 1810 | YY_STACK_PRINT (yyss, yyssp); |
| 1811 | |
| 1812 | *++yyvsp = yyval; |
| 1813 | |
| 1814 | /* Now `shift' the result of the reduction. Determine what state |
| 1815 | that goes to, based on the state we popped back to and the rule |
| 1816 | number reduced by. */ |
| 1817 | |
| 1818 | yyn = yyr1[yyn]; |
| 1819 | |
| 1820 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 1821 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
| 1822 | yystate = yytable[yystate]; |
| 1823 | else |
| 1824 | yystate = yydefgoto[yyn - YYNTOKENS]; |
| 1825 | |
| 1826 | goto yynewstate; |
| 1827 | |
| 1828 | |
| 1829 | /*------------------------------------. |
| 1830 | | yyerrlab -- here on detecting error | |
| 1831 | `------------------------------------*/ |
| 1832 | yyerrlab: |
| 1833 | /* Make sure we have latest lookahead translation. See comments at |
| 1834 | user semantic actions for why this is necessary. */ |
| 1835 | yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); |
| 1836 | |
| 1837 | /* If not already recovering from an error, report this error. */ |
| 1838 | if (!yyerrstatus) |
| 1839 | { |
| 1840 | ++yynerrs; |
| 1841 | #if ! YYERROR_VERBOSE |
| 1842 | yyerror (YY_("syntax error")); |
| 1843 | #else |
| 1844 | # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ |
| 1845 | yyssp, yytoken) |
| 1846 | { |
| 1847 | char const *yymsgp = YY_("syntax error"); |
| 1848 | int yysyntax_error_status; |
| 1849 | yysyntax_error_status = YYSYNTAX_ERROR; |
| 1850 | if (yysyntax_error_status == 0) |
| 1851 | yymsgp = yymsg; |
| 1852 | else if (yysyntax_error_status == 1) |
| 1853 | { |
| 1854 | if (yymsg != yymsgbuf) |
| 1855 | YYSTACK_FREE (yymsg); |
| 1856 | yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); |
| 1857 | if (!yymsg) |
| 1858 | { |
| 1859 | yymsg = yymsgbuf; |
| 1860 | yymsg_alloc = sizeof yymsgbuf; |
| 1861 | yysyntax_error_status = 2; |
| 1862 | } |
| 1863 | else |
| 1864 | { |
| 1865 | yysyntax_error_status = YYSYNTAX_ERROR; |
| 1866 | yymsgp = yymsg; |
| 1867 | } |
| 1868 | } |
| 1869 | yyerror (yymsgp); |
| 1870 | if (yysyntax_error_status == 2) |
| 1871 | goto yyexhaustedlab; |
| 1872 | } |
| 1873 | # undef YYSYNTAX_ERROR |
| 1874 | #endif |
| 1875 | } |
| 1876 | |
| 1877 | |
| 1878 | |
| 1879 | if (yyerrstatus == 3) |
| 1880 | { |
| 1881 | /* If just tried and failed to reuse lookahead token after an |
| 1882 | error, discard it. */ |
| 1883 | |
| 1884 | if (yychar <= YYEOF) |
| 1885 | { |
| 1886 | /* Return failure if at end of input. */ |
| 1887 | if (yychar == YYEOF) |
| 1888 | YYABORT; |
| 1889 | } |
| 1890 | else |
| 1891 | { |
| 1892 | yydestruct ("Error: discarding", |
| 1893 | yytoken, &yylval); |
| 1894 | yychar = YYEMPTY; |
| 1895 | } |
| 1896 | } |
| 1897 | |
| 1898 | /* Else will try to reuse lookahead token after shifting the error |
| 1899 | token. */ |
| 1900 | goto yyerrlab1; |
| 1901 | |
| 1902 | |
| 1903 | /*---------------------------------------------------. |
| 1904 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 1905 | `---------------------------------------------------*/ |
| 1906 | yyerrorlab: |
| 1907 | |
| 1908 | /* Pacify compilers like GCC when the user code never invokes |
| 1909 | YYERROR and the label yyerrorlab therefore never appears in user |
| 1910 | code. */ |
| 1911 | if (/*CONSTCOND*/ 0) |
| 1912 | goto yyerrorlab; |
| 1913 | |
| 1914 | /* Do not reclaim the symbols of the rule which action triggered |
| 1915 | this YYERROR. */ |
| 1916 | YYPOPSTACK (yylen); |
| 1917 | yylen = 0; |
| 1918 | YY_STACK_PRINT (yyss, yyssp); |
| 1919 | yystate = *yyssp; |
| 1920 | goto yyerrlab1; |
| 1921 | |
| 1922 | |
| 1923 | /*-------------------------------------------------------------. |
| 1924 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 1925 | `-------------------------------------------------------------*/ |
| 1926 | yyerrlab1: |
| 1927 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 1928 | |
| 1929 | for (;;) |
| 1930 | { |
| 1931 | yyn = yypact[yystate]; |
| 1932 | if (!yypact_value_is_default (yyn)) |
| 1933 | { |
| 1934 | yyn += YYTERROR; |
| 1935 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 1936 | { |
| 1937 | yyn = yytable[yyn]; |
| 1938 | if (0 < yyn) |
| 1939 | break; |
| 1940 | } |
| 1941 | } |
| 1942 | |
| 1943 | /* Pop the current state because it cannot handle the error token. */ |
| 1944 | if (yyssp == yyss) |
| 1945 | YYABORT; |
| 1946 | |
| 1947 | |
| 1948 | yydestruct ("Error: popping", |
| 1949 | yystos[yystate], yyvsp); |
| 1950 | YYPOPSTACK (1); |
| 1951 | yystate = *yyssp; |
| 1952 | YY_STACK_PRINT (yyss, yyssp); |
| 1953 | } |
| 1954 | |
| 1955 | *++yyvsp = yylval; |
| 1956 | |
| 1957 | |
| 1958 | /* Shift the error token. */ |
| 1959 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
| 1960 | |
| 1961 | yystate = yyn; |
| 1962 | goto yynewstate; |
| 1963 | |
| 1964 | |
| 1965 | /*-------------------------------------. |
| 1966 | | yyacceptlab -- YYACCEPT comes here. | |
| 1967 | `-------------------------------------*/ |
| 1968 | yyacceptlab: |
| 1969 | yyresult = 0; |
| 1970 | goto yyreturn; |
| 1971 | |
| 1972 | /*-----------------------------------. |
| 1973 | | yyabortlab -- YYABORT comes here. | |
| 1974 | `-----------------------------------*/ |
| 1975 | yyabortlab: |
| 1976 | yyresult = 1; |
| 1977 | goto yyreturn; |
| 1978 | |
| 1979 | #if !defined(yyoverflow) || YYERROR_VERBOSE |
| 1980 | /*-------------------------------------------------. |
| 1981 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 1982 | `-------------------------------------------------*/ |
| 1983 | yyexhaustedlab: |
| 1984 | yyerror (YY_("memory exhausted")); |
| 1985 | yyresult = 2; |
| 1986 | /* Fall through. */ |
| 1987 | #endif |
| 1988 | |
| 1989 | yyreturn: |
| 1990 | if (yychar != YYEMPTY) |
| 1991 | { |
| 1992 | /* Make sure we have latest lookahead translation. See comments at |
| 1993 | user semantic actions for why this is necessary. */ |
| 1994 | yytoken = YYTRANSLATE (yychar); |
| 1995 | yydestruct ("Cleanup: discarding lookahead", |
| 1996 | yytoken, &yylval); |
| 1997 | } |
| 1998 | /* Do not reclaim the symbols of the rule which action triggered |
| 1999 | this YYABORT or YYACCEPT. */ |
| 2000 | YYPOPSTACK (yylen); |
| 2001 | YY_STACK_PRINT (yyss, yyssp); |
| 2002 | while (yyssp != yyss) |
| 2003 | { |
| 2004 | yydestruct ("Cleanup: popping", |
| 2005 | yystos[*yyssp], yyvsp); |
| 2006 | YYPOPSTACK (1); |
| 2007 | } |
| 2008 | #ifndef yyoverflow |
| 2009 | if (yyss != yyssa) |
| 2010 | YYSTACK_FREE (yyss); |
| 2011 | #endif |
| 2012 | #if YYERROR_VERBOSE |
| 2013 | if (yymsg != yymsgbuf) |
| 2014 | YYSTACK_FREE (yymsg); |
| 2015 | #endif |
| 2016 | /* Make sure YYID is used. */ |
| 2017 | return YYID (yyresult); |
| 2018 | } |
| 2019 | |
| 2020 | |
| 2021 | |
| 2022 | /* Line 2067 of yacc.c */ |
| 2023 | #line 330 "lib/conf-parse.y" |
| 2024 | |
| 2025 | |
| 2026 | void sensors_yyerror(const char *err) |
| 2027 | { |
| 2028 | if (sensors_lex_error[0]) { |
| 2029 | sensors_parse_error_wfn(sensors_lex_error, sensors_yyfilename, sensors_yylineno); |
| 2030 | sensors_lex_error[0] = '\0'; |
| 2031 | } else |
| 2032 | sensors_parse_error_wfn(err, sensors_yyfilename, sensors_yylineno); |
| 2033 | } |
| 2034 | |
| 2035 | sensors_expr *malloc_expr(void) |
| 2036 | { |
| 2037 | sensors_expr *res = malloc(sizeof(sensors_expr)); |
| 2038 | if (! res) |
| 2039 | sensors_fatal_error(__func__, "Allocating a new expression"); |
| 2040 | return res; |
| 2041 | } |
| 2042 | |