~ubuntu-branches/ubuntu/lucid/graphviz/lucid-security

« back to all changes in this revision

Viewing changes to tools/expr/exparse.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2002-02-05 18:52:12 UTC
  • Revision ID: james.westby@ubuntu.com-20020205185212-8i04c70te00rc40y
Tags: upstream-1.7.16
ImportĀ upstreamĀ versionĀ 1.7.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/* A Bison parser, made from exparse.y
 
3
   by GNU bison 1.30.  */
 
4
 
 
5
#define EXBISON 1  /* Identify Bison output.  */
 
6
 
 
7
# define        MINTOKEN        257
 
8
# define        CHAR    258
 
9
# define        INT     259
 
10
# define        INTEGER 260
 
11
# define        UNSIGNED        261
 
12
# define        FLOATING        262
 
13
# define        STRING  263
 
14
# define        VOID    264
 
15
# define        BREAK   265
 
16
# define        CALL    266
 
17
# define        CASE    267
 
18
# define        CONSTANT        268
 
19
# define        CONTINUE        269
 
20
# define        DECLARE 270
 
21
# define        DEFAULT 271
 
22
# define        DYNAMIC 272
 
23
# define        ELSE    273
 
24
# define        EXIT    274
 
25
# define        FOR     275
 
26
# define        FUNCTION        276
 
27
# define        ITERATE 277
 
28
# define        ID      278
 
29
# define        IF      279
 
30
# define        LABEL   280
 
31
# define        MEMBER  281
 
32
# define        NAME    282
 
33
# define        POS     283
 
34
# define        PRAGMA  284
 
35
# define        PRE     285
 
36
# define        PRINTF  286
 
37
# define        PROCEDURE       287
 
38
# define        QUERY   288
 
39
# define        RETURN  289
 
40
# define        SPRINTF 290
 
41
# define        SWITCH  291
 
42
# define        WHILE   292
 
43
# define        F2I     293
 
44
# define        F2S     294
 
45
# define        I2F     295
 
46
# define        I2S     296
 
47
# define        S2B     297
 
48
# define        S2F     298
 
49
# define        S2I     299
 
50
# define        F2X     300
 
51
# define        I2X     301
 
52
# define        S2X     302
 
53
# define        X2F     303
 
54
# define        X2I     304
 
55
# define        X2S     305
 
56
# define        OR      306
 
57
# define        AND     307
 
58
# define        EQ      308
 
59
# define        NE      309
 
60
# define        LE      310
 
61
# define        GE      311
 
62
# define        LS      312
 
63
# define        RS      313
 
64
# define        UNARY   314
 
65
# define        INC     315
 
66
# define        DEC     316
 
67
# define        CAST    317
 
68
# define        MAXTOKEN        318
 
69
 
 
70
#line 1 "exparse.y"
 
71
 
 
72
 
 
73
#pragma prototyped
 
74
 
 
75
/*
 
76
 * Glenn Fowler
 
77
 * AT&T Research
 
78
 *
 
79
 * expression library grammar and compiler
 
80
 *
 
81
 * NOTE: procedure arguments not implemented yet
 
82
 */
 
83
 
 
84
#include <stdio.h>
 
85
#include <ast.h>
 
86
 
 
87
#undef  RS      /* hp.pa <signal.h> grabs this!! */
 
88
 
 
89
 
 
90
#line 21 "exparse.y"
 
91
typedef union
 
92
{
 
93
        struct Exnode_s*expr;
 
94
        double          floating;
 
95
        struct Exref_s* reference;
 
96
        struct Exid_s*  id;
 
97
        Sflong_t        integer;
 
98
        int             op;
 
99
        char*           string;
 
100
        void*           user;
 
101
        struct Exbuf_s* buffer;
 
102
} EXSTYPE;
 
103
#line 128 "exparse.y"
 
104
 
 
105
 
 
106
#include "exgram.h"
 
107
 
 
108
#ifndef EXDEBUG
 
109
# define EXDEBUG 1
 
110
#endif
 
111
 
 
112
#include <stdio.h>
 
113
 
 
114
 
 
115
 
 
116
#define EXFINAL         214
 
117
#define EXFLAG          -32768
 
118
#define EXNTBASE        89
 
119
 
 
120
/* EXTRANSLATE(EXLEX) -- Bison token number corresponding to EXLEX. */
 
121
#define EXTRANSLATE(x) ((unsigned)(x) <= 318 ? extranslate[x] : 127)
 
122
 
 
123
/* EXTRANSLATE[EXLEX] -- Bison token number corresponding to EXLEX. */
 
124
static const char extranslate[] =
 
125
{
 
126
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
127
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
128
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
129
       2,     2,     2,    74,     2,     2,     2,    73,    60,     2,
 
130
      80,    85,    71,    69,    52,    70,    88,    72,     2,     2,
 
131
       2,     2,     2,     2,     2,     2,     2,     2,    55,    84,
 
132
      63,    53,    64,    54,     2,     2,     2,     2,     2,     2,
 
133
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
134
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
135
       2,    86,     2,    87,    59,     2,     2,     2,     2,     2,
 
136
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
137
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
138
       2,     2,     2,    82,    58,    83,    75,     2,     2,     2,
 
139
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
140
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
141
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
142
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
143
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
144
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
145
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
146
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
147
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
148
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
149
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
150
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
151
       2,     2,     2,     2,     2,     2,     1,     3,     4,     5,
 
152
       6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
 
153
      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
 
154
      26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
 
155
      36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
 
156
      46,    47,    48,    49,    50,    51,    56,    57,    61,    62,
 
157
      65,    66,    67,    68,    76,    77,    78,    79,    81
 
158
};
 
159
 
 
160
#if EXDEBUG != 0
 
161
static const short exprhs[] =
 
162
{
 
163
       0,     0,     3,     4,     7,     8,    13,    14,    17,    21,
 
164
      24,    25,    30,    37,    43,    53,    59,    60,    69,    73,
 
165
      77,    81,    82,    85,    88,    90,    93,    97,   100,   102,
 
166
     106,   107,   112,   114,   116,   117,   120,   121,   123,   127,
 
167
     132,   136,   140,   144,   148,   152,   156,   160,   164,   168,
 
168
     172,   176,   180,   184,   188,   192,   196,   200,   204,   208,
 
169
     209,   210,   218,   221,   224,   227,   230,   235,   240,   245,
 
170
     250,   253,   256,   259,   262,   265,   267,   269,   271,   273,
 
171
     275,   277,   279,   281,   283,   286,   290,   292,   293,   296,
 
172
     297,   301,   302,   304,   306,   310,   311,   313,   315,   317,
 
173
     321,   322,   326,   327,   329,   333,   336,   339,   340,   343,
 
174
     345,   346,   347
 
175
};
 
176
static const short exrhs[] =
 
177
{
 
178
      93,    90,     0,     0,    90,    91,     0,     0,    26,    55,
 
179
      92,    93,     0,     0,    93,    94,     0,    82,    93,    83,
 
180
       0,   106,    84,     0,     0,    16,    95,   101,    84,     0,
 
181
      25,    80,   107,    85,    94,   105,     0,    21,    80,   112,
 
182
      85,    94,     0,    21,    80,   106,    84,   106,    84,   106,
 
183
      85,    94,     0,    38,    80,   107,    85,    94,     0,     0,
 
184
      37,    80,   107,    96,    85,    82,    97,    83,     0,    11,
 
185
     106,    84,     0,    15,   106,    84,     0,    35,   106,    84,
 
186
       0,     0,    97,    98,     0,    99,    93,     0,   100,     0,
 
187
      99,   100,     0,    13,   110,    55,     0,    17,    55,     0,
 
188
     102,     0,   101,    52,   102,     0,     0,    28,   103,   113,
 
189
     124,     0,    28,     0,    18,     0,     0,    19,    94,     0,
 
190
       0,   107,     0,    80,   107,    85,     0,    80,    16,    85,
 
191
     107,     0,   107,    63,   107,     0,   107,    70,   107,     0,
 
192
     107,    71,   107,     0,   107,    72,   107,     0,   107,    73,
 
193
     107,     0,   107,    67,   107,     0,   107,    68,   107,     0,
 
194
     107,    64,   107,     0,   107,    65,   107,     0,   107,    66,
 
195
     107,     0,   107,    61,   107,     0,   107,    62,   107,     0,
 
196
     107,    60,   107,     0,   107,    58,   107,     0,   107,    59,
 
197
     107,     0,   107,    69,   107,     0,   107,    57,   107,     0,
 
198
     107,    56,   107,     0,   107,    52,   107,     0,     0,     0,
 
199
     107,    54,   108,   107,    55,   109,   107,     0,    74,   107,
 
200
       0,    75,   107,     0,    70,   107,     0,    69,   107,     0,
 
201
      22,    80,   115,    85,     0,    20,    80,   107,    85,     0,
 
202
      33,    80,   115,    85,     0,   111,    80,   115,    85,     0,
 
203
     112,   123,     0,    77,   112,     0,   112,    77,     0,    78,
 
204
     112,     0,   112,    78,     0,   110,     0,    14,     0,     8,
 
205
       0,     6,     0,     9,     0,     7,     0,    32,     0,    34,
 
206
       0,    36,     0,    24,   121,     0,    18,   114,   121,     0,
 
207
      28,     0,     0,    86,    87,     0,     0,    86,   107,    87,
 
208
       0,     0,   116,     0,   107,     0,   116,    52,   107,     0,
 
209
       0,    16,     0,   118,     0,   119,     0,   118,    52,   119,
 
210
       0,     0,    16,   120,   104,     0,     0,   122,     0,    88,
 
211
      24,   122,     0,    88,    24,     0,    88,    28,     0,     0,
 
212
      53,   107,     0,   123,     0,     0,     0,    80,   125,   117,
 
213
     126,    85,    82,    93,    83,     0
 
214
};
 
215
 
 
216
#endif
 
217
 
 
218
#if EXDEBUG != 0
 
219
/* EXRLINE[EXN] -- source line where rule number EXN was defined. */
 
220
static const short exrline[] =
 
221
{
 
222
       0,   136,   157,   158,   161,   176,   196,   200,   215,   219,
 
223
     223,   223,   227,   235,   248,   263,   271,   271,   282,   294,
 
224
     298,   310,   340,   343,   372,   373,   376,   397,   403,   404,
 
225
     411,   411,   451,   452,   455,   459,   465,   469,   472,   476,
 
226
     480,   522,   526,   530,   534,   538,   542,   546,   550,   554,
 
227
     558,   562,   566,   570,   574,   578,   582,   591,   595,   604,
 
228
     604,   605,   643,   660,   664,   668,   672,   676,   682,   687,
 
229
     711,   735,   743,   751,   755,   759,   762,   769,   774,   779,
 
230
     784,   791,   792,   793,   796,   800,   816,   828,   832,   838,
 
231
     842,   848,   852,   860,   865,   871,   875,   881,   884,   888,
 
232
     899,   900,   909,   913,   925,   944,   948,   953,   957,   964,
 
233
     965,   978,   982
 
234
};
 
235
#endif
 
236
 
 
237
 
 
238
#if EXDEBUG != 0 || defined EXERROR_VERBOSE
 
239
 
 
240
/* EXTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
 
241
static const char *const extname[] =
 
242
{
 
243
  "$", "error", "$undefined.", "MINTOKEN", "CHAR", "INT", "INTEGER", 
 
244
  "UNSIGNED", "FLOATING", "STRING", "VOID", "BREAK", "CALL", "CASE", 
 
245
  "CONSTANT", "CONTINUE", "DECLARE", "DEFAULT", "DYNAMIC", "ELSE", "EXIT", 
 
246
  "FOR", "FUNCTION", "ITERATE", "ID", "IF", "LABEL", "MEMBER", "NAME", 
 
247
  "POS", "PRAGMA", "PRE", "PRINTF", "PROCEDURE", "QUERY", "RETURN", 
 
248
  "SPRINTF", "SWITCH", "WHILE", "F2I", "F2S", "I2F", "I2S", "S2B", "S2F", 
 
249
  "S2I", "F2X", "I2X", "S2X", "X2F", "X2I", "X2S", "','", "'='", "'?'", 
 
250
  "':'", "OR", "AND", "'|'", "'^'", "'&'", "EQ", "NE", "'<'", "'>'", "LE", 
 
251
  "GE", "LS", "RS", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "'~'", 
 
252
  "UNARY", "INC", "DEC", "CAST", "'('", "MAXTOKEN", "'{'", "'}'", "';'", 
 
253
  "')'", "'['", "']'", "'.'", "program", "action_list", "action", "@1", 
 
254
  "statement_list", "statement", "@2", "@3", "switch_list", "switch_item", 
 
255
  "case_list", "case_item", "dcl_list", "dcl_item", "@4", "name", 
 
256
  "else_opt", "expr_opt", "expr", "@5", "@6", "constant", "print", 
 
257
  "variable", "array", "index", "args", "arg_list", "formals", 
 
258
  "formal_list", "formal_item", "@7", "members", "member", "assign", 
 
259
  "initialize", "@8", "@9", NULL
 
260
};
 
261
#endif
 
262
 
 
263
/* EXR1[EXN] -- Symbol number of symbol that rule EXN derives. */
 
264
static const short exr1[] =
 
265
{
 
266
       0,    89,    90,    90,    92,    91,    93,    93,    94,    94,
 
267
      95,    94,    94,    94,    94,    94,    96,    94,    94,    94,
 
268
      94,    97,    97,    98,    99,    99,   100,   100,   101,   101,
 
269
     103,   102,   104,   104,   105,   105,   106,   106,   107,   107,
 
270
     107,   107,   107,   107,   107,   107,   107,   107,   107,   107,
 
271
     107,   107,   107,   107,   107,   107,   107,   107,   107,   108,
 
272
     109,   107,   107,   107,   107,   107,   107,   107,   107,   107,
 
273
     107,   107,   107,   107,   107,   107,   110,   110,   110,   110,
 
274
     110,   111,   111,   111,   112,   112,   112,   113,   113,   114,
 
275
     114,   115,   115,   116,   116,   117,   117,   117,   118,   118,
 
276
     120,   119,   121,   121,   121,   122,   122,   123,   123,   124,
 
277
     125,   126,   124
 
278
};
 
279
 
 
280
/* EXR2[EXN] -- Number of symbols composing right hand side of rule EXN. */
 
281
static const short exr2[] =
 
282
{
 
283
       0,     2,     0,     2,     0,     4,     0,     2,     3,     2,
 
284
       0,     4,     6,     5,     9,     5,     0,     8,     3,     3,
 
285
       3,     0,     2,     2,     1,     2,     3,     2,     1,     3,
 
286
       0,     4,     1,     1,     0,     2,     0,     1,     3,     4,
 
287
       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
 
288
       3,     3,     3,     3,     3,     3,     3,     3,     3,     0,
 
289
       0,     7,     2,     2,     2,     2,     4,     4,     4,     4,
 
290
       2,     2,     2,     2,     2,     1,     1,     1,     1,     1,
 
291
       1,     1,     1,     1,     2,     3,     1,     0,     2,     0,
 
292
       3,     0,     1,     1,     3,     0,     1,     1,     1,     3,
 
293
       0,     3,     0,     1,     3,     2,     2,     0,     2,     1,
 
294
       0,     0,     8
 
295
};
 
296
 
 
297
/* EXDEFACT[S] -- default rule to reduce with in state S when EXTABLE
 
298
   doesn't specify something else to do.  Zero means the default is an
 
299
   error. */
 
300
static const short exdefact[] =
 
301
{
 
302
       6,     2,    78,    80,    77,    79,    36,    76,    36,    10,
 
303
      89,     0,     0,     0,   102,     0,    86,    81,     0,    82,
 
304
      36,    83,     0,     0,     0,     0,     0,     0,     0,     0,
 
305
       0,     6,     1,     7,     0,    37,    75,     0,   107,     0,
 
306
       0,     0,     0,   102,     0,    36,    91,     0,    84,   103,
 
307
       0,    91,     0,     0,     0,    65,    64,    62,    63,    71,
 
308
      73,     0,     0,    36,     0,     3,     9,     0,    59,     0,
 
309
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
 
310
       0,     0,     0,     0,     0,     0,     0,    91,     0,    72,
 
311
      74,    70,    18,    19,    30,     0,    28,     0,    85,     0,
 
312
       0,   107,    93,     0,    92,   105,   106,     0,     0,    20,
 
313
      16,     0,     0,    38,     8,     4,    58,     0,    57,    56,
 
314
      53,    54,    52,    50,    51,    40,    47,    48,    49,    45,
 
315
      46,    55,    41,    42,    43,    44,     0,   108,    87,     0,
 
316
      11,    90,    67,    36,    36,    66,     0,     0,   104,    36,
 
317
      68,     0,    36,    39,     6,     0,    69,     0,   107,    29,
 
318
       0,    13,    94,   105,    34,     0,    15,     5,    60,    88,
 
319
     110,   109,    31,    36,    36,    12,    21,     0,    95,     0,
 
320
      35,     0,    61,   100,   111,    97,    98,    36,     0,     0,
 
321
      17,    22,     6,    24,     0,     0,     0,    14,     0,    27,
 
322
      23,    25,    33,    32,   101,     0,   100,    99,    26,     6,
 
323
      36,   112,     0,     0,     0
 
324
};
 
325
 
 
326
static const short exdefgoto[] =
 
327
{
 
328
     212,    32,    65,   154,     1,    33,    41,   151,   181,   191,
 
329
     192,   193,    95,    96,   138,   204,   175,    34,    35,   117,
 
330
     177,    36,    37,    38,   158,    43,   103,   104,   184,   185,
 
331
     186,   194,    48,    49,    91,   172,   178,   195
 
332
};
 
333
 
 
334
static const short expact[] =
 
335
{
 
336
  -32768,    66,-32768,-32768,-32768,-32768,   429,-32768,   429,-32768,
 
337
     -67,   -43,   -41,   -38,   -12,     3,-32768,-32768,     5,-32768,
 
338
     429,-32768,     9,    13,   429,   429,   429,   429,    -1,    -1,
 
339
     398,-32768,    22,-32768,    -6,   540,-32768,    30,   -32,    27,
 
340
      31,    88,   429,   -12,   429,   429,   429,    -8,-32768,-32768,
 
341
     429,   429,    40,   429,   429,-32768,-32768,-32768,-32768,-32768,
 
342
  -32768,    42,   230,   165,    70,-32768,-32768,   429,-32768,   429,
 
343
     429,   429,   429,   429,   429,   429,   429,   429,   429,   429,
 
344
     429,   429,   429,   429,   429,   429,   429,   429,   429,-32768,
 
345
  -32768,-32768,-32768,-32768,-32768,   -40,-32768,   154,-32768,   308,
 
346
      44,   -42,   423,    45,    77,    43,-32768,   456,    47,-32768,
 
347
     540,   486,   429,-32768,-32768,-32768,   423,   429,   557,   573,
 
348
     588,   602,   615,   628,   628,   639,   639,   639,   639,    49,
 
349
      49,    -2,    -2,-32768,-32768,-32768,    48,   423,    51,    88,
 
350
  -32768,-32768,-32768,   429,   321,-32768,   429,     1,-32768,   321,
 
351
  -32768,    57,   321,-32768,-32768,   518,-32768,    58,   -39,-32768,
 
352
      50,-32768,   423,-32768,   128,    69,-32768,    66,-32768,-32768,
 
353
  -32768,-32768,-32768,   429,   321,-32768,-32768,   429,   133,    68,
 
354
  -32768,    -4,   423,    71,-32768,   102,-32768,   321,    99,   100,
 
355
  -32768,-32768,    15,-32768,   -10,    73,   143,-32768,   105,-32768,
 
356
      66,-32768,-32768,-32768,-32768,    80,-32768,-32768,-32768,-32768,
 
357
     243,-32768,   163,   164,-32768
 
358
};
 
359
 
 
360
static const short expgoto[] =
 
361
{
 
362
  -32768,-32768,-32768,-32768,   -31,   -35,-32768,-32768,-32768,-32768,
 
363
  -32768,   -27,-32768,    28,-32768,-32768,-32768,    -5,   -20,-32768,
 
364
  -32768,   -22,-32768,    67,-32768,-32768,   -49,-32768,-32768,-32768,
 
365
     -26,-32768,   126,    72,    17,-32768,-32768,-32768
 
366
};
 
367
 
 
368
 
 
369
#define EXLAST          712
 
370
 
 
371
 
 
372
static const short extable[] =
 
373
{
 
374
      63,    39,   108,    40,    55,    56,    57,    58,   202,   188,
 
375
      62,    88,   139,   189,    88,    52,   105,    10,   203,    42,
 
376
     106,    88,    97,    14,    99,   163,   102,    16,   188,   106,
 
377
     107,   102,   189,   110,   111,    89,    90,    44,   136,    45,
 
378
     100,   170,    46,   144,   140,    89,    90,   116,    64,   118,
 
379
     119,   120,   121,   122,   123,   124,   125,   126,   127,   128,
 
380
     129,   130,   131,   132,   133,   134,   135,   102,   137,    84,
 
381
      85,    86,     2,     3,     4,     5,    47,     6,    66,   190,
 
382
       7,     8,     9,    50,    10,    51,    11,    12,    13,    53,
 
383
      14,    15,   153,    54,    16,    59,    60,   155,    17,    18,
 
384
      19,    20,    21,    22,    23,     2,     3,     4,     5,   161,
 
385
      87,    92,   101,     7,   164,    93,    94,   166,    82,    83,
 
386
      84,    85,    86,   167,   109,   115,   162,   112,   143,   146,
 
387
     145,   147,   150,   156,   173,    24,    25,   157,   160,   180,
 
388
      26,    27,   165,    28,    29,   169,    30,   174,    31,   183,
 
389
     -36,   176,   197,   187,   196,   199,   -96,   182,   205,   206,
 
390
     208,   200,   209,   213,   214,   201,   198,   159,   179,    98,
 
391
     207,     2,     3,     4,     5,   171,     6,   148,   210,     7,
 
392
       8,     9,     0,    10,     0,    11,    12,    13,     0,    14,
 
393
      15,     0,     0,    16,     0,     0,     0,    17,    18,    19,
 
394
      20,    21,    22,    23,     0,     0,    67,     0,    68,     0,
 
395
      69,    70,    71,    72,    73,    74,    75,    76,    77,    78,
 
396
      79,    80,    81,    82,    83,    84,    85,    86,     0,     0,
 
397
       0,     0,     0,     0,    24,    25,     0,     0,     0,    26,
 
398
      27,   141,    28,    29,     0,    30,     0,    31,   114,     2,
 
399
       3,     4,     5,     0,     6,     0,     0,     7,     8,     9,
 
400
       0,    10,     0,    11,    12,    13,     0,    14,    15,     0,
 
401
       0,    16,     0,     0,     0,    17,    18,    19,    20,    21,
 
402
      22,    23,    67,     0,    68,     0,    69,    70,    71,    72,
 
403
      73,    74,    75,    76,    77,    78,    79,    80,    81,    82,
 
404
      83,    84,    85,    86,     0,     0,     0,     0,     0,     0,
 
405
       0,     0,    24,    25,     0,   113,     0,    26,    27,     0,
 
406
      28,    29,     0,    30,     0,    31,   211,     2,     3,     4,
 
407
       5,     0,     6,     0,     0,     7,     8,     9,     0,    10,
 
408
       0,    11,    12,    13,     0,    14,    15,     0,     0,    16,
 
409
       0,     0,     0,    17,    18,    19,    20,    21,    22,    23,
 
410
      67,     0,    68,     0,    69,    70,    71,    72,    73,    74,
 
411
      75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
 
412
      85,    86,     0,     0,     0,     0,     0,     0,     0,     0,
 
413
      24,    25,     0,   142,     0,    26,    27,     0,    28,    29,
 
414
       0,    30,     0,    31,     2,     3,     4,     5,     0,     0,
 
415
       0,     0,     7,     0,    61,     0,    10,     0,    11,     0,
 
416
      13,     0,    14,     0,     0,     0,    16,     0,     0,     0,
 
417
      17,    18,    19,     0,    21,     2,     3,     4,     5,     0,
 
418
       0,     0,     0,     7,     0,     0,     0,    10,     0,    11,
 
419
       0,    13,     0,    14,     0,     0,     0,    16,     0,     0,
 
420
       0,    17,    18,    19,     0,    21,     0,    24,    25,     0,
 
421
       0,     0,    26,    27,     0,    28,    29,    68,    30,    69,
 
422
      70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
 
423
      80,    81,    82,    83,    84,    85,    86,     0,    24,    25,
 
424
       0,     0,     0,    26,    27,     0,    28,    29,    67,    30,
 
425
      68,     0,    69,    70,    71,    72,    73,    74,    75,    76,
 
426
      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
 
427
       0,     0,     0,     0,     0,     0,     0,     0,    67,     0,
 
428
      68,   149,    69,    70,    71,    72,    73,    74,    75,    76,
 
429
      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
 
430
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
 
431
      67,   152,    68,   168,    69,    70,    71,    72,    73,    74,
 
432
      75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
 
433
      85,    86,    67,     0,    68,     0,    69,    70,    71,    72,
 
434
      73,    74,    75,    76,    77,    78,    79,    80,    81,    82,
 
435
      83,    84,    85,    86,    70,    71,    72,    73,    74,    75,
 
436
      76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
 
437
      86,    71,    72,    73,    74,    75,    76,    77,    78,    79,
 
438
      80,    81,    82,    83,    84,    85,    86,    72,    73,    74,
 
439
      75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
 
440
      85,    86,    73,    74,    75,    76,    77,    78,    79,    80,
 
441
      81,    82,    83,    84,    85,    86,    74,    75,    76,    77,
 
442
      78,    79,    80,    81,    82,    83,    84,    85,    86,-32768,
 
443
  -32768,    76,    77,    78,    79,    80,    81,    82,    83,    84,
 
444
      85,    86,-32768,-32768,-32768,-32768,    80,    81,    82,    83,
 
445
      84,    85,    86
 
446
};
 
447
 
 
448
static const short excheck[] =
 
449
{
 
450
      31,     6,    51,     8,    24,    25,    26,    27,    18,    13,
 
451
      30,    53,    52,    17,    53,    20,    24,    18,    28,    86,
 
452
      28,    53,    42,    24,    44,    24,    46,    28,    13,    28,
 
453
      50,    51,    17,    53,    54,    77,    78,    80,    87,    80,
 
454
      45,    80,    80,    85,    84,    77,    78,    67,    26,    69,
 
455
      70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
 
456
      80,    81,    82,    83,    84,    85,    86,    87,    88,    71,
 
457
      72,    73,     6,     7,     8,     9,    88,    11,    84,    83,
 
458
      14,    15,    16,    80,    18,    80,    20,    21,    22,    80,
 
459
      24,    25,   112,    80,    28,    28,    29,   117,    32,    33,
 
460
      34,    35,    36,    37,    38,     6,     7,     8,     9,   144,
 
461
      80,    84,    45,    14,   149,    84,    28,   152,    69,    70,
 
462
      71,    72,    73,   154,    84,    55,   146,    85,    84,    52,
 
463
      85,    88,    85,    85,    84,    69,    70,    86,   143,   174,
 
464
      74,    75,    85,    77,    78,    87,    80,    19,    82,    16,
 
465
      84,    82,   187,    85,    52,    55,    85,   177,    85,    16,
 
466
      55,   192,    82,     0,     0,   192,   188,   139,   173,    43,
 
467
     196,     6,     7,     8,     9,   158,    11,   105,   209,    14,
 
468
      15,    16,    -1,    18,    -1,    20,    21,    22,    -1,    24,
 
469
      25,    -1,    -1,    28,    -1,    -1,    -1,    32,    33,    34,
 
470
      35,    36,    37,    38,    -1,    -1,    52,    -1,    54,    -1,
 
471
      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
 
472
      66,    67,    68,    69,    70,    71,    72,    73,    -1,    -1,
 
473
      -1,    -1,    -1,    -1,    69,    70,    -1,    -1,    -1,    74,
 
474
      75,    87,    77,    78,    -1,    80,    -1,    82,    83,     6,
 
475
       7,     8,     9,    -1,    11,    -1,    -1,    14,    15,    16,
 
476
      -1,    18,    -1,    20,    21,    22,    -1,    24,    25,    -1,
 
477
      -1,    28,    -1,    -1,    -1,    32,    33,    34,    35,    36,
 
478
      37,    38,    52,    -1,    54,    -1,    56,    57,    58,    59,
 
479
      60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
 
480
      70,    71,    72,    73,    -1,    -1,    -1,    -1,    -1,    -1,
 
481
      -1,    -1,    69,    70,    -1,    85,    -1,    74,    75,    -1,
 
482
      77,    78,    -1,    80,    -1,    82,    83,     6,     7,     8,
 
483
       9,    -1,    11,    -1,    -1,    14,    15,    16,    -1,    18,
 
484
      -1,    20,    21,    22,    -1,    24,    25,    -1,    -1,    28,
 
485
      -1,    -1,    -1,    32,    33,    34,    35,    36,    37,    38,
 
486
      52,    -1,    54,    -1,    56,    57,    58,    59,    60,    61,
 
487
      62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
 
488
      72,    73,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
 
489
      69,    70,    -1,    85,    -1,    74,    75,    -1,    77,    78,
 
490
      -1,    80,    -1,    82,     6,     7,     8,     9,    -1,    -1,
 
491
      -1,    -1,    14,    -1,    16,    -1,    18,    -1,    20,    -1,
 
492
      22,    -1,    24,    -1,    -1,    -1,    28,    -1,    -1,    -1,
 
493
      32,    33,    34,    -1,    36,     6,     7,     8,     9,    -1,
 
494
      -1,    -1,    -1,    14,    -1,    -1,    -1,    18,    -1,    20,
 
495
      -1,    22,    -1,    24,    -1,    -1,    -1,    28,    -1,    -1,
 
496
      -1,    32,    33,    34,    -1,    36,    -1,    69,    70,    -1,
 
497
      -1,    -1,    74,    75,    -1,    77,    78,    54,    80,    56,
 
498
      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
 
499
      67,    68,    69,    70,    71,    72,    73,    -1,    69,    70,
 
500
      -1,    -1,    -1,    74,    75,    -1,    77,    78,    52,    80,
 
501
      54,    -1,    56,    57,    58,    59,    60,    61,    62,    63,
 
502
      64,    65,    66,    67,    68,    69,    70,    71,    72,    73,
 
503
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    52,    -1,
 
504
      54,    85,    56,    57,    58,    59,    60,    61,    62,    63,
 
505
      64,    65,    66,    67,    68,    69,    70,    71,    72,    73,
 
506
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
 
507
      52,    85,    54,    55,    56,    57,    58,    59,    60,    61,
 
508
      62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
 
509
      72,    73,    52,    -1,    54,    -1,    56,    57,    58,    59,
 
510
      60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
 
511
      70,    71,    72,    73,    57,    58,    59,    60,    61,    62,
 
512
      63,    64,    65,    66,    67,    68,    69,    70,    71,    72,
 
513
      73,    58,    59,    60,    61,    62,    63,    64,    65,    66,
 
514
      67,    68,    69,    70,    71,    72,    73,    59,    60,    61,
 
515
      62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
 
516
      72,    73,    60,    61,    62,    63,    64,    65,    66,    67,
 
517
      68,    69,    70,    71,    72,    73,    61,    62,    63,    64,
 
518
      65,    66,    67,    68,    69,    70,    71,    72,    73,    61,
 
519
      62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
 
520
      72,    73,    63,    64,    65,    66,    67,    68,    69,    70,
 
521
      71,    72,    73
 
522
};
 
523
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
 
524
#line 3 "/usr/share/bison/bison.simple"
 
525
 
 
526
/* Skeleton output parser for bison,
 
527
   Copyright 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc.
 
528
 
 
529
   This program is free software; you can redistribute it and/or modify
 
530
   it under the terms of the GNU General Public License as published by
 
531
   the Free Software Foundation; either version 2, or (at your option)
 
532
   any later version.
 
533
 
 
534
   This program is distributed in the hope that it will be useful,
 
535
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
536
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
537
   GNU General Public License for more details.
 
538
 
 
539
   You should have received a copy of the GNU General Public License
 
540
   along with this program; if not, write to the Free Software
 
541
   Foundation, Inc., 59 Temple Place - Suite 330,
 
542
   Boston, MA 02111-1307, USA.  */
 
543
 
 
544
/* As a special exception, when this file is copied by Bison into a
 
545
   Bison output file, you may use that output file without restriction.
 
546
   This special exception was added by the Free Software Foundation
 
547
   in version 1.24 of Bison.  */
 
548
 
 
549
/* This is the parser code that is written into each bison parser when
 
550
   the %semantic_parser declaration is not specified in the grammar.
 
551
   It was written by Richard Stallman by simplifying the hairy parser
 
552
   used when %semantic_parser is specified.  */
 
553
 
 
554
#ifndef EXSTACK_USE_ALLOCA
 
555
# ifdef alloca
 
556
#  define EXSTACK_USE_ALLOCA 1
 
557
# else /* alloca not defined */
 
558
#  ifdef __GNUC__
 
559
#   define EXSTACK_USE_ALLOCA 1
 
560
#   define alloca __builtin_alloca
 
561
#  else /* not GNU C.  */
 
562
#   if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
 
563
#    define EXSTACK_USE_ALLOCA 1
 
564
#    include <alloca.h>
 
565
#   else /* not sparc */
 
566
     /* We think this test detects Watcom and Microsoft C.  */
 
567
     /* This used to test MSDOS, but that is a bad idea since that
 
568
        symbol is in the user namespace.  */
 
569
#    if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
 
570
#     if 0
 
571
       /* No need for malloc.h, which pollutes the namespace; instead,
 
572
          just don't use alloca.  */
 
573
#      include <malloc.h>
 
574
#     endif
 
575
#    else /* not MSDOS, or __TURBOC__ */
 
576
#     if defined(_AIX)
 
577
       /* I don't know what this was needed for, but it pollutes the
 
578
          namespace.  So I turned it off.  rms, 2 May 1997.  */
 
579
       /* #include <malloc.h>  */
 
580
 #pragma alloca
 
581
#      define EXSTACK_USE_ALLOCA 1
 
582
#     else /* not MSDOS, or __TURBOC__, or _AIX */
 
583
#      if 0
 
584
        /* haible@ilog.fr says this works for HPUX 9.05 and up, and on
 
585
           HPUX 10.  Eventually we can turn this on.  */
 
586
#       ifdef __hpux
 
587
#        define EXSTACK_USE_ALLOCA 1
 
588
#        define alloca __builtin_alloca
 
589
#       endif /* __hpux */
 
590
#      endif
 
591
#     endif /* not _AIX */
 
592
#    endif /* not MSDOS, or __TURBOC__ */
 
593
#   endif /* not sparc */
 
594
#  endif /* not GNU C */
 
595
# endif /* alloca not defined */
 
596
#endif /* EXSTACK_USE_ALLOCA not defined */
 
597
 
 
598
#ifndef EXSTACK_USE_ALLOCA
 
599
# define EXSTACK_USE_ALLOCA 0
 
600
#endif
 
601
 
 
602
#if EXSTACK_USE_ALLOCA
 
603
# define EXSTACK_ALLOC alloca
 
604
#else
 
605
# define EXSTACK_ALLOC malloc
 
606
#endif
 
607
 
 
608
#define exerrok         (exerrstatus = 0)
 
609
#define exclearin       (exchar = EXEMPTY)
 
610
#define EXEMPTY         -2
 
611
#define EXEOF           0
 
612
#define EXACCEPT        goto exacceptlab
 
613
#define EXABORT         goto exabortlab
 
614
#define EXERROR         goto exerrlab1
 
615
/* Like EXERROR except do call exerror.  This remains here temporarily
 
616
   to ease the transition to the new meaning of EXERROR, for GCC.
 
617
   Once GCC version 2 has supplanted version 1, this can go.  */
 
618
#define EXFAIL          goto exerrlab
 
619
#define EXRECOVERING()  (!!exerrstatus)
 
620
#define EXBACKUP(Token, Value)                                  \
 
621
do                                                              \
 
622
  if (exchar == EXEMPTY && exlen == 1)                          \
 
623
    {                                                           \
 
624
      exchar = (Token);                                         \
 
625
      exlval = (Value);                                         \
 
626
      exchar1 = EXTRANSLATE (exchar);                           \
 
627
      EXPOPSTACK;                                               \
 
628
      goto exbackup;                                            \
 
629
    }                                                           \
 
630
  else                                                          \
 
631
    {                                                           \
 
632
      exerror ("syntax error: cannot back up");                 \
 
633
      EXERROR;                                                  \
 
634
    }                                                           \
 
635
while (0)
 
636
 
 
637
#define EXTERROR        1
 
638
#define EXERRCODE       256
 
639
 
 
640
 
 
641
/* EXLLOC_DEFAULT -- Compute the default location (before the actions
 
642
   are run).
 
643
 
 
644
   When EXLLOC_DEFAULT is run, CURRENT is set the location of the
 
645
   first token.  By default, to implement support for ranges, extend
 
646
   its range to the last symbol.  */
 
647
 
 
648
#ifndef EXLLOC_DEFAULT
 
649
# define EXLLOC_DEFAULT(Current, Rhs, N)        \
 
650
   Current.last_line   = Rhs[N].last_line;      \
 
651
   Current.last_column = Rhs[N].last_column;
 
652
#endif
 
653
 
 
654
 
 
655
/* EXLEX -- calling `exlex' with the right arguments.  */
 
656
 
 
657
#if EXPURE
 
658
# if EXLSP_NEEDED
 
659
#  ifdef EXLEX_PARAM
 
660
#   define EXLEX                exlex (&exlval, &exlloc, EXLEX_PARAM)
 
661
#  else
 
662
#   define EXLEX                exlex (&exlval, &exlloc)
 
663
#  endif
 
664
# else /* !EXLSP_NEEDED */
 
665
#  ifdef EXLEX_PARAM
 
666
#   define EXLEX                exlex (&exlval, EXLEX_PARAM)
 
667
#  else
 
668
#   define EXLEX                exlex (&exlval)
 
669
#  endif
 
670
# endif /* !EXLSP_NEEDED */
 
671
#else /* !EXPURE */
 
672
# define EXLEX                  exlex ()
 
673
#endif /* !EXPURE */
 
674
 
 
675
 
 
676
/* Enable debugging if requested.  */
 
677
#if EXDEBUG
 
678
# define EXDPRINTF(Args)                        \
 
679
do {                                            \
 
680
  if (exdebug)                                  \
 
681
    fprintf Args;                               \
 
682
} while (0)
 
683
/* Nonzero means print parse trace. [The following comment makes no
 
684
   sense to me.  Could someone clarify it?  --akim] Since this is
 
685
   uninitialized, it does not stop multiple parsers from coexisting.
 
686
   */
 
687
int exdebug;
 
688
#else /* !EXDEBUG */
 
689
# define EXDPRINTF(Args)
 
690
#endif /* !EXDEBUG */
 
691
 
 
692
/* EXINITDEPTH -- initial size of the parser's stacks.  */
 
693
#ifndef EXINITDEPTH
 
694
# define EXINITDEPTH 200
 
695
#endif
 
696
 
 
697
/* EXMAXDEPTH -- maximum size the stacks can grow to (effective only
 
698
   if the built-in stack extension method is used).  */
 
699
#if EXMAXDEPTH == 0
 
700
# undef EXMAXDEPTH
 
701
#endif
 
702
 
 
703
#ifndef EXMAXDEPTH
 
704
# define EXMAXDEPTH 10000
 
705
#endif
 
706
 
 
707
/* Define __ex_memcpy.  Note that the size argument
 
708
   should be passed with type unsigned int, because that is what the non-GCC
 
709
   definitions require.  With GCC, __builtin_memcpy takes an arg
 
710
   of type size_t, but it can handle unsigned int.  */
 
711
 
 
712
#if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
 
713
# define __ex_memcpy(To, From, Count)   __builtin_memcpy (To, From, Count)
 
714
#else                           /* not GNU C or C++ */
 
715
 
 
716
/* This is the most reliable way to avoid incompatibilities
 
717
   in available built-in functions on various systems.  */
 
718
static void
 
719
# ifndef __cplusplus
 
720
__ex_memcpy (to, from, count)
 
721
     char *to;
 
722
     const char *from;
 
723
     unsigned int count;
 
724
# else /* __cplusplus */
 
725
__ex_memcpy (char *to, const char *from, unsigned int count)
 
726
# endif
 
727
{
 
728
  register const char *f = from;
 
729
  register char *t = to;
 
730
  register int i = count;
 
731
 
 
732
  while (i-- > 0)
 
733
    *t++ = *f++;
 
734
}
 
735
 
 
736
#endif
 
737
 
 
738
#line 216 "/usr/share/bison/bison.simple"
 
739
 
 
740
 
 
741
/* The user can define EXPARSE_PARAM as the name of an argument to be passed
 
742
   into exparse.  The argument should have type void *.
 
743
   It should actually point to an object.
 
744
   Grammar actions can access the variable by casting it
 
745
   to the proper pointer type.  */
 
746
 
 
747
#ifdef EXPARSE_PARAM
 
748
# ifdef __cplusplus
 
749
#  define EXPARSE_PARAM_ARG void *EXPARSE_PARAM
 
750
#  define EXPARSE_PARAM_DECL
 
751
# else /* !__cplusplus */
 
752
#  define EXPARSE_PARAM_ARG EXPARSE_PARAM
 
753
#  define EXPARSE_PARAM_DECL void *EXPARSE_PARAM;
 
754
# endif /* !__cplusplus */
 
755
#else /* !EXPARSE_PARAM */
 
756
# define EXPARSE_PARAM_ARG
 
757
# define EXPARSE_PARAM_DECL
 
758
#endif /* !EXPARSE_PARAM */
 
759
 
 
760
/* Prevent warning if -Wstrict-prototypes.  */
 
761
#ifdef __GNUC__
 
762
# ifdef EXPARSE_PARAM
 
763
int exparse (void *);
 
764
# else
 
765
int exparse (void);
 
766
# endif
 
767
#endif
 
768
 
 
769
/* EX_DECL_VARIABLES -- depending whether we use a pure parser,
 
770
   variables are global, or local to EXPARSE.  */
 
771
 
 
772
#define _EX_DECL_VARIABLES                              \
 
773
/* The lookahead symbol.  */                            \
 
774
int exchar;                                             \
 
775
                                                        \
 
776
/* The semantic value of the lookahead symbol. */       \
 
777
EXSTYPE exlval;                                         \
 
778
                                                        \
 
779
/* Number of parse errors so far.  */                   \
 
780
int exnerrs;
 
781
 
 
782
#if EXLSP_NEEDED
 
783
# define EX_DECL_VARIABLES                      \
 
784
_EX_DECL_VARIABLES                              \
 
785
                                                \
 
786
/* Location data for the lookahead symbol.  */  \
 
787
EXLTYPE exlloc;
 
788
#else
 
789
# define EX_DECL_VARIABLES                      \
 
790
_EX_DECL_VARIABLES
 
791
#endif
 
792
 
 
793
 
 
794
/* If nonreentrant, generate the variables here. */
 
795
 
 
796
#if !EXPURE
 
797
EX_DECL_VARIABLES
 
798
#endif  /* !EXPURE */
 
799
 
 
800
int
 
801
exparse (EXPARSE_PARAM_ARG)
 
802
     EXPARSE_PARAM_DECL
 
803
{
 
804
  /* If reentrant, generate the variables here. */
 
805
#if EXPURE
 
806
  EX_DECL_VARIABLES
 
807
#endif  /* !EXPURE */
 
808
 
 
809
  register int exstate;
 
810
  register int exn;
 
811
  /* Number of tokens to shift before error messages enabled.  */
 
812
  int exerrstatus;
 
813
  /* Lookahead token as an internal (translated) token number.  */
 
814
  int exchar1 = 0;
 
815
 
 
816
  /* Three stacks and their tools:
 
817
     `exss': related to states,
 
818
     `exsv': related to semantic values,
 
819
     `exls': related to locations.
 
820
 
 
821
     Refer to the stacks thru separate pointers, to allow exoverflow
 
822
     to reallocate them elsewhere.  */
 
823
 
 
824
  /* The state stack. */
 
825
  short exssa[EXINITDEPTH];
 
826
  short *exss = exssa;
 
827
  register short *exssp;
 
828
 
 
829
  /* The semantic value stack.  */
 
830
  EXSTYPE exvsa[EXINITDEPTH];
 
831
  EXSTYPE *exvs = exvsa;
 
832
  register EXSTYPE *exvsp;
 
833
 
 
834
#if EXLSP_NEEDED
 
835
  /* The location stack.  */
 
836
  EXLTYPE exlsa[EXINITDEPTH];
 
837
  EXLTYPE *exls = exlsa;
 
838
  EXLTYPE *exlsp;
 
839
#endif
 
840
 
 
841
#if EXLSP_NEEDED
 
842
# define EXPOPSTACK   (exvsp--, exssp--, exlsp--)
 
843
#else
 
844
# define EXPOPSTACK   (exvsp--, exssp--)
 
845
#endif
 
846
 
 
847
  int exstacksize = EXINITDEPTH;
 
848
  int exfree_stacks = 0;
 
849
 
 
850
 
 
851
  /* The variables used to return semantic value and location from the
 
852
     action routines.  */
 
853
  EXSTYPE exval;
 
854
# if EXLSP_NEEDED
 
855
  EXLTYPE exloc;
 
856
# endif
 
857
 
 
858
  /* When reducing, the number of symbols on the RHS of the reduced
 
859
     rule. */
 
860
  int exlen;
 
861
 
 
862
  EXDPRINTF ((stderr, "Starting parse\n"));
 
863
 
 
864
  exstate = 0;
 
865
  exerrstatus = 0;
 
866
  exnerrs = 0;
 
867
  exchar = EXEMPTY;             /* Cause a token to be read.  */
 
868
 
 
869
  /* Initialize stack pointers.
 
870
     Waste one element of value and location stack
 
871
     so that they stay on the same level as the state stack.
 
872
     The wasted elements are never initialized.  */
 
873
 
 
874
  exssp = exss;
 
875
  exvsp = exvs;
 
876
#if EXLSP_NEEDED
 
877
  exlsp = exls;
 
878
#endif
 
879
  goto exsetstate;
 
880
 
 
881
/*------------------------------------------------------------.
 
882
| exnewstate -- Push a new state, which is found in exstate.  |
 
883
`------------------------------------------------------------*/
 
884
 exnewstate:
 
885
  /* In all cases, when you get here, the value and location stacks
 
886
     have just been pushed. so pushing a state here evens the stacks.
 
887
     */
 
888
  exssp++;
 
889
 
 
890
 exsetstate:
 
891
  *exssp = exstate;
 
892
 
 
893
  if (exssp >= exss + exstacksize - 1)
 
894
    {
 
895
      /* Give user a chance to reallocate the stack. Use copies of
 
896
         these so that the &'s don't force the real ones into memory.
 
897
         */
 
898
      EXSTYPE *exvs1 = exvs;
 
899
      short *exss1 = exss;
 
900
#if EXLSP_NEEDED
 
901
      EXLTYPE *exls1 = exls;
 
902
#endif
 
903
 
 
904
      /* Get the current used size of the three stacks, in elements.  */
 
905
      int size = exssp - exss + 1;
 
906
 
 
907
#ifdef exoverflow
 
908
      /* Each stack pointer address is followed by the size of the
 
909
         data in use in that stack, in bytes.  */
 
910
# if EXLSP_NEEDED
 
911
      /* This used to be a conditional around just the two extra args,
 
912
         but that might be undefined if exoverflow is a macro.  */
 
913
      exoverflow ("parser stack overflow",
 
914
                  &exss1, size * sizeof (*exssp),
 
915
                  &exvs1, size * sizeof (*exvsp),
 
916
                  &exls1, size * sizeof (*exlsp),
 
917
                  &exstacksize);
 
918
# else
 
919
      exoverflow ("parser stack overflow",
 
920
                  &exss1, size * sizeof (*exssp),
 
921
                  &exvs1, size * sizeof (*exvsp),
 
922
                  &exstacksize);
 
923
# endif
 
924
 
 
925
      exss = exss1; exvs = exvs1;
 
926
# if EXLSP_NEEDED
 
927
      exls = exls1;
 
928
# endif
 
929
#else /* no exoverflow */
 
930
      /* Extend the stack our own way.  */
 
931
      if (exstacksize >= EXMAXDEPTH)
 
932
        {
 
933
          exerror ("parser stack overflow");
 
934
          if (exfree_stacks)
 
935
            {
 
936
              free (exss);
 
937
              free (exvs);
 
938
# if EXLSP_NEEDED
 
939
              free (exls);
 
940
# endif
 
941
            }
 
942
          return 2;
 
943
        }
 
944
      exstacksize *= 2;
 
945
      if (exstacksize > EXMAXDEPTH)
 
946
        exstacksize = EXMAXDEPTH;
 
947
# if !EXSTACK_USE_ALLOCA
 
948
      exfree_stacks = 1;
 
949
# endif
 
950
      exss = (short *) EXSTACK_ALLOC (exstacksize * sizeof (*exssp));
 
951
      __ex_memcpy ((char *)exss, (char *)exss1,
 
952
                   size * (unsigned int) sizeof (*exssp));
 
953
      exvs = (EXSTYPE *) EXSTACK_ALLOC (exstacksize * sizeof (*exvsp));
 
954
      __ex_memcpy ((char *)exvs, (char *)exvs1,
 
955
                   size * (unsigned int) sizeof (*exvsp));
 
956
# if EXLSP_NEEDED
 
957
      exls = (EXLTYPE *) EXSTACK_ALLOC (exstacksize * sizeof (*exlsp));
 
958
      __ex_memcpy ((char *)exls, (char *)exls1,
 
959
                   size * (unsigned int) sizeof (*exlsp));
 
960
# endif
 
961
#endif /* no exoverflow */
 
962
 
 
963
      exssp = exss + size - 1;
 
964
      exvsp = exvs + size - 1;
 
965
#if EXLSP_NEEDED
 
966
      exlsp = exls + size - 1;
 
967
#endif
 
968
 
 
969
      EXDPRINTF ((stderr, "Stack size increased to %d\n", exstacksize));
 
970
 
 
971
      if (exssp >= exss + exstacksize - 1)
 
972
        EXABORT;
 
973
    }
 
974
 
 
975
  EXDPRINTF ((stderr, "Entering state %d\n", exstate));
 
976
 
 
977
  goto exbackup;
 
978
 
 
979
 
 
980
/*-----------.
 
981
| exbackup.  |
 
982
`-----------*/
 
983
exbackup:
 
984
 
 
985
/* Do appropriate processing given the current state.  */
 
986
/* Read a lookahead token if we need one and don't already have one.  */
 
987
/* exresume: */
 
988
 
 
989
  /* First try to decide what to do without reference to lookahead token.  */
 
990
 
 
991
  exn = expact[exstate];
 
992
  if (exn == EXFLAG)
 
993
    goto exdefault;
 
994
 
 
995
  /* Not known => get a lookahead token if don't already have one.  */
 
996
 
 
997
  /* exchar is either EXEMPTY or EXEOF
 
998
     or a valid token in external form.  */
 
999
 
 
1000
  if (exchar == EXEMPTY)
 
1001
    {
 
1002
      EXDPRINTF ((stderr, "Reading a token: "));
 
1003
      exchar = EXLEX;
 
1004
    }
 
1005
 
 
1006
  /* Convert token to internal form (in exchar1) for indexing tables with */
 
1007
 
 
1008
  if (exchar <= 0)              /* This means end of input. */
 
1009
    {
 
1010
      exchar1 = 0;
 
1011
      exchar = EXEOF;           /* Don't call EXLEX any more */
 
1012
 
 
1013
      EXDPRINTF ((stderr, "Now at end of input.\n"));
 
1014
    }
 
1015
  else
 
1016
    {
 
1017
      exchar1 = EXTRANSLATE (exchar);
 
1018
 
 
1019
#if EXDEBUG
 
1020
     /* We have to keep this `#if EXDEBUG', since we use variables
 
1021
        which are defined only if `EXDEBUG' is set.  */
 
1022
      if (exdebug)
 
1023
        {
 
1024
          fprintf (stderr, "Next token is %d (%s", exchar, extname[exchar1]);
 
1025
          /* Give the individual parser a way to print the precise
 
1026
             meaning of a token, for further debugging info.  */
 
1027
# ifdef EXPRINT
 
1028
          EXPRINT (stderr, exchar, exlval);
 
1029
# endif
 
1030
          fprintf (stderr, ")\n");
 
1031
        }
 
1032
#endif
 
1033
    }
 
1034
 
 
1035
  exn += exchar1;
 
1036
  if (exn < 0 || exn > EXLAST || excheck[exn] != exchar1)
 
1037
    goto exdefault;
 
1038
 
 
1039
  exn = extable[exn];
 
1040
 
 
1041
  /* exn is what to do for this token type in this state.
 
1042
     Negative => reduce, -exn is rule number.
 
1043
     Positive => shift, exn is new state.
 
1044
       New state is final state => don't bother to shift,
 
1045
       just return success.
 
1046
     0, or most negative number => error.  */
 
1047
 
 
1048
  if (exn < 0)
 
1049
    {
 
1050
      if (exn == EXFLAG)
 
1051
        goto exerrlab;
 
1052
      exn = -exn;
 
1053
      goto exreduce;
 
1054
    }
 
1055
  else if (exn == 0)
 
1056
    goto exerrlab;
 
1057
 
 
1058
  if (exn == EXFINAL)
 
1059
    EXACCEPT;
 
1060
 
 
1061
  /* Shift the lookahead token.  */
 
1062
  EXDPRINTF ((stderr, "Shifting token %d (%s), ", exchar, extname[exchar1]));
 
1063
 
 
1064
  /* Discard the token being shifted unless it is eof.  */
 
1065
  if (exchar != EXEOF)
 
1066
    exchar = EXEMPTY;
 
1067
 
 
1068
  *++exvsp = exlval;
 
1069
#if EXLSP_NEEDED
 
1070
  *++exlsp = exlloc;
 
1071
#endif
 
1072
 
 
1073
  /* Count tokens shifted since error; after three, turn off error
 
1074
     status.  */
 
1075
  if (exerrstatus)
 
1076
    exerrstatus--;
 
1077
 
 
1078
  exstate = exn;
 
1079
  goto exnewstate;
 
1080
 
 
1081
 
 
1082
/*-----------------------------------------------------------.
 
1083
| exdefault -- do the default action for the current state.  |
 
1084
`-----------------------------------------------------------*/
 
1085
exdefault:
 
1086
  exn = exdefact[exstate];
 
1087
  if (exn == 0)
 
1088
    goto exerrlab;
 
1089
  goto exreduce;
 
1090
 
 
1091
 
 
1092
/*-----------------------------.
 
1093
| exreduce -- Do a reduction.  |
 
1094
`-----------------------------*/
 
1095
exreduce:
 
1096
  /* exn is the number of a rule to reduce with.  */
 
1097
  exlen = exr2[exn];
 
1098
 
 
1099
  /* If EXLEN is nonzero, implement the default value of the action:
 
1100
     `$$ = $1'.
 
1101
 
 
1102
     Otherwise, the following line sets EXVAL to the semantic value of
 
1103
     the lookahead token.  This behavior is undocumented and Bison
 
1104
     users should not rely upon it.  Assigning to EXVAL
 
1105
     unconditionally makes the parser a bit smaller, and it avoids a
 
1106
     GCC warning that EXVAL may be used uninitialized.  */
 
1107
  exval = exvsp[1-exlen];
 
1108
 
 
1109
#if EXLSP_NEEDED
 
1110
  /* Similarly for the default location.  Let the user run additional
 
1111
     commands if for instance locations are ranges.  */
 
1112
  exloc = exlsp[1-exlen];
 
1113
  EXLLOC_DEFAULT (exloc, (exlsp - exlen), exlen);
 
1114
#endif
 
1115
 
 
1116
#if EXDEBUG
 
1117
  /* We have to keep this `#if EXDEBUG', since we use variables which
 
1118
     are defined only if `EXDEBUG' is set.  */
 
1119
  if (exdebug)
 
1120
    {
 
1121
      int i;
 
1122
 
 
1123
      fprintf (stderr, "Reducing via rule %d (line %d), ",
 
1124
               exn, exrline[exn]);
 
1125
 
 
1126
      /* Print the symbols being reduced, and their result.  */
 
1127
      for (i = exprhs[exn]; exrhs[i] > 0; i++)
 
1128
        fprintf (stderr, "%s ", extname[exrhs[i]]);
 
1129
      fprintf (stderr, " -> %s\n", extname[exr1[exn]]);
 
1130
    }
 
1131
#endif
 
1132
 
 
1133
  switch (exn) {
 
1134
 
 
1135
case 1:
 
1136
#line 137 "exparse.y"
 
1137
{
 
1138
                        if (exvsp[-1].expr && !(expr.program->disc->flags & EX_STRICT))
 
1139
                        {
 
1140
                                if (expr.program->main.value && !(expr.program->disc->flags & EX_RETAIN))
 
1141
                                        exfreenode(expr.program, expr.program->main.value);
 
1142
                                if (exvsp[-1].expr->op == S2B)
 
1143
                                {
 
1144
                                        Exnode_t*       x;
 
1145
 
 
1146
                                        x = exvsp[-1].expr;
 
1147
                                        exvsp[-1].expr = x->data.operand.left;
 
1148
                                        x->data.operand.left = 0;
 
1149
                                        exfreenode(expr.program, x);
 
1150
                                }
 
1151
                                expr.program->main.lex = PROCEDURE;
 
1152
                                expr.program->main.value = exnewnode(expr.program, PROCEDURE, 1, exvsp[-1].expr->type, NiL, exvsp[-1].expr);
 
1153
                        }
 
1154
                ;
 
1155
    break;}
 
1156
case 4:
 
1157
#line 161 "exparse.y"
 
1158
{
 
1159
                                register Dtdisc_t*      disc;
 
1160
 
 
1161
                                if (expr.procedure)
 
1162
                                        exerror("no nested function definitions");
 
1163
                                exvsp[-1].id->lex = PROCEDURE;
 
1164
                                expr.procedure = exvsp[-1].id->value = exnewnode(expr.program, PROCEDURE, 1, exvsp[-1].id->type, NiL, NiL);
 
1165
                                expr.procedure->type = INTEGER;
 
1166
                                if (!(disc = newof(0, Dtdisc_t, 1, 0)))
 
1167
                                        exerror("out of space [frame discipline]");
 
1168
                                disc->key = offsetof(Exid_t, name);
 
1169
                                if (!(expr.procedure->data.procedure.frame = dtopen(disc, Dtset)) || !dtview(expr.procedure->data.procedure.frame, expr.program->symbols))
 
1170
                                        exerror("out of space [frame table]");
 
1171
                                expr.program->symbols = expr.program->frame = expr.procedure->data.procedure.frame;
 
1172
                        ;
 
1173
    break;}
 
1174
case 5:
 
1175
#line 176 "exparse.y"
 
1176
{
 
1177
                        expr.procedure = 0;
 
1178
                        if (expr.program->frame)
 
1179
                        {
 
1180
                                expr.program->symbols = expr.program->frame->view;
 
1181
                                dtview(expr.program->frame, NiL);
 
1182
                        }
 
1183
                        if (exvsp[0].expr && exvsp[0].expr->op == S2B)
 
1184
                        {
 
1185
                                Exnode_t*       x;
 
1186
 
 
1187
                                x = exvsp[0].expr;
 
1188
                                exvsp[0].expr = x->data.operand.left;
 
1189
                                x->data.operand.left = 0;
 
1190
                                exfreenode(expr.program, x);
 
1191
                        }
 
1192
                        exvsp[-3].id->value->data.operand.right = excast(expr.program, exvsp[0].expr, exvsp[-3].id->type, NiL, 0);
 
1193
                ;
 
1194
    break;}
 
1195
case 6:
 
1196
#line 197 "exparse.y"
 
1197
{
 
1198
                        exval.expr = 0;
 
1199
                ;
 
1200
    break;}
 
1201
case 7:
 
1202
#line 201 "exparse.y"
 
1203
{
 
1204
                        if (!exvsp[-1].expr)
 
1205
                                exval.expr = exvsp[0].expr;
 
1206
                        else if (!exvsp[0].expr)
 
1207
                                exval.expr = exvsp[-1].expr;
 
1208
                        else if (exvsp[-1].expr->op == CONSTANT)
 
1209
                        {
 
1210
                                exfreenode(expr.program, exvsp[-1].expr);
 
1211
                                exval.expr = exvsp[0].expr;
 
1212
                        }
 
1213
                        else exval.expr = exnewnode(expr.program, ';', 1, exvsp[0].expr->type, exvsp[-1].expr, exvsp[0].expr);
 
1214
                ;
 
1215
    break;}
 
1216
case 8:
 
1217
#line 216 "exparse.y"
 
1218
{
 
1219
                        exval.expr = exvsp[-1].expr;
 
1220
                ;
 
1221
    break;}
 
1222
case 9:
 
1223
#line 220 "exparse.y"
 
1224
{
 
1225
                        exval.expr = (exvsp[-1].expr && exvsp[-1].expr->type == STRING) ? exnewnode(expr.program, S2B, 1, INTEGER, exvsp[-1].expr, NiL) : exvsp[-1].expr;
 
1226
                ;
 
1227
    break;}
 
1228
case 10:
 
1229
#line 223 "exparse.y"
 
1230
{expr.declare=exvsp[0].id->type;;
 
1231
    break;}
 
1232
case 11:
 
1233
#line 224 "exparse.y"
 
1234
{
 
1235
                        exval.expr = exvsp[-1].expr;
 
1236
                ;
 
1237
    break;}
 
1238
case 12:
 
1239
#line 228 "exparse.y"
 
1240
{
 
1241
                        if (exvsp[-3].expr->type == STRING)
 
1242
                                exvsp[-3].expr = exnewnode(expr.program, S2B, 1, INTEGER, exvsp[-3].expr, NiL);
 
1243
                        else if (!INTEGRAL(exvsp[-3].expr->type))
 
1244
                                exvsp[-3].expr = excast(expr.program, exvsp[-3].expr, INTEGER, NiL, 0);
 
1245
                        exval.expr = exnewnode(expr.program, exvsp[-5].id->index, 1, INTEGER, exvsp[-3].expr, exnewnode(expr.program, ':', 1, exvsp[-1].expr ? exvsp[-1].expr->type : 0, exvsp[-1].expr, exvsp[0].expr));
 
1246
                ;
 
1247
    break;}
 
1248
case 13:
 
1249
#line 236 "exparse.y"
 
1250
{
 
1251
                        exval.expr = exnewnode(expr.program, ITERATE, 0, INTEGER, NiL, NiL);
 
1252
                        exval.expr->data.generate.array = exvsp[-2].expr;
 
1253
                        if (!exvsp[-2].expr->data.variable.index || exvsp[-2].expr->data.variable.index->op != DYNAMIC)
 
1254
                                exerror("simple index variable expected");
 
1255
                        exval.expr->data.generate.index = exvsp[-2].expr->data.variable.index->data.variable.symbol;
 
1256
                        if (exvsp[-2].expr->op == ID && exval.expr->data.generate.index->type != INTEGER)
 
1257
                                exerror("integer index variable expected");
 
1258
                        exfreenode(expr.program, exvsp[-2].expr->data.variable.index);
 
1259
                        exvsp[-2].expr->data.variable.index = 0;
 
1260
                        exval.expr->data.generate.statement = exvsp[0].expr;
 
1261
                ;
 
1262
    break;}
 
1263
case 14:
 
1264
#line 249 "exparse.y"
 
1265
{
 
1266
                        if (!exvsp[-4].expr)
 
1267
                        {
 
1268
                                exvsp[-4].expr = exnewnode(expr.program, CONSTANT, 0, INTEGER, NiL, NiL);
 
1269
                                exvsp[-4].expr->data.constant.value.integer = 1;
 
1270
                        }
 
1271
                        else if (exvsp[-4].expr->type == STRING)
 
1272
                                exvsp[-4].expr = exnewnode(expr.program, S2B, 1, INTEGER, exvsp[-4].expr, NiL);
 
1273
                        else if (!INTEGRAL(exvsp[-4].expr->type))
 
1274
                                exvsp[-4].expr = excast(expr.program, exvsp[-4].expr, INTEGER, NiL, 0);
 
1275
                        exval.expr = exnewnode(expr.program, exvsp[-8].id->index, 1, INTEGER, exvsp[-4].expr, exnewnode(expr.program, ';', 1, 0, exvsp[-2].expr, exvsp[0].expr));
 
1276
                        if (exvsp[-6].expr)
 
1277
                                exval.expr = exnewnode(expr.program, ';', 1, INTEGER, exvsp[-6].expr, exval.expr);
 
1278
                ;
 
1279
    break;}
 
1280
case 15:
 
1281
#line 264 "exparse.y"
 
1282
{
 
1283
                        if (exvsp[-2].expr->type == STRING)
 
1284
                                exvsp[-2].expr = exnewnode(expr.program, S2B, 1, INTEGER, exvsp[-2].expr, NiL);
 
1285
                        else if (!INTEGRAL(exvsp[-2].expr->type))
 
1286
                                exvsp[-2].expr = excast(expr.program, exvsp[-2].expr, INTEGER, NiL, 0);
 
1287
                        exval.expr = exnewnode(expr.program, exvsp[-4].id->index, 1, INTEGER, exvsp[-2].expr, exnewnode(expr.program, ';', 1, 0, NiL, exvsp[0].expr));
 
1288
                ;
 
1289
    break;}
 
1290
case 16:
 
1291
#line 271 "exparse.y"
 
1292
{expr.declare=exvsp[0].expr->type;;
 
1293
    break;}
 
1294
case 17:
 
1295
#line 272 "exparse.y"
 
1296
{
 
1297
                        register Switch_t*      sw = expr.swstate;
 
1298
 
 
1299
                        exval.expr = exnewnode(expr.program, exvsp[-7].id->index, 1, INTEGER, exvsp[-5].expr, exnewnode(expr.program, DEFAULT, 1, 0, sw->defcase, sw->firstcase));
 
1300
                        expr.swstate = expr.swstate->prev;
 
1301
                        if (sw->base)
 
1302
                                free(sw->base);
 
1303
                        if (sw != &swstate)
 
1304
                                free(sw);
 
1305
                ;
 
1306
    break;}
 
1307
case 18:
 
1308
#line 283 "exparse.y"
 
1309
{
 
1310
                loopop:
 
1311
                        if (!exvsp[-1].expr)
 
1312
                        {
 
1313
                                exvsp[-1].expr = exnewnode(expr.program, CONSTANT, 0, INTEGER, NiL, NiL);
 
1314
                                exvsp[-1].expr->data.constant.value.integer = 1;
 
1315
                        }
 
1316
                        else if (!INTEGRAL(exvsp[-1].expr->type))
 
1317
                                exvsp[-1].expr = excast(expr.program, exvsp[-1].expr, INTEGER, NiL, 0);
 
1318
                        exval.expr = exnewnode(expr.program, exvsp[-2].id->index, 1, INTEGER, exvsp[-1].expr, NiL);
 
1319
                ;
 
1320
    break;}
 
1321
case 19:
 
1322
#line 295 "exparse.y"
 
1323
{
 
1324
                        goto loopop;
 
1325
                ;
 
1326
    break;}
 
1327
case 20:
 
1328
#line 299 "exparse.y"
 
1329
{
 
1330
                        if (exvsp[-1].expr)
 
1331
                        {
 
1332
                                if (expr.procedure && !expr.procedure->type)
 
1333
                                        exerror("return in void function");
 
1334
                                exvsp[-1].expr = excast(expr.program, exvsp[-1].expr, expr.procedure ? expr.procedure->type : INTEGER, NiL, 0);
 
1335
                        }
 
1336
                        exval.expr = exnewnode(expr.program, RETURN, 1, exvsp[-1].expr ? exvsp[-1].expr->type : 0, exvsp[-1].expr, NiL);
 
1337
                ;
 
1338
    break;}
 
1339
case 21:
 
1340
#line 311 "exparse.y"
 
1341
{
 
1342
                        register Switch_t*              sw;
 
1343
                        int                             n;
 
1344
 
 
1345
                        if (expr.swstate)
 
1346
                        {
 
1347
                                if (!(sw = newof(0, Switch_t, 1, 0)))
 
1348
                                {
 
1349
                                        exerror("out of space [switch]");
 
1350
                                        sw = &swstate;
 
1351
                                }
 
1352
                                sw->prev = expr.swstate;
 
1353
                        }
 
1354
                        else sw = &swstate;
 
1355
                        expr.swstate = sw;
 
1356
                        sw->type = expr.declare;
 
1357
                        sw->firstcase = 0;
 
1358
                        sw->lastcase = 0;
 
1359
                        sw->defcase = 0;
 
1360
                        sw->def = 0;
 
1361
                        n = 8;
 
1362
                        if (!(sw->base = newof(0, Extype_t*, n, 0)))
 
1363
                        {
 
1364
                                exerror("out of space [case]");
 
1365
                                n = 0;
 
1366
                        }
 
1367
                        sw->cur = sw->base;
 
1368
                        sw->last = sw->base + n;
 
1369
                ;
 
1370
    break;}
 
1371
case 23:
 
1372
#line 344 "exparse.y"
 
1373
{
 
1374
                        register Switch_t*      sw = expr.swstate;
 
1375
                        int                     n;
 
1376
 
 
1377
                        exval.expr = exnewnode(expr.program, CASE, 1, 0, exvsp[0].expr, NiL);
 
1378
                        if (sw->cur > sw->base)
 
1379
                        {
 
1380
                                if (sw->lastcase)
 
1381
                                        sw->lastcase->data.select.next = exval.expr;
 
1382
                                else sw->firstcase = exval.expr;
 
1383
                                sw->lastcase = exval.expr;
 
1384
                                n = sw->cur - sw->base;
 
1385
                                sw->cur = sw->base;
 
1386
                                exval.expr->data.select.constant = (Extype_t**)exalloc(expr.program, (n + 1) * sizeof(Extype_t*));
 
1387
                                memcpy(exval.expr->data.select.constant, sw->base, n * sizeof(Extype_t*));
 
1388
                                exval.expr->data.select.constant[n] = 0;
 
1389
                        }
 
1390
                        else exval.expr->data.select.constant = 0;
 
1391
                        if (sw->def)
 
1392
                        {
 
1393
                                sw->def = 0;
 
1394
                                if (sw->defcase)
 
1395
                                        exerror("duplicate default in switch");
 
1396
                                else sw->defcase = exvsp[0].expr;
 
1397
                        }
 
1398
                ;
 
1399
    break;}
 
1400
case 26:
 
1401
#line 377 "exparse.y"
 
1402
{
 
1403
                        int     n;
 
1404
 
 
1405
                        if (expr.swstate->cur >= expr.swstate->last)
 
1406
                        {
 
1407
                                n = expr.swstate->cur - expr.swstate->base;
 
1408
                                if (!(expr.swstate->base = newof(expr.swstate->base, Extype_t*, 2 * n, 0)))
 
1409
                                {
 
1410
                                        exerror("too many case labels for switch");
 
1411
                                        n = 0;
 
1412
                                }
 
1413
                                expr.swstate->cur = expr.swstate->base + n;
 
1414
                                expr.swstate->last = expr.swstate->base + 2 * n;
 
1415
                        }
 
1416
                        if (expr.swstate->cur)
 
1417
                        {
 
1418
                                exvsp[-1].expr = excast(expr.program, exvsp[-1].expr, expr.swstate->type, NiL, 0);
 
1419
                                *expr.swstate->cur++ = &(exvsp[-1].expr->data.constant.value);
 
1420
                        }
 
1421
                ;
 
1422
    break;}
 
1423
case 27:
 
1424
#line 398 "exparse.y"
 
1425
{
 
1426
                        expr.swstate->def = 1;
 
1427
                ;
 
1428
    break;}
 
1429
case 29:
 
1430
#line 405 "exparse.y"
 
1431
{
 
1432
                        if (exvsp[0].expr)
 
1433
                                exval.expr = exvsp[-2].expr ? exnewnode(expr.program, ',', 1, exvsp[0].expr->type, exvsp[-2].expr, exvsp[0].expr) : exvsp[0].expr;
 
1434
                ;
 
1435
    break;}
 
1436
case 30:
 
1437
#line 411 "exparse.y"
 
1438
{expr.id=exvsp[0].id;;
 
1439
    break;}
 
1440
case 31:
 
1441
#line 412 "exparse.y"
 
1442
{
 
1443
                        exval.expr = 0;
 
1444
                        exvsp[-3].id->type = expr.declare;
 
1445
                        if (exvsp[0].expr && exvsp[0].expr->op == PROCEDURE)
 
1446
                        {
 
1447
                                exvsp[-3].id->lex = PROCEDURE;
 
1448
                                exvsp[-3].id->value = exvsp[0].expr;
 
1449
                        }
 
1450
                        else
 
1451
                        {
 
1452
                                exvsp[-3].id->lex = DYNAMIC;
 
1453
                                exvsp[-3].id->value = exnewnode(expr.program, 0, 0, 0, NiL, NiL);
 
1454
                                if (exvsp[-1].integer && !exvsp[-3].id->local.pointer)
 
1455
                                {
 
1456
                                        Dtdisc_t*       disc;
 
1457
 
 
1458
                                        if (!(disc = newof(0, Dtdisc_t, 1, 0)))
 
1459
                                                exerror("out of space [associative array]");
 
1460
                                        disc->key = offsetof(Exassoc_t, name);
 
1461
                                        if (!(exvsp[-3].id->local.pointer = (char*)dtopen(disc, Dtoset)))
 
1462
                                                exerror("%s: cannot initialize associative array", exvsp[-3].id->name);
 
1463
                                }
 
1464
                                if (exvsp[0].expr)
 
1465
                                {
 
1466
                                        if (exvsp[0].expr->type != exvsp[-3].id->type)
 
1467
                                        {
 
1468
                                                exvsp[0].expr->type = exvsp[-3].id->type;
 
1469
                                                exvsp[0].expr->data.operand.right = excast(expr.program, exvsp[0].expr->data.operand.right, exvsp[-3].id->type, NiL, 0);
 
1470
                                        }
 
1471
                                        exvsp[0].expr->data.operand.left = exnewnode(expr.program, DYNAMIC, 0, exvsp[-3].id->type, NiL, NiL);
 
1472
                                        exvsp[0].expr->data.operand.left->data.variable.symbol = exvsp[-3].id;
 
1473
                                        exval.expr = exvsp[0].expr;
 
1474
                                }
 
1475
                                else if (!exvsp[-1].integer)
 
1476
                                        exvsp[-3].id->value->data.value = exzero(exvsp[-3].id->type);
 
1477
                        }
 
1478
                ;
 
1479
    break;}
 
1480
case 34:
 
1481
#line 456 "exparse.y"
 
1482
{
 
1483
                        exval.expr = 0;
 
1484
                ;
 
1485
    break;}
 
1486
case 35:
 
1487
#line 460 "exparse.y"
 
1488
{
 
1489
                        exval.expr = exvsp[0].expr;
 
1490
                ;
 
1491
    break;}
 
1492
case 36:
 
1493
#line 466 "exparse.y"
 
1494
{
 
1495
                        exval.expr = 0;
 
1496
                ;
 
1497
    break;}
 
1498
case 38:
 
1499
#line 473 "exparse.y"
 
1500
{
 
1501
                        exval.expr = exvsp[-1].expr;
 
1502
                ;
 
1503
    break;}
 
1504
case 39:
 
1505
#line 477 "exparse.y"
 
1506
{
 
1507
                        exval.expr = (exvsp[0].expr->type == exvsp[-2].id->type) ? exvsp[0].expr : excast(expr.program, exvsp[0].expr, exvsp[-2].id->type, NiL, 0);
 
1508
                ;
 
1509
    break;}
 
1510
case 40:
 
1511
#line 481 "exparse.y"
 
1512
{
 
1513
                        int     rel;
 
1514
 
 
1515
                relational:
 
1516
                        rel = INTEGER;
 
1517
                        goto coerce;
 
1518
                binary:
 
1519
                        rel = 0;
 
1520
                coerce:
 
1521
                        if (!exvsp[-2].expr->type)
 
1522
                        {
 
1523
                                if (!exvsp[0].expr->type)
 
1524
                                        exvsp[-2].expr->type = exvsp[0].expr->type = rel ? STRING : INTEGER;
 
1525
                                else exvsp[-2].expr->type = exvsp[0].expr->type;
 
1526
                        }
 
1527
                        else if (!exvsp[0].expr->type) exvsp[0].expr->type = exvsp[-2].expr->type;
 
1528
                        if (exvsp[-2].expr->type != exvsp[0].expr->type)
 
1529
                        {
 
1530
                                if (exvsp[-2].expr->type == STRING)
 
1531
                                        exvsp[-2].expr = excast(expr.program, exvsp[-2].expr, exvsp[0].expr->type, exvsp[0].expr, 0);
 
1532
                                else if (exvsp[0].expr->type == STRING)
 
1533
                                        exvsp[0].expr = excast(expr.program, exvsp[0].expr, exvsp[-2].expr->type, exvsp[-2].expr, 0);
 
1534
                                else if (exvsp[-2].expr->type == FLOATING)
 
1535
                                        exvsp[0].expr = excast(expr.program, exvsp[0].expr, FLOATING, exvsp[-2].expr, 0);
 
1536
                                else if (exvsp[0].expr->type == FLOATING)
 
1537
                                        exvsp[-2].expr = excast(expr.program, exvsp[-2].expr, FLOATING, exvsp[0].expr, 0);
 
1538
                        }
 
1539
                        if (!rel)
 
1540
                                rel = (exvsp[-2].expr->type == STRING) ? STRING : ((exvsp[-2].expr->type == UNSIGNED) ? UNSIGNED : exvsp[0].expr->type);
 
1541
                        exval.expr = exnewnode(expr.program, exvsp[-1].op, 1, rel, exvsp[-2].expr, exvsp[0].expr);
 
1542
                        if (!expr.program->errors && exvsp[-2].expr->op == CONSTANT && exvsp[0].expr->op == CONSTANT)
 
1543
                        {
 
1544
                                expr.program->vc = expr.program->vm;
 
1545
                                exval.expr->data.constant.value = exeval(expr.program, exval.expr, NiL);
 
1546
                                expr.program->vc = expr.program->ve;
 
1547
                                exval.expr->binary = 0;
 
1548
                                exval.expr->op = CONSTANT;
 
1549
                                exfreenode(expr.program, exvsp[-2].expr);
 
1550
                                exfreenode(expr.program, exvsp[0].expr);
 
1551
                        }
 
1552
                ;
 
1553
    break;}
 
1554
case 41:
 
1555
#line 523 "exparse.y"
 
1556
{
 
1557
                        goto binary;
 
1558
                ;
 
1559
    break;}
 
1560
case 42:
 
1561
#line 527 "exparse.y"
 
1562
{
 
1563
                        goto binary;
 
1564
                ;
 
1565
    break;}
 
1566
case 43:
 
1567
#line 531 "exparse.y"
 
1568
{
 
1569
                        goto binary;
 
1570
                ;
 
1571
    break;}
 
1572
case 44:
 
1573
#line 535 "exparse.y"
 
1574
{
 
1575
                        goto binary;
 
1576
                ;
 
1577
    break;}
 
1578
case 45:
 
1579
#line 539 "exparse.y"
 
1580
{
 
1581
                        goto binary;
 
1582
                ;
 
1583
    break;}
 
1584
case 46:
 
1585
#line 543 "exparse.y"
 
1586
{
 
1587
                        goto binary;
 
1588
                ;
 
1589
    break;}
 
1590
case 47:
 
1591
#line 547 "exparse.y"
 
1592
{
 
1593
                        goto relational;
 
1594
                ;
 
1595
    break;}
 
1596
case 48:
 
1597
#line 551 "exparse.y"
 
1598
{
 
1599
                        goto relational;
 
1600
                ;
 
1601
    break;}
 
1602
case 49:
 
1603
#line 555 "exparse.y"
 
1604
{
 
1605
                        goto relational;
 
1606
                ;
 
1607
    break;}
 
1608
case 50:
 
1609
#line 559 "exparse.y"
 
1610
{
 
1611
                        goto relational;
 
1612
                ;
 
1613
    break;}
 
1614
case 51:
 
1615
#line 563 "exparse.y"
 
1616
{
 
1617
                        goto relational;
 
1618
                ;
 
1619
    break;}
 
1620
case 52:
 
1621
#line 567 "exparse.y"
 
1622
{
 
1623
                        goto binary;
 
1624
                ;
 
1625
    break;}
 
1626
case 53:
 
1627
#line 571 "exparse.y"
 
1628
{
 
1629
                        goto binary;
 
1630
                ;
 
1631
    break;}
 
1632
case 54:
 
1633
#line 575 "exparse.y"
 
1634
{
 
1635
                        goto binary;
 
1636
                ;
 
1637
    break;}
 
1638
case 55:
 
1639
#line 579 "exparse.y"
 
1640
{
 
1641
                        goto binary;
 
1642
                ;
 
1643
    break;}
 
1644
case 56:
 
1645
#line 583 "exparse.y"
 
1646
{
 
1647
                logical:
 
1648
                        if (exvsp[-2].expr->type == STRING)
 
1649
                                exvsp[-2].expr = exnewnode(expr.program, S2B, 1, INTEGER, exvsp[-2].expr, NiL);
 
1650
                        if (exvsp[0].expr->type == STRING)
 
1651
                                exvsp[0].expr = exnewnode(expr.program, S2B, 1, INTEGER, exvsp[0].expr, NiL);
 
1652
                        goto binary;
 
1653
                ;
 
1654
    break;}
 
1655
case 57:
 
1656
#line 592 "exparse.y"
 
1657
{
 
1658
                        goto logical;
 
1659
                ;
 
1660
    break;}
 
1661
case 58:
 
1662
#line 596 "exparse.y"
 
1663
{
 
1664
                        if (exvsp[-2].expr->op == CONSTANT)
 
1665
                        {
 
1666
                                exfreenode(expr.program, exvsp[-2].expr);
 
1667
                                exval.expr = exvsp[0].expr;
 
1668
                        }
 
1669
                        else exval.expr = exnewnode(expr.program, ',', 1, exvsp[0].expr->type, exvsp[-2].expr, exvsp[0].expr);
 
1670
                ;
 
1671
    break;}
 
1672
case 59:
 
1673
#line 604 "exparse.y"
 
1674
{expr.nolabel=1;;
 
1675
    break;}
 
1676
case 60:
 
1677
#line 604 "exparse.y"
 
1678
{expr.nolabel=0;;
 
1679
    break;}
 
1680
case 61:
 
1681
#line 605 "exparse.y"
 
1682
{
 
1683
                        if (!exvsp[-3].expr->type)
 
1684
                        {
 
1685
                                if (!exvsp[0].expr->type)
 
1686
                                        exvsp[-3].expr->type = exvsp[0].expr->type = INTEGER;
 
1687
                                else exvsp[-3].expr->type = exvsp[0].expr->type;
 
1688
                        }
 
1689
                        else if (!exvsp[0].expr->type)
 
1690
                                exvsp[0].expr->type = exvsp[-3].expr->type;
 
1691
                        if (exvsp[-6].expr->type == STRING)
 
1692
                                exvsp[-6].expr = exnewnode(expr.program, S2B, 1, INTEGER, exvsp[-6].expr, NiL);
 
1693
                        else if (!INTEGRAL(exvsp[-6].expr->type))
 
1694
                                exvsp[-6].expr = excast(expr.program, exvsp[-6].expr, INTEGER, NiL, 0);
 
1695
                        if (exvsp[-3].expr->type != exvsp[0].expr->type)
 
1696
                        {
 
1697
                                if (exvsp[-3].expr->type == STRING || exvsp[0].expr->type == STRING)
 
1698
                                        exerror("if statement string type mismatch");
 
1699
                                else if (exvsp[-3].expr->type == FLOATING)
 
1700
                                        exvsp[0].expr = excast(expr.program, exvsp[0].expr, FLOATING, NiL, 0);
 
1701
                                else if (exvsp[0].expr->type == FLOATING)
 
1702
                                        exvsp[-3].expr = excast(expr.program, exvsp[-3].expr, FLOATING, NiL, 0);
 
1703
                        }
 
1704
                        if (exvsp[-6].expr->op == CONSTANT)
 
1705
                        {
 
1706
                                if (exvsp[-6].expr->data.constant.value.integer)
 
1707
                                {
 
1708
                                        exval.expr = exvsp[-3].expr;
 
1709
                                        exfreenode(expr.program, exvsp[0].expr);
 
1710
                                }
 
1711
                                else
 
1712
                                {
 
1713
                                        exval.expr = exvsp[0].expr;
 
1714
                                        exfreenode(expr.program, exvsp[-3].expr);
 
1715
                                }
 
1716
                                exfreenode(expr.program, exvsp[-6].expr);
 
1717
                        }
 
1718
                        else exval.expr = exnewnode(expr.program, '?', 1, exvsp[-3].expr->type, exvsp[-6].expr, exnewnode(expr.program, ':', 1, exvsp[-3].expr->type, exvsp[-3].expr, exvsp[0].expr));
 
1719
                ;
 
1720
    break;}
 
1721
case 62:
 
1722
#line 644 "exparse.y"
 
1723
{
 
1724
                iunary:
 
1725
                        if (exvsp[0].expr->type == STRING)
 
1726
                                exvsp[0].expr = exnewnode(expr.program, S2B, 1, INTEGER, exvsp[0].expr, NiL);
 
1727
                        else if (!INTEGRAL(exvsp[0].expr->type))
 
1728
                                exvsp[0].expr = excast(expr.program, exvsp[0].expr, INTEGER, NiL, 0);
 
1729
                unary:
 
1730
                        exval.expr = exnewnode(expr.program, exvsp[-1].op, 1, exvsp[0].expr->type == UNSIGNED ? INTEGER : exvsp[0].expr->type, exvsp[0].expr, NiL);
 
1731
                        if (exvsp[0].expr->op == CONSTANT)
 
1732
                        {
 
1733
                                exval.expr->data.constant.value = exeval(expr.program, exval.expr, NiL);
 
1734
                                exval.expr->binary = 0;
 
1735
                                exval.expr->op = CONSTANT;
 
1736
                                exfreenode(expr.program, exvsp[0].expr);
 
1737
                        }
 
1738
                ;
 
1739
    break;}
 
1740
case 63:
 
1741
#line 661 "exparse.y"
 
1742
{
 
1743
                        goto iunary;
 
1744
                ;
 
1745
    break;}
 
1746
case 64:
 
1747
#line 665 "exparse.y"
 
1748
{
 
1749
                        goto unary;
 
1750
                ;
 
1751
    break;}
 
1752
case 65:
 
1753
#line 669 "exparse.y"
 
1754
{
 
1755
                        exval.expr = exvsp[0].expr;
 
1756
                ;
 
1757
    break;}
 
1758
case 66:
 
1759
#line 673 "exparse.y"
 
1760
{
 
1761
                        exval.expr = exnewnode(expr.program, FUNCTION, 1, T(exvsp[-3].id->type), call(0, exvsp[-3].id, exvsp[-1].expr), exvsp[-1].expr);
 
1762
                ;
 
1763
    break;}
 
1764
case 67:
 
1765
#line 677 "exparse.y"
 
1766
{
 
1767
                        if (!INTEGRAL(exvsp[-1].expr->type))
 
1768
                                exvsp[-1].expr = excast(expr.program, exvsp[-1].expr, INTEGER, NiL, 0);
 
1769
                        exval.expr = exnewnode(expr.program, EXIT, 1, INTEGER, exvsp[-1].expr, NiL);
 
1770
                ;
 
1771
    break;}
 
1772
case 68:
 
1773
#line 683 "exparse.y"
 
1774
{
 
1775
                        exval.expr = exnewnode(expr.program, CALL, 1, exvsp[-3].id->type, NiL, exvsp[-1].expr);
 
1776
                        exval.expr->data.call.procedure = exvsp[-3].id;
 
1777
                ;
 
1778
    break;}
 
1779
case 69:
 
1780
#line 688 "exparse.y"
 
1781
{
 
1782
                        exval.expr = exnewnode(expr.program, exvsp[-3].id->index, 0, exvsp[-3].id->type, NiL, NiL);
 
1783
                        if (exvsp[-1].expr && exvsp[-1].expr->data.operand.left->type == INTEGER)
 
1784
                        {
 
1785
                                exval.expr->data.print.descriptor = exvsp[-1].expr->data.operand.left;
 
1786
                                exvsp[-1].expr = exvsp[-1].expr->data.operand.right;
 
1787
                        }
 
1788
                        else switch (exvsp[-3].id->index)
 
1789
                        {
 
1790
                        case QUERY:
 
1791
                                exval.expr->data.print.descriptor = exnewnode(expr.program, CONSTANT, 0, INTEGER, NiL, NiL);
 
1792
                                exval.expr->data.print.descriptor->data.constant.value.integer = 2;
 
1793
                                break;
 
1794
                        case PRINTF:
 
1795
                                exval.expr->data.print.descriptor = exnewnode(expr.program, CONSTANT, 0, INTEGER, NiL, NiL);
 
1796
                                exval.expr->data.print.descriptor->data.constant.value.integer = 1;
 
1797
                                break;
 
1798
                        case SPRINTF:
 
1799
                                exval.expr->data.print.descriptor = 0;
 
1800
                                break;
 
1801
                        }
 
1802
                        exval.expr->data.print.args = preprint(exvsp[-1].expr);
 
1803
                ;
 
1804
    break;}
 
1805
case 70:
 
1806
#line 712 "exparse.y"
 
1807
{
 
1808
                        if (exvsp[0].expr)
 
1809
                        {
 
1810
                                if (exvsp[-1].expr->op == ID && !expr.program->disc->setf)
 
1811
                                        exerror("%s: variable assignment not supported", exvsp[-1].expr->data.variable.symbol->name);
 
1812
                                else
 
1813
                                {
 
1814
                                        if (!exvsp[-1].expr->type)
 
1815
                                                exvsp[-1].expr->type = exvsp[0].expr->type;
 
1816
#if 0
 
1817
                                        else if (exvsp[0].expr->type != exvsp[-1].expr->type && exvsp[-1].expr->type >= 0200)
 
1818
#else
 
1819
                                        else if (exvsp[0].expr->type != exvsp[-1].expr->type)
 
1820
#endif
 
1821
                                        {
 
1822
                                                exvsp[0].expr->type = exvsp[-1].expr->type;
 
1823
                                                exvsp[0].expr->data.operand.right = excast(expr.program, exvsp[0].expr->data.operand.right, exvsp[-1].expr->type, NiL, 0);
 
1824
                                        }
 
1825
                                        exvsp[0].expr->data.operand.left = exvsp[-1].expr;
 
1826
                                        exval.expr = exvsp[0].expr;
 
1827
                                }
 
1828
                        }
 
1829
                ;
 
1830
    break;}
 
1831
case 71:
 
1832
#line 736 "exparse.y"
 
1833
{
 
1834
                pre:
 
1835
                        if (exvsp[0].expr->type == STRING)
 
1836
                                exerror("++ and -- invalid for string variables");
 
1837
                        exval.expr = exnewnode(expr.program, exvsp[-1].op, 0, exvsp[0].expr->type, exvsp[0].expr, NiL);
 
1838
                        exval.expr->subop = PRE;
 
1839
                ;
 
1840
    break;}
 
1841
case 72:
 
1842
#line 744 "exparse.y"
 
1843
{
 
1844
                pos:
 
1845
                        if (exvsp[-1].expr->type == STRING)
 
1846
                                exerror("++ and -- invalid for string variables");
 
1847
                        exval.expr = exnewnode(expr.program, exvsp[0].op, 0, exvsp[-1].expr->type, exvsp[-1].expr, NiL);
 
1848
                        exval.expr->subop = POS;
 
1849
                ;
 
1850
    break;}
 
1851
case 73:
 
1852
#line 752 "exparse.y"
 
1853
{
 
1854
                        goto pre;
 
1855
                ;
 
1856
    break;}
 
1857
case 74:
 
1858
#line 756 "exparse.y"
 
1859
{
 
1860
                        goto pos;
 
1861
                ;
 
1862
    break;}
 
1863
case 76:
 
1864
#line 763 "exparse.y"
 
1865
{
 
1866
                        exval.expr = exnewnode(expr.program, CONSTANT, 0, exvsp[0].id->type, NiL, NiL);
 
1867
                        if (!expr.program->disc->reff)
 
1868
                                exerror("%s: identifier references not supported", exvsp[0].id->name);
 
1869
                        else exval.expr->data.constant.value = (*expr.program->disc->reff)(expr.program, exval.expr, exvsp[0].id, NiL, NiL, EX_SCALAR, expr.program->disc);
 
1870
                ;
 
1871
    break;}
 
1872
case 77:
 
1873
#line 770 "exparse.y"
 
1874
{
 
1875
                        exval.expr = exnewnode(expr.program, CONSTANT, 0, FLOATING, NiL, NiL);
 
1876
                        exval.expr->data.constant.value.floating = exvsp[0].floating;
 
1877
                ;
 
1878
    break;}
 
1879
case 78:
 
1880
#line 775 "exparse.y"
 
1881
{
 
1882
                        exval.expr = exnewnode(expr.program, CONSTANT, 0, INTEGER, NiL, NiL);
 
1883
                        exval.expr->data.constant.value.integer = exvsp[0].integer;
 
1884
                ;
 
1885
    break;}
 
1886
case 79:
 
1887
#line 780 "exparse.y"
 
1888
{
 
1889
                        exval.expr = exnewnode(expr.program, CONSTANT, 0, STRING, NiL, NiL);
 
1890
                        exval.expr->data.constant.value.string = exvsp[0].string;
 
1891
                ;
 
1892
    break;}
 
1893
case 80:
 
1894
#line 785 "exparse.y"
 
1895
{
 
1896
                        exval.expr = exnewnode(expr.program, CONSTANT, 0, UNSIGNED, NiL, NiL);
 
1897
                        exval.expr->data.constant.value.integer = exvsp[0].integer;
 
1898
                ;
 
1899
    break;}
 
1900
case 84:
 
1901
#line 797 "exparse.y"
 
1902
{
 
1903
                        exval.expr = makeVar(expr.program, exvsp[-1].id, 0, 0, exvsp[0].reference);
 
1904
                ;
 
1905
    break;}
 
1906
case 85:
 
1907
#line 801 "exparse.y"
 
1908
{
 
1909
            Exnode_t*   n;
 
1910
 
 
1911
            n = exnewnode(expr.program, DYNAMIC, 0, exvsp[-2].id->type, NiL, NiL);
 
1912
            n->data.variable.symbol = exvsp[-2].id;
 
1913
            n->data.variable.reference = 0;
 
1914
            if (((n->data.variable.index = exvsp[-1].expr) == 0) != (exvsp[-2].id->local.pointer ==
 
1915
0))
 
1916
              exerror("%s: is%s an array", exvsp[-2].id->name, exvsp[-2].id->local.pointer ? "" : " not");
 
1917
                        if (exvsp[0].reference) {
 
1918
              n->data.variable.dyna =exnewnode(expr.program, 0, 0, 0, NiL, NiL);
 
1919
              exval.expr = makeVar(expr.program, exvsp[-2].id, exvsp[-1].expr, n, exvsp[0].reference);
 
1920
            }
 
1921
            else exval.expr = n;
 
1922
                ;
 
1923
    break;}
 
1924
case 86:
 
1925
#line 817 "exparse.y"
 
1926
{
 
1927
                        exval.expr = exnewnode(expr.program, ID, 0, STRING, NiL, NiL);
 
1928
                        exval.expr->data.variable.symbol = exvsp[0].id;
 
1929
                        exval.expr->data.variable.reference = 0;
 
1930
                        exval.expr->data.variable.index = 0;
 
1931
                        exval.expr->data.variable.dyna = 0;
 
1932
                        if (!(expr.program->disc->flags & EX_UNDECLARED))
 
1933
                                exerror("unknown identifier");
 
1934
                ;
 
1935
    break;}
 
1936
case 87:
 
1937
#line 829 "exparse.y"
 
1938
{
 
1939
                        exval.integer = 0;
 
1940
                ;
 
1941
    break;}
 
1942
case 88:
 
1943
#line 833 "exparse.y"
 
1944
{
 
1945
                        exval.integer = 1;
 
1946
                ;
 
1947
    break;}
 
1948
case 89:
 
1949
#line 839 "exparse.y"
 
1950
{
 
1951
                        exval.expr = 0;
 
1952
                ;
 
1953
    break;}
 
1954
case 90:
 
1955
#line 843 "exparse.y"
 
1956
{
 
1957
                        exval.expr = exvsp[-1].expr;
 
1958
                ;
 
1959
    break;}
 
1960
case 91:
 
1961
#line 849 "exparse.y"
 
1962
{
 
1963
                        exval.expr = 0;
 
1964
                ;
 
1965
    break;}
 
1966
case 92:
 
1967
#line 853 "exparse.y"
 
1968
{
 
1969
                        exval.expr = exvsp[0].expr->data.operand.left;
 
1970
                        exvsp[0].expr->data.operand.left = exvsp[0].expr->data.operand.right = 0;
 
1971
                        exfreenode(expr.program, exvsp[0].expr);
 
1972
                ;
 
1973
    break;}
 
1974
case 93:
 
1975
#line 861 "exparse.y"
 
1976
{
 
1977
                        exval.expr = exnewnode(expr.program, ',', 1, 0, exnewnode(expr.program, ',', 1, exvsp[0].expr->type, exvsp[0].expr, NiL), NiL);
 
1978
                        exval.expr->data.operand.right = exval.expr->data.operand.left;
 
1979
                ;
 
1980
    break;}
 
1981
case 94:
 
1982
#line 866 "exparse.y"
 
1983
{
 
1984
                        exvsp[-2].expr->data.operand.right = exvsp[-2].expr->data.operand.right->data.operand.right = exnewnode(expr.program, ',', 1, exvsp[-2].expr->type, exvsp[0].expr, NiL);
 
1985
                ;
 
1986
    break;}
 
1987
case 95:
 
1988
#line 872 "exparse.y"
 
1989
{
 
1990
                        exval.expr = 0;
 
1991
                ;
 
1992
    break;}
 
1993
case 96:
 
1994
#line 876 "exparse.y"
 
1995
{
 
1996
                        exval.expr = 0;
 
1997
                        if (exvsp[0].id->type)
 
1998
                                exerror("(void) expected");
 
1999
                ;
 
2000
    break;}
 
2001
case 98:
 
2002
#line 885 "exparse.y"
 
2003
{
 
2004
                        exval.expr = exnewnode(expr.program, ',', 1, exvsp[0].expr->type, exvsp[0].expr, NiL);
 
2005
                ;
 
2006
    break;}
 
2007
case 99:
 
2008
#line 889 "exparse.y"
 
2009
{
 
2010
                        register Exnode_t*      x;
 
2011
                        register Exnode_t*      y;
 
2012
 
 
2013
                        exval.expr = exvsp[-2].expr;
 
2014
                        for (x = exvsp[-2].expr; y = x->data.operand.right; x = y);
 
2015
                        x->data.operand.right = exnewnode(expr.program, ',', 1, exvsp[0].expr->type, exvsp[0].expr, NiL);
 
2016
                ;
 
2017
    break;}
 
2018
case 100:
 
2019
#line 899 "exparse.y"
 
2020
{expr.declare=exvsp[0].id->type;;
 
2021
    break;}
 
2022
case 101:
 
2023
#line 900 "exparse.y"
 
2024
{
 
2025
                        exval.expr = exnewnode(expr.program, ID, 0, exvsp[0].id->type, NiL, NiL);
 
2026
                        exval.expr->data.variable.symbol = exvsp[0].id;
 
2027
                        exvsp[0].id->lex = DYNAMIC;
 
2028
                        exvsp[0].id->value = exnewnode(expr.program, 0, 0, 0, NiL, NiL);
 
2029
                        expr.procedure->data.procedure.arity++;
 
2030
                ;
 
2031
    break;}
 
2032
case 102:
 
2033
#line 910 "exparse.y"
 
2034
{
 
2035
                        exval.reference = expr.refs = expr.lastref = 0;
 
2036
                ;
 
2037
    break;}
 
2038
case 103:
 
2039
#line 914 "exparse.y"
 
2040
{
 
2041
                        Exref_t*        r;
 
2042
 
 
2043
                        r = ALLOCATE(expr.program, Exref_t);
 
2044
                        r->symbol = exvsp[0].id;
 
2045
                        expr.refs = r;
 
2046
                        expr.lastref = r;
 
2047
                        r->next = 0;
 
2048
                        r->index = 0;
 
2049
                        exval.reference = expr.refs;
 
2050
                ;
 
2051
    break;}
 
2052
case 104:
 
2053
#line 926 "exparse.y"
 
2054
{
 
2055
                        Exref_t*        r;
 
2056
                        Exref_t*        l;
 
2057
 
 
2058
                        r = ALLOCATE(expr.program, Exref_t);
 
2059
                        r->symbol = exvsp[0].id;
 
2060
                        r->index = 0;
 
2061
                        r->next = 0;
 
2062
                        l = ALLOCATE(expr.program, Exref_t);
 
2063
                        l->symbol = exvsp[-1].id;
 
2064
                        l->index = 0;
 
2065
                        l->next = r;
 
2066
                        expr.refs = l;
 
2067
                        expr.lastref = r;
 
2068
                        exval.reference = expr.refs;
 
2069
        ;
 
2070
    break;}
 
2071
case 105:
 
2072
#line 945 "exparse.y"
 
2073
{
 
2074
                        exval.id = exvsp[0].id;
 
2075
                ;
 
2076
    break;}
 
2077
case 106:
 
2078
#line 949 "exparse.y"
 
2079
{
 
2080
                        exval.id = exvsp[0].id;
 
2081
                ;
 
2082
    break;}
 
2083
case 107:
 
2084
#line 954 "exparse.y"
 
2085
{
 
2086
                        exval.expr = 0;
 
2087
                ;
 
2088
    break;}
 
2089
case 108:
 
2090
#line 958 "exparse.y"
 
2091
{
 
2092
                        exval.expr = exnewnode(expr.program, '=', 1, exvsp[0].expr->type, NiL, exvsp[0].expr);
 
2093
                        exval.expr->subop = exvsp[-1].op;
 
2094
                ;
 
2095
    break;}
 
2096
case 110:
 
2097
#line 965 "exparse.y"
 
2098
{
 
2099
                                register Dtdisc_t*      disc;
 
2100
 
 
2101
                                if (expr.procedure)
 
2102
                                        exerror("no nested function definitions");
 
2103
                                expr.procedure = exnewnode(expr.program, PROCEDURE, 1, expr.declare, NiL, NiL);
 
2104
                                if (!(disc = newof(0, Dtdisc_t, 1, 0)))
 
2105
                                        exerror("out of space [frame discipline]");
 
2106
                                disc->key = offsetof(Exid_t, name);
 
2107
                                if (!(expr.procedure->data.procedure.frame = dtopen(disc, Dtset)) || !dtview(expr.procedure->data.procedure.frame, expr.program->symbols))
 
2108
                                        exerror("out of space [frame table]");
 
2109
                                expr.program->symbols = expr.program->frame = expr.procedure->data.procedure.frame;
 
2110
                                expr.program->formals = 1;
 
2111
                        ;
 
2112
    break;}
 
2113
case 111:
 
2114
#line 978 "exparse.y"
 
2115
{
 
2116
                                expr.program->formals = 0;
 
2117
                                expr.id->lex = PROCEDURE;
 
2118
                                expr.id->type = expr.declare;
 
2119
                        ;
 
2120
    break;}
 
2121
case 112:
 
2122
#line 983 "exparse.y"
 
2123
{
 
2124
                        exval.expr = expr.procedure;
 
2125
                        expr.procedure = 0;
 
2126
                        if (expr.program->frame)
 
2127
                        {
 
2128
                                expr.program->symbols = expr.program->frame->view;
 
2129
                                dtview(expr.program->frame, NiL);
 
2130
                        }
 
2131
                        exval.expr->data.operand.left = exvsp[-5].expr;
 
2132
                        exval.expr->data.operand.right = excast(expr.program, exvsp[-1].expr, exval.expr->type, NiL, 0);
 
2133
 
 
2134
                        /*
 
2135
                         * NOTE: procedure definition was slipped into the
 
2136
                         *       declaration initializer statement production,
 
2137
                         *       therefore requiring the statement terminator
 
2138
                         */
 
2139
 
 
2140
                        exunlex(expr.program, ';');
 
2141
                ;
 
2142
    break;}
 
2143
}
 
2144
 
 
2145
#line 610 "/usr/share/bison/bison.simple"
 
2146
 
 
2147
 
 
2148
  exvsp -= exlen;
 
2149
  exssp -= exlen;
 
2150
#if EXLSP_NEEDED
 
2151
  exlsp -= exlen;
 
2152
#endif
 
2153
 
 
2154
#if EXDEBUG
 
2155
  if (exdebug)
 
2156
    {
 
2157
      short *ssp1 = exss - 1;
 
2158
      fprintf (stderr, "state stack now");
 
2159
      while (ssp1 != exssp)
 
2160
        fprintf (stderr, " %d", *++ssp1);
 
2161
      fprintf (stderr, "\n");
 
2162
    }
 
2163
#endif
 
2164
 
 
2165
  *++exvsp = exval;
 
2166
#if EXLSP_NEEDED
 
2167
  *++exlsp = exloc;
 
2168
#endif
 
2169
 
 
2170
  /* Now `shift' the result of the reduction.  Determine what state
 
2171
     that goes to, based on the state we popped back to and the rule
 
2172
     number reduced by.  */
 
2173
 
 
2174
  exn = exr1[exn];
 
2175
 
 
2176
  exstate = expgoto[exn - EXNTBASE] + *exssp;
 
2177
  if (exstate >= 0 && exstate <= EXLAST && excheck[exstate] == *exssp)
 
2178
    exstate = extable[exstate];
 
2179
  else
 
2180
    exstate = exdefgoto[exn - EXNTBASE];
 
2181
 
 
2182
  goto exnewstate;
 
2183
 
 
2184
 
 
2185
/*------------------------------------.
 
2186
| exerrlab -- here on detecting error |
 
2187
`------------------------------------*/
 
2188
exerrlab:
 
2189
  /* If not already recovering from an error, report this error.  */
 
2190
  if (!exerrstatus)
 
2191
    {
 
2192
      ++exnerrs;
 
2193
 
 
2194
#ifdef EXERROR_VERBOSE
 
2195
      exn = expact[exstate];
 
2196
 
 
2197
      if (exn > EXFLAG && exn < EXLAST)
 
2198
        {
 
2199
          int size = 0;
 
2200
          char *msg;
 
2201
          int x, count;
 
2202
 
 
2203
          count = 0;
 
2204
          /* Start X at -exn if nec to avoid negative indexes in excheck.  */
 
2205
          for (x = (exn < 0 ? -exn : 0);
 
2206
               x < (int) (sizeof (extname) / sizeof (char *)); x++)
 
2207
            if (excheck[x + exn] == x)
 
2208
              size += strlen (extname[x]) + 15, count++;
 
2209
          size += strlen ("parse error, unexpected `") + 1;
 
2210
          size += strlen (extname[EXTRANSLATE (exchar)]);
 
2211
          msg = (char *) malloc (size);
 
2212
          if (msg != 0)
 
2213
            {
 
2214
              strcpy (msg, "parse error, unexpected `");
 
2215
              strcat (msg, extname[EXTRANSLATE (exchar)]);
 
2216
              strcat (msg, "'");
 
2217
 
 
2218
              if (count < 5)
 
2219
                {
 
2220
                  count = 0;
 
2221
                  for (x = (exn < 0 ? -exn : 0);
 
2222
                       x < (int) (sizeof (extname) / sizeof (char *)); x++)
 
2223
                    if (excheck[x + exn] == x)
 
2224
                      {
 
2225
                        strcat (msg, count == 0 ? ", expecting `" : " or `");
 
2226
                        strcat (msg, extname[x]);
 
2227
                        strcat (msg, "'");
 
2228
                        count++;
 
2229
                      }
 
2230
                }
 
2231
              exerror (msg);
 
2232
              free (msg);
 
2233
            }
 
2234
          else
 
2235
            exerror ("parse error; also virtual memory exceeded");
 
2236
        }
 
2237
      else
 
2238
#endif /* EXERROR_VERBOSE */
 
2239
        exerror ("parse error");
 
2240
    }
 
2241
  goto exerrlab1;
 
2242
 
 
2243
 
 
2244
/*--------------------------------------------------.
 
2245
| exerrlab1 -- error raised explicitly by an action |
 
2246
`--------------------------------------------------*/
 
2247
exerrlab1:
 
2248
  if (exerrstatus == 3)
 
2249
    {
 
2250
      /* If just tried and failed to reuse lookahead token after an
 
2251
         error, discard it.  */
 
2252
 
 
2253
      /* return failure if at end of input */
 
2254
      if (exchar == EXEOF)
 
2255
        EXABORT;
 
2256
      EXDPRINTF ((stderr, "Discarding token %d (%s).\n",
 
2257
                  exchar, extname[exchar1]));
 
2258
      exchar = EXEMPTY;
 
2259
    }
 
2260
 
 
2261
  /* Else will try to reuse lookahead token after shifting the error
 
2262
     token.  */
 
2263
 
 
2264
  exerrstatus = 3;              /* Each real token shifted decrements this */
 
2265
 
 
2266
  goto exerrhandle;
 
2267
 
 
2268
 
 
2269
/*-------------------------------------------------------------------.
 
2270
| exerrdefault -- current state does not do anything special for the |
 
2271
| error token.                                                       |
 
2272
`-------------------------------------------------------------------*/
 
2273
exerrdefault:
 
2274
#if 0
 
2275
  /* This is wrong; only states that explicitly want error tokens
 
2276
     should shift them.  */
 
2277
 
 
2278
  /* If its default is to accept any token, ok.  Otherwise pop it.  */
 
2279
  exn = exdefact[exstate];
 
2280
  if (exn)
 
2281
    goto exdefault;
 
2282
#endif
 
2283
 
 
2284
 
 
2285
/*---------------------------------------------------------------.
 
2286
| exerrpop -- pop the current state because it cannot handle the |
 
2287
| error token                                                    |
 
2288
`---------------------------------------------------------------*/
 
2289
exerrpop:
 
2290
  if (exssp == exss)
 
2291
    EXABORT;
 
2292
  exvsp--;
 
2293
  exstate = *--exssp;
 
2294
#if EXLSP_NEEDED
 
2295
  exlsp--;
 
2296
#endif
 
2297
 
 
2298
#if EXDEBUG
 
2299
  if (exdebug)
 
2300
    {
 
2301
      short *ssp1 = exss - 1;
 
2302
      fprintf (stderr, "Error: state stack now");
 
2303
      while (ssp1 != exssp)
 
2304
        fprintf (stderr, " %d", *++ssp1);
 
2305
      fprintf (stderr, "\n");
 
2306
    }
 
2307
#endif
 
2308
 
 
2309
/*--------------.
 
2310
| exerrhandle.  |
 
2311
`--------------*/
 
2312
exerrhandle:
 
2313
  exn = expact[exstate];
 
2314
  if (exn == EXFLAG)
 
2315
    goto exerrdefault;
 
2316
 
 
2317
  exn += EXTERROR;
 
2318
  if (exn < 0 || exn > EXLAST || excheck[exn] != EXTERROR)
 
2319
    goto exerrdefault;
 
2320
 
 
2321
  exn = extable[exn];
 
2322
  if (exn < 0)
 
2323
    {
 
2324
      if (exn == EXFLAG)
 
2325
        goto exerrpop;
 
2326
      exn = -exn;
 
2327
      goto exreduce;
 
2328
    }
 
2329
  else if (exn == 0)
 
2330
    goto exerrpop;
 
2331
 
 
2332
  if (exn == EXFINAL)
 
2333
    EXACCEPT;
 
2334
 
 
2335
  EXDPRINTF ((stderr, "Shifting error token, "));
 
2336
 
 
2337
  *++exvsp = exlval;
 
2338
#if EXLSP_NEEDED
 
2339
  *++exlsp = exlloc;
 
2340
#endif
 
2341
 
 
2342
  exstate = exn;
 
2343
  goto exnewstate;
 
2344
 
 
2345
 
 
2346
/*-------------------------------------.
 
2347
| exacceptlab -- EXACCEPT comes here.  |
 
2348
`-------------------------------------*/
 
2349
exacceptlab:
 
2350
  if (exfree_stacks)
 
2351
    {
 
2352
      free (exss);
 
2353
      free (exvs);
 
2354
#if EXLSP_NEEDED
 
2355
      free (exls);
 
2356
#endif
 
2357
    }
 
2358
  return 0;
 
2359
 
 
2360
 
 
2361
/*-----------------------------------.
 
2362
| exabortlab -- EXABORT comes here.  |
 
2363
`-----------------------------------*/
 
2364
exabortlab:
 
2365
  if (exfree_stacks)
 
2366
    {
 
2367
      free (exss);
 
2368
      free (exvs);
 
2369
#if EXLSP_NEEDED
 
2370
      free (exls);
 
2371
#endif
 
2372
    }
 
2373
  return 1;
 
2374
}
 
2375
#line 1004 "exparse.y"
 
2376
 
 
2377
 
 
2378
#include "exgram.h"