MISR Toolkit  1.5.1
parser.c
Go to the documentation of this file.
1 # line 2 "odl2.y"
2 
3 /*****************************************************************************
4 
5  Description: This file contains the parser for the Object Description
6  Langauge (ODL). The parser is produced using Yacc and
7  all changes to the parsing scheme should be made by
8  modifying the Yacc input file rather than the
9  C-language code produced from by Yacc.
10 
11  Author: Randy Davis, University of Colorado LASP
12 
13  Creation Date: 17 April 1990
14  Last Modified: 18 May 1991
15 
16  History:
17 
18  Creation - This module was introduced in the Version 1 ODLC library.
19 
20  Version 2.0 - 30 August 1990 - R. Davis, U. of Colorado LASP
21  a) Modified to comply with ODL Version 2. This includes adding
22  support for GROUP statements.
23 
24  Version 2.0.1 - 26 November 1990 - R. Davis, U. of Colorado LASP
25  a) Changed parsing scheme to provide better error reporting and
26  recovery.
27 
28  Version 2.1 - 13 March 1991
29  a) Modified calls to parser action routines to pass pointers to
30  value structures rather than copying in the entire structure.
31 
32  Version 2.2 - 18 May 1991 - M. DeMore, Jet Propulsion Laboratory
33  Added include file odlinter.h.
34 
35 *****************************************************************************/
36 
37 #include <stdlib.h>
38 #include "odldef.h"
39 #include "odlinter.h"
40 
41 #ifdef PDS_TOOLBOX
42  extern int pds_watch_ends;
43 #else
45 #endif
46 
47 
48 # line 51 "odl2.y"
49 typedef union {
50  struct Value_Data item;
51  int flag;
52  } YYSTYPE;
53 # define _OBJECT 257
54 # define _END_OBJECT 258
55 # define _GROUP 259
56 # define _END_GROUP 260
57 # define _END 261
58 # define _sequence_opening 262
59 # define _sequence_closing 263
60 # define _set_opening 264
61 # define _set_closing 265
62 # define _units_opening 266
63 # define _units_closing 267
64 # define _list_separator 268
65 # define _point_operator 269
66 # define _assignment_operator 270
67 # define _multiply_operator 271
68 # define _divide_operator 272
69 # define _exponentiate_operator 273
70 # define _range_operator 274
71 # define _date 275
72 # define _date_time 276
73 # define _date_timeV0 277
74 # define _integer 278
75 # define _name 279
76 # define _real 280
77 # define _symbol 281
78 # define _text_string 282
79 # define _time 283
80 #define yyclearin yychar = -1
81 #define yyerrok yyerrflag = 0
82 extern int yychar;
83 extern int yyerrflag;
84 #ifndef YYMAXDEPTH
85 #define YYMAXDEPTH 150
86 #endif
88 # define YYERRCODE 256
89 
90 # line 310 "odl2.y"
91 
92 
93 
94 /* Error handling routine. This routine is called, explicitly or
95  implicitly, whenever a syntax error is detected. */
96 
97 int yyerror (
98  char *error_msg) /* Error message text */
99 
100 {
101  ODLPrintError (error_msg);
102 
103  return (0);
104 }
105 int yyexca[] ={
106 -1, 1,
107  0, -1,
108  -2, 0,
109 -1, 2,
110  0, 1,
111  -2, 0,
112 -1, 25,
113  262, 25,
114  264, 25,
115  275, 25,
116  276, 25,
117  277, 25,
118  278, 25,
119  279, 25,
120  280, 25,
121  281, 25,
122  282, 25,
123  283, 25,
124  -2, 0,
125  };
126 # define YYNPROD 83
127 # define YYLAST 187
128 int yyact[]={
129 
130  67, 87, 38, 37, 36, 35, 77, 73, 27, 67,
131  52, 63, 105, 34, 33, 97, 73, 31, 30, 54,
132  56, 57, 52, 58, 53, 59, 60, 55, 54, 56,
133  57, 52, 58, 53, 59, 60, 55, 61, 96, 51,
134  67, 29, 28, 98, 85, 72, 84, 77, 90, 64,
135  54, 56, 57, 52, 58, 53, 59, 60, 55, 54,
136  56, 57, 52, 58, 53, 59, 60, 55, 54, 56,
137  57, 52, 58, 53, 59, 60, 55, 7, 19, 20,
138  21, 22, 12, 111, 26, 94, 103, 89, 66, 83,
139  18, 49, 68, 74, 88, 82, 39, 99, 25, 80,
140  17, 101, 102, 3, 81, 110, 23, 80, 75, 50,
141  71, 24, 104, 93, 70, 69, 48, 47, 46, 45,
142  43, 40, 42, 41, 62, 44, 32, 15, 13, 11,
143  10, 9, 8, 6, 5, 4, 2, 100, 109, 95,
144  14, 16, 1, 0, 106, 65, 0, 0, 0, 0,
145  108, 40, 0, 76, 0, 44, 79, 0, 112, 78,
146  86, 0, 0, 0, 0, 0, 0, 91, 0, 92,
147  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
148  0, 0, 0, 0, 0, 0, 107 };
149 int yypact[]={
150 
151  -179, -1000, -179, -1000, -1000, -1000, -1000, -179, -1000, -1000,
152  -1000, -1000, -1000, -1000, -1000, -1000, -1000, -172, -271, -228,
153  -229, -252, -253, -1000, -1000, -242, -1000, -257, -274, -275,
154  -276, -277, -225, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
155  -1000, -1000, -1000, -1000, -263, -1000, -1000, -1000, -1000, -1000,
156  -1000, -216, -1000, -1000, -1000, -1000, -1000, -221, -1000, -1000,
157  -1000, -256, -225, -268, -1000, -161, -1000, -1000, -1000, -222,
158  -222, -1000, -278, -1000, -169, -215, -1000, -247, -1000, -1000,
159  -207, -1000, -1000, -1000, -1000, -241, -1000, -224, -1000, -1000,
160  -1000, -1000, -1000, -170, -1000, -261, -1000, -222, -1000, -1000,
161  -241, -1000, -1000, -222, -173, -1000, -1000, -1000, -1000, -1000,
162  -1000, -222, -1000 };
163 int yypgo[]={
164 
165  0, 142, 92, 141, 140, 139, 138, 137, 136, 103,
166  135, 134, 133, 132, 131, 130, 129, 128, 127, 126,
167  96, 124, 88, 123, 122, 120, 119, 118, 117, 116,
168  115, 89, 114, 46, 113, 85, 112, 110, 91, 109,
169  93, 108 };
170 int yyr1[]={
171 
172  0, 1, 8, 8, 9, 9, 9, 9, 10, 10,
173  11, 11, 12, 13, 13, 17, 17, 4, 4, 14,
174  14, 18, 18, 3, 3, 19, 15, 15, 15, 21,
175  16, 20, 20, 20, 20, 22, 22, 22, 22, 22,
176  30, 2, 32, 26, 31, 31, 33, 34, 34, 35,
177  35, 5, 5, 7, 7, 7, 36, 6, 6, 27,
178  27, 27, 27, 37, 37, 28, 28, 29, 23, 23,
179  38, 38, 38, 40, 40, 40, 39, 41, 41, 24,
180  24, 24, 25 };
181 int yyr2[]={
182 
183  0, 3, 2, 4, 2, 2, 2, 4, 2, 2,
184  2, 2, 3, 2, 2, 3, 7, 3, 7, 2,
185  2, 3, 7, 3, 7, 1, 8, 7, 5, 1,
186  10, 3, 3, 3, 3, 2, 2, 2, 2, 2,
187  1, 6, 1, 6, 0, 2, 6, 2, 7, 3,
188  7, 2, 5, 3, 3, 5, 2, 2, 5, 3,
189  3, 3, 5, 0, 6, 3, 3, 3, 2, 2,
190  5, 7, 7, 2, 6, 3, 6, 2, 4, 4,
191  6, 7, 7 };
192 int yychk[]={
193 
194  -1000, -1, -8, -9, -10, -11, -12, 256, -13, -14,
195  -15, -16, 261, -17, -4, -18, -3, 279, 269, 257,
196  258, 259, 260, -9, -9, 270, 256, 279, 270, 270,
197  270, 270, -19, 256, 270, 279, 279, 279, 279, -20,
198  -22, -23, -24, -25, -2, -26, -27, -28, -29, -38,
199  -39, 264, 278, 280, 275, 283, 276, 277, 279, 281,
200  282, 262, -21, 274, 265, -40, -22, 256, -2, -30,
201  -32, -37, 266, 263, -40, -41, -38, 262, -20, -2,
202  268, 265, 256, -31, -33, 266, -31, 279, 263, 256,
203  263, -38, -22, -34, -35, -5, 279, 256, 267, 267,
204  -7, 271, 272, 256, -36, 273, -33, -35, -33, -6,
205  278, 256, -33 };
206 int yydef[]={
207 
208  0, -2, -2, 2, 4, 5, 6, 0, 8, 9,
209  10, 11, 12, 13, 14, 19, 20, 0, 0, 15,
210  17, 21, 23, 3, 7, -2, 28, 0, 0, 0,
211  0, 0, 0, 27, 29, 16, 18, 22, 24, 26,
212  31, 32, 33, 34, 35, 36, 37, 38, 39, 68,
213  69, 0, 40, 42, 59, 60, 61, 63, 65, 66,
214  67, 0, 0, 0, 79, 0, 73, 75, 35, 44,
215  44, 62, 0, 70, 0, 0, 77, 0, 30, 82,
216  0, 80, 81, 41, 45, 0, 43, 0, 71, 72,
217  76, 78, 74, 0, 47, 49, 51, 0, 64, 46,
218  0, 53, 54, 0, 0, 56, 52, 48, 55, 50,
219  57, 0, 58 };
220 typedef struct { char *t_name; int t_val; } yytoktype;
221 #ifndef YYDEBUG
222 # define YYDEBUG 0 /* don't allow debugging */
223 #endif
224 
225 #if YYDEBUG
226 
227 yytoktype yytoks[] =
228 {
229  "_OBJECT", 257,
230  "_END_OBJECT", 258,
231  "_GROUP", 259,
232  "_END_GROUP", 260,
233  "_END", 261,
234  "_sequence_opening", 262,
235  "_sequence_closing", 263,
236  "_set_opening", 264,
237  "_set_closing", 265,
238  "_units_opening", 266,
239  "_units_closing", 267,
240  "_list_separator", 268,
241  "_point_operator", 269,
242  "_assignment_operator", 270,
243  "_multiply_operator", 271,
244  "_divide_operator", 272,
245  "_exponentiate_operator", 273,
246  "_range_operator", 274,
247  "_date", 275,
248  "_date_time", 276,
249  "_date_timeV0", 277,
250  "_integer", 278,
251  "_name", 279,
252  "_real", 280,
253  "_symbol", 281,
254  "_text_string", 282,
255  "_time", 283,
256  "-unknown-", -1 /* ends search */
257 };
258 
259 char * yyreds[] =
260 {
261  "-no such reduction-",
262  "label : statement_list",
263  "statement_list : statement",
264  "statement_list : statement_list statement",
265  "statement : aggregation_stmt",
266  "statement : assignment_stmt",
267  "statement : end_statement",
268  "statement : error statement",
269  "aggregation_stmt : object_stmt",
270  "aggregation_stmt : group_stmt",
271  "assignment_stmt : attribute_stmt",
272  "assignment_stmt : pointer_stmt",
273  "end_statement : _END",
274  "object_stmt : object_opening",
275  "object_stmt : object_closing",
276  "object_opening : _OBJECT",
277  "object_opening : _OBJECT _assignment_operator _name",
278  "object_closing : _END_OBJECT",
279  "object_closing : _END_OBJECT _assignment_operator _name",
280  "group_stmt : group_opening",
281  "group_stmt : group_closing",
282  "group_opening : _GROUP",
283  "group_opening : _GROUP _assignment_operator _name",
284  "group_closing : _END_GROUP",
285  "group_closing : _END_GROUP _assignment_operator _name",
286  "attribute_stmt : _name _assignment_operator",
287  "attribute_stmt : _name _assignment_operator value",
288  "attribute_stmt : _name _assignment_operator error",
289  "attribute_stmt : _name error",
290  "pointer_stmt : _point_operator _name _assignment_operator",
291  "pointer_stmt : _point_operator _name _assignment_operator value",
292  "value : scalar_value",
293  "value : sequence_value",
294  "value : set_value",
295  "value : range_value",
296  "scalar_value : integer_value",
297  "scalar_value : real_value",
298  "scalar_value : date_time_value",
299  "scalar_value : symbolic_value",
300  "scalar_value : text_string_value",
301  "integer_value : _integer",
302  "integer_value : _integer units_part",
303  "real_value : _real",
304  "real_value : _real units_part",
305  "units_part : /* empty */",
306  "units_part : units_expression",
307  "units_expression : _units_opening units_expr _units_closing",
308  "units_expr : units_factor",
309  "units_expr : units_expr units_mult_op units_factor",
310  "units_factor : units",
311  "units_factor : units units_exp_op units_exponent",
312  "units : _name",
313  "units : error units_expression",
314  "units_mult_op : _multiply_operator",
315  "units_mult_op : _divide_operator",
316  "units_mult_op : error units_expression",
317  "units_exp_op : _exponentiate_operator",
318  "units_exponent : _integer",
319  "units_exponent : error units_expression",
320  "date_time_value : _date",
321  "date_time_value : _time",
322  "date_time_value : _date_time",
323  "date_time_value : _date_timeV0 time_zoneV0",
324  "time_zoneV0 : /* empty */",
325  "time_zoneV0 : _units_opening _name _units_closing",
326  "symbolic_value : _name",
327  "symbolic_value : _symbol",
328  "text_string_value : _text_string",
329  "sequence_value : sequence_1D",
330  "sequence_value : sequence_2D",
331  "sequence_1D : _sequence_opening _sequence_closing",
332  "sequence_1D : _sequence_opening value_list _sequence_closing",
333  "sequence_1D : _sequence_opening value_list error",
334  "value_list : scalar_value",
335  "value_list : value_list _list_separator scalar_value",
336  "value_list : error",
337  "sequence_2D : _sequence_opening sequence_1D_list _sequence_closing",
338  "sequence_1D_list : sequence_1D",
339  "sequence_1D_list : sequence_1D_list sequence_1D",
340  "set_value : _set_opening _set_closing",
341  "set_value : _set_opening value_list _set_closing",
342  "set_value : _set_opening value_list error",
343  "range_value : integer_value _range_operator integer_value",
344 };
345 #endif /* YYDEBUG */
346 #line 1 "/usr/lib/yaccpar"
347 /* @(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10 */
348 
349 /*
350 ** Skeleton parser driver for yacc output
351 */
352 
353 /*
354 ** yacc user known macros and defines
355 */
356 #define YYERROR goto yyerrlab
357 #define YYACCEPT { free(yys); free(yyv); return(0); }
358 #define YYABORT { free(yys); free(yyv); return(1); }
359 #define YYBACKUP( newtoken, newvalue )\
360 {\
361  if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
362  {\
363  yyerror( "syntax error - cannot backup" );\
364  goto yyerrlab;\
365  }\
366  yychar = newtoken;\
367  yystate = *yyps;\
368  yylval = newvalue;\
369  goto yynewstate;\
370 }
371 #define YYRECOVERING() (!!yyerrflag)
372 #ifndef YYDEBUG
373 # define YYDEBUG 1 /* make debugging available */
374 #endif
375 
376 /*
377 ** user known globals
378 */
379 int yydebug; /* set to 1 to get debugging */
380 
381 /*
382 ** driver internal defines
383 */
384 #define YYFLAG (-1000)
385 
386 /*
387 ** static variables used by the parser
388 */
389 static YYSTYPE *yyv; /* value stack */
390 static int *yys; /* state stack */
391 
392 static YYSTYPE *yypv; /* top of value stack */
393 static int *yyps; /* top of state stack */
394 
395 static int yystate; /* current state */
396 static int yytmp; /* extra var (lasts between blocks) */
397 
398 int yynerrs; /* number of errors */
399 
400 int yyerrflag; /* error recovery flag */
401 int yychar; /* current input token number */
402 
403 
404 /*
405 ** yyparse - return 0 if worked, 1 if syntax error not recovered from
406 */
407 int
409 {
410  register YYSTYPE *yypvt; /* top of value stack for $vars */
411  unsigned yymaxdepth = YYMAXDEPTH;
412 
413  /*
414  ** Initialize externals - yyparse may be called more than once
415  */
416  yyv = (YYSTYPE*)malloc(yymaxdepth*sizeof(YYSTYPE));
417  yys = (int*)malloc(yymaxdepth*sizeof(int));
418  if (!yyv || !yys)
419  {
420  yyerror( "out of memory" );
421  return(1);
422  }
423  yypv = &yyv[-1];
424  yyps = &yys[-1];
425  yystate = 0;
426  yytmp = 0;
427  yynerrs = 0;
428  yyerrflag = 0;
429  yychar = -1;
430 
431  goto yystack;
432  {
433  register YYSTYPE *yy_pv; /* top of value stack */
434  register int *yy_ps; /* top of state stack */
435  register int yy_state; /* current state */
436  register int yy_n; /* internal state number info */
437 
438  /*
439  ** get globals into registers.
440  ** branch to here only if YYBACKUP was called.
441  */
442  yynewstate:
443  yy_pv = yypv;
444  yy_ps = yyps;
445  yy_state = yystate;
446  goto yy_newstate;
447 
448  /*
449  ** get globals into registers.
450  ** either we just started, or we just finished a reduction
451  */
452  yystack:
453  yy_pv = yypv;
454  yy_ps = yyps;
455  yy_state = yystate;
456 
457  /*
458  ** top of for (;;) loop while no reductions done
459  */
460  yy_stack:
461  /*
462  ** put a state and value onto the stacks
463  */
464 #if YYDEBUG
465  /*
466  ** if debugging, look up token value in list of value vs.
467  ** name pairs. 0 and negative (-1) are special values.
468  ** Note: linear search is used since time is not a real
469  ** consideration while debugging.
470  */
471  if ( yydebug )
472  {
473  register int yy_i;
474 
475  (void)printf( "State %d, token ", yy_state );
476  if ( yychar == 0 )
477  (void)printf( "end-of-file\n" );
478  else if ( yychar < 0 )
479  (void)printf( "-none-\n" );
480  else
481  {
482  for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
483  yy_i++ )
484  {
485  if ( yytoks[yy_i].t_val == yychar )
486  break;
487  }
488  (void)printf( "%s\n", yytoks[yy_i].t_name );
489  }
490  }
491 #endif /* YYDEBUG */
492  if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */
493  {
494  /*
495  ** reallocate and recover. Note that pointers
496  ** have to be reset, or bad things will happen
497  */
498  int yyps_index = (yy_ps - yys);
499  int yypv_index = (yy_pv - yyv);
500  int yypvt_index = (yypvt - yyv);
501  yymaxdepth += YYMAXDEPTH;
502  yyv = (YYSTYPE*)realloc((char*)yyv,
503  yymaxdepth * sizeof(YYSTYPE));
504  yys = (int*)realloc((char*)yys,
505  yymaxdepth * sizeof(int));
506  if (!yyv || !yys)
507  {
508  yyerror( "yacc stack overflow" );
509  return(1);
510  }
511  yy_ps = yys + yyps_index;
512  yy_pv = yyv + yypv_index;
513  yypvt = yyv + yypvt_index;
514  }
515  *yy_ps = yy_state;
516  *++yy_pv = yyval;
517 
518  /*
519  ** we have a new state - find out what to do
520  */
521  yy_newstate:
522  if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
523  goto yydefault; /* simple state */
524 #if YYDEBUG
525  /*
526  ** if debugging, need to mark whether new token grabbed
527  */
528  yytmp = yychar < 0;
529 #endif
530  if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
531  yychar = 0; /* reached EOF */
532 #if YYDEBUG
533  if ( yydebug && yytmp )
534  {
535  register int yy_i;
536 
537  (void)printf( "Received token " );
538  if ( yychar == 0 )
539  (void)printf( "end-of-file\n" );
540  else if ( yychar < 0 )
541  (void)printf( "-none-\n" );
542  else
543  {
544  for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
545  yy_i++ )
546  {
547  if ( yytoks[yy_i].t_val == yychar )
548  break;
549  }
550  (void)printf( "%s\n", yytoks[yy_i].t_name );
551  }
552  }
553 #endif /* YYDEBUG */
554  if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
555  goto yydefault;
556  if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/
557  {
558  yychar = -1;
559  yyval = yylval;
560  yy_state = yy_n;
561  if ( yyerrflag > 0 )
562  yyerrflag--;
563  goto yy_stack;
564  }
565 
566  yydefault:
567  if ( ( yy_n = yydef[ yy_state ] ) == -2 )
568  {
569 #if YYDEBUG
570  yytmp = yychar < 0;
571 #endif
572  if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
573  yychar = 0; /* reached EOF */
574 #if YYDEBUG
575  if ( yydebug && yytmp )
576  {
577  register int yy_i;
578 
579  (void)printf( "Received token " );
580  if ( yychar == 0 )
581  (void)printf( "end-of-file\n" );
582  else if ( yychar < 0 )
583  (void)printf( "-none-\n" );
584  else
585  {
586  for ( yy_i = 0;
587  yytoks[yy_i].t_val >= 0;
588  yy_i++ )
589  {
590  if ( yytoks[yy_i].t_val
591  == yychar )
592  {
593  break;
594  }
595  }
596  (void)printf( "%s\n", yytoks[yy_i].t_name );
597  }
598  }
599 #endif /* YYDEBUG */
600  /*
601  ** look through exception table
602  */
603  {
604  register int *yyxi = yyexca;
605 
606  while ( ( *yyxi != -1 ) ||
607  ( yyxi[1] != yy_state ) )
608  {
609  yyxi += 2;
610  }
611  while ( ( *(yyxi += 2) >= 0 ) &&
612  ( *yyxi != yychar ) )
613  ;
614  if ( ( yy_n = yyxi[1] ) < 0 )
615  YYACCEPT;
616  }
617  }
618 
619  /*
620  ** check for syntax error
621  */
622  if ( yy_n == 0 ) /* have an error */
623  {
624  /* no worry about speed here! */
625  switch ( yyerrflag )
626  {
627  case 0: /* new error */
628  yyerror( "syntax error" );
629  goto skip_init;
630  yyerrlab:
631  /*
632  ** get globals into registers.
633  ** we have a user generated syntax type error
634  */
635  yy_pv = yypv;
636  yy_ps = yyps;
637  yy_state = yystate;
638  yynerrs++;
639  skip_init:
640  case 1:
641  case 2: /* incompletely recovered error */
642  /* try again... */
643  yyerrflag = 3;
644  /*
645  ** find state where "error" is a legal
646  ** shift action
647  */
648  while ( yy_ps >= yys )
649  {
650  yy_n = yypact[ *yy_ps ] + YYERRCODE;
651  if ( yy_n >= 0 && yy_n < YYLAST &&
652  yychk[yyact[yy_n]] == YYERRCODE) {
653  /*
654  ** simulate shift of "error"
655  */
656  yy_state = yyact[ yy_n ];
657  goto yy_stack;
658  }
659  /*
660  ** current state has no shift on
661  ** "error", pop stack
662  */
663 #if YYDEBUG
664 # define _POP_ "Error recovery pops state %d, uncovers state %d\n"
665  if ( yydebug )
666  (void)printf( _POP_, *yy_ps,
667  yy_ps[-1] );
668 # undef _POP_
669 #endif
670  yy_ps--;
671  yy_pv--;
672  }
673  /*
674  ** there is no state on stack with "error" as
675  ** a valid shift. give up.
676  */
677  YYABORT;
678  case 3: /* no shift yet; eat a token */
679 #if YYDEBUG
680  /*
681  ** if debugging, look up token in list of
682  ** pairs. 0 and negative shouldn't occur,
683  ** but since timing doesn't matter when
684  ** debugging, it doesn't hurt to leave the
685  ** tests here.
686  */
687  if ( yydebug )
688  {
689  register int yy_i;
690 
691  (void)printf( "Error recovery discards " );
692  if ( yychar == 0 )
693  (void)printf( "token end-of-file\n" );
694  else if ( yychar < 0 )
695  (void)printf( "token -none-\n" );
696  else
697  {
698  for ( yy_i = 0;
699  yytoks[yy_i].t_val >= 0;
700  yy_i++ )
701  {
702  if ( yytoks[yy_i].t_val
703  == yychar )
704  {
705  break;
706  }
707  }
708  (void)printf( "token %s\n",
709  yytoks[yy_i].t_name );
710  }
711  }
712 #endif /* YYDEBUG */
713  if ( yychar == 0 ) /* reached EOF. quit */
714  YYABORT;
715  yychar = -1;
716  goto yy_newstate;
717  }
718  }/* end if ( yy_n == 0 ) */
719  /*
720  ** reduction by production yy_n
721  ** put stack tops, etc. so things right after switch
722  */
723 #if YYDEBUG
724  /*
725  ** if debugging, print the string that is the user's
726  ** specification of the reduction which is just about
727  ** to be done.
728  */
729  if ( yydebug )
730  (void)printf( "Reduce by (%d) \"%s\"\n",
731  yy_n, yyreds[ yy_n ] );
732 #endif
733  yytmp = yy_n; /* value to switch over */
734  yypvt = yy_pv; /* $vars top of value stack */
735  /*
736  ** Look in goto table for next state
737  ** Sorry about using yy_state here as temporary
738  ** register variable, but why not, if it works...
739  ** If yyr2[ yy_n ] doesn't have the low order bit
740  ** set, then there is no action to be done for
741  ** this reduction. So, no saving & unsaving of
742  ** registers done. The only difference between the
743  ** code just after the if and the body of the if is
744  ** the goto yy_stack in the body. This way the test
745  ** can be made before the choice of what to do is needed.
746  */
747  {
748  /* length of production doubled with extra bit */
749  register int yy_len = yyr2[ yy_n ];
750 
751  if ( !( yy_len & 01 ) )
752  {
753  yy_len >>= 1;
754  yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
755  yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
756  *( yy_ps -= yy_len ) + 1;
757  if ( yy_state >= YYLAST ||
758  yychk[ yy_state =
759  yyact[ yy_state ] ] != -yy_n )
760  {
761  yy_state = yyact[ yypgo[ yy_n ] ];
762  }
763  goto yy_stack;
764  }
765  yy_len >>= 1;
766  yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
767  yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
768  *( yy_ps -= yy_len ) + 1;
769  if ( yy_state >= YYLAST ||
770  yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
771  {
772  yy_state = yyact[ yypgo[ yy_n ] ];
773  }
774  }
775  /* save until reenter driver code */
776  yystate = yy_state;
777  yyps = yy_ps;
778  yypv = yy_pv;
779  }
780  /*
781  ** code supplied by user is placed in this switch
782  */
783  switch( yytmp )
784  {
785 
786 case 1:
787 # line 97 "odl2.y"
788 {
789  /* End-of-file hit before END statement found */
790  ODLEndLabel ();
791  if (pds_watch_ends)
792  {
793  yyerror ("END statement is missing");
794  YYABORT;
795  }
796  else
797  YYACCEPT;
798  } break;
799 case 12:
800 # line 126 "odl2.y"
801 {
802  /* This is the normal termination of parsing */
803  if (ODLEndLabel ())
804  {
805  YYACCEPT;
806  }
807  else
808  {
809  YYABORT;
810  }
811  } break;
812 case 15:
813 # line 144 "odl2.y"
814 { yyerror ("Missing '=' operator after OBJECT"); } break;
815 case 16:
816 # line 146 "odl2.y"
817 { ODLBeginAggregate (KA_OBJECT, &yypvt[-0].item); } break;
818 case 17:
819 # line 149 "odl2.y"
820 {
821  yyval.item.value.string = NULL;
822  ODLEndAggregate (KA_OBJECT, &yyval.item);
823  } break;
824 case 18:
825 # line 154 "odl2.y"
826 { ODLEndAggregate (KA_OBJECT, &yypvt[-0].item); } break;
827 case 21:
828 # line 162 "odl2.y"
829 { yyerror ("Missing '=' operator after GROUP"); } break;
830 case 22:
831 # line 164 "odl2.y"
832 { ODLBeginAggregate (KA_GROUP, &yypvt[-0].item); } break;
833 case 23:
834 # line 167 "odl2.y"
835 {
836  yyval.item.value.string = NULL;
837  ODLEndAggregate (KA_GROUP, &yyval.item);
838  } break;
839 case 24:
840 # line 172 "odl2.y"
841 { ODLEndAggregate (KA_GROUP, &yypvt[-0].item); } break;
842 case 25:
843 # line 176 "odl2.y"
844 { ODLBeginParameter (KP_ATTRIBUTE, &yypvt[-1].item); } break;
845 case 27:
846 # line 179 "odl2.y"
847 {
848  yyerror ("Bad value in assignment statement");
849  yyclearin;
850  } break;
851 case 28:
852 # line 184 "odl2.y"
853 { yyerror ("Expected '=' after name"); } break;
854 case 29:
855 # line 188 "odl2.y"
856 { ODLBeginParameter (KP_POINTER, &yypvt[-1].item); } break;
857 case 31:
858 # line 193 "odl2.y"
859 { ODLMarkParameter (KV_SCALAR); } break;
860 case 32:
861 # line 195 "odl2.y"
862 { ODLMarkParameter (KV_SEQUENCE); } break;
863 case 33:
864 # line 197 "odl2.y"
865 { ODLMarkParameter (KV_SET); } break;
866 case 34:
867 # line 199 "odl2.y"
868 { ODLMarkParameter (KV_SEQUENCE); } break;
869 case 40:
870 # line 210 "odl2.y"
871 { ODLStoreValue (&yypvt[-0].item); } break;
872 case 42:
873 # line 215 "odl2.y"
874 { ODLStoreValue (&yypvt[-0].item); } break;
875 case 48:
876 # line 228 "odl2.y"
877 { ODLMarkUnits (yypvt[-1].flag); } break;
878 case 49:
879 # line 231 "odl2.y"
880 { ODLStoreUnits1 (&yypvt[-0].item); } break;
881 case 50:
882 # line 233 "odl2.y"
883 { ODLStoreUnits2 (&yypvt[-2].item, &yypvt[-0].item); } break;
884 case 52:
885 # line 237 "odl2.y"
886 { yyerror ("Units designator must be a name"); } break;
887 case 53:
888 # line 240 "odl2.y"
889 { yyval.flag = 1; } break;
890 case 54:
891 # line 242 "odl2.y"
892 { yyval.flag = -1; } break;
893 case 55:
894 # line 244 "odl2.y"
895 { yyerror ("Expected a '*', '/' or '**' operator");} break;
896 case 58:
897 # line 251 "odl2.y"
898 { yyerror("Exponent in units expr must be integer");} break;
899 case 59:
900 # line 254 "odl2.y"
901 { ODLStoreValue (&yypvt[-0].item); } break;
902 case 60:
903 # line 256 "odl2.y"
904 { ODLStoreValue (&yypvt[-0].item); } break;
905 case 61:
906 # line 258 "odl2.y"
907 { ODLStoreValue (&yypvt[-0].item); } break;
908 case 62:
909 # line 260 "odl2.y"
910 { ODLStoreValue (&yypvt[-1].item); } break;
911 case 65:
912 # line 267 "odl2.y"
913 { ODLStoreValue (&yypvt[-0].item); } break;
914 case 66:
915 # line 269 "odl2.y"
916 { ODLStoreValue (&yypvt[-0].item); } break;
917 case 67:
918 # line 272 "odl2.y"
919 { ODLStoreValue (&yypvt[-0].item); } break;
920 case 70:
921 # line 279 "odl2.y"
922 { yyerror("Sequences with no values not allowed"); } break;
923 case 71:
924 # line 281 "odl2.y"
925 { ODLCheckSequence (); } break;
926 case 72:
927 # line 283 "odl2.y"
928 {
929  yyerror("')' at end of a sequence is missing");
930  ODLCheckSequence ();
931  } break;
932 case 75:
933 # line 291 "odl2.y"
934 { yyerror ("Error in value list"); } break;
935 case 81:
936 # line 303 "odl2.y"
937 { yyerror ("The '}' is missing at end of set"); } break;
938 case 82:
939 # line 307 "odl2.y"
940 { ODLCheckRange (&yypvt[-2].item, &yypvt[-0].item); } break;
941  }
942  goto yystack; /* reset registers in driver code */
943 }
int yychk[]
Definition: parser.c:192
void ODLStoreUnits1()
void ODLMarkParameter()
void ODLBeginParameter()
void ODLCheckSequence()
Definition: parsact.c:593
void ODLStoreValue()
int t_val
Definition: parser.c:220
struct Value_Data item
Definition: odlparse.h:29
static YYSTYPE * yypv
Definition: parser.c:392
int yyact[]
Definition: parser.c:128
void ODLStoreUnits2()
#define yyclearin
Definition: parser.c:80
yylex()
Definition: lexan.c:131
int yychar
Definition: parser.c:401
void ODLEndAggregate()
int yyparse()
Definition: parser.c:408
int flag
Definition: odlparse.h:30
void ODLMarkUnits()
int pds_watch_ends
Definition: parser.c:44
int ODLEndLabel()
Definition: parsact.c:676
int yyexca[]
Definition: parser.c:105
int yyr2[]
Definition: parser.c:181
YYSTYPE yylval
Definition: parser.c:87
void ODLBeginAggregate()
#define YYABORT
Definition: parser.c:358
int yydef[]
Definition: parser.c:206
int yypact[]
Definition: parser.c:149
char * string
Definition: odldef.h:222
#define TRUE
Definition: odldef.h:49
int yyr1[]
Definition: parser.c:170
int yydebug
Definition: parser.c:379
static YYSTYPE * yyv
Definition: parser.c:389
int yynerrs
Definition: parser.c:398
int yypgo[]
Definition: parser.c:163
#define YYMAXDEPTH
Definition: parser.c:85
YYSTYPE yyval
Definition: parser.c:87
#define YYFLAG
Definition: parser.c:384
static int * yyps
Definition: parser.c:393
H5TOOLS_DLL void error_msg(const char *fmt,...)
union YYSTYPE YYSTYPE
int yyerror(char *error_msg)
Definition: parser.c:97
#define YYACCEPT
Definition: parser.c:357
#define YYLAST
Definition: parser.c:127
int yyerrflag
Definition: parser.c:400
#define YYERRCODE
Definition: parser.c:88
Definition: odldef.h:93
static int yystate
Definition: parser.c:395
void ODLCheckRange()
static int yytmp
Definition: parser.c:396
union Value_Data::@2 value
void ODLPrintError()
static int * yys
Definition: parser.c:390

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:51