|
k-dot-p 0.1
|
00001 00002 /* A Bison parser, made by GNU Bison 2.4.1. */ 00003 00004 /* Skeleton implementation for Bison's Yacc-like parsers in C 00005 00006 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 00007 Free Software Foundation, Inc. 00008 00009 This program is free software: you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00021 00022 /* As a special exception, you may create a larger work that contains 00023 part or all of the Bison parser skeleton and distribute that work 00024 under terms of your choice, so long as that work isn't itself a 00025 parser generator using the skeleton or a modified version thereof 00026 as a parser skeleton. Alternatively, if you modify or redistribute 00027 the parser skeleton itself, you may (at your option) remove this 00028 special exception, which will cause the skeleton and the resulting 00029 Bison output files to be licensed under the GNU General Public 00030 License without this special exception. 00031 00032 This special exception was added by the Free Software Foundation in 00033 version 2.2 of Bison. */ 00034 00035 /* C LALR(1) parser skeleton written by Richard Stallman, by 00036 simplifying the original so-called "semantic" parser. */ 00037 00038 /* All symbols defined below should begin with yy or YY, to avoid 00039 infringing on user name space. This should be done even for local 00040 variables, as they might otherwise be expanded by user macros. 00041 There are some unavoidable exceptions within include files to 00042 define necessary library symbols; they are noted "INFRINGES ON 00043 USER NAME SPACE" below. */ 00044 00045 /* Identify Bison output. */ 00046 #define YYBISON 1 00047 00048 /* Bison version. */ 00049 #define YYBISON_VERSION "2.4.1" 00050 00051 /* Skeleton name. */ 00052 #define YYSKELETON_NAME "yacc.c" 00053 00054 /* Pure parsers. */ 00055 #define YYPURE 0 00056 00057 /* Push parsers. */ 00058 #define YYPUSH 0 00059 00060 /* Pull parsers. */ 00061 #define YYPULL 1 00062 00063 /* Using locations. */ 00064 #define YYLSP_NEEDED 1 00065 00066 00067 00068 /* Copy the first part of user declarations. */ 00069 00070 /* Line 189 of yacc.c */ 00071 #line 1 "structspec_parser.y++" 00072 00073 /* 00074 * 00075 Copyright (C) 2009 Joseph Pingenot 00076 00077 This program is free software: you can redistribute it and/or modify 00078 it under the terms of the GNU Affero General Public License as published by 00079 the Free Software Foundation, either version 3 of the License, or 00080 (at your option) any later version. 00081 00082 This program is distributed in the hope that it will be useful, 00083 but WITHOUT ANY WARRANTY; without even the implied warranty of 00084 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00085 GNU Affero General Public License for more details. 00086 00087 You should have received a copy of the GNU Affero General Public License 00088 along with this program. If not, see <http://www.gnu.org/licenses/>. 00089 00090 */ 00091 00092 #include <stdio.h> 00093 #include <glib.h> 00094 #include <unistd.h> 00095 #include <stdlib.h> 00096 #include <math.h> 00097 #include <libmodelxx/grid.h++> 00098 #include <libmodelxx/continuous_structure.h++> 00099 #include "lexer_parser_enums.h++" 00100 00101 #define YYDEBUG 1 00102 00103 using namespace kdotp::libmodelxx::grid; 00104 using namespace kdotp::libmodelxx::postprocessing; 00105 using namespace kdotp::libmodelxx::continuous_structure; 00106 00107 int yylex(void); 00108 void yyerror(const char *s); 00109 00110 int region_sequence_number = 0; 00111 00112 struct key_value *kv; 00113 00114 double* new_double(double x) {double* d = (double*)malloc(sizeof(double)); *d = x; return d;} 00115 int* new_int(int x) {int* d = (int*)malloc(sizeof(int)); *d = x; return d;} 00116 00117 00118 /**Set up a function expression AST node.*/ 00119 struct function_exp* new_fx(enum function_op op, struct function_exp* l, struct function_exp* r) { 00120 struct function_exp* f = (struct function_exp*)malloc(sizeof(struct function_exp)); 00121 g_assert(f != NULL); 00122 f->op = op; 00123 f->l = l; 00124 f->r = r; 00125 return f; 00126 } 00127 00128 /** Convenience function for building functin_expression AST. 00129 *\note that the doubles pointed to by values will NOT be linked into the new list. Rather, they'll be copied. 00130 */ 00131 struct function_exp* new_fx_const(int t, GList *values) { 00132 struct function_const* f = (struct function_const*)malloc(sizeof(struct function_const)); 00133 g_assert(f != NULL); 00134 f->op = kdotp::libmodelxx::postprocessing::CONST; 00135 switch(t) { 00136 case 0: 00137 f->t = kdotp::libmodelxx::postprocessing::BINARY; 00138 break; 00139 case 1: 00140 f->t = kdotp::libmodelxx::postprocessing::SCALAR; 00141 break; 00142 case 2: 00143 f->t = kdotp::libmodelxx::postprocessing::VECTOR2; 00144 break; 00145 case 3: 00146 f->t = kdotp::libmodelxx::postprocessing::VECTOR3; 00147 break; 00148 default: 00149 f->t = kdotp::libmodelxx::postprocessing::INVALID; 00150 } 00151 int len=g_list_length(values); 00152 double* vals = (double*)malloc(len*sizeof(double)); 00153 g_assert(vals != NULL); 00154 f->value = vals; 00155 int i; 00156 GList *l; 00157 for(l = values, i=0; l!=NULL; l=l->next, i++) vals[i] = *(double*)(l->data); 00158 return (struct function_exp*)f; 00159 } 00160 /**Set up a function 00161 */ 00162 struct function_exp* new_fx_func(const char* func, struct function_exp* arg) { 00163 enum function_op op = function_get_op_for_builtin_function(func); 00164 if(op == kdotp::libmodelxx::postprocessing::NOT) { 00165 fprintf(stderr, "ERROR: couldn't determine function (%s)\n", func); 00166 exit(1); 00167 } 00168 return new_fx(op, NULL, arg); 00169 } 00170 /**Convenient from of new_fx_const for a GList* of integers. 00171 */ 00172 struct function_exp* new_fx_const_ints(int t, GList *int_values) { 00173 GList *l = NULL; 00174 /*Basically, use implicit conversion from int to double with the *values* in the int_values list.*/ 00175 /*Throw the result in the new list l*/ 00176 for(GList *ll = int_values; ll!=NULL; ll=ll->next) l = g_list_append(l, new_double(*(int*)(l->data))); 00177 struct function_exp* f = new_fx_const(t, l); 00178 /*Free the values in the list and then the list.*/ 00179 for(GList *ll = l; ll!=NULL; ll=ll->next) free(l->data); 00180 g_list_free(l); 00181 return f; 00182 } 00183 /**More convenient form of new_fx_const for a single double or integer value. 00184 */ 00185 struct function_exp* new_fx_const_single(double value) { 00186 struct function_const* f = (struct function_const*)malloc(sizeof(struct function_const)); 00187 g_assert(f != NULL); 00188 f->op = kdotp::libmodelxx::postprocessing::CONST; 00189 f->t = kdotp::libmodelxx::postprocessing::SCALAR; 00190 f->value = new_double(value); 00191 return (struct function_exp*)f; 00192 } 00193 struct function_exp* new_fx_symbol(char* symbol) { 00194 struct function_symbol* f = (struct function_symbol*)malloc(sizeof(struct function_symbol)); 00195 g_assert(f != NULL); 00196 f->op = kdotp::libmodelxx::postprocessing::SYMBOL; 00197 GString *s = g_string_new(symbol); 00198 f->symbol = s->str; 00199 g_string_free(s, FALSE); 00200 return (struct function_exp*)f; 00201 } 00202 00203 /*This stores the grid for this structure, since grid is specified first.*/ 00204 struct grid *g = NULL; 00205 struct continuous_structure* the_structure = NULL; 00206 00207 00208 /* Line 189 of yacc.c */ 00209 #line 210 "kdotp/structspec_parser.c++" 00210 00211 /* Enabling traces. */ 00212 #ifndef YYDEBUG 00213 # define YYDEBUG 1 00214 #endif 00215 00216 /* Enabling verbose error messages. */ 00217 #ifdef YYERROR_VERBOSE 00218 # undef YYERROR_VERBOSE 00219 # define YYERROR_VERBOSE 1 00220 #else 00221 # define YYERROR_VERBOSE 0 00222 #endif 00223 00224 /* Enabling the token table. */ 00225 #ifndef YYTOKEN_TABLE 00226 # define YYTOKEN_TABLE 0 00227 #endif 00228 00229 00230 /* Tokens. */ 00231 #ifndef YYTOKENTYPE 00232 # define YYTOKENTYPE 00233 /* Put the tokens into the symbol table, so that GDB and other debuggers 00234 know about them. */ 00235 enum yytokentype { 00236 TOK_IDENTIFIER = 258, 00237 TOK_STRING = 259, 00238 TOK_ENERGY = 260, 00239 TOK_LENGTH = 261, 00240 TOK_FLOAT = 262, 00241 TOK_INT = 263, 00242 TOK_VECTOR = 264, 00243 TOK_GRID_TYPE = 265, 00244 TOK_STRUCTURE = 266, 00245 TO_STRUCTURE = 267, 00246 TOK_GRID = 268, 00247 TOK_REGION = 269, 00248 TOK_SHAPE = 270, 00249 TOK_CONST = 271, 00250 TOK_POTENTIAL = 272, 00251 TOK_DOPING = 273, 00252 UMINUS = 274 00253 }; 00254 #endif 00255 /* Tokens. */ 00256 #define TOK_IDENTIFIER 258 00257 #define TOK_STRING 259 00258 #define TOK_ENERGY 260 00259 #define TOK_LENGTH 261 00260 #define TOK_FLOAT 262 00261 #define TOK_INT 263 00262 #define TOK_VECTOR 264 00263 #define TOK_GRID_TYPE 265 00264 #define TOK_STRUCTURE 266 00265 #define TO_STRUCTURE 267 00266 #define TOK_GRID 268 00267 #define TOK_REGION 269 00268 #define TOK_SHAPE 270 00269 #define TOK_CONST 271 00270 #define TOK_POTENTIAL 272 00271 #define TOK_DOPING 273 00272 #define UMINUS 274 00273 00274 00275 00276 00277 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 00278 typedef union YYSTYPE 00279 { 00280 00281 /* Line 214 of yacc.c */ 00282 #line 137 "structspec_parser.y++" 00283 00284 char* str; 00285 double fval; 00286 int ival; 00287 enum kdotp::libmodelxx::continuous_structure::length len; 00288 enum kdotp::libmodelxx::continuous_structure::energy energy; 00289 struct vector* v; 00290 GList *list; 00291 struct key_value *kvu; 00292 enum kdotp::libmodelxx::grid::grid_type gt; 00293 struct kdotp::libmodelxx::grid::shape_tree *stree; 00294 struct kdotp::libmodelxx::continuous_structure::region *region; 00295 struct kdotp::libmodelxx::grid::grid *g; 00296 struct kdotp::libmodelxx::continuous_structure::continuous_structure *s; 00297 struct kdotp::libmodelxx::continuous_structure::potential *potential; 00298 struct kdotp::libmodelxx::continuous_structure::doping *doping; 00299 struct kdotp::libmodelxx::postprocessing::function_exp *exp; 00300 00301 00302 00303 /* Line 214 of yacc.c */ 00304 #line 305 "kdotp/structspec_parser.c++" 00305 } YYSTYPE; 00306 # define YYSTYPE_IS_TRIVIAL 1 00307 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 00308 # define YYSTYPE_IS_DECLARED 1 00309 #endif 00310 00311 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED 00312 typedef struct YYLTYPE 00313 { 00314 int first_line; 00315 int first_column; 00316 int last_line; 00317 int last_column; 00318 } YYLTYPE; 00319 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ 00320 # define YYLTYPE_IS_DECLARED 1 00321 # define YYLTYPE_IS_TRIVIAL 1 00322 #endif 00323 00324 00325 /* Copy the second part of user declarations. */ 00326 00327 00328 /* Line 264 of yacc.c */ 00329 #line 330 "kdotp/structspec_parser.c++" 00330 00331 #ifdef short 00332 # undef short 00333 #endif 00334 00335 #ifdef YYTYPE_UINT8 00336 typedef YYTYPE_UINT8 yytype_uint8; 00337 #else 00338 typedef unsigned char yytype_uint8; 00339 #endif 00340 00341 #ifdef YYTYPE_INT8 00342 typedef YYTYPE_INT8 yytype_int8; 00343 #elif (defined __STDC__ || defined __C99__FUNC__ \ 00344 || defined __cplusplus || defined _MSC_VER) 00345 typedef signed char yytype_int8; 00346 #else 00347 typedef short int yytype_int8; 00348 #endif 00349 00350 #ifdef YYTYPE_UINT16 00351 typedef YYTYPE_UINT16 yytype_uint16; 00352 #else 00353 typedef unsigned short int yytype_uint16; 00354 #endif 00355 00356 #ifdef YYTYPE_INT16 00357 typedef YYTYPE_INT16 yytype_int16; 00358 #else 00359 typedef short int yytype_int16; 00360 #endif 00361 00362 #ifndef YYSIZE_T 00363 # ifdef __SIZE_TYPE__ 00364 # define YYSIZE_T __SIZE_TYPE__ 00365 # elif defined size_t 00366 # define YYSIZE_T size_t 00367 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 00368 || defined __cplusplus || defined _MSC_VER) 00369 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 00370 # define YYSIZE_T size_t 00371 # else 00372 # define YYSIZE_T unsigned int 00373 # endif 00374 #endif 00375 00376 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 00377 00378 #ifndef YY_ 00379 # if YYENABLE_NLS 00380 # if ENABLE_NLS 00381 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 00382 # define YY_(msgid) dgettext ("bison-runtime", msgid) 00383 # endif 00384 # endif 00385 # ifndef YY_ 00386 # define YY_(msgid) msgid 00387 # endif 00388 #endif 00389 00390 /* Suppress unused-variable warnings by "using" E. */ 00391 #if ! defined lint || defined __GNUC__ 00392 # define YYUSE(e) ((void) (e)) 00393 #else 00394 # define YYUSE(e) /* empty */ 00395 #endif 00396 00397 /* Identity function, used to suppress warnings about constant conditions. */ 00398 #ifndef lint 00399 # define YYID(n) (n) 00400 #else 00401 #if (defined __STDC__ || defined __C99__FUNC__ \ 00402 || defined __cplusplus || defined _MSC_VER) 00403 static int 00404 YYID (int yyi) 00405 #else 00406 static int 00407 YYID (yyi) 00408 int yyi; 00409 #endif 00410 { 00411 return yyi; 00412 } 00413 #endif 00414 00415 #if ! defined yyoverflow || YYERROR_VERBOSE 00416 00417 /* The parser invokes alloca or malloc; define the necessary symbols. */ 00418 00419 # ifdef YYSTACK_USE_ALLOCA 00420 # if YYSTACK_USE_ALLOCA 00421 # ifdef __GNUC__ 00422 # define YYSTACK_ALLOC __builtin_alloca 00423 # elif defined __BUILTIN_VA_ARG_INCR 00424 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 00425 # elif defined _AIX 00426 # define YYSTACK_ALLOC __alloca 00427 # elif defined _MSC_VER 00428 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 00429 # define alloca _alloca 00430 # else 00431 # define YYSTACK_ALLOC alloca 00432 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00433 || defined __cplusplus || defined _MSC_VER) 00434 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00435 # ifndef _STDLIB_H 00436 # define _STDLIB_H 1 00437 # endif 00438 # endif 00439 # endif 00440 # endif 00441 # endif 00442 00443 # ifdef YYSTACK_ALLOC 00444 /* Pacify GCC's `empty if-body' warning. */ 00445 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 00446 # ifndef YYSTACK_ALLOC_MAXIMUM 00447 /* The OS might guarantee only one guard page at the bottom of the stack, 00448 and a page size can be as small as 4096 bytes. So we cannot safely 00449 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 00450 to allow for a few compiler-allocated temporary stack slots. */ 00451 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 00452 # endif 00453 # else 00454 # define YYSTACK_ALLOC YYMALLOC 00455 # define YYSTACK_FREE YYFREE 00456 # ifndef YYSTACK_ALLOC_MAXIMUM 00457 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 00458 # endif 00459 # if (defined __cplusplus && ! defined _STDLIB_H \ 00460 && ! ((defined YYMALLOC || defined malloc) \ 00461 && (defined YYFREE || defined free))) 00462 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00463 # ifndef _STDLIB_H 00464 # define _STDLIB_H 1 00465 # endif 00466 # endif 00467 # ifndef YYMALLOC 00468 # define YYMALLOC malloc 00469 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00470 || defined __cplusplus || defined _MSC_VER) 00471 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 00472 # endif 00473 # endif 00474 # ifndef YYFREE 00475 # define YYFREE free 00476 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00477 || defined __cplusplus || defined _MSC_VER) 00478 void free (void *); /* INFRINGES ON USER NAME SPACE */ 00479 # endif 00480 # endif 00481 # endif 00482 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 00483 00484 00485 #if (! defined yyoverflow \ 00486 && (! defined __cplusplus \ 00487 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ 00488 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 00489 00490 /* A type that is properly aligned for any stack member. */ 00491 union yyalloc 00492 { 00493 yytype_int16 yyss_alloc; 00494 YYSTYPE yyvs_alloc; 00495 YYLTYPE yyls_alloc; 00496 }; 00497 00498 /* The size of the maximum gap between one aligned stack and the next. */ 00499 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 00500 00501 /* The size of an array large to enough to hold all stacks, each with 00502 N elements. */ 00503 # define YYSTACK_BYTES(N) \ 00504 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ 00505 + 2 * YYSTACK_GAP_MAXIMUM) 00506 00507 /* Copy COUNT objects from FROM to TO. The source and destination do 00508 not overlap. */ 00509 # ifndef YYCOPY 00510 # if defined __GNUC__ && 1 < __GNUC__ 00511 # define YYCOPY(To, From, Count) \ 00512 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 00513 # else 00514 # define YYCOPY(To, From, Count) \ 00515 do \ 00516 { \ 00517 YYSIZE_T yyi; \ 00518 for (yyi = 0; yyi < (Count); yyi++) \ 00519 (To)[yyi] = (From)[yyi]; \ 00520 } \ 00521 while (YYID (0)) 00522 # endif 00523 # endif 00524 00525 /* Relocate STACK from its old location to the new one. The 00526 local variables YYSIZE and YYSTACKSIZE give the old and new number of 00527 elements in the stack, and YYPTR gives the new location of the 00528 stack. Advance YYPTR to a properly aligned location for the next 00529 stack. */ 00530 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 00531 do \ 00532 { \ 00533 YYSIZE_T yynewbytes; \ 00534 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 00535 Stack = &yyptr->Stack_alloc; \ 00536 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 00537 yyptr += yynewbytes / sizeof (*yyptr); \ 00538 } \ 00539 while (YYID (0)) 00540 00541 #endif 00542 00543 /* YYFINAL -- State number of the termination state. */ 00544 #define YYFINAL 5 00545 /* YYLAST -- Last index in YYTABLE. */ 00546 #define YYLAST 162 00547 00548 /* YYNTOKENS -- Number of terminals. */ 00549 #define YYNTOKENS 41 00550 /* YYNNTS -- Number of nonterminals. */ 00551 #define YYNNTS 28 00552 /* YYNRULES -- Number of rules. */ 00553 #define YYNRULES 74 00554 /* YYNRULES -- Number of states. */ 00555 #define YYNSTATES 144 00556 00557 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 00558 #define YYUNDEFTOK 2 00559 #define YYMAXUTOK 274 00560 00561 #define YYTRANSLATE(YYX) \ 00562 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 00563 00564 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 00565 static const yytype_uint8 yytranslate[] = 00566 { 00567 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00570 2, 2, 2, 29, 2, 2, 2, 2, 25, 2, 00571 31, 33, 21, 19, 32, 20, 23, 22, 2, 2, 00572 2, 2, 2, 2, 2, 2, 2, 2, 2, 36, 00573 37, 28, 38, 2, 2, 2, 2, 2, 2, 2, 00574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00576 2, 39, 2, 40, 27, 2, 2, 2, 2, 2, 00577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00579 24, 2, 2, 34, 26, 35, 2, 2, 2, 2, 00580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00592 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 00593 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 00594 15, 16, 17, 18, 30 00595 }; 00596 00597 #if YYDEBUG 00598 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 00599 YYRHS. */ 00600 static const yytype_uint8 yyprhs[] = 00601 { 00602 0, 0, 3, 6, 20, 28, 29, 32, 33, 36, 00603 46, 47, 50, 60, 62, 68, 69, 72, 73, 75, 00604 79, 81, 86, 88, 90, 92, 94, 96, 100, 104, 00605 107, 111, 115, 120, 122, 126, 130, 132, 136, 137, 00606 141, 143, 147, 148, 152, 154, 157, 160, 162, 165, 00607 168, 170, 172, 173, 176, 178, 181, 183, 186, 188, 00608 192, 196, 200, 204, 208, 212, 216, 219, 224, 226, 00609 228, 231, 234, 236, 239 00610 }; 00611 00612 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 00613 static const yytype_int8 yyrhs[] = 00614 { 00615 42, 0, -1, 43, 44, -1, 13, 31, 10, 32, 00616 8, 32, 61, 32, 59, 33, 34, 51, 35, -1, 00617 11, 34, 51, 48, 46, 45, 35, -1, -1, 45, 00618 65, -1, -1, 46, 47, -1, 18, 31, 64, 32, 00619 56, 33, 34, 51, 35, -1, -1, 48, 49, -1, 00620 14, 31, 50, 32, 56, 33, 34, 51, 35, -1, 00621 3, -1, 3, 31, 66, 33, 3, -1, -1, 51, 00622 54, -1, -1, 53, -1, 53, 32, 66, -1, 66, 00623 -1, 3, 28, 55, 36, -1, 3, -1, 4, -1, 00624 63, -1, 59, -1, 57, -1, 56, 25, 56, -1, 00625 56, 26, 56, -1, 29, 56, -1, 56, 27, 56, 00626 -1, 31, 56, 33, -1, 3, 31, 52, 33, -1, 00627 3, -1, 37, 58, 38, -1, 58, 32, 59, -1, 00628 59, -1, 37, 60, 38, -1, -1, 60, 32, 63, 00629 -1, 63, -1, 39, 62, 40, -1, -1, 62, 32, 00630 68, -1, 68, -1, 67, 6, -1, 67, 5, -1, 00631 67, -1, 68, 6, -1, 68, 5, -1, 68, -1, 00632 66, -1, -1, 17, 59, -1, 7, -1, 19, 7, 00633 -1, 8, -1, 19, 8, -1, 59, -1, 66, 19, 00634 66, -1, 66, 20, 66, -1, 66, 21, 66, -1, 00635 66, 22, 66, -1, 66, 24, 66, -1, 66, 23, 00636 66, -1, 31, 66, 33, -1, 20, 66, -1, 3, 00637 31, 66, 33, -1, 3, -1, 7, -1, 20, 7, 00638 -1, 19, 7, -1, 8, -1, 20, 8, -1, 19, 00639 8, -1 00640 }; 00641 00642 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 00643 static const yytype_uint16 yyrline[] = 00644 { 00645 0, 184, 184, 189, 199, 209, 210, 214, 215, 219, 00646 225, 226, 230, 237, 245, 280, 281, 290, 291, 293, 00647 300, 308, 309, 310, 311, 312, 313, 315, 322, 329, 00648 336, 343, 344, 360, 380, 382, 383, 385, 387, 388, 00649 389, 391, 395, 396, 397, 399, 400, 401, 402, 403, 00650 404, 406, 415, 416, 425, 426, 428, 429, 431, 432, 00651 433, 434, 435, 436, 437, 438, 439, 440, 441, 443, 00652 444, 445, 447, 448, 449 00653 }; 00654 #endif 00655 00656 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 00657 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 00658 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 00659 static const char *const yytname[] = 00660 { 00661 "$end", "error", "$undefined", "TOK_IDENTIFIER", "TOK_STRING", 00662 "TOK_ENERGY", "TOK_LENGTH", "TOK_FLOAT", "TOK_INT", "TOK_VECTOR", 00663 "TOK_GRID_TYPE", "TOK_STRUCTURE", "TO_STRUCTURE", "TOK_GRID", 00664 "TOK_REGION", "TOK_SHAPE", "TOK_CONST", "TOK_POTENTIAL", "TOK_DOPING", 00665 "'+'", "'-'", "'*'", "'/'", "'.'", "'x'", "'&'", "'|'", "'^'", "'='", 00666 "'!'", "UMINUS", "'('", "','", "')'", "'{'", "'}'", "';'", "'<'", "'>'", 00667 "'['", "']'", "$accept", "start", "gridspec", "structure", 00668 "potential_list", "doping_list", "doping", "region_list", "region", 00669 "material_spec", "key_value_list", "fx_list", "fx_list_", "key_value", 00670 "value", "shape_description", "vector_set", "vector_list", "vector", 00671 "float_list", "int_vector", "int_list", "float_with_units", 00672 "doping_spec", "potential_spec", "fx", "float", "int", 0 00673 }; 00674 #endif 00675 00676 # ifdef YYPRINT 00677 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 00678 token YYLEX-NUM. */ 00679 static const yytype_uint16 yytoknum[] = 00680 { 00681 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 00682 265, 266, 267, 268, 269, 270, 271, 272, 273, 43, 00683 45, 42, 47, 46, 120, 38, 124, 94, 61, 33, 00684 274, 40, 44, 41, 123, 125, 59, 60, 62, 91, 00685 93 00686 }; 00687 # endif 00688 00689 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 00690 static const yytype_uint8 yyr1[] = 00691 { 00692 0, 41, 42, 43, 44, 45, 45, 46, 46, 47, 00693 48, 48, 49, 50, 50, 51, 51, 52, 52, 53, 00694 53, 54, 55, 55, 55, 55, 55, 56, 56, 56, 00695 56, 56, 56, 56, 57, 58, 58, 59, 60, 60, 00696 60, 61, 62, 62, 62, 63, 63, 63, 63, 63, 00697 63, 64, 65, 65, 66, 66, 66, 66, 66, 66, 00698 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 00699 67, 67, 68, 68, 68 00700 }; 00701 00702 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 00703 static const yytype_uint8 yyr2[] = 00704 { 00705 0, 2, 2, 13, 7, 0, 2, 0, 2, 9, 00706 0, 2, 9, 1, 5, 0, 2, 0, 1, 3, 00707 1, 4, 1, 1, 1, 1, 1, 3, 3, 2, 00708 3, 3, 4, 1, 3, 3, 1, 3, 0, 3, 00709 1, 3, 0, 3, 1, 2, 2, 1, 2, 2, 00710 1, 1, 0, 2, 1, 2, 1, 2, 1, 3, 00711 3, 3, 3, 3, 3, 3, 2, 4, 1, 1, 00712 2, 2, 1, 2, 2 00713 }; 00714 00715 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 00716 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 00717 means the default is an error. */ 00718 static const yytype_uint8 yydefact[] = 00719 { 00720 0, 0, 0, 0, 0, 1, 0, 2, 0, 15, 00721 0, 10, 0, 0, 7, 16, 0, 0, 0, 5, 00722 11, 42, 0, 22, 23, 69, 72, 0, 0, 38, 00723 0, 26, 25, 24, 47, 50, 0, 0, 0, 8, 00724 0, 0, 0, 44, 0, 71, 74, 70, 73, 38, 00725 0, 36, 0, 40, 21, 46, 45, 49, 48, 13, 00726 0, 0, 0, 4, 6, 0, 41, 0, 0, 34, 00727 0, 37, 0, 0, 68, 54, 56, 0, 0, 0, 00728 58, 0, 51, 53, 43, 0, 35, 39, 0, 33, 00729 0, 0, 0, 0, 55, 57, 66, 0, 0, 0, 00730 0, 0, 0, 0, 0, 15, 0, 17, 29, 0, 00731 0, 0, 0, 0, 0, 65, 0, 59, 60, 61, 00732 62, 64, 63, 0, 14, 0, 18, 20, 31, 27, 00733 28, 30, 15, 67, 0, 3, 32, 0, 0, 15, 00734 19, 12, 0, 9 00735 }; 00736 00737 /* YYDEFGOTO[NTERM-NUM]. */ 00738 static const yytype_int8 yydefgoto[] = 00739 { 00740 -1, 2, 3, 7, 38, 19, 39, 14, 20, 60, 00741 11, 125, 126, 15, 30, 92, 31, 50, 80, 52, 00742 22, 42, 53, 81, 64, 82, 34, 35 00743 }; 00744 00745 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 00746 STATE-NUM. */ 00747 #define YYPACT_NINF -92 00748 static const yytype_int16 yypact[] = 00749 { 00750 -10, 2, 40, 42, 50, -92, 66, -92, 87, -92, 00751 61, 114, 105, 92, 115, -92, 99, 5, 108, 122, 00752 -92, 44, 109, -92, -92, -92, -92, 9, 64, 37, 00753 106, -92, -92, -92, 14, 93, 140, 113, -12, -92, 00754 137, 138, -14, -92, 110, -92, -92, -92, -92, 89, 00755 35, -92, 38, -92, -92, -92, -92, -92, -92, 117, 00756 118, 31, 110, -92, -92, 44, -92, 116, 110, -92, 00757 89, -92, 31, 46, 120, -92, -92, 86, 31, 31, 00758 -92, 121, 112, -92, -92, 123, -92, -92, 62, 124, 00759 46, 46, 85, 31, -92, -92, -92, 68, 46, 31, 00760 31, 31, 31, 31, 31, -92, 149, 31, -92, 88, 00761 46, 46, 46, 125, 83, -92, 97, 104, 104, -92, 00762 -92, -92, -92, 1, -92, 127, 126, 112, -92, -92, 00763 -92, -92, -92, -92, 128, -92, -92, 31, 8, -92, 00764 112, -92, 12, -92 00765 }; 00766 00767 /* YYPGOTO[NTERM-NUM]. */ 00768 static const yytype_int8 yypgoto[] = 00769 { 00770 -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, 00771 -91, -92, -92, -92, -92, -32, -92, -92, -7, -92, 00772 -92, -92, -16, -92, -92, -72, -92, -19 00773 }; 00774 00775 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 00776 positive, shift that token. If negative, reduce the rule which 00777 number is the opposite. If zero, do what YYDEFACT says. 00778 If YYTABLE_NINF, syntax error. */ 00779 #define YYTABLE_NINF -1 00780 static const yytype_uint8 yytable[] = 00781 { 00782 88, 33, 43, 1, 13, 62, 96, 97, 23, 24, 00783 32, 13, 25, 26, 123, 13, 45, 46, 65, 55, 00784 56, 114, 51, 63, 27, 28, 66, 117, 118, 119, 00785 120, 121, 122, 4, 74, 127, 135, 67, 75, 76, 00786 5, 138, 29, 141, 25, 26, 84, 143, 142, 89, 00787 77, 78, 26, 6, 87, 83, 27, 28, 108, 109, 00788 8, 86, 79, 40, 41, 140, 116, 68, 49, 12, 00789 70, 47, 48, 69, 49, 90, 71, 91, 129, 130, 00790 131, 99, 100, 101, 102, 103, 104, 99, 100, 101, 00791 102, 103, 104, 94, 95, 106, 25, 26, 57, 58, 00792 9, 115, 99, 100, 101, 102, 103, 104, 27, 28, 00793 110, 111, 112, 110, 111, 112, 133, 13, 113, 10, 00794 17, 128, 110, 111, 112, 101, 102, 103, 104, 18, 00795 134, 99, 100, 101, 102, 103, 104, 16, 21, 36, 00796 37, 44, 54, 59, 61, 46, 48, 49, 72, 85, 00797 73, 93, 124, 98, 0, 107, 0, 105, 137, 132, 00798 136, 0, 139 00799 }; 00800 00801 static const yytype_int16 yycheck[] = 00802 { 00803 72, 17, 21, 13, 3, 17, 78, 79, 3, 4, 00804 17, 3, 7, 8, 105, 3, 7, 8, 32, 5, 00805 6, 93, 29, 35, 19, 20, 40, 99, 100, 101, 00806 102, 103, 104, 31, 3, 107, 35, 44, 7, 8, 00807 0, 132, 37, 35, 7, 8, 65, 35, 139, 3, 00808 19, 20, 8, 11, 70, 62, 19, 20, 90, 91, 00809 10, 68, 31, 19, 20, 137, 98, 32, 37, 8, 00810 32, 7, 8, 38, 37, 29, 38, 31, 110, 111, 00811 112, 19, 20, 21, 22, 23, 24, 19, 20, 21, 00812 22, 23, 24, 7, 8, 33, 7, 8, 5, 6, 00813 34, 33, 19, 20, 21, 22, 23, 24, 19, 20, 00814 25, 26, 27, 25, 26, 27, 33, 3, 33, 32, 00815 28, 33, 25, 26, 27, 21, 22, 23, 24, 14, 00816 33, 19, 20, 21, 22, 23, 24, 32, 39, 31, 00817 18, 32, 36, 3, 31, 8, 8, 37, 31, 33, 00818 32, 31, 3, 32, -1, 31, -1, 34, 32, 34, 00819 33, -1, 34 00820 }; 00821 00822 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 00823 symbol of state STATE-NUM. */ 00824 static const yytype_uint8 yystos[] = 00825 { 00826 0, 13, 42, 43, 31, 0, 11, 44, 10, 34, 00827 32, 51, 8, 3, 48, 54, 32, 28, 14, 46, 00828 49, 39, 61, 3, 4, 7, 8, 19, 20, 37, 00829 55, 57, 59, 63, 67, 68, 31, 18, 45, 47, 00830 19, 20, 62, 68, 32, 7, 8, 7, 8, 37, 00831 58, 59, 60, 63, 36, 5, 6, 5, 6, 3, 00832 50, 31, 17, 35, 65, 32, 40, 59, 32, 38, 00833 32, 38, 31, 32, 3, 7, 8, 19, 20, 31, 00834 59, 64, 66, 59, 68, 33, 59, 63, 66, 3, 00835 29, 31, 56, 31, 7, 8, 66, 66, 32, 19, 00836 20, 21, 22, 23, 24, 34, 33, 31, 56, 56, 00837 25, 26, 27, 33, 66, 33, 56, 66, 66, 66, 00838 66, 66, 66, 51, 3, 52, 53, 66, 33, 56, 00839 56, 56, 34, 33, 33, 35, 33, 32, 51, 34, 00840 66, 35, 51, 35 00841 }; 00842 00843 #define yyerrok (yyerrstatus = 0) 00844 #define yyclearin (yychar = YYEMPTY) 00845 #define YYEMPTY (-2) 00846 #define YYEOF 0 00847 00848 #define YYACCEPT goto yyacceptlab 00849 #define YYABORT goto yyabortlab 00850 #define YYERROR goto yyerrorlab 00851 00852 00853 /* Like YYERROR except do call yyerror. This remains here temporarily 00854 to ease the transition to the new meaning of YYERROR, for GCC. 00855 Once GCC version 2 has supplanted version 1, this can go. */ 00856 00857 #define YYFAIL goto yyerrlab 00858 00859 #define YYRECOVERING() (!!yyerrstatus) 00860 00861 #define YYBACKUP(Token, Value) \ 00862 do \ 00863 if (yychar == YYEMPTY && yylen == 1) \ 00864 { \ 00865 yychar = (Token); \ 00866 yylval = (Value); \ 00867 yytoken = YYTRANSLATE (yychar); \ 00868 YYPOPSTACK (1); \ 00869 goto yybackup; \ 00870 } \ 00871 else \ 00872 { \ 00873 yyerror (YY_("syntax error: cannot back up")); \ 00874 YYERROR; \ 00875 } \ 00876 while (YYID (0)) 00877 00878 00879 #define YYTERROR 1 00880 #define YYERRCODE 256 00881 00882 00883 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 00884 If N is 0, then set CURRENT to the empty location which ends 00885 the previous symbol: RHS[0] (always defined). */ 00886 00887 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 00888 #ifndef YYLLOC_DEFAULT 00889 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 00890 do \ 00891 if (YYID (N)) \ 00892 { \ 00893 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 00894 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 00895 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 00896 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 00897 } \ 00898 else \ 00899 { \ 00900 (Current).first_line = (Current).last_line = \ 00901 YYRHSLOC (Rhs, 0).last_line; \ 00902 (Current).first_column = (Current).last_column = \ 00903 YYRHSLOC (Rhs, 0).last_column; \ 00904 } \ 00905 while (YYID (0)) 00906 #endif 00907 00908 00909 /* YY_LOCATION_PRINT -- Print the location on the stream. 00910 This macro was not mandated originally: define only if we know 00911 we won't break user code: when these are the locations we know. */ 00912 00913 #ifndef YY_LOCATION_PRINT 00914 # if YYLTYPE_IS_TRIVIAL 00915 # define YY_LOCATION_PRINT(File, Loc) \ 00916 fprintf (File, "%d.%d-%d.%d", \ 00917 (Loc).first_line, (Loc).first_column, \ 00918 (Loc).last_line, (Loc).last_column) 00919 # else 00920 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 00921 # endif 00922 #endif 00923 00924 00925 /* YYLEX -- calling `yylex' with the right arguments. */ 00926 00927 #ifdef YYLEX_PARAM 00928 # define YYLEX yylex (YYLEX_PARAM) 00929 #else 00930 # define YYLEX yylex () 00931 #endif 00932 00933 /* Enable debugging if requested. */ 00934 #if YYDEBUG 00935 00936 # ifndef YYFPRINTF 00937 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 00938 # define YYFPRINTF fprintf 00939 # endif 00940 00941 # define YYDPRINTF(Args) \ 00942 do { \ 00943 if (yydebug) \ 00944 YYFPRINTF Args; \ 00945 } while (YYID (0)) 00946 00947 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 00948 do { \ 00949 if (yydebug) \ 00950 { \ 00951 YYFPRINTF (stderr, "%s ", Title); \ 00952 yy_symbol_print (stderr, \ 00953 Type, Value, Location); \ 00954 YYFPRINTF (stderr, "\n"); \ 00955 } \ 00956 } while (YYID (0)) 00957 00958 00959 /*--------------------------------. 00960 | Print this symbol on YYOUTPUT. | 00961 `--------------------------------*/ 00962 00963 /*ARGSUSED*/ 00964 #if (defined __STDC__ || defined __C99__FUNC__ \ 00965 || defined __cplusplus || defined _MSC_VER) 00966 static void 00967 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) 00968 #else 00969 static void 00970 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp) 00971 FILE *yyoutput; 00972 int yytype; 00973 YYSTYPE const * const yyvaluep; 00974 YYLTYPE const * const yylocationp; 00975 #endif 00976 { 00977 if (!yyvaluep) 00978 return; 00979 YYUSE (yylocationp); 00980 # ifdef YYPRINT 00981 if (yytype < YYNTOKENS) 00982 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 00983 # else 00984 YYUSE (yyoutput); 00985 # endif 00986 switch (yytype) 00987 { 00988 default: 00989 break; 00990 } 00991 } 00992 00993 00994 /*--------------------------------. 00995 | Print this symbol on YYOUTPUT. | 00996 `--------------------------------*/ 00997 00998 #if (defined __STDC__ || defined __C99__FUNC__ \ 00999 || defined __cplusplus || defined _MSC_VER) 01000 static void 01001 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) 01002 #else 01003 static void 01004 yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) 01005 FILE *yyoutput; 01006 int yytype; 01007 YYSTYPE const * const yyvaluep; 01008 YYLTYPE const * const yylocationp; 01009 #endif 01010 { 01011 if (yytype < YYNTOKENS) 01012 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 01013 else 01014 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 01015 01016 YY_LOCATION_PRINT (yyoutput, *yylocationp); 01017 YYFPRINTF (yyoutput, ": "); 01018 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); 01019 YYFPRINTF (yyoutput, ")"); 01020 } 01021 01022 /*------------------------------------------------------------------. 01023 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 01024 | TOP (included). | 01025 `------------------------------------------------------------------*/ 01026 01027 #if (defined __STDC__ || defined __C99__FUNC__ \ 01028 || defined __cplusplus || defined _MSC_VER) 01029 static void 01030 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 01031 #else 01032 static void 01033 yy_stack_print (yybottom, yytop) 01034 yytype_int16 *yybottom; 01035 yytype_int16 *yytop; 01036 #endif 01037 { 01038 YYFPRINTF (stderr, "Stack now"); 01039 for (; yybottom <= yytop; yybottom++) 01040 { 01041 int yybot = *yybottom; 01042 YYFPRINTF (stderr, " %d", yybot); 01043 } 01044 YYFPRINTF (stderr, "\n"); 01045 } 01046 01047 # define YY_STACK_PRINT(Bottom, Top) \ 01048 do { \ 01049 if (yydebug) \ 01050 yy_stack_print ((Bottom), (Top)); \ 01051 } while (YYID (0)) 01052 01053 01054 /*------------------------------------------------. 01055 | Report that the YYRULE is going to be reduced. | 01056 `------------------------------------------------*/ 01057 01058 #if (defined __STDC__ || defined __C99__FUNC__ \ 01059 || defined __cplusplus || defined _MSC_VER) 01060 static void 01061 yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) 01062 #else 01063 static void 01064 yy_reduce_print (yyvsp, yylsp, yyrule) 01065 YYSTYPE *yyvsp; 01066 YYLTYPE *yylsp; 01067 int yyrule; 01068 #endif 01069 { 01070 int yynrhs = yyr2[yyrule]; 01071 int yyi; 01072 unsigned long int yylno = yyrline[yyrule]; 01073 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 01074 yyrule - 1, yylno); 01075 /* The symbols being reduced. */ 01076 for (yyi = 0; yyi < yynrhs; yyi++) 01077 { 01078 YYFPRINTF (stderr, " $%d = ", yyi + 1); 01079 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 01080 &(yyvsp[(yyi + 1) - (yynrhs)]) 01081 , &(yylsp[(yyi + 1) - (yynrhs)]) ); 01082 YYFPRINTF (stderr, "\n"); 01083 } 01084 } 01085 01086 # define YY_REDUCE_PRINT(Rule) \ 01087 do { \ 01088 if (yydebug) \ 01089 yy_reduce_print (yyvsp, yylsp, Rule); \ 01090 } while (YYID (0)) 01091 01092 /* Nonzero means print parse trace. It is left uninitialized so that 01093 multiple parsers can coexist. */ 01094 int yydebug; 01095 #else /* !YYDEBUG */ 01096 # define YYDPRINTF(Args) 01097 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 01098 # define YY_STACK_PRINT(Bottom, Top) 01099 # define YY_REDUCE_PRINT(Rule) 01100 #endif /* !YYDEBUG */ 01101 01102 01103 /* YYINITDEPTH -- initial size of the parser's stacks. */ 01104 #ifndef YYINITDEPTH 01105 # define YYINITDEPTH 200 01106 #endif 01107 01108 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 01109 if the built-in stack extension method is used). 01110 01111 Do not make this value too large; the results are undefined if 01112 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 01113 evaluated with infinite-precision integer arithmetic. */ 01114 01115 #ifndef YYMAXDEPTH 01116 # define YYMAXDEPTH 10000 01117 #endif 01118 01119 01120 01121 #if YYERROR_VERBOSE 01122 01123 # ifndef yystrlen 01124 # if defined __GLIBC__ && defined _STRING_H 01125 # define yystrlen strlen 01126 # else 01127 /* Return the length of YYSTR. */ 01128 #if (defined __STDC__ || defined __C99__FUNC__ \ 01129 || defined __cplusplus || defined _MSC_VER) 01130 static YYSIZE_T 01131 yystrlen (const char *yystr) 01132 #else 01133 static YYSIZE_T 01134 yystrlen (yystr) 01135 const char *yystr; 01136 #endif 01137 { 01138 YYSIZE_T yylen; 01139 for (yylen = 0; yystr[yylen]; yylen++) 01140 continue; 01141 return yylen; 01142 } 01143 # endif 01144 # endif 01145 01146 # ifndef yystpcpy 01147 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 01148 # define yystpcpy stpcpy 01149 # else 01150 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 01151 YYDEST. */ 01152 #if (defined __STDC__ || defined __C99__FUNC__ \ 01153 || defined __cplusplus || defined _MSC_VER) 01154 static char * 01155 yystpcpy (char *yydest, const char *yysrc) 01156 #else 01157 static char * 01158 yystpcpy (yydest, yysrc) 01159 char *yydest; 01160 const char *yysrc; 01161 #endif 01162 { 01163 char *yyd = yydest; 01164 const char *yys = yysrc; 01165 01166 while ((*yyd++ = *yys++) != '\0') 01167 continue; 01168 01169 return yyd - 1; 01170 } 01171 # endif 01172 # endif 01173 01174 # ifndef yytnamerr 01175 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 01176 quotes and backslashes, so that it's suitable for yyerror. The 01177 heuristic is that double-quoting is unnecessary unless the string 01178 contains an apostrophe, a comma, or backslash (other than 01179 backslash-backslash). YYSTR is taken from yytname. If YYRES is 01180 null, do not copy; instead, return the length of what the result 01181 would have been. */ 01182 static YYSIZE_T 01183 yytnamerr (char *yyres, const char *yystr) 01184 { 01185 if (*yystr == '"') 01186 { 01187 YYSIZE_T yyn = 0; 01188 char const *yyp = yystr; 01189 01190 for (;;) 01191 switch (*++yyp) 01192 { 01193 case '\'': 01194 case ',': 01195 goto do_not_strip_quotes; 01196 01197 case '\\': 01198 if (*++yyp != '\\') 01199 goto do_not_strip_quotes; 01200 /* Fall through. */ 01201 default: 01202 if (yyres) 01203 yyres[yyn] = *yyp; 01204 yyn++; 01205 break; 01206 01207 case '"': 01208 if (yyres) 01209 yyres[yyn] = '\0'; 01210 return yyn; 01211 } 01212 do_not_strip_quotes: ; 01213 } 01214 01215 if (! yyres) 01216 return yystrlen (yystr); 01217 01218 return yystpcpy (yyres, yystr) - yyres; 01219 } 01220 # endif 01221 01222 /* Copy into YYRESULT an error message about the unexpected token 01223 YYCHAR while in state YYSTATE. Return the number of bytes copied, 01224 including the terminating null byte. If YYRESULT is null, do not 01225 copy anything; just return the number of bytes that would be 01226 copied. As a special case, return 0 if an ordinary "syntax error" 01227 message will do. Return YYSIZE_MAXIMUM if overflow occurs during 01228 size calculation. */ 01229 static YYSIZE_T 01230 yysyntax_error (char *yyresult, int yystate, int yychar) 01231 { 01232 int yyn = yypact[yystate]; 01233 01234 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 01235 return 0; 01236 else 01237 { 01238 int yytype = YYTRANSLATE (yychar); 01239 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 01240 YYSIZE_T yysize = yysize0; 01241 YYSIZE_T yysize1; 01242 int yysize_overflow = 0; 01243 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 01244 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 01245 int yyx; 01246 01247 # if 0 01248 /* This is so xgettext sees the translatable formats that are 01249 constructed on the fly. */ 01250 YY_("syntax error, unexpected %s"); 01251 YY_("syntax error, unexpected %s, expecting %s"); 01252 YY_("syntax error, unexpected %s, expecting %s or %s"); 01253 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 01254 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 01255 # endif 01256 char *yyfmt; 01257 char const *yyf; 01258 static char const yyunexpected[] = "syntax error, unexpected %s"; 01259 static char const yyexpecting[] = ", expecting %s"; 01260 static char const yyor[] = " or %s"; 01261 char yyformat[sizeof yyunexpected 01262 + sizeof yyexpecting - 1 01263 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 01264 * (sizeof yyor - 1))]; 01265 char const *yyprefix = yyexpecting; 01266 01267 /* Start YYX at -YYN if negative to avoid negative indexes in 01268 YYCHECK. */ 01269 int yyxbegin = yyn < 0 ? -yyn : 0; 01270 01271 /* Stay within bounds of both yycheck and yytname. */ 01272 int yychecklim = YYLAST - yyn + 1; 01273 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 01274 int yycount = 1; 01275 01276 yyarg[0] = yytname[yytype]; 01277 yyfmt = yystpcpy (yyformat, yyunexpected); 01278 01279 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 01280 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 01281 { 01282 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 01283 { 01284 yycount = 1; 01285 yysize = yysize0; 01286 yyformat[sizeof yyunexpected - 1] = '\0'; 01287 break; 01288 } 01289 yyarg[yycount++] = yytname[yyx]; 01290 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 01291 yysize_overflow |= (yysize1 < yysize); 01292 yysize = yysize1; 01293 yyfmt = yystpcpy (yyfmt, yyprefix); 01294 yyprefix = yyor; 01295 } 01296 01297 yyf = YY_(yyformat); 01298 yysize1 = yysize + yystrlen (yyf); 01299 yysize_overflow |= (yysize1 < yysize); 01300 yysize = yysize1; 01301 01302 if (yysize_overflow) 01303 return YYSIZE_MAXIMUM; 01304 01305 if (yyresult) 01306 { 01307 /* Avoid sprintf, as that infringes on the user's name space. 01308 Don't have undefined behavior even if the translation 01309 produced a string with the wrong number of "%s"s. */ 01310 char *yyp = yyresult; 01311 int yyi = 0; 01312 while ((*yyp = *yyf) != '\0') 01313 { 01314 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 01315 { 01316 yyp += yytnamerr (yyp, yyarg[yyi++]); 01317 yyf += 2; 01318 } 01319 else 01320 { 01321 yyp++; 01322 yyf++; 01323 } 01324 } 01325 } 01326 return yysize; 01327 } 01328 } 01329 #endif /* YYERROR_VERBOSE */ 01330 01331 01332 /*-----------------------------------------------. 01333 | Release the memory associated to this symbol. | 01334 `-----------------------------------------------*/ 01335 01336 /*ARGSUSED*/ 01337 #if (defined __STDC__ || defined __C99__FUNC__ \ 01338 || defined __cplusplus || defined _MSC_VER) 01339 static void 01340 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) 01341 #else 01342 static void 01343 yydestruct (yymsg, yytype, yyvaluep, yylocationp) 01344 const char *yymsg; 01345 int yytype; 01346 YYSTYPE *yyvaluep; 01347 YYLTYPE *yylocationp; 01348 #endif 01349 { 01350 YYUSE (yyvaluep); 01351 YYUSE (yylocationp); 01352 01353 if (!yymsg) 01354 yymsg = "Deleting"; 01355 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 01356 01357 switch (yytype) 01358 { 01359 01360 default: 01361 break; 01362 } 01363 } 01364 01365 /* Prevent warnings from -Wmissing-prototypes. */ 01366 #ifdef YYPARSE_PARAM 01367 #if defined __STDC__ || defined __cplusplus 01368 int yyparse (void *YYPARSE_PARAM); 01369 #else 01370 int yyparse (); 01371 #endif 01372 #else /* ! YYPARSE_PARAM */ 01373 #if defined __STDC__ || defined __cplusplus 01374 int yyparse (void); 01375 #else 01376 int yyparse (); 01377 #endif 01378 #endif /* ! YYPARSE_PARAM */ 01379 01380 01381 /* The lookahead symbol. */ 01382 int yychar; 01383 01384 /* The semantic value of the lookahead symbol. */ 01385 YYSTYPE yylval; 01386 01387 /* Location data for the lookahead symbol. */ 01388 YYLTYPE yylloc; 01389 01390 /* Number of syntax errors so far. */ 01391 int yynerrs; 01392 01393 01394 01395 /*-------------------------. 01396 | yyparse or yypush_parse. | 01397 `-------------------------*/ 01398 01399 #ifdef YYPARSE_PARAM 01400 #if (defined __STDC__ || defined __C99__FUNC__ \ 01401 || defined __cplusplus || defined _MSC_VER) 01402 int 01403 yyparse (void *YYPARSE_PARAM) 01404 #else 01405 int 01406 yyparse (YYPARSE_PARAM) 01407 void *YYPARSE_PARAM; 01408 #endif 01409 #else /* ! YYPARSE_PARAM */ 01410 #if (defined __STDC__ || defined __C99__FUNC__ \ 01411 || defined __cplusplus || defined _MSC_VER) 01412 int 01413 yyparse (void) 01414 #else 01415 int 01416 yyparse () 01417 01418 #endif 01419 #endif 01420 { 01421 01422 01423 int yystate; 01424 /* Number of tokens to shift before error messages enabled. */ 01425 int yyerrstatus; 01426 01427 /* The stacks and their tools: 01428 `yyss': related to states. 01429 `yyvs': related to semantic values. 01430 `yyls': related to locations. 01431 01432 Refer to the stacks thru separate pointers, to allow yyoverflow 01433 to reallocate them elsewhere. */ 01434 01435 /* The state stack. */ 01436 yytype_int16 yyssa[YYINITDEPTH]; 01437 yytype_int16 *yyss; 01438 yytype_int16 *yyssp; 01439 01440 /* The semantic value stack. */ 01441 YYSTYPE yyvsa[YYINITDEPTH]; 01442 YYSTYPE *yyvs; 01443 YYSTYPE *yyvsp; 01444 01445 /* The location stack. */ 01446 YYLTYPE yylsa[YYINITDEPTH]; 01447 YYLTYPE *yyls; 01448 YYLTYPE *yylsp; 01449 01450 /* The locations where the error started and ended. */ 01451 YYLTYPE yyerror_range[2]; 01452 01453 YYSIZE_T yystacksize; 01454 01455 int yyn; 01456 int yyresult; 01457 /* Lookahead token as an internal (translated) token number. */ 01458 int yytoken; 01459 /* The variables used to return semantic value and location from the 01460 action routines. */ 01461 YYSTYPE yyval; 01462 YYLTYPE yyloc; 01463 01464 #if YYERROR_VERBOSE 01465 /* Buffer for error messages, and its allocated size. */ 01466 char yymsgbuf[128]; 01467 char *yymsg = yymsgbuf; 01468 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 01469 #endif 01470 01471 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) 01472 01473 /* The number of symbols on the RHS of the reduced rule. 01474 Keep to zero when no symbol should be popped. */ 01475 int yylen = 0; 01476 01477 yytoken = 0; 01478 yyss = yyssa; 01479 yyvs = yyvsa; 01480 yyls = yylsa; 01481 yystacksize = YYINITDEPTH; 01482 01483 YYDPRINTF ((stderr, "Starting parse\n")); 01484 01485 yystate = 0; 01486 yyerrstatus = 0; 01487 yynerrs = 0; 01488 yychar = YYEMPTY; /* Cause a token to be read. */ 01489 01490 /* Initialize stack pointers. 01491 Waste one element of value and location stack 01492 so that they stay on the same level as the state stack. 01493 The wasted elements are never initialized. */ 01494 yyssp = yyss; 01495 yyvsp = yyvs; 01496 yylsp = yyls; 01497 01498 #if YYLTYPE_IS_TRIVIAL 01499 /* Initialize the default location before parsing starts. */ 01500 yylloc.first_line = yylloc.last_line = 1; 01501 yylloc.first_column = yylloc.last_column = 1; 01502 #endif 01503 01504 goto yysetstate; 01505 01506 /*------------------------------------------------------------. 01507 | yynewstate -- Push a new state, which is found in yystate. | 01508 `------------------------------------------------------------*/ 01509 yynewstate: 01510 /* In all cases, when you get here, the value and location stacks 01511 have just been pushed. So pushing a state here evens the stacks. */ 01512 yyssp++; 01513 01514 yysetstate: 01515 *yyssp = yystate; 01516 01517 if (yyss + yystacksize - 1 <= yyssp) 01518 { 01519 /* Get the current used size of the three stacks, in elements. */ 01520 YYSIZE_T yysize = yyssp - yyss + 1; 01521 01522 #ifdef yyoverflow 01523 { 01524 /* Give user a chance to reallocate the stack. Use copies of 01525 these so that the &'s don't force the real ones into 01526 memory. */ 01527 YYSTYPE *yyvs1 = yyvs; 01528 yytype_int16 *yyss1 = yyss; 01529 YYLTYPE *yyls1 = yyls; 01530 01531 /* Each stack pointer address is followed by the size of the 01532 data in use in that stack, in bytes. This used to be a 01533 conditional around just the two extra args, but that might 01534 be undefined if yyoverflow is a macro. */ 01535 yyoverflow (YY_("memory exhausted"), 01536 &yyss1, yysize * sizeof (*yyssp), 01537 &yyvs1, yysize * sizeof (*yyvsp), 01538 &yyls1, yysize * sizeof (*yylsp), 01539 &yystacksize); 01540 01541 yyls = yyls1; 01542 yyss = yyss1; 01543 yyvs = yyvs1; 01544 } 01545 #else /* no yyoverflow */ 01546 # ifndef YYSTACK_RELOCATE 01547 goto yyexhaustedlab; 01548 # else 01549 /* Extend the stack our own way. */ 01550 if (YYMAXDEPTH <= yystacksize) 01551 goto yyexhaustedlab; 01552 yystacksize *= 2; 01553 if (YYMAXDEPTH < yystacksize) 01554 yystacksize = YYMAXDEPTH; 01555 01556 { 01557 yytype_int16 *yyss1 = yyss; 01558 union yyalloc *yyptr = 01559 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 01560 if (! yyptr) 01561 goto yyexhaustedlab; 01562 YYSTACK_RELOCATE (yyss_alloc, yyss); 01563 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 01564 YYSTACK_RELOCATE (yyls_alloc, yyls); 01565 # undef YYSTACK_RELOCATE 01566 if (yyss1 != yyssa) 01567 YYSTACK_FREE (yyss1); 01568 } 01569 # endif 01570 #endif /* no yyoverflow */ 01571 01572 yyssp = yyss + yysize - 1; 01573 yyvsp = yyvs + yysize - 1; 01574 yylsp = yyls + yysize - 1; 01575 01576 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 01577 (unsigned long int) yystacksize)); 01578 01579 if (yyss + yystacksize - 1 <= yyssp) 01580 YYABORT; 01581 } 01582 01583 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 01584 01585 if (yystate == YYFINAL) 01586 YYACCEPT; 01587 01588 goto yybackup; 01589 01590 /*-----------. 01591 | yybackup. | 01592 `-----------*/ 01593 yybackup: 01594 01595 /* Do appropriate processing given the current state. Read a 01596 lookahead token if we need one and don't already have one. */ 01597 01598 /* First try to decide what to do without reference to lookahead token. */ 01599 yyn = yypact[yystate]; 01600 if (yyn == YYPACT_NINF) 01601 goto yydefault; 01602 01603 /* Not known => get a lookahead token if don't already have one. */ 01604 01605 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 01606 if (yychar == YYEMPTY) 01607 { 01608 YYDPRINTF ((stderr, "Reading a token: ")); 01609 yychar = YYLEX; 01610 } 01611 01612 if (yychar <= YYEOF) 01613 { 01614 yychar = yytoken = YYEOF; 01615 YYDPRINTF ((stderr, "Now at end of input.\n")); 01616 } 01617 else 01618 { 01619 yytoken = YYTRANSLATE (yychar); 01620 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 01621 } 01622 01623 /* If the proper action on seeing token YYTOKEN is to reduce or to 01624 detect an error, take that action. */ 01625 yyn += yytoken; 01626 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 01627 goto yydefault; 01628 yyn = yytable[yyn]; 01629 if (yyn <= 0) 01630 { 01631 if (yyn == 0 || yyn == YYTABLE_NINF) 01632 goto yyerrlab; 01633 yyn = -yyn; 01634 goto yyreduce; 01635 } 01636 01637 /* Count tokens shifted since error; after three, turn off error 01638 status. */ 01639 if (yyerrstatus) 01640 yyerrstatus--; 01641 01642 /* Shift the lookahead token. */ 01643 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 01644 01645 /* Discard the shifted token. */ 01646 yychar = YYEMPTY; 01647 01648 yystate = yyn; 01649 *++yyvsp = yylval; 01650 *++yylsp = yylloc; 01651 goto yynewstate; 01652 01653 01654 /*-----------------------------------------------------------. 01655 | yydefault -- do the default action for the current state. | 01656 `-----------------------------------------------------------*/ 01657 yydefault: 01658 yyn = yydefact[yystate]; 01659 if (yyn == 0) 01660 goto yyerrlab; 01661 goto yyreduce; 01662 01663 01664 /*-----------------------------. 01665 | yyreduce -- Do a reduction. | 01666 `-----------------------------*/ 01667 yyreduce: 01668 /* yyn is the number of a rule to reduce with. */ 01669 yylen = yyr2[yyn]; 01670 01671 /* If YYLEN is nonzero, implement the default value of the action: 01672 `$$ = $1'. 01673 01674 Otherwise, the following line sets YYVAL to garbage. 01675 This behavior is undocumented and Bison 01676 users should not rely upon it. Assigning to YYVAL 01677 unconditionally makes the parser a bit smaller, and it avoids a 01678 GCC warning that YYVAL may be used uninitialized. */ 01679 yyval = yyvsp[1-yylen]; 01680 01681 /* Default location. */ 01682 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); 01683 YY_REDUCE_PRINT (yyn); 01684 switch (yyn) 01685 { 01686 case 2: 01687 01688 /* Line 1455 of yacc.c */ 01689 #line 184 "structspec_parser.y++" 01690 { 01691 /*Note that grid info was stored in the structure when it was all read in*/ 01692 the_structure = (yyvsp[(2) - (2)].s); 01693 } 01694 break; 01695 01696 case 3: 01697 01698 /* Line 1455 of yacc.c */ 01699 #line 189 "structspec_parser.y++" 01700 { 01701 g = (struct grid*)malloc(sizeof(struct grid)); 01702 g->t = (yyvsp[(3) - (13)].gt); 01703 g->dimensions = (yyvsp[(5) - (13)].ival); 01704 g->box_size = (yyvsp[(7) - (13)].list); 01705 g->site_length = (yyvsp[(9) - (13)].list); 01706 g->key_values = (yyvsp[(12) - (13)].list); 01707 (yyval.g) = g; 01708 } 01709 break; 01710 01711 case 4: 01712 01713 /* Line 1455 of yacc.c */ 01714 #line 199 "structspec_parser.y++" 01715 { 01716 struct continuous_structure *s = (struct continuous_structure*)malloc(sizeof(struct continuous_structure)); 01717 s->key_values = (yyvsp[(3) - (7)].list); 01718 s->regions = (yyvsp[(4) - (7)].list); 01719 s->dopings = (yyvsp[(5) - (7)].list); 01720 s->potential = (yyvsp[(6) - (7)].list); 01721 s->g = g; 01722 (yyval.s) = s; 01723 } 01724 break; 01725 01726 case 5: 01727 01728 /* Line 1455 of yacc.c */ 01729 #line 209 "structspec_parser.y++" 01730 {(yyval.list) = NULL;} 01731 break; 01732 01733 case 6: 01734 01735 /* Line 1455 of yacc.c */ 01736 #line 210 "structspec_parser.y++" 01737 { 01738 (yyval.list) = g_list_append((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].potential)); 01739 } 01740 break; 01741 01742 case 7: 01743 01744 /* Line 1455 of yacc.c */ 01745 #line 214 "structspec_parser.y++" 01746 {(yyval.list) = NULL;} 01747 break; 01748 01749 case 8: 01750 01751 /* Line 1455 of yacc.c */ 01752 #line 215 "structspec_parser.y++" 01753 { 01754 (yyval.list) = g_list_append((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].doping)); 01755 } 01756 break; 01757 01758 case 9: 01759 01760 /* Line 1455 of yacc.c */ 01761 #line 219 "structspec_parser.y++" 01762 { 01763 ((yyvsp[(3) - (9)].doping))->key_values = (yyvsp[(8) - (9)].list); 01764 ((yyvsp[(3) - (9)].doping))->st = (yyvsp[(5) - (9)].stree); 01765 (yyval.doping) = (yyvsp[(3) - (9)].doping); 01766 } 01767 break; 01768 01769 case 10: 01770 01771 /* Line 1455 of yacc.c */ 01772 #line 225 "structspec_parser.y++" 01773 {(yyval.list) = NULL;} 01774 break; 01775 01776 case 11: 01777 01778 /* Line 1455 of yacc.c */ 01779 #line 226 "structspec_parser.y++" 01780 { 01781 (yyval.list) = g_list_append((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].region)); 01782 } 01783 break; 01784 01785 case 12: 01786 01787 /* Line 1455 of yacc.c */ 01788 #line 230 "structspec_parser.y++" 01789 { 01790 ((yyvsp[(3) - (9)].region))->key_values = (yyvsp[(8) - (9)].list); 01791 ((yyvsp[(3) - (9)].region))->st = (yyvsp[(5) - (9)].stree); 01792 (yyval.region) = (yyvsp[(3) - (9)].region); 01793 } 01794 break; 01795 01796 case 13: 01797 01798 /* Line 1455 of yacc.c */ 01799 #line 237 "structspec_parser.y++" 01800 { 01801 struct region *r = (struct region*)malloc(sizeof(struct region)); 01802 r->mat1 = (yyvsp[(1) - (1)].str); 01803 r->mat2 = NULL; 01804 r->x = 1.0; 01805 r->f = NULL; 01806 (yyval.region) = r; 01807 } 01808 break; 01809 01810 case 14: 01811 01812 /* Line 1455 of yacc.c */ 01813 #line 245 "structspec_parser.y++" 01814 { 01815 struct region *r = (struct region*)malloc(sizeof(struct region)); 01816 r->mat1 = (yyvsp[(1) - (5)].str); 01817 r->mat2 = (yyvsp[(5) - (5)].str); 01818 r->f = (yyvsp[(3) - (5)].exp); 01819 /*Check if this is just a const; if it is, do it instead of a full-on function evaluation (much faster).*/ 01820 if((yyvsp[(3) - (5)].exp)->op == kdotp::libmodelxx::postprocessing::CONST) { 01821 /*Make sure this is a scalar.*/ 01822 if(((struct function_const*)r->f)->t == 1) { 01823 r->x = ((struct function_const*)r->f)->value[0]; 01824 free(r->f); 01825 /*Flag this as not being in use.*/ 01826 r->f = NULL; 01827 if(((r->x) < 0.0) || ((r->x) > 1.0)) {fprintf(stderr, "ERROR: material specification %s(%f)%s is invalid; %f is not in range [0,1]\n", (yyvsp[(1) - (5)].str), r->x, (yyvsp[(5) - (5)].str), r->x);} 01828 } 01829 } 01830 (yyval.region) = r; 01831 } 01832 break; 01833 01834 case 15: 01835 01836 /* Line 1455 of yacc.c */ 01837 #line 280 "structspec_parser.y++" 01838 {(yyval.list) = NULL;} 01839 break; 01840 01841 case 16: 01842 01843 /* Line 1455 of yacc.c */ 01844 #line 281 "structspec_parser.y++" 01845 {(yyval.list) = g_list_append((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].kvu));} 01846 break; 01847 01848 case 17: 01849 01850 /* Line 1455 of yacc.c */ 01851 #line 290 "structspec_parser.y++" 01852 {(yyval.list) = NULL;} 01853 break; 01854 01855 case 18: 01856 01857 /* Line 1455 of yacc.c */ 01858 #line 291 "structspec_parser.y++" 01859 {(yyval.list) = (yyvsp[(1) - (1)].list);} 01860 break; 01861 01862 case 19: 01863 01864 /* Line 1455 of yacc.c */ 01865 #line 293 "structspec_parser.y++" 01866 { 01867 (yyval.list) = g_list_append((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].exp)); 01868 GString *s = g_string_new(""); 01869 function_print_tree((yyvsp[(3) - (3)].exp), &s, 1); 01870 fprintf(stderr, "***appending to fx_list: \n%s***\n", s->str); 01871 g_string_free(s, TRUE); 01872 } 01873 break; 01874 01875 case 20: 01876 01877 /* Line 1455 of yacc.c */ 01878 #line 300 "structspec_parser.y++" 01879 { 01880 (yyval.list) = g_list_append(NULL, (yyvsp[(1) - (1)].exp)); 01881 GString *s = g_string_new(""); 01882 function_print_tree((yyvsp[(1) - (1)].exp), &s, 1); 01883 fprintf(stderr, "***creating new fx_list: \n%s***\n", s->str); 01884 g_string_free(s, TRUE); 01885 } 01886 break; 01887 01888 case 21: 01889 01890 /* Line 1455 of yacc.c */ 01891 #line 308 "structspec_parser.y++" 01892 {((yyvsp[(3) - (4)].kvu))->key = ((yyvsp[(1) - (4)].str)); (yyval.kvu)=(yyvsp[(3) - (4)].kvu);} 01893 break; 01894 01895 case 22: 01896 01897 /* Line 1455 of yacc.c */ 01898 #line 309 "structspec_parser.y++" 01899 {kv=(struct key_value*)malloc(sizeof(struct key_value)); kv->key = NULL; kv->value.s = (yyvsp[(1) - (1)].str); kv->t = STRING; (yyval.kvu)=kv;} 01900 break; 01901 01902 case 23: 01903 01904 /* Line 1455 of yacc.c */ 01905 #line 310 "structspec_parser.y++" 01906 {kv=(struct key_value*)malloc(sizeof(struct key_value)); kv->key = NULL; kv->value.s = (yyvsp[(1) - (1)].str); kv->t = STRING; (yyval.kvu)=kv;} 01907 break; 01908 01909 case 24: 01910 01911 /* Line 1455 of yacc.c */ 01912 #line 311 "structspec_parser.y++" 01913 {kv=(struct key_value*)malloc(sizeof(struct key_value)); kv->key =NULL; kv->value.d = (yyvsp[(1) - (1)].fval); kv->t = FLOAT; (yyval.kvu)=kv;} 01914 break; 01915 01916 case 25: 01917 01918 /* Line 1455 of yacc.c */ 01919 #line 312 "structspec_parser.y++" 01920 {kv=(struct key_value*)malloc(sizeof(struct key_value)); kv->key = NULL; kv->value.l = (yyvsp[(1) - (1)].list); kv->t = VECTOR; (yyval.kvu)=kv;} 01921 break; 01922 01923 case 26: 01924 01925 /* Line 1455 of yacc.c */ 01926 #line 313 "structspec_parser.y++" 01927 {kv=(struct key_value*)malloc(sizeof(struct key_value)); kv->key = NULL; kv->value.l = (yyvsp[(1) - (1)].list); kv->t = VECTOR_SET; (yyval.kvu)=kv;} 01928 break; 01929 01930 case 27: 01931 01932 /* Line 1455 of yacc.c */ 01933 #line 315 "structspec_parser.y++" 01934 { 01935 struct shape_tree *st = (struct shape_tree*) malloc(sizeof(struct shape_tree)); 01936 st->l = (yyvsp[(1) - (3)].stree); 01937 st->r = (yyvsp[(3) - (3)].stree); 01938 st->op = ::kdotp::libmodelxx::grid::AND; 01939 (yyval.stree) = st; 01940 } 01941 break; 01942 01943 case 28: 01944 01945 /* Line 1455 of yacc.c */ 01946 #line 322 "structspec_parser.y++" 01947 { 01948 struct shape_tree* st = (struct shape_tree*) malloc(sizeof(struct shape_tree)); 01949 st->l = (yyvsp[(1) - (3)].stree); 01950 st->r = (yyvsp[(3) - (3)].stree); 01951 st->op = ::kdotp::libmodelxx::grid::OR; 01952 (yyval.stree) = st; 01953 } 01954 break; 01955 01956 case 29: 01957 01958 /* Line 1455 of yacc.c */ 01959 #line 329 "structspec_parser.y++" 01960 { 01961 struct shape_tree* st = (struct shape_tree*) malloc(sizeof(struct shape_tree)); 01962 st->l = (yyvsp[(2) - (2)].stree); 01963 st->r = NULL; 01964 st->op = ::kdotp::libmodelxx::grid::NOT; 01965 (yyval.stree) = st; 01966 } 01967 break; 01968 01969 case 30: 01970 01971 /* Line 1455 of yacc.c */ 01972 #line 336 "structspec_parser.y++" 01973 { 01974 struct shape_tree* st = (struct shape_tree*) malloc(sizeof(struct shape_tree)); 01975 st->l = (yyvsp[(1) - (3)].stree); 01976 st->r = (yyvsp[(3) - (3)].stree); 01977 st->op = ::kdotp::libmodelxx::grid::XOR; 01978 (yyval.stree) = st; 01979 } 01980 break; 01981 01982 case 31: 01983 01984 /* Line 1455 of yacc.c */ 01985 #line 343 "structspec_parser.y++" 01986 {(yyval.stree) = (yyvsp[(2) - (3)].stree);} 01987 break; 01988 01989 case 32: 01990 01991 /* Line 1455 of yacc.c */ 01992 #line 344 "structspec_parser.y++" 01993 { 01994 struct shape *s = (struct shape*)malloc(sizeof(struct shape)); 01995 s->type = get_shape_from_identifier((yyvsp[(1) - (4)].str)); 01996 s->op = kdotp::libmodelxx::grid::LEAF; 01997 if(s->type == ::kdotp::libmodelxx::grid::INVALID) { 01998 fprintf(stderr, "ERROR: shape identifier (%s) is invalid!\n", ((yyvsp[(1) - (4)].str))); 01999 exit(5); 02000 } 02001 char* c = NULL; 02002 get_string_from_shape_type(&c, s->type); 02003 fprintf(stderr, "A: Got shape type %s\n", c); 02004 g_free(c); 02005 s->descriptor = (yyvsp[(3) - (4)].list); 02006 s->generic = true; 02007 (yyval.stree) = (struct shape_tree*)s; 02008 } 02009 break; 02010 02011 case 33: 02012 02013 /* Line 1455 of yacc.c */ 02014 #line 360 "structspec_parser.y++" 02015 { 02016 struct shape *s = (struct shape*)malloc(sizeof(struct shape)); 02017 s->op = kdotp::libmodelxx::grid::LEAF; 02018 s->type = get_shape_from_identifier((yyvsp[(1) - (1)].str)); 02019 if(s->type == ::kdotp::libmodelxx::grid::INVALID) { 02020 fprintf(stderr, "ERROR: shape identifier (%s) is invalid!\n", ((yyvsp[(1) - (1)].str))); 02021 exit(5); 02022 } 02023 if(s->type != ::kdotp::libmodelxx::grid::GLOBAL) { 02024 fprintf(stderr, "ERROR: shape (%s) is invalid (only the global shape does not need an argument)\n", ((yyvsp[(1) - (1)].str))); 02025 exit(5); 02026 } 02027 char* c = NULL; 02028 get_string_from_shape_type(&c, s->type); 02029 fprintf(stderr, "B: Got shape type %s\n", c); 02030 g_free(c); 02031 s->descriptor = NULL; 02032 s->generic = true; 02033 (yyval.stree) = (struct shape_tree*)s; 02034 } 02035 break; 02036 02037 case 34: 02038 02039 /* Line 1455 of yacc.c */ 02040 #line 380 "structspec_parser.y++" 02041 {(yyval.list) = (yyvsp[(2) - (3)].list);} 02042 break; 02043 02044 case 35: 02045 02046 /* Line 1455 of yacc.c */ 02047 #line 382 "structspec_parser.y++" 02048 {(yyval.list) = g_list_append((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list));} 02049 break; 02050 02051 case 36: 02052 02053 /* Line 1455 of yacc.c */ 02054 #line 383 "structspec_parser.y++" 02055 {(yyval.list) = g_list_append(NULL, (yyvsp[(1) - (1)].list));} 02056 break; 02057 02058 case 37: 02059 02060 /* Line 1455 of yacc.c */ 02061 #line 385 "structspec_parser.y++" 02062 {(yyval.list) = (yyvsp[(2) - (3)].list);} 02063 break; 02064 02065 case 38: 02066 02067 /* Line 1455 of yacc.c */ 02068 #line 387 "structspec_parser.y++" 02069 {(yyval.list) = NULL;} 02070 break; 02071 02072 case 39: 02073 02074 /* Line 1455 of yacc.c */ 02075 #line 388 "structspec_parser.y++" 02076 {(yyval.list) = g_list_append((yyvsp[(1) - (3)].list), new_double((yyvsp[(3) - (3)].fval)));} 02077 break; 02078 02079 case 40: 02080 02081 /* Line 1455 of yacc.c */ 02082 #line 389 "structspec_parser.y++" 02083 {(yyval.list) = g_list_append(NULL, new_double((yyvsp[(1) - (1)].fval)));} 02084 break; 02085 02086 case 41: 02087 02088 /* Line 1455 of yacc.c */ 02089 #line 391 "structspec_parser.y++" 02090 { 02091 (yyval.list) = (yyvsp[(2) - (3)].list); 02092 } 02093 break; 02094 02095 case 42: 02096 02097 /* Line 1455 of yacc.c */ 02098 #line 395 "structspec_parser.y++" 02099 {(yyval.list) = NULL;} 02100 break; 02101 02102 case 43: 02103 02104 /* Line 1455 of yacc.c */ 02105 #line 396 "structspec_parser.y++" 02106 {(yyval.list) = g_list_append((yyvsp[(1) - (3)].list), new_int((yyvsp[(3) - (3)].ival)));} 02107 break; 02108 02109 case 44: 02110 02111 /* Line 1455 of yacc.c */ 02112 #line 397 "structspec_parser.y++" 02113 {(yyval.list) = g_list_append(NULL, new_int((yyvsp[(1) - (1)].ival)));} 02114 break; 02115 02116 case 45: 02117 02118 /* Line 1455 of yacc.c */ 02119 #line 399 "structspec_parser.y++" 02120 {(yyval.fval) = convert_length_to_nm((yyvsp[(1) - (2)].fval), (yyvsp[(2) - (2)].len));} 02121 break; 02122 02123 case 46: 02124 02125 /* Line 1455 of yacc.c */ 02126 #line 400 "structspec_parser.y++" 02127 {(yyval.fval) = convert_energy_to_hartree((yyvsp[(1) - (2)].fval), (yyvsp[(2) - (2)].energy));} 02128 break; 02129 02130 case 47: 02131 02132 /* Line 1455 of yacc.c */ 02133 #line 401 "structspec_parser.y++" 02134 {fprintf(stderr, "structspec PARSER WARNING: float %g presented without units where a float with units is expected; you should specify your units!\n", (yyvsp[(1) - (1)].fval)); (yyval.fval) = (yyvsp[(1) - (1)].fval);} 02135 break; 02136 02137 case 48: 02138 02139 /* Line 1455 of yacc.c */ 02140 #line 402 "structspec_parser.y++" 02141 {(yyval.fval) = convert_length_to_nm((double)(yyvsp[(1) - (2)].ival), (yyvsp[(2) - (2)].len));} 02142 break; 02143 02144 case 49: 02145 02146 /* Line 1455 of yacc.c */ 02147 #line 403 "structspec_parser.y++" 02148 {(yyval.fval) = convert_energy_to_hartree((double)(yyvsp[(1) - (2)].ival), (yyvsp[(2) - (2)].energy));} 02149 break; 02150 02151 case 50: 02152 02153 /* Line 1455 of yacc.c */ 02154 #line 404 "structspec_parser.y++" 02155 {fprintf(stderr, "structspec PARSER WARNING: integer %d presented without units where a float with units is expected; you should specify your units!\n", (yyvsp[(1) - (1)].ival)); (yyval.fval) = (double)(yyvsp[(1) - (1)].ival);} 02156 break; 02157 02158 case 51: 02159 02160 /* Line 1455 of yacc.c */ 02161 #line 406 "structspec_parser.y++" 02162 { 02163 struct doping* doping = (struct doping*)malloc(sizeof(struct doping)); 02164 g_assert(doping != NULL); 02165 doping->f = (yyvsp[(1) - (1)].exp); 02166 doping->st = NULL; 02167 doping->key_values = NULL; 02168 (yyval.doping) = doping; 02169 } 02170 break; 02171 02172 case 52: 02173 02174 /* Line 1455 of yacc.c */ 02175 #line 415 "structspec_parser.y++" 02176 {(yyval.potential) = NULL;} 02177 break; 02178 02179 case 53: 02180 02181 /* Line 1455 of yacc.c */ 02182 #line 416 "structspec_parser.y++" 02183 { 02184 struct potential *pot = (struct potential*)malloc(sizeof(struct potential)); 02185 g_assert(pot != NULL); 02186 pot->Evec = (yyvsp[(2) - (2)].list); 02187 pot->E = NULL; 02188 pot->function = NULL; 02189 (yyval.potential) = pot; 02190 } 02191 break; 02192 02193 case 54: 02194 02195 /* Line 1455 of yacc.c */ 02196 #line 425 "structspec_parser.y++" 02197 {(yyval.exp) = new_fx_const_single((yyvsp[(1) - (1)].fval));} 02198 break; 02199 02200 case 55: 02201 02202 /* Line 1455 of yacc.c */ 02203 #line 426 "structspec_parser.y++" 02204 {(yyval.exp) = new_fx_const_single((yyvsp[(2) - (2)].fval));} 02205 break; 02206 02207 case 56: 02208 02209 /* Line 1455 of yacc.c */ 02210 #line 428 "structspec_parser.y++" 02211 {(yyval.exp) = new_fx_const_single((yyvsp[(1) - (1)].ival));} 02212 break; 02213 02214 case 57: 02215 02216 /* Line 1455 of yacc.c */ 02217 #line 429 "structspec_parser.y++" 02218 {(yyval.exp) = new_fx_const_single((yyvsp[(2) - (2)].ival));} 02219 break; 02220 02221 case 58: 02222 02223 /* Line 1455 of yacc.c */ 02224 #line 431 "structspec_parser.y++" 02225 {(yyval.exp) = new_fx_const(g_list_length((yyvsp[(1) - (1)].list)), (yyvsp[(1) - (1)].list));} 02226 break; 02227 02228 case 59: 02229 02230 /* Line 1455 of yacc.c */ 02231 #line 432 "structspec_parser.y++" 02232 {(yyval.exp) = new_fx(kdotp::libmodelxx::postprocessing::PLUS, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));} 02233 break; 02234 02235 case 60: 02236 02237 /* Line 1455 of yacc.c */ 02238 #line 433 "structspec_parser.y++" 02239 {(yyval.exp) = new_fx(kdotp::libmodelxx::postprocessing::MINUS, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));} 02240 break; 02241 02242 case 61: 02243 02244 /* Line 1455 of yacc.c */ 02245 #line 434 "structspec_parser.y++" 02246 {(yyval.exp) = new_fx(kdotp::libmodelxx::postprocessing::MUL, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));} 02247 break; 02248 02249 case 62: 02250 02251 /* Line 1455 of yacc.c */ 02252 #line 435 "structspec_parser.y++" 02253 {(yyval.exp) = new_fx(kdotp::libmodelxx::postprocessing::DIV, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));} 02254 break; 02255 02256 case 63: 02257 02258 /* Line 1455 of yacc.c */ 02259 #line 436 "structspec_parser.y++" 02260 {(yyval.exp) = new_fx(kdotp::libmodelxx::postprocessing::CROSS, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));} 02261 break; 02262 02263 case 64: 02264 02265 /* Line 1455 of yacc.c */ 02266 #line 437 "structspec_parser.y++" 02267 {(yyval.exp) = new_fx(kdotp::libmodelxx::postprocessing::DOT, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));} 02268 break; 02269 02270 case 65: 02271 02272 /* Line 1455 of yacc.c */ 02273 #line 438 "structspec_parser.y++" 02274 {(yyval.exp) = (yyvsp[(2) - (3)].exp);} 02275 break; 02276 02277 case 66: 02278 02279 /* Line 1455 of yacc.c */ 02280 #line 439 "structspec_parser.y++" 02281 {(yyval.exp) = new_fx(kdotp::libmodelxx::postprocessing::NEG, NULL, (yyvsp[(2) - (2)].exp));} 02282 break; 02283 02284 case 67: 02285 02286 /* Line 1455 of yacc.c */ 02287 #line 440 "structspec_parser.y++" 02288 {(yyval.exp) = new_fx_func((yyvsp[(1) - (4)].str), (yyvsp[(3) - (4)].exp));} 02289 break; 02290 02291 case 68: 02292 02293 /* Line 1455 of yacc.c */ 02294 #line 441 "structspec_parser.y++" 02295 {(yyval.exp) = new_fx_symbol((yyvsp[(1) - (1)].str));} 02296 break; 02297 02298 case 69: 02299 02300 /* Line 1455 of yacc.c */ 02301 #line 443 "structspec_parser.y++" 02302 {(yyval.fval) = (yyvsp[(1) - (1)].fval);} 02303 break; 02304 02305 case 70: 02306 02307 /* Line 1455 of yacc.c */ 02308 #line 444 "structspec_parser.y++" 02309 {(yyval.fval) = -(yyvsp[(2) - (2)].fval);} 02310 break; 02311 02312 case 71: 02313 02314 /* Line 1455 of yacc.c */ 02315 #line 445 "structspec_parser.y++" 02316 {(yyval.fval) = (yyvsp[(2) - (2)].fval);} 02317 break; 02318 02319 case 72: 02320 02321 /* Line 1455 of yacc.c */ 02322 #line 447 "structspec_parser.y++" 02323 {(yyval.ival) = (yyvsp[(1) - (1)].ival);} 02324 break; 02325 02326 case 73: 02327 02328 /* Line 1455 of yacc.c */ 02329 #line 448 "structspec_parser.y++" 02330 {(yyval.ival) = -(yyvsp[(2) - (2)].ival);} 02331 break; 02332 02333 case 74: 02334 02335 /* Line 1455 of yacc.c */ 02336 #line 449 "structspec_parser.y++" 02337 {(yyval.ival) = (yyvsp[(2) - (2)].ival);} 02338 break; 02339 02340 02341 02342 /* Line 1455 of yacc.c */ 02343 #line 2344 "kdotp/structspec_parser.c++" 02344 default: break; 02345 } 02346 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 02347 02348 YYPOPSTACK (yylen); 02349 yylen = 0; 02350 YY_STACK_PRINT (yyss, yyssp); 02351 02352 *++yyvsp = yyval; 02353 *++yylsp = yyloc; 02354 02355 /* Now `shift' the result of the reduction. Determine what state 02356 that goes to, based on the state we popped back to and the rule 02357 number reduced by. */ 02358 02359 yyn = yyr1[yyn]; 02360 02361 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 02362 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 02363 yystate = yytable[yystate]; 02364 else 02365 yystate = yydefgoto[yyn - YYNTOKENS]; 02366 02367 goto yynewstate; 02368 02369 02370 /*------------------------------------. 02371 | yyerrlab -- here on detecting error | 02372 `------------------------------------*/ 02373 yyerrlab: 02374 /* If not already recovering from an error, report this error. */ 02375 if (!yyerrstatus) 02376 { 02377 ++yynerrs; 02378 #if ! YYERROR_VERBOSE 02379 yyerror (YY_("syntax error")); 02380 #else 02381 { 02382 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 02383 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 02384 { 02385 YYSIZE_T yyalloc = 2 * yysize; 02386 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 02387 yyalloc = YYSTACK_ALLOC_MAXIMUM; 02388 if (yymsg != yymsgbuf) 02389 YYSTACK_FREE (yymsg); 02390 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 02391 if (yymsg) 02392 yymsg_alloc = yyalloc; 02393 else 02394 { 02395 yymsg = yymsgbuf; 02396 yymsg_alloc = sizeof yymsgbuf; 02397 } 02398 } 02399 02400 if (0 < yysize && yysize <= yymsg_alloc) 02401 { 02402 (void) yysyntax_error (yymsg, yystate, yychar); 02403 yyerror (yymsg); 02404 } 02405 else 02406 { 02407 yyerror (YY_("syntax error")); 02408 if (yysize != 0) 02409 goto yyexhaustedlab; 02410 } 02411 } 02412 #endif 02413 } 02414 02415 yyerror_range[0] = yylloc; 02416 02417 if (yyerrstatus == 3) 02418 { 02419 /* If just tried and failed to reuse lookahead token after an 02420 error, discard it. */ 02421 02422 if (yychar <= YYEOF) 02423 { 02424 /* Return failure if at end of input. */ 02425 if (yychar == YYEOF) 02426 YYABORT; 02427 } 02428 else 02429 { 02430 yydestruct ("Error: discarding", 02431 yytoken, &yylval, &yylloc); 02432 yychar = YYEMPTY; 02433 } 02434 } 02435 02436 /* Else will try to reuse lookahead token after shifting the error 02437 token. */ 02438 goto yyerrlab1; 02439 02440 02441 /*---------------------------------------------------. 02442 | yyerrorlab -- error raised explicitly by YYERROR. | 02443 `---------------------------------------------------*/ 02444 yyerrorlab: 02445 02446 /* Pacify compilers like GCC when the user code never invokes 02447 YYERROR and the label yyerrorlab therefore never appears in user 02448 code. */ 02449 if (/*CONSTCOND*/ 0) 02450 goto yyerrorlab; 02451 02452 yyerror_range[0] = yylsp[1-yylen]; 02453 /* Do not reclaim the symbols of the rule which action triggered 02454 this YYERROR. */ 02455 YYPOPSTACK (yylen); 02456 yylen = 0; 02457 YY_STACK_PRINT (yyss, yyssp); 02458 yystate = *yyssp; 02459 goto yyerrlab1; 02460 02461 02462 /*-------------------------------------------------------------. 02463 | yyerrlab1 -- common code for both syntax error and YYERROR. | 02464 `-------------------------------------------------------------*/ 02465 yyerrlab1: 02466 yyerrstatus = 3; /* Each real token shifted decrements this. */ 02467 02468 for (;;) 02469 { 02470 yyn = yypact[yystate]; 02471 if (yyn != YYPACT_NINF) 02472 { 02473 yyn += YYTERROR; 02474 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 02475 { 02476 yyn = yytable[yyn]; 02477 if (0 < yyn) 02478 break; 02479 } 02480 } 02481 02482 /* Pop the current state because it cannot handle the error token. */ 02483 if (yyssp == yyss) 02484 YYABORT; 02485 02486 yyerror_range[0] = *yylsp; 02487 yydestruct ("Error: popping", 02488 yystos[yystate], yyvsp, yylsp); 02489 YYPOPSTACK (1); 02490 yystate = *yyssp; 02491 YY_STACK_PRINT (yyss, yyssp); 02492 } 02493 02494 *++yyvsp = yylval; 02495 02496 yyerror_range[1] = yylloc; 02497 /* Using YYLLOC is tempting, but would change the location of 02498 the lookahead. YYLOC is available though. */ 02499 YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); 02500 *++yylsp = yyloc; 02501 02502 /* Shift the error token. */ 02503 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 02504 02505 yystate = yyn; 02506 goto yynewstate; 02507 02508 02509 /*-------------------------------------. 02510 | yyacceptlab -- YYACCEPT comes here. | 02511 `-------------------------------------*/ 02512 yyacceptlab: 02513 yyresult = 0; 02514 goto yyreturn; 02515 02516 /*-----------------------------------. 02517 | yyabortlab -- YYABORT comes here. | 02518 `-----------------------------------*/ 02519 yyabortlab: 02520 yyresult = 1; 02521 goto yyreturn; 02522 02523 #if !defined(yyoverflow) || YYERROR_VERBOSE 02524 /*-------------------------------------------------. 02525 | yyexhaustedlab -- memory exhaustion comes here. | 02526 `-------------------------------------------------*/ 02527 yyexhaustedlab: 02528 yyerror (YY_("memory exhausted")); 02529 yyresult = 2; 02530 /* Fall through. */ 02531 #endif 02532 02533 yyreturn: 02534 if (yychar != YYEMPTY) 02535 yydestruct ("Cleanup: discarding lookahead", 02536 yytoken, &yylval, &yylloc); 02537 /* Do not reclaim the symbols of the rule which action triggered 02538 this YYABORT or YYACCEPT. */ 02539 YYPOPSTACK (yylen); 02540 YY_STACK_PRINT (yyss, yyssp); 02541 while (yyssp != yyss) 02542 { 02543 yydestruct ("Cleanup: popping", 02544 yystos[*yyssp], yyvsp, yylsp); 02545 YYPOPSTACK (1); 02546 } 02547 #ifndef yyoverflow 02548 if (yyss != yyssa) 02549 YYSTACK_FREE (yyss); 02550 #endif 02551 #if YYERROR_VERBOSE 02552 if (yymsg != yymsgbuf) 02553 YYSTACK_FREE (yymsg); 02554 #endif 02555 /* Make sure YYID is used. */ 02556 return YYID (yyresult); 02557 } 02558 02559 02560 02561 /* Line 1675 of yacc.c */ 02562 #line 451 "structspec_parser.y++" 02563 02564 02565 void yyerror(const char *s) { 02566 fprintf(stderr, "parser error: %s\n", s); 02567 } 02568