1 |
|
2 |
/* A Bison parser, made from BASSyacc.y |
3 |
by GNU Bison version 1.25 |
4 |
*/ |
5 |
|
6 |
#define YYBISON 1 /* Identify Bison output. */ |
7 |
|
8 |
#define MOLECULE 258 |
9 |
#define ATOM 259 |
10 |
#define BOND 260 |
11 |
#define BEND 261 |
12 |
#define TORSION 262 |
13 |
#define POSITION 263 |
14 |
#define MEMBERS 264 |
15 |
#define CONSTRAINT 265 |
16 |
#define COMPONENT 266 |
17 |
#define START_INDEX 267 |
18 |
#define DEFINED 268 |
19 |
#define ORIENTATION 269 |
20 |
#define ZCONSTRAINT 270 |
21 |
#define RIGIDBODY 271 |
22 |
#define CUTOFFGROUP 272 |
23 |
#define INTEGER 273 |
24 |
#define ARRAY_INDEX 274 |
25 |
#define DOUBLE 275 |
26 |
#define IDENTIFIER 276 |
27 |
#define QUOTED_STRING 277 |
28 |
#define LIST_STRING 278 |
29 |
|
30 |
|
31 |
#line 10 "BASSyacc.y" |
32 |
typedef union { |
33 |
int i_val; /* integer value */ |
34 |
double d_val; /* double value */ |
35 |
char * s_ptr; /* string pointer */ |
36 |
struct node_tag* node_ptr; /* pointer to the statement node tree */ |
37 |
} YYSTYPE; |
38 |
#line 45 "BASSyacc.y" |
39 |
|
40 |
#include <stdlib.h> |
41 |
#include <stdio.h> |
42 |
#include <string.h> |
43 |
|
44 |
#include "node_list.h" |
45 |
#include "make_nodes.h" |
46 |
#include "parse_tree.h" |
47 |
#include "simError.h" |
48 |
#ifdef IS_MPI |
49 |
#define __is_lex__ |
50 |
#include "mpiBASS.h" |
51 |
#endif |
52 |
|
53 |
extern int yylineno; |
54 |
|
55 |
struct filename_list{ |
56 |
char my_name[300]; |
57 |
struct filename_list* next; |
58 |
}; |
59 |
extern struct filename_list* yyfile_name; |
60 |
|
61 |
extern void change_in_file( FILE* in_file ); |
62 |
extern void yacc_model( char* file_name ); |
63 |
extern void kill_lists(void); |
64 |
|
65 |
/* top of the node list */ |
66 |
|
67 |
struct node_tag* head_node; |
68 |
struct node_tag* current_node; |
69 |
|
70 |
#include <stdio.h> |
71 |
|
72 |
#ifndef __cplusplus |
73 |
#ifndef __STDC__ |
74 |
#define const |
75 |
#endif |
76 |
#endif |
77 |
|
78 |
|
79 |
|
80 |
#define YYFINAL 87 |
81 |
#define YYFLAG -32768 |
82 |
#define YYNTBASE 28 |
83 |
|
84 |
#define YYTRANSLATE(x) ((unsigned)(x) <= 278 ? yytranslate[x] : 47) |
85 |
|
86 |
static const char yytranslate[] = { 0, |
87 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
88 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
89 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
90 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
91 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
92 |
2, 2, 2, 2, 2, 2, 2, 2, 25, 2, |
93 |
24, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
94 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
95 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
96 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
97 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
98 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
99 |
2, 2, 26, 2, 27, 2, 2, 2, 2, 2, |
100 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
101 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
102 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
103 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
104 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
105 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
106 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
107 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
108 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
109 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
110 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
111 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
112 |
2, 2, 2, 2, 2, 1, 2, 3, 4, 5, |
113 |
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
114 |
16, 17, 18, 19, 20, 21, 22, 23 |
115 |
}; |
116 |
|
117 |
#if YYDEBUG != 0 |
118 |
static const short yyprhs[] = { 0, |
119 |
0, 2, 3, 6, 8, 10, 12, 14, 16, 18, |
120 |
23, 28, 33, 38, 42, 46, 50, 54, 56, 58, |
121 |
60, 62, 64, 66, 68, 70, 72, 77, 83, 89, |
122 |
95, 101, 107, 113, 119, 124, 126 |
123 |
}; |
124 |
|
125 |
static const short yyrhs[] = { 29, |
126 |
0, 0, 29, 30, 0, 31, 0, 32, 0, 33, |
127 |
0, 34, 0, 35, 0, 36, 0, 21, 24, 18, |
128 |
25, 0, 21, 24, 20, 25, 0, 21, 24, 21, |
129 |
25, 0, 21, 24, 22, 25, 0, 9, 23, 25, |
130 |
0, 10, 23, 25, 0, 14, 23, 25, 0, 8, |
131 |
23, 25, 0, 37, 0, 38, 0, 39, 0, 40, |
132 |
0, 41, 0, 42, 0, 43, 0, 44, 0, 45, |
133 |
0, 3, 26, 46, 27, 0, 4, 19, 26, 46, |
134 |
27, 0, 5, 19, 26, 46, 27, 0, 6, 19, |
135 |
26, 46, 27, 0, 7, 19, 26, 46, 27, 0, |
136 |
15, 19, 26, 46, 27, 0, 16, 19, 26, 46, |
137 |
27, 0, 17, 19, 26, 46, 27, 0, 11, 26, |
138 |
46, 27, 0, 30, 0, 46, 30, 0 |
139 |
}; |
140 |
|
141 |
#endif |
142 |
|
143 |
#if YYDEBUG != 0 |
144 |
static const short yyrline[] = { 0, |
145 |
80, 84, 85, 92, 94, 95, 96, 97, 98, 101, |
146 |
104, 106, 108, 112, 117, 122, 127, 132, 134, 135, |
147 |
136, 137, 138, 139, 140, 141, 144, 149, 154, 159, |
148 |
164, 169, 174, 179, 184, 189, 191 |
149 |
}; |
150 |
#endif |
151 |
|
152 |
|
153 |
#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) |
154 |
|
155 |
static const char * const yytname[] = { "$","error","$undefined.","MOLECULE", |
156 |
"ATOM","BOND","BEND","TORSION","POSITION","MEMBERS","CONSTRAINT","COMPONENT", |
157 |
"START_INDEX","DEFINED","ORIENTATION","ZCONSTRAINT","RIGIDBODY","CUTOFFGROUP", |
158 |
"INTEGER","ARRAY_INDEX","DOUBLE","IDENTIFIER","QUOTED_STRING","LIST_STRING", |
159 |
"'='","';'","'{'","'}'","program","commands","stmt","assignment","members","constraint", |
160 |
"orientation","position","block","molecule_block","atom_block","bond_block", |
161 |
"bend_block","torsion_block","zconstraint_block","rigidbody_block","cutoffgroup_block", |
162 |
"component_block","stmt_list", NULL |
163 |
}; |
164 |
#endif |
165 |
|
166 |
static const short yyr1[] = { 0, |
167 |
28, 29, 29, 30, 30, 30, 30, 30, 30, 31, |
168 |
31, 31, 31, 32, 33, 34, 35, 36, 36, 36, |
169 |
36, 36, 36, 36, 36, 36, 37, 38, 39, 40, |
170 |
41, 42, 43, 44, 45, 46, 46 |
171 |
}; |
172 |
|
173 |
static const short yyr2[] = { 0, |
174 |
1, 0, 2, 1, 1, 1, 1, 1, 1, 4, |
175 |
4, 4, 4, 3, 3, 3, 3, 1, 1, 1, |
176 |
1, 1, 1, 1, 1, 1, 4, 5, 5, 5, |
177 |
5, 5, 5, 5, 4, 1, 2 |
178 |
}; |
179 |
|
180 |
static const short yydefact[] = { 2, |
181 |
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
182 |
0, 0, 0, 0, 0, 3, 4, 5, 6, 7, |
183 |
8, 9, 18, 19, 20, 21, 22, 23, 24, 25, |
184 |
26, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
185 |
0, 0, 0, 0, 0, 36, 0, 0, 0, 0, |
186 |
0, 17, 14, 15, 0, 16, 0, 0, 0, 0, |
187 |
0, 0, 0, 27, 37, 0, 0, 0, 0, 35, |
188 |
0, 0, 0, 10, 11, 12, 13, 28, 29, 30, |
189 |
31, 32, 33, 34, 0, 0, 0 |
190 |
}; |
191 |
|
192 |
static const short yydefgoto[] = { 85, |
193 |
1, 46, 17, 18, 19, 20, 21, 22, 23, 24, |
194 |
25, 26, 27, 28, 29, 30, 31, 47 |
195 |
}; |
196 |
|
197 |
static const short yypact[] = {-32768, |
198 |
257, -16, -8, -3, 4, 5, -6, 12, 13, 15, |
199 |
19, 24, 26, 28, 25,-32768,-32768,-32768,-32768,-32768, |
200 |
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
201 |
-32768, 257, 22, 27, 29, 30, 32, 33, 34, 257, |
202 |
35, 36, 37, 38, 0,-32768, -2, 257, 257, 257, |
203 |
257,-32768,-32768,-32768, 23,-32768, 257, 257, 257, 44, |
204 |
57, 58, 63,-32768,-32768, 70, 95, 120, 145,-32768, |
205 |
170, 195, 220,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
206 |
-32768,-32768,-32768,-32768, 51, 52,-32768 |
207 |
}; |
208 |
|
209 |
static const short yypgoto[] = {-32768, |
210 |
-32768, -1,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
211 |
-32768,-32768,-32768,-32768,-32768,-32768,-32768, 200 |
212 |
}; |
213 |
|
214 |
|
215 |
#define YYLAST 278 |
216 |
|
217 |
|
218 |
static const short yytable[] = { 16, |
219 |
2, 3, 4, 5, 6, 7, 8, 9, 10, 32, |
220 |
33, 11, 12, 13, 14, 34, 37, 60, 15, 61, |
221 |
62, 63, 35, 36, 64, 2, 3, 4, 5, 6, |
222 |
7, 8, 9, 10, 38, 39, 11, 12, 13, 14, |
223 |
40, 41, 42, 15, 43, 65, 44, 48, 45, 70, |
224 |
86, 87, 49, 65, 50, 51, 52, 53, 54, 56, |
225 |
0, 57, 58, 59, 65, 65, 65, 65, 74, 65, |
226 |
65, 65, 2, 3, 4, 5, 6, 7, 8, 9, |
227 |
10, 75, 76, 11, 12, 13, 14, 77, 0, 0, |
228 |
15, 0, 0, 0, 0, 0, 78, 2, 3, 4, |
229 |
5, 6, 7, 8, 9, 10, 0, 0, 11, 12, |
230 |
13, 14, 0, 0, 0, 15, 0, 0, 0, 0, |
231 |
0, 79, 2, 3, 4, 5, 6, 7, 8, 9, |
232 |
10, 0, 0, 11, 12, 13, 14, 0, 0, 0, |
233 |
15, 0, 0, 0, 0, 0, 80, 2, 3, 4, |
234 |
5, 6, 7, 8, 9, 10, 0, 0, 11, 12, |
235 |
13, 14, 0, 0, 0, 15, 0, 0, 0, 0, |
236 |
0, 81, 2, 3, 4, 5, 6, 7, 8, 9, |
237 |
10, 0, 0, 11, 12, 13, 14, 0, 0, 0, |
238 |
15, 0, 0, 0, 0, 0, 82, 2, 3, 4, |
239 |
5, 6, 7, 8, 9, 10, 0, 0, 11, 12, |
240 |
13, 14, 0, 0, 0, 15, 0, 0, 0, 0, |
241 |
0, 83, 2, 3, 4, 5, 6, 7, 8, 9, |
242 |
10, 0, 0, 11, 12, 13, 14, 0, 0, 55, |
243 |
15, 0, 0, 0, 0, 0, 84, 66, 67, 68, |
244 |
69, 0, 0, 0, 0, 0, 71, 72, 73, 2, |
245 |
3, 4, 5, 6, 7, 8, 9, 10, 0, 0, |
246 |
11, 12, 13, 14, 0, 0, 0, 15 |
247 |
}; |
248 |
|
249 |
static const short yycheck[] = { 1, |
250 |
3, 4, 5, 6, 7, 8, 9, 10, 11, 26, |
251 |
19, 14, 15, 16, 17, 19, 23, 18, 21, 20, |
252 |
21, 22, 19, 19, 27, 3, 4, 5, 6, 7, |
253 |
8, 9, 10, 11, 23, 23, 14, 15, 16, 17, |
254 |
26, 23, 19, 21, 19, 47, 19, 26, 24, 27, |
255 |
0, 0, 26, 55, 26, 26, 25, 25, 25, 25, |
256 |
-1, 26, 26, 26, 66, 67, 68, 69, 25, 71, |
257 |
72, 73, 3, 4, 5, 6, 7, 8, 9, 10, |
258 |
11, 25, 25, 14, 15, 16, 17, 25, -1, -1, |
259 |
21, -1, -1, -1, -1, -1, 27, 3, 4, 5, |
260 |
6, 7, 8, 9, 10, 11, -1, -1, 14, 15, |
261 |
16, 17, -1, -1, -1, 21, -1, -1, -1, -1, |
262 |
-1, 27, 3, 4, 5, 6, 7, 8, 9, 10, |
263 |
11, -1, -1, 14, 15, 16, 17, -1, -1, -1, |
264 |
21, -1, -1, -1, -1, -1, 27, 3, 4, 5, |
265 |
6, 7, 8, 9, 10, 11, -1, -1, 14, 15, |
266 |
16, 17, -1, -1, -1, 21, -1, -1, -1, -1, |
267 |
-1, 27, 3, 4, 5, 6, 7, 8, 9, 10, |
268 |
11, -1, -1, 14, 15, 16, 17, -1, -1, -1, |
269 |
21, -1, -1, -1, -1, -1, 27, 3, 4, 5, |
270 |
6, 7, 8, 9, 10, 11, -1, -1, 14, 15, |
271 |
16, 17, -1, -1, -1, 21, -1, -1, -1, -1, |
272 |
-1, 27, 3, 4, 5, 6, 7, 8, 9, 10, |
273 |
11, -1, -1, 14, 15, 16, 17, -1, -1, 40, |
274 |
21, -1, -1, -1, -1, -1, 27, 48, 49, 50, |
275 |
51, -1, -1, -1, -1, -1, 57, 58, 59, 3, |
276 |
4, 5, 6, 7, 8, 9, 10, 11, -1, -1, |
277 |
14, 15, 16, 17, -1, -1, -1, 21 |
278 |
}; |
279 |
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ |
280 |
#line 3 "bison.simple" |
281 |
|
282 |
/* Skeleton output parser for bison, |
283 |
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. |
284 |
|
285 |
This program is free software; you can redistribute it and/or modify |
286 |
it under the terms of the GNU General Public License as published by |
287 |
the Free Software Foundation; either version 2, or (at your option) |
288 |
any later version. |
289 |
|
290 |
This program is distributed in the hope that it will be useful, |
291 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
292 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
293 |
GNU General Public License for more details. |
294 |
|
295 |
You should have received a copy of the GNU General Public License |
296 |
along with this program; if not, write to the Free Software |
297 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
298 |
|
299 |
/* As a special exception, when this file is copied by Bison into a |
300 |
Bison output file, you may use that output file without restriction. |
301 |
This special exception was added by the Free Software Foundation |
302 |
in version 1.24 of Bison. */ |
303 |
|
304 |
#ifndef alloca |
305 |
#ifdef __GNUC__ |
306 |
#define alloca __builtin_alloca |
307 |
#else /* not GNU C. */ |
308 |
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) |
309 |
#include <alloca.h> |
310 |
#else /* not sparc */ |
311 |
#if defined (MSDOS) && !defined (__TURBOC__) |
312 |
#include <malloc.h> |
313 |
#else /* not MSDOS, or __TURBOC__ */ |
314 |
#if defined(_AIX) |
315 |
#include <malloc.h> |
316 |
#pragma alloca |
317 |
#else /* not MSDOS, __TURBOC__, or _AIX */ |
318 |
#ifdef __hpux |
319 |
#ifdef __cplusplus |
320 |
extern "C" { |
321 |
void *alloca (unsigned int); |
322 |
}; |
323 |
#else /* not __cplusplus */ |
324 |
void *alloca (); |
325 |
#endif /* not __cplusplus */ |
326 |
#endif /* __hpux */ |
327 |
#endif /* not _AIX */ |
328 |
#endif /* not MSDOS, or __TURBOC__ */ |
329 |
#endif /* not sparc. */ |
330 |
#endif /* not GNU C. */ |
331 |
#endif /* alloca not defined. */ |
332 |
|
333 |
/* This is the parser code that is written into each bison parser |
334 |
when the %semantic_parser declaration is not specified in the grammar. |
335 |
It was written by Richard Stallman by simplifying the hairy parser |
336 |
used when %semantic_parser is specified. */ |
337 |
|
338 |
/* Note: there must be only one dollar sign in this file. |
339 |
It is replaced by the list of actions, each action |
340 |
as one case of the switch. */ |
341 |
|
342 |
#define yyerrok (yyerrstatus = 0) |
343 |
#define yyclearin (yychar = YYEMPTY) |
344 |
#define YYEMPTY -2 |
345 |
#define YYEOF 0 |
346 |
#define YYACCEPT return(0) |
347 |
#define YYABORT return(1) |
348 |
#define YYERROR goto yyerrlab1 |
349 |
/* Like YYERROR except do call yyerror. |
350 |
This remains here temporarily to ease the |
351 |
transition to the new meaning of YYERROR, for GCC. |
352 |
Once GCC version 2 has supplanted version 1, this can go. */ |
353 |
#define YYFAIL goto yyerrlab |
354 |
#define YYRECOVERING() (!!yyerrstatus) |
355 |
#define YYBACKUP(token, value) \ |
356 |
do \ |
357 |
if (yychar == YYEMPTY && yylen == 1) \ |
358 |
{ yychar = (token), yylval = (value); \ |
359 |
yychar1 = YYTRANSLATE (yychar); \ |
360 |
YYPOPSTACK; \ |
361 |
goto yybackup; \ |
362 |
} \ |
363 |
else \ |
364 |
{ yyerror ("syntax error: cannot back up"); YYERROR; } \ |
365 |
while (0) |
366 |
|
367 |
#define YYTERROR 1 |
368 |
#define YYERRCODE 256 |
369 |
|
370 |
#ifndef YYPURE |
371 |
#define YYLEX yylex() |
372 |
#endif |
373 |
|
374 |
#ifdef YYPURE |
375 |
#ifdef YYLSP_NEEDED |
376 |
#ifdef YYLEX_PARAM |
377 |
#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) |
378 |
#else |
379 |
#define YYLEX yylex(&yylval, &yylloc) |
380 |
#endif |
381 |
#else /* not YYLSP_NEEDED */ |
382 |
#ifdef YYLEX_PARAM |
383 |
#define YYLEX yylex(&yylval, YYLEX_PARAM) |
384 |
#else |
385 |
#define YYLEX yylex(&yylval) |
386 |
#endif |
387 |
#endif /* not YYLSP_NEEDED */ |
388 |
#endif |
389 |
|
390 |
/* If nonreentrant, generate the variables here */ |
391 |
|
392 |
#ifndef YYPURE |
393 |
|
394 |
int yychar; /* the lookahead symbol */ |
395 |
YYSTYPE yylval; /* the semantic value of the */ |
396 |
/* lookahead symbol */ |
397 |
|
398 |
#ifdef YYLSP_NEEDED |
399 |
YYLTYPE yylloc; /* location data for the lookahead */ |
400 |
/* symbol */ |
401 |
#endif |
402 |
|
403 |
int yynerrs; /* number of parse errors so far */ |
404 |
#endif /* not YYPURE */ |
405 |
|
406 |
#if YYDEBUG != 0 |
407 |
int yydebug; /* nonzero means print parse trace */ |
408 |
/* Since this is uninitialized, it does not stop multiple parsers |
409 |
from coexisting. */ |
410 |
#endif |
411 |
|
412 |
/* YYINITDEPTH indicates the initial size of the parser's stacks */ |
413 |
|
414 |
#ifndef YYINITDEPTH |
415 |
#define YYINITDEPTH 200 |
416 |
#endif |
417 |
|
418 |
/* YYMAXDEPTH is the maximum size the stacks can grow to |
419 |
(effective only if the built-in stack extension method is used). */ |
420 |
|
421 |
#if YYMAXDEPTH == 0 |
422 |
#undef YYMAXDEPTH |
423 |
#endif |
424 |
|
425 |
#ifndef YYMAXDEPTH |
426 |
#define YYMAXDEPTH 10000 |
427 |
#endif |
428 |
|
429 |
/* Prevent warning if -Wstrict-prototypes. */ |
430 |
#ifdef __GNUC__ |
431 |
int yyparse (void); |
432 |
#endif |
433 |
|
434 |
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ |
435 |
#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) |
436 |
#else /* not GNU C or C++ */ |
437 |
#ifndef __cplusplus |
438 |
|
439 |
/* This is the most reliable way to avoid incompatibilities |
440 |
in available built-in functions on various systems. */ |
441 |
static void |
442 |
__yy_memcpy (to, from, count) |
443 |
char *to; |
444 |
char *from; |
445 |
int count; |
446 |
{ |
447 |
register char *f = from; |
448 |
register char *t = to; |
449 |
register int i = count; |
450 |
|
451 |
while (i-- > 0) |
452 |
*t++ = *f++; |
453 |
} |
454 |
|
455 |
#else /* __cplusplus */ |
456 |
|
457 |
/* This is the most reliable way to avoid incompatibilities |
458 |
in available built-in functions on various systems. */ |
459 |
static void |
460 |
__yy_memcpy (char *to, char *from, int count) |
461 |
{ |
462 |
register char *f = from; |
463 |
register char *t = to; |
464 |
register int i = count; |
465 |
|
466 |
while (i-- > 0) |
467 |
*t++ = *f++; |
468 |
} |
469 |
|
470 |
#endif |
471 |
#endif |
472 |
|
473 |
#line 196 "bison.simple" |
474 |
|
475 |
/* The user can define YYPARSE_PARAM as the name of an argument to be passed |
476 |
into yyparse. The argument should have type void *. |
477 |
It should actually point to an object. |
478 |
Grammar actions can access the variable by casting it |
479 |
to the proper pointer type. */ |
480 |
|
481 |
#ifdef YYPARSE_PARAM |
482 |
#ifdef __cplusplus |
483 |
#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM |
484 |
#define YYPARSE_PARAM_DECL |
485 |
#else /* not __cplusplus */ |
486 |
#define YYPARSE_PARAM_ARG YYPARSE_PARAM |
487 |
#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; |
488 |
#endif /* not __cplusplus */ |
489 |
#else /* not YYPARSE_PARAM */ |
490 |
#define YYPARSE_PARAM_ARG |
491 |
#define YYPARSE_PARAM_DECL |
492 |
#endif /* not YYPARSE_PARAM */ |
493 |
|
494 |
int |
495 |
yyparse(YYPARSE_PARAM_ARG) |
496 |
YYPARSE_PARAM_DECL |
497 |
{ |
498 |
register int yystate; |
499 |
register int yyn; |
500 |
register short *yyssp; |
501 |
register YYSTYPE *yyvsp; |
502 |
int yyerrstatus; /* number of tokens to shift before error messages enabled */ |
503 |
int yychar1 = 0; /* lookahead token as an internal (translated) token number */ |
504 |
|
505 |
short yyssa[YYINITDEPTH]; /* the state stack */ |
506 |
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ |
507 |
|
508 |
short *yyss = yyssa; /* refer to the stacks thru separate pointers */ |
509 |
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ |
510 |
|
511 |
#ifdef YYLSP_NEEDED |
512 |
YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ |
513 |
YYLTYPE *yyls = yylsa; |
514 |
YYLTYPE *yylsp; |
515 |
|
516 |
#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) |
517 |
#else |
518 |
#define YYPOPSTACK (yyvsp--, yyssp--) |
519 |
#endif |
520 |
|
521 |
int yystacksize = YYINITDEPTH; |
522 |
|
523 |
#ifdef YYPURE |
524 |
int yychar; |
525 |
YYSTYPE yylval; |
526 |
int yynerrs; |
527 |
#ifdef YYLSP_NEEDED |
528 |
YYLTYPE yylloc; |
529 |
#endif |
530 |
#endif |
531 |
|
532 |
YYSTYPE yyval; /* the variable used to return */ |
533 |
/* semantic values from the action */ |
534 |
/* routines */ |
535 |
|
536 |
int yylen; |
537 |
|
538 |
#if YYDEBUG != 0 |
539 |
if (yydebug) |
540 |
fprintf(stderr, "Starting parse\n"); |
541 |
#endif |
542 |
|
543 |
yystate = 0; |
544 |
yyerrstatus = 0; |
545 |
yynerrs = 0; |
546 |
yychar = YYEMPTY; /* Cause a token to be read. */ |
547 |
|
548 |
/* Initialize stack pointers. |
549 |
Waste one element of value and location stack |
550 |
so that they stay on the same level as the state stack. |
551 |
The wasted elements are never initialized. */ |
552 |
|
553 |
yyssp = yyss - 1; |
554 |
yyvsp = yyvs; |
555 |
#ifdef YYLSP_NEEDED |
556 |
yylsp = yyls; |
557 |
#endif |
558 |
|
559 |
/* Push a new state, which is found in yystate . */ |
560 |
/* In all cases, when you get here, the value and location stacks |
561 |
have just been pushed. so pushing a state here evens the stacks. */ |
562 |
yynewstate: |
563 |
|
564 |
*++yyssp = yystate; |
565 |
|
566 |
if (yyssp >= yyss + yystacksize - 1) |
567 |
{ |
568 |
/* Give user a chance to reallocate the stack */ |
569 |
/* Use copies of these so that the &'s don't force the real ones into memory. */ |
570 |
YYSTYPE *yyvs1 = yyvs; |
571 |
short *yyss1 = yyss; |
572 |
#ifdef YYLSP_NEEDED |
573 |
YYLTYPE *yyls1 = yyls; |
574 |
#endif |
575 |
|
576 |
/* Get the current used size of the three stacks, in elements. */ |
577 |
int size = yyssp - yyss + 1; |
578 |
|
579 |
#ifdef yyoverflow |
580 |
/* Each stack pointer address is followed by the size of |
581 |
the data in use in that stack, in bytes. */ |
582 |
#ifdef YYLSP_NEEDED |
583 |
/* This used to be a conditional around just the two extra args, |
584 |
but that might be undefined if yyoverflow is a macro. */ |
585 |
yyoverflow("parser stack overflow", |
586 |
&yyss1, size * sizeof (*yyssp), |
587 |
&yyvs1, size * sizeof (*yyvsp), |
588 |
&yyls1, size * sizeof (*yylsp), |
589 |
&yystacksize); |
590 |
#else |
591 |
yyoverflow("parser stack overflow", |
592 |
&yyss1, size * sizeof (*yyssp), |
593 |
&yyvs1, size * sizeof (*yyvsp), |
594 |
&yystacksize); |
595 |
#endif |
596 |
|
597 |
yyss = yyss1; yyvs = yyvs1; |
598 |
#ifdef YYLSP_NEEDED |
599 |
yyls = yyls1; |
600 |
#endif |
601 |
#else /* no yyoverflow */ |
602 |
/* Extend the stack our own way. */ |
603 |
if (yystacksize >= YYMAXDEPTH) |
604 |
{ |
605 |
yyerror("parser stack overflow"); |
606 |
return 2; |
607 |
} |
608 |
yystacksize *= 2; |
609 |
if (yystacksize > YYMAXDEPTH) |
610 |
yystacksize = YYMAXDEPTH; |
611 |
yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); |
612 |
__yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); |
613 |
yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); |
614 |
__yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); |
615 |
#ifdef YYLSP_NEEDED |
616 |
yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); |
617 |
__yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); |
618 |
#endif |
619 |
#endif /* no yyoverflow */ |
620 |
|
621 |
yyssp = yyss + size - 1; |
622 |
yyvsp = yyvs + size - 1; |
623 |
#ifdef YYLSP_NEEDED |
624 |
yylsp = yyls + size - 1; |
625 |
#endif |
626 |
|
627 |
#if YYDEBUG != 0 |
628 |
if (yydebug) |
629 |
fprintf(stderr, "Stack size increased to %d\n", yystacksize); |
630 |
#endif |
631 |
|
632 |
if (yyssp >= yyss + yystacksize - 1) |
633 |
YYABORT; |
634 |
} |
635 |
|
636 |
#if YYDEBUG != 0 |
637 |
if (yydebug) |
638 |
fprintf(stderr, "Entering state %d\n", yystate); |
639 |
#endif |
640 |
|
641 |
goto yybackup; |
642 |
yybackup: |
643 |
|
644 |
/* Do appropriate processing given the current state. */ |
645 |
/* Read a lookahead token if we need one and don't already have one. */ |
646 |
/* yyresume: */ |
647 |
|
648 |
/* First try to decide what to do without reference to lookahead token. */ |
649 |
|
650 |
yyn = yypact[yystate]; |
651 |
if (yyn == YYFLAG) |
652 |
goto yydefault; |
653 |
|
654 |
/* Not known => get a lookahead token if don't already have one. */ |
655 |
|
656 |
/* yychar is either YYEMPTY or YYEOF |
657 |
or a valid token in external form. */ |
658 |
|
659 |
if (yychar == YYEMPTY) |
660 |
{ |
661 |
#if YYDEBUG != 0 |
662 |
if (yydebug) |
663 |
fprintf(stderr, "Reading a token: "); |
664 |
#endif |
665 |
yychar = YYLEX; |
666 |
} |
667 |
|
668 |
/* Convert token to internal form (in yychar1) for indexing tables with */ |
669 |
|
670 |
if (yychar <= 0) /* This means end of input. */ |
671 |
{ |
672 |
yychar1 = 0; |
673 |
yychar = YYEOF; /* Don't call YYLEX any more */ |
674 |
|
675 |
#if YYDEBUG != 0 |
676 |
if (yydebug) |
677 |
fprintf(stderr, "Now at end of input.\n"); |
678 |
#endif |
679 |
} |
680 |
else |
681 |
{ |
682 |
yychar1 = YYTRANSLATE(yychar); |
683 |
|
684 |
#if YYDEBUG != 0 |
685 |
if (yydebug) |
686 |
{ |
687 |
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); |
688 |
/* Give the individual parser a way to print the precise meaning |
689 |
of a token, for further debugging info. */ |
690 |
#ifdef YYPRINT |
691 |
YYPRINT (stderr, yychar, yylval); |
692 |
#endif |
693 |
fprintf (stderr, ")\n"); |
694 |
} |
695 |
#endif |
696 |
} |
697 |
|
698 |
yyn += yychar1; |
699 |
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) |
700 |
goto yydefault; |
701 |
|
702 |
yyn = yytable[yyn]; |
703 |
|
704 |
/* yyn is what to do for this token type in this state. |
705 |
Negative => reduce, -yyn is rule number. |
706 |
Positive => shift, yyn is new state. |
707 |
New state is final state => don't bother to shift, |
708 |
just return success. |
709 |
0, or most negative number => error. */ |
710 |
|
711 |
if (yyn < 0) |
712 |
{ |
713 |
if (yyn == YYFLAG) |
714 |
goto yyerrlab; |
715 |
yyn = -yyn; |
716 |
goto yyreduce; |
717 |
} |
718 |
else if (yyn == 0) |
719 |
goto yyerrlab; |
720 |
|
721 |
if (yyn == YYFINAL) |
722 |
YYACCEPT; |
723 |
|
724 |
/* Shift the lookahead token. */ |
725 |
|
726 |
#if YYDEBUG != 0 |
727 |
if (yydebug) |
728 |
fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); |
729 |
#endif |
730 |
|
731 |
/* Discard the token being shifted unless it is eof. */ |
732 |
if (yychar != YYEOF) |
733 |
yychar = YYEMPTY; |
734 |
|
735 |
*++yyvsp = yylval; |
736 |
#ifdef YYLSP_NEEDED |
737 |
*++yylsp = yylloc; |
738 |
#endif |
739 |
|
740 |
/* count tokens shifted since error; after three, turn off error status. */ |
741 |
if (yyerrstatus) yyerrstatus--; |
742 |
|
743 |
yystate = yyn; |
744 |
goto yynewstate; |
745 |
|
746 |
/* Do the default action for the current state. */ |
747 |
yydefault: |
748 |
|
749 |
yyn = yydefact[yystate]; |
750 |
if (yyn == 0) |
751 |
goto yyerrlab; |
752 |
|
753 |
/* Do a reduction. yyn is the number of a rule to reduce with. */ |
754 |
yyreduce: |
755 |
yylen = yyr2[yyn]; |
756 |
if (yylen > 0) |
757 |
yyval = yyvsp[1-yylen]; /* implement default value of the action */ |
758 |
|
759 |
#if YYDEBUG != 0 |
760 |
if (yydebug) |
761 |
{ |
762 |
int i; |
763 |
|
764 |
fprintf (stderr, "Reducing via rule %d (line %d), ", |
765 |
yyn, yyrline[yyn]); |
766 |
|
767 |
/* Print the symbols being reduced, and their result. */ |
768 |
for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) |
769 |
fprintf (stderr, "%s ", yytname[yyrhs[i]]); |
770 |
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); |
771 |
} |
772 |
#endif |
773 |
|
774 |
|
775 |
switch (yyn) { |
776 |
|
777 |
case 3: |
778 |
#line 85 "BASSyacc.y" |
779 |
{ |
780 |
current_node->next_stmt = yyvsp[0].node_ptr; |
781 |
yyvsp[0].node_ptr->prev_stmt = current_node; |
782 |
current_node = yyvsp[0].node_ptr; |
783 |
; |
784 |
break;} |
785 |
case 4: |
786 |
#line 93 "BASSyacc.y" |
787 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
788 |
break;} |
789 |
case 5: |
790 |
#line 94 "BASSyacc.y" |
791 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
792 |
break;} |
793 |
case 6: |
794 |
#line 95 "BASSyacc.y" |
795 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
796 |
break;} |
797 |
case 7: |
798 |
#line 96 "BASSyacc.y" |
799 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
800 |
break;} |
801 |
case 8: |
802 |
#line 97 "BASSyacc.y" |
803 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
804 |
break;} |
805 |
case 9: |
806 |
#line 98 "BASSyacc.y" |
807 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
808 |
break;} |
809 |
case 10: |
810 |
#line 103 "BASSyacc.y" |
811 |
{ yyval.node_ptr = assign_i( yyvsp[-3].s_ptr, yyvsp[-1].i_val ); ; |
812 |
break;} |
813 |
case 11: |
814 |
#line 105 "BASSyacc.y" |
815 |
{ yyval.node_ptr = assign_d( yyvsp[-3].s_ptr, yyvsp[-1].d_val ); ; |
816 |
break;} |
817 |
case 12: |
818 |
#line 107 "BASSyacc.y" |
819 |
{ yyval.node_ptr = assign_s( yyvsp[-3].s_ptr, yyvsp[-1].s_ptr ); ; |
820 |
break;} |
821 |
case 13: |
822 |
#line 109 "BASSyacc.y" |
823 |
{ yyval.node_ptr = assign_s( yyvsp[-3].s_ptr, yyvsp[-1].s_ptr ); ; |
824 |
break;} |
825 |
case 14: |
826 |
#line 114 "BASSyacc.y" |
827 |
{ yyval.node_ptr = members( yyvsp[-1].s_ptr ); ; |
828 |
break;} |
829 |
case 15: |
830 |
#line 119 "BASSyacc.y" |
831 |
{ yyval.node_ptr = constraint( yyvsp[-1].s_ptr ); ; |
832 |
break;} |
833 |
case 16: |
834 |
#line 124 "BASSyacc.y" |
835 |
{ yyval.node_ptr = orientation( yyvsp[-1].s_ptr ); ; |
836 |
break;} |
837 |
case 17: |
838 |
#line 129 "BASSyacc.y" |
839 |
{ yyval.node_ptr = position( yyvsp[-1].s_ptr ); ; |
840 |
break;} |
841 |
case 18: |
842 |
#line 133 "BASSyacc.y" |
843 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
844 |
break;} |
845 |
case 19: |
846 |
#line 134 "BASSyacc.y" |
847 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
848 |
break;} |
849 |
case 20: |
850 |
#line 135 "BASSyacc.y" |
851 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
852 |
break;} |
853 |
case 21: |
854 |
#line 136 "BASSyacc.y" |
855 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
856 |
break;} |
857 |
case 22: |
858 |
#line 137 "BASSyacc.y" |
859 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
860 |
break;} |
861 |
case 23: |
862 |
#line 138 "BASSyacc.y" |
863 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
864 |
break;} |
865 |
case 24: |
866 |
#line 139 "BASSyacc.y" |
867 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
868 |
break;} |
869 |
case 25: |
870 |
#line 140 "BASSyacc.y" |
871 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
872 |
break;} |
873 |
case 26: |
874 |
#line 141 "BASSyacc.y" |
875 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
876 |
break;} |
877 |
case 27: |
878 |
#line 146 "BASSyacc.y" |
879 |
{ yyval.node_ptr = molecule_blk( yyvsp[-1].node_ptr ); ; |
880 |
break;} |
881 |
case 28: |
882 |
#line 151 "BASSyacc.y" |
883 |
{ yyval.node_ptr = atom_blk( yyvsp[-3].i_val, yyvsp[-1].node_ptr ); ; |
884 |
break;} |
885 |
case 29: |
886 |
#line 156 "BASSyacc.y" |
887 |
{ yyval.node_ptr = bond_blk( yyvsp[-3].i_val, yyvsp[-1].node_ptr ); ; |
888 |
break;} |
889 |
case 30: |
890 |
#line 161 "BASSyacc.y" |
891 |
{ yyval.node_ptr = bend_blk( yyvsp[-3].i_val, yyvsp[-1].node_ptr ); ; |
892 |
break;} |
893 |
case 31: |
894 |
#line 166 "BASSyacc.y" |
895 |
{ yyval.node_ptr = torsion_blk( yyvsp[-3].i_val, yyvsp[-1].node_ptr ); ; |
896 |
break;} |
897 |
case 32: |
898 |
#line 171 "BASSyacc.y" |
899 |
{ yyval.node_ptr = zconstraint_blk( yyvsp[-3].i_val, yyvsp[-1].node_ptr ); ; |
900 |
break;} |
901 |
case 33: |
902 |
#line 176 "BASSyacc.y" |
903 |
{ yyval.node_ptr = rigidbody_blk( yyvsp[-3].i_val, yyvsp[-1].node_ptr ); ; |
904 |
break;} |
905 |
case 34: |
906 |
#line 181 "BASSyacc.y" |
907 |
{ yyval.node_ptr = cutoffgroup_blk( yyvsp[-3].i_val, yyvsp[-1].node_ptr ); ; |
908 |
break;} |
909 |
case 35: |
910 |
#line 186 "BASSyacc.y" |
911 |
{ yyval.node_ptr = component_blk( yyvsp[-1].node_ptr ); ; |
912 |
break;} |
913 |
case 36: |
914 |
#line 190 "BASSyacc.y" |
915 |
{ yyval.node_ptr = yyvsp[0].node_ptr; ; |
916 |
break;} |
917 |
case 37: |
918 |
#line 191 "BASSyacc.y" |
919 |
{ |
920 |
yyvsp[-1].node_ptr->next_stmt = yyvsp[0].node_ptr; |
921 |
yyvsp[0].node_ptr->prev_stmt = yyvsp[-1].node_ptr; |
922 |
yyval.node_ptr = yyvsp[0].node_ptr; |
923 |
; |
924 |
break;} |
925 |
} |
926 |
/* the action file gets copied in in place of this dollarsign */ |
927 |
#line 498 "bison.simple" |
928 |
|
929 |
yyvsp -= yylen; |
930 |
yyssp -= yylen; |
931 |
#ifdef YYLSP_NEEDED |
932 |
yylsp -= yylen; |
933 |
#endif |
934 |
|
935 |
#if YYDEBUG != 0 |
936 |
if (yydebug) |
937 |
{ |
938 |
short *ssp1 = yyss - 1; |
939 |
fprintf (stderr, "state stack now"); |
940 |
while (ssp1 != yyssp) |
941 |
fprintf (stderr, " %d", *++ssp1); |
942 |
fprintf (stderr, "\n"); |
943 |
} |
944 |
#endif |
945 |
|
946 |
*++yyvsp = yyval; |
947 |
|
948 |
#ifdef YYLSP_NEEDED |
949 |
yylsp++; |
950 |
if (yylen == 0) |
951 |
{ |
952 |
yylsp->first_line = yylloc.first_line; |
953 |
yylsp->first_column = yylloc.first_column; |
954 |
yylsp->last_line = (yylsp-1)->last_line; |
955 |
yylsp->last_column = (yylsp-1)->last_column; |
956 |
yylsp->text = 0; |
957 |
} |
958 |
else |
959 |
{ |
960 |
yylsp->last_line = (yylsp+yylen-1)->last_line; |
961 |
yylsp->last_column = (yylsp+yylen-1)->last_column; |
962 |
} |
963 |
#endif |
964 |
|
965 |
/* Now "shift" the result of the reduction. |
966 |
Determine what state that goes to, |
967 |
based on the state we popped back to |
968 |
and the rule number reduced by. */ |
969 |
|
970 |
yyn = yyr1[yyn]; |
971 |
|
972 |
yystate = yypgoto[yyn - YYNTBASE] + *yyssp; |
973 |
if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
974 |
yystate = yytable[yystate]; |
975 |
else |
976 |
yystate = yydefgoto[yyn - YYNTBASE]; |
977 |
|
978 |
goto yynewstate; |
979 |
|
980 |
yyerrlab: /* here on detecting error */ |
981 |
|
982 |
if (! yyerrstatus) |
983 |
/* If not already recovering from an error, report this error. */ |
984 |
{ |
985 |
++yynerrs; |
986 |
|
987 |
#ifdef YYERROR_VERBOSE |
988 |
yyn = yypact[yystate]; |
989 |
|
990 |
if (yyn > YYFLAG && yyn < YYLAST) |
991 |
{ |
992 |
int size = 0; |
993 |
char *msg; |
994 |
int x, count; |
995 |
|
996 |
count = 0; |
997 |
/* Start X at -yyn if nec to avoid negative indexes in yycheck. */ |
998 |
for (x = (yyn < 0 ? -yyn : 0); |
999 |
x < (sizeof(yytname) / sizeof(char *)); x++) |
1000 |
if (yycheck[x + yyn] == x) |
1001 |
size += strlen(yytname[x]) + 15, count++; |
1002 |
msg = (char *) malloc(size + 15); |
1003 |
if (msg != 0) |
1004 |
{ |
1005 |
strcpy(msg, "parse error"); |
1006 |
|
1007 |
if (count < 5) |
1008 |
{ |
1009 |
count = 0; |
1010 |
for (x = (yyn < 0 ? -yyn : 0); |
1011 |
x < (sizeof(yytname) / sizeof(char *)); x++) |
1012 |
if (yycheck[x + yyn] == x) |
1013 |
{ |
1014 |
strcat(msg, count == 0 ? ", expecting `" : " or `"); |
1015 |
strcat(msg, yytname[x]); |
1016 |
strcat(msg, "'"); |
1017 |
count++; |
1018 |
} |
1019 |
} |
1020 |
yyerror(msg); |
1021 |
free(msg); |
1022 |
} |
1023 |
else |
1024 |
yyerror ("parse error; also virtual memory exceeded"); |
1025 |
} |
1026 |
else |
1027 |
#endif /* YYERROR_VERBOSE */ |
1028 |
yyerror("parse error"); |
1029 |
} |
1030 |
|
1031 |
goto yyerrlab1; |
1032 |
yyerrlab1: /* here on error raised explicitly by an action */ |
1033 |
|
1034 |
if (yyerrstatus == 3) |
1035 |
{ |
1036 |
/* if just tried and failed to reuse lookahead token after an error, discard it. */ |
1037 |
|
1038 |
/* return failure if at end of input */ |
1039 |
if (yychar == YYEOF) |
1040 |
YYABORT; |
1041 |
|
1042 |
#if YYDEBUG != 0 |
1043 |
if (yydebug) |
1044 |
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); |
1045 |
#endif |
1046 |
|
1047 |
yychar = YYEMPTY; |
1048 |
} |
1049 |
|
1050 |
/* Else will try to reuse lookahead token |
1051 |
after shifting the error token. */ |
1052 |
|
1053 |
yyerrstatus = 3; /* Each real token shifted decrements this */ |
1054 |
|
1055 |
goto yyerrhandle; |
1056 |
|
1057 |
yyerrdefault: /* current state does not do anything special for the error token. */ |
1058 |
|
1059 |
#if 0 |
1060 |
/* This is wrong; only states that explicitly want error tokens |
1061 |
should shift them. */ |
1062 |
yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ |
1063 |
if (yyn) goto yydefault; |
1064 |
#endif |
1065 |
|
1066 |
yyerrpop: /* pop the current state because it cannot handle the error token */ |
1067 |
|
1068 |
if (yyssp == yyss) YYABORT; |
1069 |
yyvsp--; |
1070 |
yystate = *--yyssp; |
1071 |
#ifdef YYLSP_NEEDED |
1072 |
yylsp--; |
1073 |
#endif |
1074 |
|
1075 |
#if YYDEBUG != 0 |
1076 |
if (yydebug) |
1077 |
{ |
1078 |
short *ssp1 = yyss - 1; |
1079 |
fprintf (stderr, "Error: state stack now"); |
1080 |
while (ssp1 != yyssp) |
1081 |
fprintf (stderr, " %d", *++ssp1); |
1082 |
fprintf (stderr, "\n"); |
1083 |
} |
1084 |
#endif |
1085 |
|
1086 |
yyerrhandle: |
1087 |
|
1088 |
yyn = yypact[yystate]; |
1089 |
if (yyn == YYFLAG) |
1090 |
goto yyerrdefault; |
1091 |
|
1092 |
yyn += YYTERROR; |
1093 |
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) |
1094 |
goto yyerrdefault; |
1095 |
|
1096 |
yyn = yytable[yyn]; |
1097 |
if (yyn < 0) |
1098 |
{ |
1099 |
if (yyn == YYFLAG) |
1100 |
goto yyerrpop; |
1101 |
yyn = -yyn; |
1102 |
goto yyreduce; |
1103 |
} |
1104 |
else if (yyn == 0) |
1105 |
goto yyerrpop; |
1106 |
|
1107 |
if (yyn == YYFINAL) |
1108 |
YYACCEPT; |
1109 |
|
1110 |
#if YYDEBUG != 0 |
1111 |
if (yydebug) |
1112 |
fprintf(stderr, "Shifting error token, "); |
1113 |
#endif |
1114 |
|
1115 |
*++yyvsp = yylval; |
1116 |
#ifdef YYLSP_NEEDED |
1117 |
*++yylsp = yylloc; |
1118 |
#endif |
1119 |
|
1120 |
yystate = yyn; |
1121 |
goto yynewstate; |
1122 |
} |
1123 |
#line 198 "BASSyacc.y" |
1124 |
|
1125 |
|
1126 |
extern int yyerror( char *err_msg ){ |
1127 |
|
1128 |
sprintf( painCave.errMsg, "OOPSE parse error in %s at line %d: %s\n", |
1129 |
yyfile_name->my_name, yylineno + 1, err_msg ); |
1130 |
painCave.isFatal = 1; |
1131 |
simError(); |
1132 |
return 0; |
1133 |
} |
1134 |
|
1135 |
void yacc_BASS( char* file_name ){ |
1136 |
|
1137 |
FILE* in_file; |
1138 |
|
1139 |
head_node = (struct node_tag* )malloc( sizeof( node ) ); |
1140 |
|
1141 |
head_node->type = GLOBAL_HEAD; |
1142 |
head_node->index =0; |
1143 |
head_node->next_stmt = NULL; |
1144 |
head_node->prev_stmt = NULL; |
1145 |
head_node->stmt_list = NULL; |
1146 |
|
1147 |
current_node = head_node; |
1148 |
|
1149 |
in_file = fopen( file_name, "r" ); |
1150 |
if( in_file == NULL ){ |
1151 |
sprintf( painCave.errMsg, "yacc error: couldn't open file =>%s\n", |
1152 |
file_name ); |
1153 |
painCave.isFatal = 1; |
1154 |
simError(); |
1155 |
} |
1156 |
|
1157 |
yyfile_name = |
1158 |
(struct filename_list*)malloc( sizeof( struct filename_list ) ); |
1159 |
yyfile_name->next = NULL; |
1160 |
strcpy( yyfile_name->my_name, file_name ); |
1161 |
change_in_file( in_file ); |
1162 |
|
1163 |
yyparse(); |
1164 |
|
1165 |
#ifdef IS_MPI |
1166 |
strcpy( checkPointMsg, "yyParse successful." ); |
1167 |
MPIcheckPoint(); |
1168 |
painCave.isEventLoop = 1; |
1169 |
#endif // is_mpi |
1170 |
|
1171 |
fclose( in_file ); |
1172 |
kill_lists(); |
1173 |
|
1174 |
pt_me( head_node ); |
1175 |
|
1176 |
#ifdef IS_MPI |
1177 |
painCave.isEventLoop = 0; |
1178 |
#endif // is_mpi |
1179 |
|
1180 |
kill_tree( head_node ); |
1181 |
head_node = NULL; |
1182 |
} |