~ubuntu-branches/ubuntu/breezy/aqsis/breezy

« back to all changes in this revision

Viewing changes to libslparse/parser.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Will Newton
  • Date: 2004-12-07 20:06:49 UTC
  • Revision ID: james.westby@ubuntu.com-20041207200649-fccswkrvp4oc8lmn
Tags: upstream-0.9.3
ImportĀ upstreamĀ versionĀ 0.9.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* A Bison parser, made by GNU Bison 1.875.  */
 
2
 
 
3
/* Skeleton parser for Yacc-like parsing with Bison,
 
4
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
 
5
 
 
6
   This program is free software; you can redistribute it and/or modify
 
7
   it under the terms of the GNU General Public License as published by
 
8
   the Free Software Foundation; either version 2, or (at your option)
 
9
   any later version.
 
10
 
 
11
   This program is distributed in the hope that it will be useful,
 
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
   GNU General Public License for more details.
 
15
 
 
16
   You should have received a copy of the GNU General Public License
 
17
   along with this program; if not, write to the Free Software
 
18
   Foundation, Inc., 59 Temple Place - Suite 330,
 
19
   Boston, MA 02111-1307, USA.  */
 
20
 
 
21
/* As a special exception, when this file is copied by Bison into a
 
22
   Bison output file, you may use that output file without restriction.
 
23
   This special exception was added by the Free Software Foundation
 
24
   in version 1.24 of Bison.  */
 
25
 
 
26
/* Written by Richard Stallman by simplifying the original so called
 
27
   ``semantic'' parser.  */
 
28
 
 
29
/* All symbols defined below should begin with yy or YY, to avoid
 
30
   infringing on user name space.  This should be done even for local
 
31
   variables, as they might otherwise be expanded by user macros.
 
32
   There are some unavoidable exceptions within include files to
 
33
   define necessary library symbols; they are noted "INFRINGES ON
 
34
   USER NAME SPACE" below.  */
 
35
 
 
36
/* Identify Bison output.  */
 
37
#define YYBISON 1
 
38
 
 
39
/* Skeleton name.  */
 
40
#define YYSKELETON_NAME "yacc.c"
 
41
 
 
42
/* Pure parsers.  */
 
43
#define YYPURE 0
 
44
 
 
45
/* Using locations.  */
 
46
#define YYLSP_NEEDED 0
 
47
 
 
48
 
 
49
 
 
50
/* Tokens.  */
 
51
#ifndef YYTOKENTYPE
 
52
# define YYTOKENTYPE
 
53
   /* Put the tokens into the symbol table, so that GDB and other debuggers
 
54
      know about them.  */
 
55
   enum yytokentype {
 
56
     IDENTIFIER = 258,
 
57
     SYMBOL = 259,
 
58
     ARRAY_SYMBOL = 260,
 
59
     TYPE_FLOAT = 261,
 
60
     TYPE_POINT = 262,
 
61
     TYPE_STRING = 263,
 
62
     TYPE_COLOR = 264,
 
63
     TYPE_NORMAL = 265,
 
64
     TYPE_VECTOR = 266,
 
65
     TYPE_VOID = 267,
 
66
     TYPE_MATRIX = 268,
 
67
     TYPE_UNIFORM = 269,
 
68
     TYPE_VARYING = 270,
 
69
     SHADER_TYPE_SURFACE = 271,
 
70
     SHADER_TYPE_VOLUME = 272,
 
71
     SHADER_TYPE_IMAGER = 273,
 
72
     SHADER_TYPE_TRANSFORMATION = 274,
 
73
     SHADER_TYPE_DISPLACEMENT = 275,
 
74
     SHADER_TYPE_LIGHT = 276,
 
75
     SHADER_TYPE_ATMOSPHERE = 277,
 
76
     ATTRIBUTE = 278,
 
77
     OPTION = 279,
 
78
     RENDERERINFO = 280,
 
79
     INCIDENT = 281,
 
80
     OPPOSITE = 282,
 
81
     LIGHTSOURCE = 283,
 
82
     EXTERN = 284,
 
83
     TEXTUREINFO = 285,
 
84
     OUTPUT = 286,
 
85
     IF = 287,
 
86
     ELSE = 288,
 
87
     WHILE = 289,
 
88
     FOR = 290,
 
89
     CONTINUE = 291,
 
90
     BREAK = 292,
 
91
     RETURN = 293,
 
92
     ILLUMINATE = 294,
 
93
     ILLUMINANCE = 295,
 
94
     SOLAR = 296,
 
95
     TEXTUREMAP = 297,
 
96
     ENVIRONMENT = 298,
 
97
     BUMP = 299,
 
98
     SHADOW = 300,
 
99
     OCCLUSION = 301,
 
100
     SETXCOMP = 302,
 
101
     SETYCOMP = 303,
 
102
     SETZCOMP = 304,
 
103
     SETCOMP = 305,
 
104
     DIV_ASSIGN = 306,
 
105
     MUL_ASSIGN = 307,
 
106
     SUB_ASSIGN = 308,
 
107
     ADD_ASSIGN = 309,
 
108
     OR_OP = 310,
 
109
     AND_OP = 311,
 
110
     NE_OP = 312,
 
111
     EQ_OP = 313,
 
112
     LE_OP = 314,
 
113
     GE_OP = 315,
 
114
     NEG = 316,
 
115
     FLOAT_CONSTANT = 317,
 
116
     STRING_LITERAL = 318
 
117
   };
 
118
#endif
 
119
#define IDENTIFIER 258
 
120
#define SYMBOL 259
 
121
#define ARRAY_SYMBOL 260
 
122
#define TYPE_FLOAT 261
 
123
#define TYPE_POINT 262
 
124
#define TYPE_STRING 263
 
125
#define TYPE_COLOR 264
 
126
#define TYPE_NORMAL 265
 
127
#define TYPE_VECTOR 266
 
128
#define TYPE_VOID 267
 
129
#define TYPE_MATRIX 268
 
130
#define TYPE_UNIFORM 269
 
131
#define TYPE_VARYING 270
 
132
#define SHADER_TYPE_SURFACE 271
 
133
#define SHADER_TYPE_VOLUME 272
 
134
#define SHADER_TYPE_IMAGER 273
 
135
#define SHADER_TYPE_TRANSFORMATION 274
 
136
#define SHADER_TYPE_DISPLACEMENT 275
 
137
#define SHADER_TYPE_LIGHT 276
 
138
#define SHADER_TYPE_ATMOSPHERE 277
 
139
#define ATTRIBUTE 278
 
140
#define OPTION 279
 
141
#define RENDERERINFO 280
 
142
#define INCIDENT 281
 
143
#define OPPOSITE 282
 
144
#define LIGHTSOURCE 283
 
145
#define EXTERN 284
 
146
#define TEXTUREINFO 285
 
147
#define OUTPUT 286
 
148
#define IF 287
 
149
#define ELSE 288
 
150
#define WHILE 289
 
151
#define FOR 290
 
152
#define CONTINUE 291
 
153
#define BREAK 292
 
154
#define RETURN 293
 
155
#define ILLUMINATE 294
 
156
#define ILLUMINANCE 295
 
157
#define SOLAR 296
 
158
#define TEXTUREMAP 297
 
159
#define ENVIRONMENT 298
 
160
#define BUMP 299
 
161
#define SHADOW 300
 
162
#define OCCLUSION 301
 
163
#define SETXCOMP 302
 
164
#define SETYCOMP 303
 
165
#define SETZCOMP 304
 
166
#define SETCOMP 305
 
167
#define DIV_ASSIGN 306
 
168
#define MUL_ASSIGN 307
 
169
#define SUB_ASSIGN 308
 
170
#define ADD_ASSIGN 309
 
171
#define OR_OP 310
 
172
#define AND_OP 311
 
173
#define NE_OP 312
 
174
#define EQ_OP 313
 
175
#define LE_OP 314
 
176
#define GE_OP 315
 
177
#define NEG 316
 
178
#define FLOAT_CONSTANT 317
 
179
#define STRING_LITERAL 318
 
180
 
 
181
 
 
182
 
 
183
 
 
184
/* Copy the first part of user declarations.  */
 
185
#line 5 "parser.yxx"
 
186
 
 
187
#ifdef  WIN32
 
188
#include <malloc.h>
 
189
#pragma warning(disable : 4786)
 
190
#include <cstdio>
 
191
#include <memory>
 
192
namespace std
 
193
{ using ::size_t; 
 
194
  using ::malloc;
 
195
  using ::free;
 
196
}
 
197
#endif
 
198
 
 
199
#include <algorithm>
 
200
#include <iostream>
 
201
#include <map>
 
202
#include <string>
 
203
#include <vector>
 
204
#include <cassert>
 
205
 
 
206
#include        "parsenode.h"
 
207
#include        "logging.h"
 
208
 
 
209
# define YYMAXDEPTH 100000
 
210
# define YYINITDEPTH  2000
 
211
 
 
212
using namespace Aqsis;
 
213
 
 
214
 
 
215
namespace Aqsis
 
216
{
 
217
 
 
218
extern CqString ParseStreamName;
 
219
extern std::ostream* ParseErrorStream;
 
220
extern TqInt ParseLineNumber;
 
221
extern TqBool ParseSucceeded;
 
222
extern TqInt    iArrayAccess;
 
223
CqParseNode*    ParseTreePointer;
 
224
std::vector<CqString>   ParseNameSpaceStack;
 
225
std::vector<TqInt>              FunctionReturnCountStack;
 
226
EqShaderType gShaderType;
 
227
 
 
228
TqBool  FindVariable(const char* name, SqVarRef& ref);
 
229
TqBool  FindFunction(const char* name, std::vector<SqFuncRef>& Ref);
 
230
CqString strNameSpace();
 
231
void    TypeCheck();
 
232
void    Optimise();
 
233
void    InitStandardNamespace();
 
234
void    ProcessShaderArguments( CqParseNode* pArgs );
 
235
 
 
236
}
 
237
 
 
238
 
 
239
 
 
240
/* Enabling traces.  */
 
241
#ifndef YYDEBUG
 
242
# define YYDEBUG 0
 
243
#endif
 
244
 
 
245
/* Enabling verbose error messages.  */
 
246
#ifdef YYERROR_VERBOSE
 
247
# undef YYERROR_VERBOSE
 
248
# define YYERROR_VERBOSE 1
 
249
#else
 
250
# define YYERROR_VERBOSE 0
 
251
#endif
 
252
 
 
253
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 
254
#line 60 "parser.yxx"
 
255
typedef union YYSTYPE {
 
256
        CqParseNode*    m_pParseNode;
 
257
        TqInt                   m_VarType;
 
258
        EqShaderType    m_ShaderType;
 
259
        TqFloat                 m_FloatConst;
 
260
        CqString*       m_Identifier;
 
261
        struct{
 
262
                SqVarRef                VarRef;
 
263
                SqFuncRef               FuncRef;
 
264
                TqInt                           eType;
 
265
        }                               m_pSymbol;
 
266
        struct{
 
267
                TqInt                           Type;
 
268
                CqString*       Space;
 
269
        }                               m_TypeAndSpace;
 
270
        EqCommType              m_CommType;
 
271
} YYSTYPE;
 
272
/* Line 191 of yacc.c.  */
 
273
#line 273 "y.tab.c"
 
274
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
 
275
# define YYSTYPE_IS_DECLARED 1
 
276
# define YYSTYPE_IS_TRIVIAL 1
 
277
#endif
 
278
 
 
279
 
 
280
 
 
281
/* Copy the second part of user declarations.  */
 
282
#line 78 "parser.yxx"
 
283
 
 
284
extern TqInt yylex();
 
285
static void yyerror(const CqString Message);
 
286
 
 
287
 
 
288
/* Line 214 of yacc.c.  */
 
289
#line 289 "y.tab.c"
 
290
 
 
291
#if ! defined (yyoverflow) || YYERROR_VERBOSE
 
292
 
 
293
/* The parser invokes alloca or malloc; define the necessary symbols.  */
 
294
 
 
295
# if YYSTACK_USE_ALLOCA
 
296
#  define YYSTACK_ALLOC alloca
 
297
# else
 
298
#  ifndef YYSTACK_USE_ALLOCA
 
299
#   if defined (alloca) || defined (_ALLOCA_H)
 
300
#    define YYSTACK_ALLOC alloca
 
301
#   else
 
302
#    ifdef __GNUC__
 
303
#     define YYSTACK_ALLOC __builtin_alloca
 
304
#    endif
 
305
#   endif
 
306
#  endif
 
307
# endif
 
308
 
 
309
# ifdef YYSTACK_ALLOC
 
310
   /* Pacify GCC's `empty if-body' warning. */
 
311
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
 
312
# else
 
313
#  if defined (__STDC__) || defined (__cplusplus)
 
314
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
 
315
#   define YYSIZE_T size_t
 
316
#  endif
 
317
#  define YYSTACK_ALLOC malloc
 
318
#  define YYSTACK_FREE free
 
319
# endif
 
320
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
 
321
 
 
322
 
 
323
#if (! defined (yyoverflow) \
 
324
     && (! defined (__cplusplus) \
 
325
         || (YYSTYPE_IS_TRIVIAL)))
 
326
 
 
327
/* A type that is properly aligned for any stack member.  */
 
328
union yyalloc
 
329
{
 
330
  short yyss;
 
331
  YYSTYPE yyvs;
 
332
  };
 
333
 
 
334
/* The size of the maximum gap between one aligned stack and the next.  */
 
335
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
 
336
 
 
337
/* The size of an array large to enough to hold all stacks, each with
 
338
   N elements.  */
 
339
# define YYSTACK_BYTES(N) \
 
340
     ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
 
341
      + YYSTACK_GAP_MAXIMUM)
 
342
 
 
343
/* Copy COUNT objects from FROM to TO.  The source and destination do
 
344
   not overlap.  */
 
345
# ifndef YYCOPY
 
346
#  if 1 < __GNUC__
 
347
#   define YYCOPY(To, From, Count) \
 
348
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
 
349
#  else
 
350
#   define YYCOPY(To, From, Count)              \
 
351
      do                                        \
 
352
        {                                       \
 
353
          register YYSIZE_T yyi;                \
 
354
          for (yyi = 0; yyi < (Count); yyi++)   \
 
355
            (To)[yyi] = (From)[yyi];            \
 
356
        }                                       \
 
357
      while (0)
 
358
#  endif
 
359
# endif
 
360
 
 
361
/* Relocate STACK from its old location to the new one.  The
 
362
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
 
363
   elements in the stack, and YYPTR gives the new location of the
 
364
   stack.  Advance YYPTR to a properly aligned location for the next
 
365
   stack.  */
 
366
# define YYSTACK_RELOCATE(Stack)                                        \
 
367
    do                                                                  \
 
368
      {                                                                 \
 
369
        YYSIZE_T yynewbytes;                                            \
 
370
        YYCOPY (&yyptr->Stack, Stack, yysize);                          \
 
371
        Stack = &yyptr->Stack;                                          \
 
372
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
 
373
        yyptr += yynewbytes / sizeof (*yyptr);                          \
 
374
      }                                                                 \
 
375
    while (0)
 
376
 
 
377
#endif
 
378
 
 
379
#if defined (__STDC__) || defined (__cplusplus)
 
380
   typedef signed char yysigned_char;
 
381
#else
 
382
   typedef short yysigned_char;
 
383
#endif
 
384
 
 
385
/* YYFINAL -- State number of the termination state. */
 
386
#define YYFINAL  41
 
387
/* YYLAST -- Last index in YYTABLE.  */
 
388
#define YYLAST   2258
 
389
 
 
390
/* YYNTOKENS -- Number of terminals. */
 
391
#define YYNTOKENS  84
 
392
/* YYNNTS -- Number of nonterminals. */
 
393
#define YYNNTS  46
 
394
/* YYNRULES -- Number of rules. */
 
395
#define YYNRULES  179
 
396
/* YYNRULES -- Number of states. */
 
397
#define YYNSTATES  388
 
398
 
 
399
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 
400
#define YYUNDEFTOK  2
 
401
#define YYMAXUTOK   318
 
402
 
 
403
#define YYTRANSLATE(YYX)                                                \
 
404
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
 
405
 
 
406
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
 
407
static const unsigned char yytranslate[] =
 
408
{
 
409
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
410
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
411
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
412
       2,     2,     2,    72,     2,     2,     2,     2,     2,     2,
 
413
      74,    75,    70,    66,    81,    67,    71,    69,     2,     2,
 
414
       2,     2,     2,     2,     2,     2,     2,     2,    57,    80,
 
415
      61,    51,    60,    56,     2,     2,     2,     2,     2,     2,
 
416
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
417
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
418
       2,    82,     2,    83,    68,     2,     2,     2,     2,     2,
 
419
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
420
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
421
       2,     2,     2,    78,     2,    79,     2,     2,     2,     2,
 
422
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
423
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
424
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
425
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
426
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
427
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
428
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
429
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
430
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
431
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
432
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
433
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
434
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
 
435
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
 
436
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
 
437
      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
 
438
      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
 
439
      45,    46,    47,    48,    49,    50,    52,    53,    54,    55,
 
440
      58,    59,    62,    63,    64,    65,    73,    76,    77
 
441
};
 
442
 
 
443
#if YYDEBUG
 
444
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
 
445
   YYRHS.  */
 
446
static const unsigned short yyprhs[] =
 
447
{
 
448
       0,     0,     3,     5,     8,    10,    12,    21,    30,    38,
 
449
      46,    53,    59,    63,    66,    70,    73,    75,    77,    79,
 
450
      81,    83,    85,    87,    91,    94,    97,   101,   104,   108,
 
451
     111,   113,   115,   119,   122,   124,   129,   135,   139,   142,
 
452
     144,   149,   155,   159,   162,   167,   169,   173,   175,   177,
 
453
     179,   181,   183,   185,   187,   189,   191,   193,   196,   198,
 
454
     201,   203,   206,   208,   211,   213,   216,   218,   220,   222,
 
455
     225,   228,   231,   234,   237,   241,   244,   246,   249,   251,
 
456
     255,   258,   260,   264,   268,   274,   280,   284,   288,   298,
 
457
     308,   313,   321,   327,   337,   343,   351,   361,   373,   376,
 
458
     378,   380,   382,   384,   388,   392,   396,   400,   404,   408,
 
459
     411,   413,   419,   422,   424,   426,   428,   433,   435,   437,
 
460
     439,   441,   443,   447,   455,   489,   491,   493,   495,   497,
 
461
     499,   501,   505,   509,   513,   517,   520,   524,   528,   532,
 
462
     536,   540,   547,   554,   561,   568,   575,   580,   584,   589,
 
463
     593,   595,   599,   606,   612,   618,   623,   625,   627,   629,
 
464
     631,   633,   635,   639,   642,   646,   648,   650,   652,   654,
 
465
     656,   658,   660,   662,   664,   666,   668,   675,   684,   691
 
466
};
 
467
 
 
468
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
 
469
static const short yyrhs[] =
 
470
{
 
471
      85,     0,    -1,    86,    -1,    85,    86,    -1,    87,    -1,
 
472
      88,    -1,    90,     3,    74,    91,    75,    78,   108,    79,
 
473
      -1,    90,     4,    74,    91,    75,    78,   108,    79,    -1,
 
474
      90,     3,    74,    75,    78,   108,    79,    -1,    90,     4,
 
475
      74,    75,    78,   108,    79,    -1,    89,    91,    75,    78,
 
476
     108,    79,    -1,    89,    75,    78,   108,    79,    -1,    94,
 
477
       3,    74,    -1,     3,    74,    -1,    94,     4,    74,    -1,
 
478
       4,    74,    -1,    21,    -1,    16,    -1,    17,    -1,    20,
 
479
      -1,    19,    -1,    18,    -1,    92,    -1,    91,    80,    92,
 
480
      -1,    91,    80,    -1,    94,    95,    -1,    31,    94,    95,
 
481
      -1,    94,    95,    -1,    29,    94,    95,    -1,   100,   101,
 
482
      -1,   101,    -1,    96,    -1,    95,    81,    96,    -1,     3,
 
483
      97,    -1,     3,    -1,     3,    82,   127,    83,    -1,     3,
 
484
      82,   127,    83,    98,    -1,     3,    82,    83,    -1,     4,
 
485
      97,    -1,     4,    -1,     4,    82,   127,    83,    -1,     4,
 
486
      82,   127,    83,    98,    -1,     4,    82,    83,    -1,    51,
 
487
     113,    -1,    51,    78,    99,    79,    -1,   113,    -1,    99,
 
488
      81,   113,    -1,    15,    -1,    14,    -1,     6,    -1,     8,
 
489
      -1,    12,    -1,   102,    -1,   103,    -1,   104,    -1,   105,
 
490
      -1,   106,    -1,     7,   107,    -1,     7,    -1,     9,   107,
 
491
      -1,     9,    -1,    11,   107,    -1,    11,    -1,    10,   107,
 
492
      -1,    10,    -1,    13,   107,    -1,    13,    -1,    77,    -1,
 
493
     109,    -1,   108,   109,    -1,   118,    80,    -1,   119,    80,
 
494
      -1,   120,    80,    -1,   129,    80,    -1,    38,   113,    80,
 
495
      -1,   111,    80,    -1,   110,    -1,    93,    80,    -1,    88,
 
496
      -1,    78,   108,    79,    -1,    78,    79,    -1,    80,    -1,
 
497
      32,   117,   109,    -1,    32,   113,   109,    -1,    32,   117,
 
498
     109,    33,   109,    -1,    32,   113,   109,    33,   109,    -1,
 
499
      34,   117,   109,    -1,    34,   113,   109,    -1,    35,    74,
 
500
     113,    80,   117,    80,   113,    75,   109,    -1,    35,    74,
 
501
     113,    80,   113,    80,   113,    75,   109,    -1,    41,    74,
 
502
      75,   109,    -1,    41,    74,   113,    81,   113,    75,   109,
 
503
      -1,    39,    74,   113,    75,   109,    -1,    39,    74,   113,
 
504
      81,   113,    81,   113,    75,   109,    -1,    40,    74,   113,
 
505
      75,   109,    -1,    40,    74,   113,    81,   113,    75,   109,
 
506
      -1,    40,    74,   113,    81,   113,    81,   113,    75,   109,
 
507
      -1,    40,    74,   113,    81,   113,    81,   113,    81,   113,
 
508
      75,   109,    -1,   112,   127,    -1,   112,    -1,    37,    -1,
 
509
      36,    -1,   115,    -1,   113,    71,   113,    -1,   113,    69,
 
510
     113,    -1,   113,    70,   113,    -1,   113,    68,   113,    -1,
 
511
     113,    66,   113,    -1,   113,    67,   113,    -1,    67,   113,
 
512
      -1,   114,    -1,   117,    56,   113,    57,   113,    -1,   101,
 
513
     113,    -1,   127,    -1,   122,    -1,     4,    -1,     5,    82,
 
514
     113,    83,    -1,    77,    -1,   119,    -1,   120,    -1,   129,
 
515
      -1,   118,    -1,    74,   113,    75,    -1,    74,   113,    81,
 
516
     113,    81,   113,    75,    -1,    74,   113,    81,   113,    81,
 
517
     113,    81,   113,    81,   113,    81,   113,    81,   113,    81,
 
518
     113,    81,   113,    81,   113,    81,   113,    81,   113,    81,
 
519
     113,    81,   113,    81,   113,    81,   113,    75,    -1,    60,
 
520
      -1,    65,    -1,    61,    -1,    64,    -1,    63,    -1,    62,
 
521
      -1,    74,   117,    75,    -1,   113,   116,   113,    -1,   117,
 
522
      59,   117,    -1,   117,    58,   117,    -1,    72,   117,    -1,
 
523
       4,    51,   113,    -1,     4,    55,   113,    -1,     4,    54,
 
524
     113,    -1,     4,    53,   113,    -1,     4,    52,   113,    -1,
 
525
       5,    82,   113,    83,    51,   113,    -1,     5,    82,   113,
 
526
      83,    55,   113,    -1,     5,    82,   113,    83,    54,   113,
 
527
      -1,     5,    82,   113,    83,    53,   113,    -1,     5,    82,
 
528
     113,    83,    52,   113,    -1,     4,    74,   121,    75,    -1,
 
529
       4,    74,    75,    -1,     3,    74,   121,    75,    -1,     3,
 
530
      74,    75,    -1,   113,    -1,   121,    81,   113,    -1,   123,
 
531
      74,   124,   125,   126,    75,    -1,   123,    74,   124,   126,
 
532
      75,    -1,   123,    74,   124,   125,    75,    -1,   123,    74,
 
533
     124,    75,    -1,    42,    -1,    43,    -1,    44,    -1,    45,
 
534
      -1,    46,    -1,   113,    -1,    82,   113,    83,    -1,    81,
 
535
     113,    -1,   126,    81,   113,    -1,    76,    -1,    22,    -1,
 
536
      20,    -1,    28,    -1,    16,    -1,    23,    -1,    24,    -1,
 
537
      25,    -1,    26,    -1,    27,    -1,    30,    -1,   128,    74,
 
538
     113,    81,     4,    75,    -1,   128,    74,   113,    81,   113,
 
539
      81,     4,    75,    -1,   128,    74,   113,    81,     5,    75,
 
540
      -1,   128,    74,   113,    81,   113,    81,     5,    75,    -1
 
541
};
 
542
 
 
543
/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 
544
static const unsigned short yyrline[] =
 
545
{
 
546
       0,   167,   167,   168,   173,   174,   178,   191,   207,   214,
 
547
     227,   266,   289,   297,   305,   318,   334,   337,   340,   343,
 
548
     346,   349,   355,   368,   379,   383,   454,   530,   605,   656,
 
549
     660,   664,   670,   678,   687,   694,   701,   710,   717,   731,
 
550
     741,   751,   763,   776,   782,   797,   803,   811,   812,   816,
 
551
     820,   824,   828,   829,   830,   831,   832,   836,   840,   847,
 
552
     851,   858,   862,   869,   873,   880,   884,   891,   895,   901,
 
553
     909,   910,   918,   926,   931,   940,   941,   942,   968,   969,
 
554
     970,   971,   972,   980,   994,  1003,  1022,  1028,  1041,  1056,
 
555
    1078,  1084,  1098,  1107,  1123,  1136,  1150,  1167,  1188,  1189,
 
556
    1193,  1197,  1205,  1206,  1217,  1228,  1239,  1250,  1261,  1272,
 
557
    1282,  1283,  1296,  1342,  1346,  1347,  1351,  1356,  1360,  1361,
 
558
    1362,  1363,  1364,  1367,  1375,  1399,  1400,  1401,  1402,  1403,
 
559
    1404,  1408,  1411,  1418,  1425,  1432,  1440,  1446,  1460,  1474,
 
560
    1488,  1502,  1509,  1527,  1545,  1563,  1584,  1594,  1605,  1627,
 
561
    1643,  1649,  1657,  1671,  1685,  1691,  1700,  1706,  1712,  1718,
 
562
    1724,  1733,  1740,  1744,  1750,  1759,  1764,  1765,  1766,  1767,
 
563
    1768,  1769,  1770,  1771,  1772,  1773,  1778,  1799,  1829,  1850
 
564
};
 
565
#endif
 
566
 
 
567
#if YYDEBUG || YYERROR_VERBOSE
 
568
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
 
569
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
 
570
static const char *const yytname[] =
 
571
{
 
572
  "$end", "error", "$undefined", "IDENTIFIER", "SYMBOL", "ARRAY_SYMBOL", 
 
573
  "TYPE_FLOAT", "TYPE_POINT", "TYPE_STRING", "TYPE_COLOR", "TYPE_NORMAL", 
 
574
  "TYPE_VECTOR", "TYPE_VOID", "TYPE_MATRIX", "TYPE_UNIFORM", 
 
575
  "TYPE_VARYING", "SHADER_TYPE_SURFACE", "SHADER_TYPE_VOLUME", 
 
576
  "SHADER_TYPE_IMAGER", "SHADER_TYPE_TRANSFORMATION", 
 
577
  "SHADER_TYPE_DISPLACEMENT", "SHADER_TYPE_LIGHT", 
 
578
  "SHADER_TYPE_ATMOSPHERE", "ATTRIBUTE", "OPTION", "RENDERERINFO", 
 
579
  "INCIDENT", "OPPOSITE", "LIGHTSOURCE", "EXTERN", "TEXTUREINFO", 
 
580
  "OUTPUT", "IF", "ELSE", "WHILE", "FOR", "CONTINUE", "BREAK", "RETURN", 
 
581
  "ILLUMINATE", "ILLUMINANCE", "SOLAR", "TEXTUREMAP", "ENVIRONMENT", 
 
582
  "BUMP", "SHADOW", "OCCLUSION", "SETXCOMP", "SETYCOMP", "SETZCOMP", 
 
583
  "SETCOMP", "'='", "DIV_ASSIGN", "MUL_ASSIGN", "SUB_ASSIGN", 
 
584
  "ADD_ASSIGN", "'?'", "':'", "OR_OP", "AND_OP", "'>'", "'<'", "NE_OP", 
 
585
  "EQ_OP", "LE_OP", "GE_OP", "'+'", "'-'", "'^'", "'/'", "'*'", "'.'", 
 
586
  "'!'", "NEG", "'('", "')'", "FLOAT_CONSTANT", "STRING_LITERAL", "'{'", 
 
587
  "'}'", "';'", "','", "'['", "']'", "$accept", "file", "definitions", 
 
588
  "shader_definition", "function_definition", "function_declaration", 
 
589
  "shader_type", "formals", "formal_variable_definitions", 
 
590
  "variable_definitions", "typespec", "def_expressions", "def_expression", 
 
591
  "def_init", "def_array_initialisers", "array_initialisers", "detail", 
 
592
  "type", "pspace", "cspace", "vspace", "nspace", "mspace", "spacetype", 
 
593
  "statements", "statement", "loop_control", "loop_modstmt", "loop_mod", 
 
594
  "expression", "cast_expr", "primary", "relational_operator", "relation", 
 
595
  "assignexpression", "procedurecall", "unresolvedcall", "proc_arguments", 
 
596
  "texture", "texture_type", "texture_filename", "channel", 
 
597
  "texture_arguments", "number", "comm_type", "comm_function", 0
 
598
};
 
599
#endif
 
600
 
 
601
# ifdef YYPRINT
 
602
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
 
603
   token YYLEX-NUM.  */
 
604
static const unsigned short yytoknum[] =
 
605
{
 
606
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
 
607
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
 
608
     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
 
609
     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
 
610
     295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
 
611
     305,    61,   306,   307,   308,   309,    63,    58,   310,   311,
 
612
      62,    60,   312,   313,   314,   315,    43,    45,    94,    47,
 
613
      42,    46,    33,   316,    40,    41,   317,   318,   123,   125,
 
614
      59,    44,    91,    93
 
615
};
 
616
# endif
 
617
 
 
618
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 
619
static const unsigned char yyr1[] =
 
620
{
 
621
       0,    84,    85,    85,    86,    86,    87,    87,    87,    87,
 
622
      88,    88,    89,    89,    89,    89,    90,    90,    90,    90,
 
623
      90,    90,    91,    91,    91,    92,    92,    93,    93,    94,
 
624
      94,    95,    95,    96,    96,    96,    96,    96,    96,    96,
 
625
      96,    96,    96,    97,    98,    99,    99,   100,   100,   101,
 
626
     101,   101,   101,   101,   101,   101,   101,   102,   102,   103,
 
627
     103,   104,   104,   105,   105,   106,   106,   107,   108,   108,
 
628
     109,   109,   109,   109,   109,   109,   109,   109,   109,   109,
 
629
     109,   109,   109,   109,   109,   109,   110,   110,   110,   110,
 
630
     110,   110,   110,   110,   110,   110,   110,   110,   111,   111,
 
631
     112,   112,   113,   113,   113,   113,   113,   113,   113,   113,
 
632
     113,   113,   114,   115,   115,   115,   115,   115,   115,   115,
 
633
     115,   115,   115,   115,   115,   116,   116,   116,   116,   116,
 
634
     116,   117,   117,   117,   117,   117,   118,   118,   118,   118,
 
635
     118,   118,   118,   118,   118,   118,   119,   119,   120,   120,
 
636
     121,   121,   122,   122,   122,   122,   123,   123,   123,   123,
 
637
     123,   124,   125,   126,   126,   127,   128,   128,   128,   128,
 
638
     128,   128,   128,   128,   128,   128,   129,   129,   129,   129
 
639
};
 
640
 
 
641
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
 
642
static const unsigned char yyr2[] =
 
643
{
 
644
       0,     2,     1,     2,     1,     1,     8,     8,     7,     7,
 
645
       6,     5,     3,     2,     3,     2,     1,     1,     1,     1,
 
646
       1,     1,     1,     3,     2,     2,     3,     2,     3,     2,
 
647
       1,     1,     3,     2,     1,     4,     5,     3,     2,     1,
 
648
       4,     5,     3,     2,     4,     1,     3,     1,     1,     1,
 
649
       1,     1,     1,     1,     1,     1,     1,     2,     1,     2,
 
650
       1,     2,     1,     2,     1,     2,     1,     1,     1,     2,
 
651
       2,     2,     2,     2,     3,     2,     1,     2,     1,     3,
 
652
       2,     1,     3,     3,     5,     5,     3,     3,     9,     9,
 
653
       4,     7,     5,     9,     5,     7,     9,    11,     2,     1,
 
654
       1,     1,     1,     3,     3,     3,     3,     3,     3,     2,
 
655
       1,     5,     2,     1,     1,     1,     4,     1,     1,     1,
 
656
       1,     1,     3,     7,    33,     1,     1,     1,     1,     1,
 
657
       1,     3,     3,     3,     3,     2,     3,     3,     3,     3,
 
658
       3,     6,     6,     6,     6,     6,     4,     3,     4,     3,
 
659
       1,     3,     6,     5,     5,     4,     1,     1,     1,     1,
 
660
       1,     1,     3,     2,     3,     1,     1,     1,     1,     1,
 
661
       1,     1,     1,     1,     1,     1,     6,     8,     6,     8
 
662
};
 
663
 
 
664
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
 
665
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
 
666
   means the default is an error.  */
 
667
static const unsigned char yydefact[] =
 
668
{
 
669
       0,     0,     0,    49,    58,    50,    60,    64,    62,    51,
 
670
      66,    48,    47,    17,    18,    21,    20,    19,    16,     0,
 
671
       2,     4,     5,     0,     0,     0,     0,    30,    52,    53,
 
672
      54,    55,    56,    13,    15,    67,    57,    59,    63,    61,
 
673
      65,     1,     3,     0,     0,     0,    22,     0,     0,     0,
 
674
       0,     0,    29,     0,     0,     0,    24,    34,    39,    25,
 
675
      31,     0,     0,    12,    14,    26,     0,     0,     0,   169,
 
676
     167,   166,   170,   171,   172,   173,   174,   168,     0,   175,
 
677
       0,     0,     0,   101,   100,     0,     0,     0,     0,     0,
 
678
      81,    78,     0,     0,     0,    68,    76,     0,    99,     0,
 
679
       0,     0,     0,     0,     0,    23,     0,     0,    33,     0,
 
680
      38,     0,     0,     0,     0,     0,    13,     0,     0,     0,
 
681
       0,     0,    15,     0,     0,     0,   115,     0,   156,   157,
 
682
     158,   159,   160,     0,     0,     0,   165,   117,     0,     0,
 
683
     110,   102,     0,   121,   118,   119,   114,     0,   113,   120,
 
684
       0,     0,     0,     0,     0,     0,     0,     0,    80,     0,
 
685
      77,    34,    39,    27,    11,    69,    75,    98,    70,    71,
 
686
      72,     0,    73,     0,    43,    37,     0,    42,     0,    32,
 
687
       0,     0,     0,     0,   149,   150,     0,   136,   140,   139,
 
688
     138,   137,   147,     0,     0,    28,     0,     0,     0,   109,
 
689
       0,   135,     0,     0,   112,   125,   127,   130,   129,   128,
 
690
     126,     0,     0,     0,     0,     0,     0,    83,     0,     0,
 
691
       0,     0,    82,     0,    87,    86,     0,    74,     0,     0,
 
692
       0,     0,    79,     0,    10,    35,    40,     0,     0,     0,
 
693
       0,   148,     0,   146,     0,     0,   122,     0,   131,   107,
 
694
     108,   106,   104,   105,   103,     0,   132,     0,   134,   133,
 
695
       0,   161,     0,     0,     0,     0,     0,     0,    90,     0,
 
696
       0,     0,    36,    41,     8,     0,     9,     0,   151,     0,
 
697
       0,     0,     0,     0,   116,     0,    85,     0,    84,   155,
 
698
       0,     0,     0,     0,     0,     0,    92,     0,    94,     0,
 
699
       0,   115,     0,     0,     0,     6,     7,   141,   145,   144,
 
700
     143,   142,     0,   111,   163,     0,   154,     0,   153,     0,
 
701
       0,     0,     0,     0,     0,     0,   176,   178,     0,     0,
 
702
      45,     0,   162,   152,   164,     0,     0,     0,    95,     0,
 
703
      91,     0,     0,    44,     0,   123,     0,     0,     0,     0,
 
704
       0,     0,   177,   179,    46,     0,    89,    88,    93,    96,
 
705
       0,     0,     0,     0,    97,     0,     0,     0,     0,     0,
 
706
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
 
707
       0,     0,     0,     0,     0,     0,     0,   124
 
708
};
 
709
 
 
710
/* YYDEFGOTO[NTERM-NUM]. */
 
711
static const short yydefgoto[] =
 
712
{
 
713
      -1,    19,    20,    21,    91,    23,    24,    45,    46,    92,
 
714
      93,    59,    60,   108,   272,   329,    26,   138,    28,    29,
 
715
      30,    31,    32,    36,    94,    95,    96,    97,    98,   185,
 
716
     140,   141,   218,   154,   143,   144,   145,   186,   146,   147,
 
717
     262,   292,   293,   148,   102,   149
 
718
};
 
719
 
 
720
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
 
721
   STATE-NUM.  */
 
722
#define YYPACT_NINF -119
 
723
static const short yypact[] =
 
724
{
 
725
    2133,   -33,   -28,  -119,   -17,  -119,   -17,   -17,   -17,  -119,
 
726
     -17,  -119,  -119,  -119,  -119,  -119,  -119,  -119,  -119,   971,
 
727
    -119,  -119,  -119,   102,    17,    80,   531,  -119,  -119,  -119,
 
728
    -119,  -119,  -119,  -119,  -119,  -119,  -119,  -119,  -119,  -119,
 
729
    -119,  -119,  -119,   461,    -9,   -16,  -119,   115,   -25,    -1,
 
730
      18,    29,  -119,   115,  1417,    28,   424,   -37,   -34,    14,
 
731
    -119,   326,   376,  -119,  -119,    14,    52,    83,   101,  -119,
 
732
    -119,  -119,  -119,  -119,  -119,  -119,  -119,  -119,   461,  -119,
 
733
    1681,  1681,   107,  -119,  -119,  1681,   110,   116,   118,   929,
 
734
    -119,  -119,   109,   152,   990,  -119,  -119,   113,   125,   122,
 
735
     124,   130,   139,   135,  1417,  -119,  1681,   -65,  -119,   -11,
 
736
    -119,   115,   138,    21,   146,    99,  1681,  1681,  1681,  1681,
 
737
    1681,  1681,  1681,  1681,   115,   143,   117,   149,  -119,  -119,
 
738
    -119,  -119,  -119,  1681,  1681,  1681,  -119,  -119,  1681,   785,
 
739
    -119,  -119,   870,  -119,  -119,  -119,  -119,   148,  -119,  -119,
 
740
     785,   870,  1681,  2016,   106,  1681,  1681,  1456,  -119,  1051,
 
741
    -119,   -46,   -35,    14,  -119,  -119,  -119,  -119,  -119,  -119,
 
742
    -119,  1681,  -119,  1112,  2187,  -119,   150,  -119,   159,  -119,
 
743
    1417,   154,  1417,   157,  -119,  2187,   -18,  2187,  2187,  2187,
 
744
    2187,  2187,  -119,    -7,   499,    14,  1531,  1606,  1681,  -119,
 
745
    2187,  -119,   972,    66,  -119,  -119,  -119,  -119,  -119,  -119,
 
746
    -119,  1681,  1681,  1681,  1681,  1681,  1681,   193,  1681,  1681,
 
747
    1681,  1681,   194,  1681,  -119,  -119,  2037,  -119,  1033,  1094,
 
748
    1417,  1338,  -119,  1443,  -119,   177,   177,  1173,  1417,  1234,
 
749
    1417,  -119,  1681,  -119,   145,   625,  -119,  1681,  -119,   180,
 
750
     180,   -63,   172,   172,  -119,  1417,  2187,  2175,   187,  -119,
 
751
    1417,  2187,   -50,  1681,  1417,  1681,  1417,  1681,  -119,  1681,
 
752
    1756,   174,  -119,  -119,  -119,  1295,  -119,  1356,  2187,  1681,
 
753
    1681,  1681,  1681,  1681,   145,  1518,  -119,  1681,  -119,  -119,
 
754
    1681,  1681,     5,     7,  2058,   -29,  -119,  1593,  -119,  1155,
 
755
     852,    92,   -42,  1668,  1681,  -119,  -119,  2187,  2187,  2187,
 
756
    2187,  2187,  1681,  2187,  2187,   690,  -119,    16,  -119,  1681,
 
757
    1681,  1681,  1681,  1417,  1681,  1417,  -119,  -119,   144,    48,
 
758
    2187,  1216,  -119,  -119,  2187,  2095,  2111,  2127,  -119,  1277,
 
759
    -119,   178,   179,  -119,  1681,  -119,  1681,  1417,  1417,  1417,
 
760
    1417,  1681,  -119,  -119,  2187,  1743,  -119,  -119,  -119,  -119,
 
761
    2143,  1681,  1417,  1774,  -119,  1681,  1796,  1681,  1818,  1681,
 
762
    1840,  1681,  1862,  1681,  1884,  1681,  1906,  1681,  1928,  1681,
 
763
    1950,  1681,  1972,  1681,  1994,  1681,  2159,  -119
 
764
};
 
765
 
 
766
/* YYPGOTO[NTERM-NUM].  */
 
767
static const short yypgoto[] =
 
768
{
 
769
    -119,  -119,   238,  -119,     3,  -119,  -119,   114,   203,  -119,
 
770
      15,   -43,   151,   -57,    25,  -119,  -119,     0,  -119,  -119,
 
771
    -119,  -119,  -119,   199,   -80,   510,  -119,  -119,  -119,   360,
 
772
    -119,  -119,  -119,   -68,   -52,   -19,   140,  -118,  -119,  -119,
 
773
    -119,  -119,   -27,   -54,  -119,   270
 
774
};
 
775
 
 
776
/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
 
777
   positive, shift that token.  If negative, reduce the rule which
 
778
   number is the opposite.  If zero, do what YYDEFACT says.
 
779
   If YYTABLE_NINF, syntax error.  */
 
780
#define YYTABLE_NINF -1
 
781
static const unsigned short yytable[] =
 
782
{
 
783
      27,   110,    99,    22,   193,   106,   214,   215,   216,   159,
 
784
      65,   136,   142,   151,   106,    25,   106,   106,   175,    27,
 
785
      48,    49,    22,    27,   173,   289,    52,   219,    63,   220,
 
786
     221,   290,   291,   327,    25,   100,   107,    99,    47,    64,
 
787
     198,    33,    99,    27,   167,   107,    34,   109,   109,    61,
 
788
     163,   321,    99,   176,    27,   178,    27,   241,    53,    55,
 
789
      35,    27,    27,   242,    56,   136,   201,   203,   243,    54,
 
790
     100,    47,   177,    62,   242,   100,    47,    47,    27,   193,
 
791
     316,   195,   318,    50,    51,   100,   290,    99,   319,    27,
 
792
      99,   333,    63,   124,    27,   111,   181,   319,    99,    99,
 
793
     237,    56,   239,    64,    27,   110,   104,    99,     3,     4,
 
794
       5,     6,     7,     8,     9,    10,    11,    12,    57,    58,
 
795
     100,    99,   219,   100,   220,   221,   116,   343,    99,   344,
 
796
      99,   100,   100,    43,   117,   118,   119,   120,   121,    27,
 
797
     100,   248,    27,   117,   118,   119,   120,   121,   341,   342,
 
798
      27,    27,   258,   259,   100,   161,   162,   122,   275,    27,
 
799
     277,   100,   219,   100,   220,   221,   197,   326,   117,   118,
 
800
     119,   120,   121,    27,   183,   113,   115,    44,    99,    56,
 
801
      27,   152,    27,   123,   155,    99,    99,    99,    99,   160,
 
802
     156,   197,   157,   166,   101,   295,   279,   280,   281,   282,
 
803
     283,   136,   168,    99,   169,    37,    38,    39,    99,    40,
 
804
     170,   100,    99,   171,    99,   172,   180,   196,   100,   100,
 
805
     100,   100,   223,    99,   182,    99,   255,   260,   271,   101,
 
806
      27,   198,   238,   235,   101,   240,   100,    27,    27,    27,
 
807
      27,   100,   236,   216,   101,   100,   221,   100,   213,   214,
 
808
     215,   216,   304,   352,   353,    27,   100,    42,   100,   105,
 
809
      27,   273,   179,     0,    27,   317,    27,     0,     0,     0,
 
810
       0,    99,     0,    99,     0,    27,     0,    27,     0,   101,
 
811
       0,     0,   101,     0,     0,     0,     0,     0,     0,     0,
 
812
     101,   101,     0,     0,     0,    99,    99,    99,    99,   101,
 
813
       0,     0,     0,     0,   100,     0,   100,     0,     0,     0,
 
814
      99,     0,     0,   101,     0,     0,     0,     0,     0,     0,
 
815
     101,     0,   101,    27,   103,    27,     0,     0,   100,   100,
 
816
     100,   100,     3,     4,     5,     6,     7,     8,     9,    10,
 
817
      11,    12,     0,   100,     0,     0,     0,    27,    27,    27,
 
818
      27,     0,     0,     0,     0,     0,     0,    43,     0,   103,
 
819
       0,     0,    27,     0,   103,     0,     0,     0,     0,     0,
 
820
     101,     0,     0,     0,   103,     0,     0,   101,   101,   101,
 
821
     101,     0,     3,     4,     5,     6,     7,     8,     9,    10,
 
822
      11,    12,     0,     0,     0,   101,     0,     0,     0,     0,
 
823
     101,   112,     0,     0,   101,     0,   101,    43,     0,   103,
 
824
       0,     0,   103,     0,     0,   101,     0,   101,     0,     0,
 
825
     103,   103,     0,     0,     0,     0,     0,     0,     0,   103,
 
826
       3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
 
827
     139,   150,     0,   103,     0,   153,     0,     0,     0,     0,
 
828
     103,   114,   103,     0,     0,    43,     0,     0,     0,     0,
 
829
       0,     0,     0,   101,     0,   101,   174,     3,     4,     5,
 
830
       6,     7,     8,     9,    10,    11,    12,   187,   188,   189,
 
831
     190,   191,     0,   194,     0,     0,     0,   101,   101,   101,
 
832
     101,     0,     0,   199,   200,   202,     0,     0,   204,     0,
 
833
     103,     0,   101,     0,     0,     0,     0,   103,   103,   103,
 
834
     103,     0,   226,     0,     0,   228,   229,   231,     0,     0,
 
835
       0,     0,     0,     0,     0,   103,     0,     0,     0,     0,
 
836
     103,   233,     0,     0,   103,     0,   103,     3,     4,     5,
 
837
       6,     7,     8,     9,    10,   103,     0,   103,     0,     0,
 
838
       0,     0,     0,     0,     0,     0,     0,     0,   245,   205,
 
839
     206,   207,   208,   209,   210,   211,   212,   213,   214,   215,
 
840
     216,   249,   250,   251,   252,   253,   254,     0,   256,   257,
 
841
     200,   200,   244,   261,     0,     0,     0,     0,     0,     0,
 
842
       0,     0,     0,   103,     0,   103,     0,     0,     0,     0,
 
843
       0,     0,   278,     0,   165,     0,     0,   285,     0,     0,
 
844
       0,     0,     0,     0,     0,     0,     0,   103,   103,   103,
 
845
     103,     0,     0,   294,     0,   297,     0,   299,     0,   300,
 
846
     303,     0,   103,     0,     0,     0,     0,     0,     0,   307,
 
847
     308,   309,   310,   311,     0,     0,     0,   313,     0,   217,
 
848
     314,   315,   222,     0,     0,     0,     0,     0,     0,     0,
 
849
     224,   225,     0,     0,   330,     0,     0,     0,     0,   165,
 
850
       0,     0,   331,     0,     0,     0,     0,     0,     0,   334,
 
851
     335,   336,   337,   165,   339,   205,   206,   207,   208,   209,
 
852
     210,   211,   212,   213,   214,   215,   216,     0,     0,     0,
 
853
       0,     0,     0,     0,   354,     0,   355,     0,   284,     0,
 
854
       0,   360,     0,     0,     0,     0,     0,     0,     0,     0,
 
855
       0,   363,     0,     0,     0,   366,     0,   368,     0,   370,
 
856
       0,   372,     0,   374,     0,   376,     0,   378,     0,   380,
 
857
     268,   382,     0,   384,     0,   386,     0,   165,     0,   165,
 
858
     205,   206,   207,   208,   209,   210,   211,   212,   213,   214,
 
859
     215,   216,     0,     0,     0,   286,     0,     0,     0,     0,
 
860
     288,     0,     0,   332,   296,     0,   298,     0,     0,     0,
 
861
       0,     0,     0,     0,     0,   165,     0,   165,    66,    67,
 
862
      68,     3,     4,     5,     6,     7,     8,     9,    10,    11,
 
863
      12,    69,     0,     0,     0,    70,     0,    71,    72,    73,
 
864
      74,    75,    76,    77,    78,    79,     0,    80,     0,    81,
 
865
      82,    83,    84,    85,    86,    87,    88,     0,     0,     0,
 
866
       0,     0,     0,   338,     0,   340,     0,     0,     0,     0,
 
867
       0,     0,     0,     0,     0,   205,   206,   207,   208,   209,
 
868
     210,   211,   212,   213,   214,   215,   216,   356,   357,   358,
 
869
     359,     0,     0,    89,     0,    90,     0,     0,     0,     0,
 
870
       0,     0,   364,    66,    67,    68,     3,     4,     5,     6,
 
871
       7,     8,     9,    10,    11,    12,    69,     0,     0,     0,
 
872
      70,     0,    71,    72,    73,    74,    75,    76,    77,    78,
 
873
      79,     0,    80,     0,    81,    82,    83,    84,    85,    86,
 
874
      87,    88,   205,   206,   207,   208,   209,   210,   211,   212,
 
875
     213,   214,   215,   216,     0,     0,   219,   325,   220,   221,
 
876
       0,     0,    66,    67,    68,     3,     4,     5,     6,     7,
 
877
       8,     9,    10,    11,    12,    69,     0,     0,    89,    70,
 
878
      90,    71,    72,    73,    74,    75,    76,    77,    78,    79,
 
879
       0,    80,     0,    81,    82,    83,    84,    85,    86,    87,
 
880
      88,    41,     0,     0,     1,     2,     0,     3,     4,     5,
 
881
       6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
 
882
      16,    17,    18,    66,    67,    68,     3,     4,     5,     6,
 
883
       7,     8,     9,    10,    11,    12,    69,    89,   158,    90,
 
884
      70,     0,    71,    72,    73,    74,    75,    76,    77,    78,
 
885
      79,     0,    80,     0,    81,    82,    83,    84,    85,    86,
 
886
      87,    88,   205,   206,   207,   208,   209,   210,   211,   212,
 
887
     213,   214,   215,   216,     0,     0,     0,   246,     0,     0,
 
888
       0,     0,     0,   247,    66,    67,    68,     3,     4,     5,
 
889
       6,     7,     8,     9,    10,    11,    12,    69,    89,   164,
 
890
      90,    70,     0,    71,    72,    73,    74,    75,    76,    77,
 
891
      78,    79,     0,    80,     0,    81,    82,    83,    84,    85,
 
892
      86,    87,    88,   205,   206,   207,   208,   209,   210,   211,
 
893
     212,   213,   214,   215,   216,     0,     0,     0,   264,     0,
 
894
       0,     0,     0,     0,   265,    66,    67,    68,     3,     4,
 
895
       5,     6,     7,     8,     9,    10,    11,    12,    69,    89,
 
896
     232,    90,    70,     0,    71,    72,    73,    74,    75,    76,
 
897
      77,    78,    79,     0,    80,     0,    81,    82,    83,    84,
 
898
      85,    86,    87,    88,   205,   206,   207,   208,   209,   210,
 
899
     211,   212,   213,   214,   215,   216,     0,     0,     0,   266,
 
900
       0,     0,     0,     0,     0,   267,    66,    67,    68,     3,
 
901
       4,     5,     6,     7,     8,     9,    10,    11,    12,    69,
 
902
      89,   234,    90,    70,     0,    71,    72,    73,    74,    75,
 
903
      76,    77,    78,    79,     0,    80,     0,    81,    82,    83,
 
904
      84,    85,    86,    87,    88,   205,   206,   207,   208,   209,
 
905
     210,   211,   212,   213,   214,   215,   216,     0,     0,     0,
 
906
     323,     0,     0,     0,     0,     0,   324,    66,    67,    68,
 
907
       3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
 
908
      69,    89,   274,    90,    70,     0,    71,    72,    73,    74,
 
909
      75,    76,    77,    78,    79,     0,    80,     0,    81,    82,
 
910
      83,    84,    85,    86,    87,    88,   205,   206,   207,   208,
 
911
     209,   210,   211,   212,   213,   214,   215,   216,     0,     0,
 
912
       0,   345,     0,     0,     0,     0,     0,   346,    66,    67,
 
913
      68,     3,     4,     5,     6,     7,     8,     9,    10,    11,
 
914
      12,    69,    89,   276,    90,    70,     0,    71,    72,    73,
 
915
      74,    75,    76,    77,    78,    79,     0,    80,     0,    81,
 
916
      82,    83,    84,    85,    86,    87,    88,   205,   206,   207,
 
917
     208,   209,   210,   211,   212,   213,   214,   215,   216,     0,
 
918
       0,     0,   350,     0,     0,     0,     0,     0,   351,    66,
 
919
      67,    68,     3,     4,     5,     6,     7,     8,     9,    10,
 
920
      11,    12,    69,    89,   305,    90,    70,     0,    71,    72,
 
921
      73,    74,    75,    76,    77,    78,    79,     0,    80,     0,
 
922
      81,    82,    83,    84,    85,    86,    87,    88,   205,   206,
 
923
     207,   208,   209,   210,   211,   212,   213,   214,   215,   216,
 
924
       0,     0,     0,     0,     0,     0,     0,     0,     0,   269,
 
925
      66,    67,    68,     3,     4,     5,     6,     7,     8,     9,
 
926
      10,    11,    12,    69,    89,   306,    90,    70,     0,    71,
 
927
      72,    73,    74,    75,    76,    77,    78,    79,     0,    80,
 
928
       0,    81,    82,    83,    84,    85,    86,    87,    88,   125,
 
929
     126,   127,     3,     4,     5,     6,     7,     8,     9,    10,
 
930
       0,     0,    69,     0,     0,     0,    70,     0,    71,    72,
 
931
      73,    74,    75,    76,    77,     0,    79,     0,     0,     0,
 
932
       0,     0,     0,     0,     0,    89,     0,    90,   128,   129,
 
933
     130,   131,   132,   205,   206,   207,   208,   209,   210,   211,
 
934
     212,   213,   214,   215,   216,     0,     0,     0,     0,     0,
 
935
       0,     0,     0,   133,   270,     0,     0,     0,   134,     0,
 
936
     135,   230,   136,   137,   125,   126,   127,     3,     4,     5,
 
937
       6,     7,     8,     9,    10,     0,     0,    69,     0,     0,
 
938
       0,    70,     0,    71,    72,    73,    74,    75,    76,    77,
 
939
       0,    79,     0,     0,     0,     0,     0,     0,     0,     0,
 
940
       0,     0,     0,   128,   129,   130,   131,   132,   205,   206,
 
941
     207,   208,   209,   210,   211,   212,   213,   214,   215,   216,
 
942
       0,     0,     0,     0,     0,     0,     0,     0,   133,   312,
 
943
       0,     0,     0,   134,     0,   135,   184,   136,   137,   125,
 
944
     126,   127,     3,     4,     5,     6,     7,     8,     9,    10,
 
945
       0,     0,    69,     0,     0,     0,    70,     0,    71,    72,
 
946
      73,    74,    75,    76,    77,     0,    79,     0,     0,     0,
 
947
       0,     0,     0,     0,     0,     0,     0,     0,   128,   129,
 
948
     130,   131,   132,   205,   206,   207,   208,   209,   210,   211,
 
949
     212,   213,   214,   215,   216,     0,     0,     0,     0,     0,
 
950
       0,     0,     0,   133,   322,     0,     0,     0,   134,     0,
 
951
     135,   192,   136,   137,   125,   126,   127,     3,     4,     5,
 
952
       6,     7,     8,     9,    10,     0,     0,    69,     0,     0,
 
953
       0,    70,     0,    71,    72,    73,    74,    75,    76,    77,
 
954
       0,    79,     0,     0,     0,     0,     0,     0,     0,     0,
 
955
       0,     0,     0,   128,   129,   130,   131,   132,   205,   206,
 
956
     207,   208,   209,   210,   211,   212,   213,   214,   215,   216,
 
957
       0,     0,     0,     0,     0,     0,     0,     0,   133,   328,
 
958
       0,     0,     0,   134,     0,   135,     0,   136,   137,   125,
 
959
     301,   302,     3,     4,     5,     6,     7,     8,     9,    10,
 
960
       0,     0,    69,     0,     0,     0,    70,     0,    71,    72,
 
961
      73,    74,    75,    76,    77,     0,    79,     0,     0,     0,
 
962
       0,     0,     0,     0,     0,     0,     0,     0,   128,   129,
 
963
     130,   131,   132,   205,   206,   207,   208,   209,   210,   211,
 
964
     212,   213,   214,   215,   216,     0,     0,     0,     0,     0,
 
965
       0,     0,     0,   133,   361,     0,     0,     0,   134,     0,
 
966
     135,     0,   136,   137,   205,   206,   207,   208,   209,   210,
 
967
     211,   212,   213,   214,   215,   216,     0,     0,     0,     0,
 
968
       0,     0,     0,     0,     0,   365,   205,   206,   207,   208,
 
969
     209,   210,   211,   212,   213,   214,   215,   216,     0,     0,
 
970
       0,     0,     0,     0,     0,     0,     0,   367,   205,   206,
 
971
     207,   208,   209,   210,   211,   212,   213,   214,   215,   216,
 
972
       0,     0,     0,     0,     0,     0,     0,     0,     0,   369,
 
973
     205,   206,   207,   208,   209,   210,   211,   212,   213,   214,
 
974
     215,   216,     0,     0,     0,     0,     0,     0,     0,     0,
 
975
       0,   371,   205,   206,   207,   208,   209,   210,   211,   212,
 
976
     213,   214,   215,   216,     0,     0,     0,     0,     0,     0,
 
977
       0,     0,     0,   373,   205,   206,   207,   208,   209,   210,
 
978
     211,   212,   213,   214,   215,   216,     0,     0,     0,     0,
 
979
       0,     0,     0,     0,     0,   375,   205,   206,   207,   208,
 
980
     209,   210,   211,   212,   213,   214,   215,   216,     0,     0,
 
981
       0,     0,     0,     0,     0,     0,     0,   377,   205,   206,
 
982
     207,   208,   209,   210,   211,   212,   213,   214,   215,   216,
 
983
       0,     0,     0,     0,     0,     0,     0,     0,     0,   379,
 
984
     205,   206,   207,   208,   209,   210,   211,   212,   213,   214,
 
985
     215,   216,     0,     0,     0,     0,     0,     0,     0,     0,
 
986
       0,   381,   205,   206,   207,   208,   209,   210,   211,   212,
 
987
     213,   214,   215,   216,     0,     0,     0,     0,     0,     0,
 
988
       0,     0,     0,   383,   205,   206,   207,   208,   209,   210,
 
989
     211,   212,   213,   214,   215,   216,     0,     0,     0,     0,
 
990
       0,     0,     0,     0,     0,   385,   205,   206,   207,   208,
 
991
     209,   210,   211,   212,   213,   214,   215,   216,     0,     0,
 
992
       0,     0,     0,     0,     0,     0,   227,   205,   206,   207,
 
993
     208,   209,   210,   211,   212,   213,   214,   215,   216,     0,
 
994
       0,     0,     0,     0,     0,     0,     0,   263,   205,   206,
 
995
     207,   208,   209,   210,   211,   212,   213,   214,   215,   216,
 
996
       0,     0,     0,     0,     0,     0,     1,     2,   320,     3,
 
997
       4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
 
998
      14,    15,    16,    17,    18,   205,   206,   207,   208,   209,
 
999
     210,   211,   212,   213,   214,   215,   216,     0,     0,     0,
 
1000
     347,   205,   206,   207,   208,   209,   210,   211,   212,   213,
 
1001
     214,   215,   216,     0,     0,     0,   348,   205,   206,   207,
 
1002
     208,   209,   210,   211,   212,   213,   214,   215,   216,     0,
 
1003
       0,     0,   349,   205,   206,   207,   208,   209,   210,   211,
 
1004
     212,   213,   214,   215,   216,     0,     0,     0,   362,   205,
 
1005
     206,   207,   208,   209,   210,   211,   212,   213,   214,   215,
 
1006
     216,     0,   287,     0,   387,   205,   206,   207,   208,   209,
 
1007
     210,   211,   212,   213,   214,   215,   216,   205,   206,   207,
 
1008
     208,   209,   210,   211,   212,   213,   214,   215,   216
 
1009
};
 
1010
 
 
1011
static const short yycheck[] =
 
1012
{
 
1013
       0,    58,    54,     0,   122,    51,    69,    70,    71,    89,
 
1014
      53,    76,    80,    81,    51,     0,    51,    51,    83,    19,
 
1015
       3,     4,    19,    23,   104,    75,    26,    56,    74,    58,
 
1016
      59,    81,    82,    75,    19,    54,    82,    89,    23,    74,
 
1017
      82,    74,    94,    43,    98,    82,    74,    82,    82,    74,
 
1018
      93,    80,   104,   107,    54,   109,    56,    75,    43,    75,
 
1019
      77,    61,    62,    81,    80,    76,   134,   135,    75,    78,
 
1020
      89,    56,    83,    74,    81,    94,    61,    62,    78,   197,
 
1021
      75,   124,    75,     3,     4,   104,    81,   139,    81,    89,
 
1022
     142,    75,    74,    78,    94,    81,    75,    81,   150,   151,
 
1023
     180,    80,   182,    74,   104,   162,    78,   159,     6,     7,
 
1024
       8,     9,    10,    11,    12,    13,    14,    15,     3,     4,
 
1025
     139,   173,    56,   142,    58,    59,    74,    79,   180,    81,
 
1026
     182,   150,   151,    31,    51,    52,    53,    54,    55,   139,
 
1027
     159,    75,   142,    51,    52,    53,    54,    55,     4,     5,
 
1028
     150,   151,   220,   221,   173,     3,     4,    74,   238,   159,
 
1029
     240,   180,    56,   182,    58,    59,    74,    75,    51,    52,
 
1030
      53,    54,    55,   173,    75,    61,    62,    75,   230,    80,
 
1031
     180,    74,   182,    82,    74,   237,   238,   239,   240,    80,
 
1032
      74,    74,    74,    80,    54,   263,    51,    52,    53,    54,
 
1033
      55,    76,    80,   255,    80,     6,     7,     8,   260,    10,
 
1034
      80,   230,   264,    74,   266,    80,    78,    74,   237,   238,
 
1035
     239,   240,    74,   275,    78,   277,    33,    33,    51,    89,
 
1036
     230,    82,    78,    83,    94,    78,   255,   237,   238,   239,
 
1037
     240,   260,    83,    71,   104,   264,    59,   266,    68,    69,
 
1038
      70,    71,    78,    75,    75,   255,   275,    19,   277,    56,
 
1039
     260,   236,   111,    -1,   264,   292,   266,    -1,    -1,    -1,
 
1040
      -1,   323,    -1,   325,    -1,   275,    -1,   277,    -1,   139,
 
1041
      -1,    -1,   142,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
 
1042
     150,   151,    -1,    -1,    -1,   347,   348,   349,   350,   159,
 
1043
      -1,    -1,    -1,    -1,   323,    -1,   325,    -1,    -1,    -1,
 
1044
     362,    -1,    -1,   173,    -1,    -1,    -1,    -1,    -1,    -1,
 
1045
     180,    -1,   182,   323,    54,   325,    -1,    -1,   347,   348,
 
1046
     349,   350,     6,     7,     8,     9,    10,    11,    12,    13,
 
1047
      14,    15,    -1,   362,    -1,    -1,    -1,   347,   348,   349,
 
1048
     350,    -1,    -1,    -1,    -1,    -1,    -1,    31,    -1,    89,
 
1049
      -1,    -1,   362,    -1,    94,    -1,    -1,    -1,    -1,    -1,
 
1050
     230,    -1,    -1,    -1,   104,    -1,    -1,   237,   238,   239,
 
1051
     240,    -1,     6,     7,     8,     9,    10,    11,    12,    13,
 
1052
      14,    15,    -1,    -1,    -1,   255,    -1,    -1,    -1,    -1,
 
1053
     260,    75,    -1,    -1,   264,    -1,   266,    31,    -1,   139,
 
1054
      -1,    -1,   142,    -1,    -1,   275,    -1,   277,    -1,    -1,
 
1055
     150,   151,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   159,
 
1056
       6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
 
1057
      80,    81,    -1,   173,    -1,    85,    -1,    -1,    -1,    -1,
 
1058
     180,    75,   182,    -1,    -1,    31,    -1,    -1,    -1,    -1,
 
1059
      -1,    -1,    -1,   323,    -1,   325,   106,     6,     7,     8,
 
1060
       9,    10,    11,    12,    13,    14,    15,   117,   118,   119,
 
1061
     120,   121,    -1,   123,    -1,    -1,    -1,   347,   348,   349,
 
1062
     350,    -1,    -1,   133,   134,   135,    -1,    -1,   138,    -1,
 
1063
     230,    -1,   362,    -1,    -1,    -1,    -1,   237,   238,   239,
 
1064
     240,    -1,   152,    -1,    -1,   155,   156,   157,    -1,    -1,
 
1065
      -1,    -1,    -1,    -1,    -1,   255,    -1,    -1,    -1,    -1,
 
1066
     260,   171,    -1,    -1,   264,    -1,   266,     6,     7,     8,
 
1067
       9,    10,    11,    12,    13,   275,    -1,   277,    -1,    -1,
 
1068
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   198,    60,
 
1069
      61,    62,    63,    64,    65,    66,    67,    68,    69,    70,
 
1070
      71,   211,   212,   213,   214,   215,   216,    -1,   218,   219,
 
1071
     220,   221,    83,   223,    -1,    -1,    -1,    -1,    -1,    -1,
 
1072
      -1,    -1,    -1,   323,    -1,   325,    -1,    -1,    -1,    -1,
 
1073
      -1,    -1,   242,    -1,    94,    -1,    -1,   247,    -1,    -1,
 
1074
      -1,    -1,    -1,    -1,    -1,    -1,    -1,   347,   348,   349,
 
1075
     350,    -1,    -1,   263,    -1,   265,    -1,   267,    -1,   269,
 
1076
     270,    -1,   362,    -1,    -1,    -1,    -1,    -1,    -1,   279,
 
1077
     280,   281,   282,   283,    -1,    -1,    -1,   287,    -1,   139,
 
1078
     290,   291,   142,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
 
1079
     150,   151,    -1,    -1,   304,    -1,    -1,    -1,    -1,   159,
 
1080
      -1,    -1,   312,    -1,    -1,    -1,    -1,    -1,    -1,   319,
 
1081
     320,   321,   322,   173,   324,    60,    61,    62,    63,    64,
 
1082
      65,    66,    67,    68,    69,    70,    71,    -1,    -1,    -1,
 
1083
      -1,    -1,    -1,    -1,   344,    -1,   346,    -1,    83,    -1,
 
1084
      -1,   351,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
 
1085
      -1,   361,    -1,    -1,    -1,   365,    -1,   367,    -1,   369,
 
1086
      -1,   371,    -1,   373,    -1,   375,    -1,   377,    -1,   379,
 
1087
     230,   381,    -1,   383,    -1,   385,    -1,   237,    -1,   239,
 
1088
      60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
 
1089
      70,    71,    -1,    -1,    -1,   255,    -1,    -1,    -1,    -1,
 
1090
     260,    -1,    -1,    83,   264,    -1,   266,    -1,    -1,    -1,
 
1091
      -1,    -1,    -1,    -1,    -1,   275,    -1,   277,     3,     4,
 
1092
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
 
1093
      15,    16,    -1,    -1,    -1,    20,    -1,    22,    23,    24,
 
1094
      25,    26,    27,    28,    29,    30,    -1,    32,    -1,    34,
 
1095
      35,    36,    37,    38,    39,    40,    41,    -1,    -1,    -1,
 
1096
      -1,    -1,    -1,   323,    -1,   325,    -1,    -1,    -1,    -1,
 
1097
      -1,    -1,    -1,    -1,    -1,    60,    61,    62,    63,    64,
 
1098
      65,    66,    67,    68,    69,    70,    71,   347,   348,   349,
 
1099
     350,    -1,    -1,    78,    -1,    80,    -1,    -1,    -1,    -1,
 
1100
      -1,    -1,   362,     3,     4,     5,     6,     7,     8,     9,
 
1101
      10,    11,    12,    13,    14,    15,    16,    -1,    -1,    -1,
 
1102
      20,    -1,    22,    23,    24,    25,    26,    27,    28,    29,
 
1103
      30,    -1,    32,    -1,    34,    35,    36,    37,    38,    39,
 
1104
      40,    41,    60,    61,    62,    63,    64,    65,    66,    67,
 
1105
      68,    69,    70,    71,    -1,    -1,    56,    75,    58,    59,
 
1106
      -1,    -1,     3,     4,     5,     6,     7,     8,     9,    10,
 
1107
      11,    12,    13,    14,    15,    16,    -1,    -1,    78,    20,
 
1108
      80,    22,    23,    24,    25,    26,    27,    28,    29,    30,
 
1109
      -1,    32,    -1,    34,    35,    36,    37,    38,    39,    40,
 
1110
      41,     0,    -1,    -1,     3,     4,    -1,     6,     7,     8,
 
1111
       9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
 
1112
      19,    20,    21,     3,     4,     5,     6,     7,     8,     9,
 
1113
      10,    11,    12,    13,    14,    15,    16,    78,    79,    80,
 
1114
      20,    -1,    22,    23,    24,    25,    26,    27,    28,    29,
 
1115
      30,    -1,    32,    -1,    34,    35,    36,    37,    38,    39,
 
1116
      40,    41,    60,    61,    62,    63,    64,    65,    66,    67,
 
1117
      68,    69,    70,    71,    -1,    -1,    -1,    75,    -1,    -1,
 
1118
      -1,    -1,    -1,    81,     3,     4,     5,     6,     7,     8,
 
1119
       9,    10,    11,    12,    13,    14,    15,    16,    78,    79,
 
1120
      80,    20,    -1,    22,    23,    24,    25,    26,    27,    28,
 
1121
      29,    30,    -1,    32,    -1,    34,    35,    36,    37,    38,
 
1122
      39,    40,    41,    60,    61,    62,    63,    64,    65,    66,
 
1123
      67,    68,    69,    70,    71,    -1,    -1,    -1,    75,    -1,
 
1124
      -1,    -1,    -1,    -1,    81,     3,     4,     5,     6,     7,
 
1125
       8,     9,    10,    11,    12,    13,    14,    15,    16,    78,
 
1126
      79,    80,    20,    -1,    22,    23,    24,    25,    26,    27,
 
1127
      28,    29,    30,    -1,    32,    -1,    34,    35,    36,    37,
 
1128
      38,    39,    40,    41,    60,    61,    62,    63,    64,    65,
 
1129
      66,    67,    68,    69,    70,    71,    -1,    -1,    -1,    75,
 
1130
      -1,    -1,    -1,    -1,    -1,    81,     3,     4,     5,     6,
 
1131
       7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
 
1132
      78,    79,    80,    20,    -1,    22,    23,    24,    25,    26,
 
1133
      27,    28,    29,    30,    -1,    32,    -1,    34,    35,    36,
 
1134
      37,    38,    39,    40,    41,    60,    61,    62,    63,    64,
 
1135
      65,    66,    67,    68,    69,    70,    71,    -1,    -1,    -1,
 
1136
      75,    -1,    -1,    -1,    -1,    -1,    81,     3,     4,     5,
 
1137
       6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
 
1138
      16,    78,    79,    80,    20,    -1,    22,    23,    24,    25,
 
1139
      26,    27,    28,    29,    30,    -1,    32,    -1,    34,    35,
 
1140
      36,    37,    38,    39,    40,    41,    60,    61,    62,    63,
 
1141
      64,    65,    66,    67,    68,    69,    70,    71,    -1,    -1,
 
1142
      -1,    75,    -1,    -1,    -1,    -1,    -1,    81,     3,     4,
 
1143
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
 
1144
      15,    16,    78,    79,    80,    20,    -1,    22,    23,    24,
 
1145
      25,    26,    27,    28,    29,    30,    -1,    32,    -1,    34,
 
1146
      35,    36,    37,    38,    39,    40,    41,    60,    61,    62,
 
1147
      63,    64,    65,    66,    67,    68,    69,    70,    71,    -1,
 
1148
      -1,    -1,    75,    -1,    -1,    -1,    -1,    -1,    81,     3,
 
1149
       4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
 
1150
      14,    15,    16,    78,    79,    80,    20,    -1,    22,    23,
 
1151
      24,    25,    26,    27,    28,    29,    30,    -1,    32,    -1,
 
1152
      34,    35,    36,    37,    38,    39,    40,    41,    60,    61,
 
1153
      62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
 
1154
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    81,
 
1155
       3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
 
1156
      13,    14,    15,    16,    78,    79,    80,    20,    -1,    22,
 
1157
      23,    24,    25,    26,    27,    28,    29,    30,    -1,    32,
 
1158
      -1,    34,    35,    36,    37,    38,    39,    40,    41,     3,
 
1159
       4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
 
1160
      -1,    -1,    16,    -1,    -1,    -1,    20,    -1,    22,    23,
 
1161
      24,    25,    26,    27,    28,    -1,    30,    -1,    -1,    -1,
 
1162
      -1,    -1,    -1,    -1,    -1,    78,    -1,    80,    42,    43,
 
1163
      44,    45,    46,    60,    61,    62,    63,    64,    65,    66,
 
1164
      67,    68,    69,    70,    71,    -1,    -1,    -1,    -1,    -1,
 
1165
      -1,    -1,    -1,    67,    81,    -1,    -1,    -1,    72,    -1,
 
1166
      74,    75,    76,    77,     3,     4,     5,     6,     7,     8,
 
1167
       9,    10,    11,    12,    13,    -1,    -1,    16,    -1,    -1,
 
1168
      -1,    20,    -1,    22,    23,    24,    25,    26,    27,    28,
 
1169
      -1,    30,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
 
1170
      -1,    -1,    -1,    42,    43,    44,    45,    46,    60,    61,
 
1171
      62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
 
1172
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    67,    81,
 
1173
      -1,    -1,    -1,    72,    -1,    74,    75,    76,    77,     3,
 
1174
       4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
 
1175
      -1,    -1,    16,    -1,    -1,    -1,    20,    -1,    22,    23,
 
1176
      24,    25,    26,    27,    28,    -1,    30,    -1,    -1,    -1,
 
1177
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    42,    43,
 
1178
      44,    45,    46,    60,    61,    62,    63,    64,    65,    66,
 
1179
      67,    68,    69,    70,    71,    -1,    -1,    -1,    -1,    -1,
 
1180
      -1,    -1,    -1,    67,    81,    -1,    -1,    -1,    72,    -1,
 
1181
      74,    75,    76,    77,     3,     4,     5,     6,     7,     8,
 
1182
       9,    10,    11,    12,    13,    -1,    -1,    16,    -1,    -1,
 
1183
      -1,    20,    -1,    22,    23,    24,    25,    26,    27,    28,
 
1184
      -1,    30,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
 
1185
      -1,    -1,    -1,    42,    43,    44,    45,    46,    60,    61,
 
1186
      62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
 
1187
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    67,    81,
 
1188
      -1,    -1,    -1,    72,    -1,    74,    -1,    76,    77,     3,
 
1189
       4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
 
1190
      -1,    -1,    16,    -1,    -1,    -1,    20,    -1,    22,    23,
 
1191
      24,    25,    26,    27,    28,    -1,    30,    -1,    -1,    -1,
 
1192
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    42,    43,
 
1193
      44,    45,    46,    60,    61,    62,    63,    64,    65,    66,
 
1194
      67,    68,    69,    70,    71,    -1,    -1,    -1,    -1,    -1,
 
1195
      -1,    -1,    -1,    67,    81,    -1,    -1,    -1,    72,    -1,
 
1196
      74,    -1,    76,    77,    60,    61,    62,    63,    64,    65,
 
1197
      66,    67,    68,    69,    70,    71,    -1,    -1,    -1,    -1,
 
1198
      -1,    -1,    -1,    -1,    -1,    81,    60,    61,    62,    63,
 
1199
      64,    65,    66,    67,    68,    69,    70,    71,    -1,    -1,
 
1200
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    81,    60,    61,
 
1201
      62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
 
1202
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    81,
 
1203
      60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
 
1204
      70,    71,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
 
1205
      -1,    81,    60,    61,    62,    63,    64,    65,    66,    67,
 
1206
      68,    69,    70,    71,    -1,    -1,    -1,    -1,    -1,    -1,
 
1207
      -1,    -1,    -1,    81,    60,    61,    62,    63,    64,    65,
 
1208
      66,    67,    68,    69,    70,    71,    -1,    -1,    -1,    -1,
 
1209
      -1,    -1,    -1,    -1,    -1,    81,    60,    61,    62,    63,
 
1210
      64,    65,    66,    67,    68,    69,    70,    71,    -1,    -1,
 
1211
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    81,    60,    61,
 
1212
      62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
 
1213
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    81,
 
1214
      60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
 
1215
      70,    71,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
 
1216
      -1,    81,    60,    61,    62,    63,    64,    65,    66,    67,
 
1217
      68,    69,    70,    71,    -1,    -1,    -1,    -1,    -1,    -1,
 
1218
      -1,    -1,    -1,    81,    60,    61,    62,    63,    64,    65,
 
1219
      66,    67,    68,    69,    70,    71,    -1,    -1,    -1,    -1,
 
1220
      -1,    -1,    -1,    -1,    -1,    81,    60,    61,    62,    63,
 
1221
      64,    65,    66,    67,    68,    69,    70,    71,    -1,    -1,
 
1222
      -1,    -1,    -1,    -1,    -1,    -1,    80,    60,    61,    62,
 
1223
      63,    64,    65,    66,    67,    68,    69,    70,    71,    -1,
 
1224
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    80,    60,    61,
 
1225
      62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
 
1226
      -1,    -1,    -1,    -1,    -1,    -1,     3,     4,    80,     6,
 
1227
       7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
 
1228
      17,    18,    19,    20,    21,    60,    61,    62,    63,    64,
 
1229
      65,    66,    67,    68,    69,    70,    71,    -1,    -1,    -1,
 
1230
      75,    60,    61,    62,    63,    64,    65,    66,    67,    68,
 
1231
      69,    70,    71,    -1,    -1,    -1,    75,    60,    61,    62,
 
1232
      63,    64,    65,    66,    67,    68,    69,    70,    71,    -1,
 
1233
      -1,    -1,    75,    60,    61,    62,    63,    64,    65,    66,
 
1234
      67,    68,    69,    70,    71,    -1,    -1,    -1,    75,    60,
 
1235
      61,    62,    63,    64,    65,    66,    67,    68,    69,    70,
 
1236
      71,    -1,    57,    -1,    75,    60,    61,    62,    63,    64,
 
1237
      65,    66,    67,    68,    69,    70,    71,    60,    61,    62,
 
1238
      63,    64,    65,    66,    67,    68,    69,    70,    71
 
1239
};
 
1240
 
 
1241
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
 
1242
   symbol of state STATE-NUM.  */
 
1243
static const unsigned char yystos[] =
 
1244
{
 
1245
       0,     3,     4,     6,     7,     8,     9,    10,    11,    12,
 
1246
      13,    14,    15,    16,    17,    18,    19,    20,    21,    85,
 
1247
      86,    87,    88,    89,    90,    94,   100,   101,   102,   103,
 
1248
     104,   105,   106,    74,    74,    77,   107,   107,   107,   107,
 
1249
     107,     0,    86,    31,    75,    91,    92,    94,     3,     4,
 
1250
       3,     4,   101,    94,    78,    75,    80,     3,     4,    95,
 
1251
      96,    74,    74,    74,    74,    95,     3,     4,     5,    16,
 
1252
      20,    22,    23,    24,    25,    26,    27,    28,    29,    30,
 
1253
      32,    34,    35,    36,    37,    38,    39,    40,    41,    78,
 
1254
      80,    88,    93,    94,   108,   109,   110,   111,   112,   118,
 
1255
     119,   120,   128,   129,    78,    92,    51,    82,    97,    82,
 
1256
      97,    81,    75,    91,    75,    91,    74,    51,    52,    53,
 
1257
      54,    55,    74,    82,    94,     3,     4,     5,    42,    43,
 
1258
      44,    45,    46,    67,    72,    74,    76,    77,   101,   113,
 
1259
     114,   115,   117,   118,   119,   120,   122,   123,   127,   129,
 
1260
     113,   117,    74,   113,   117,    74,    74,    74,    79,   108,
 
1261
      80,     3,     4,    95,    79,   109,    80,   127,    80,    80,
 
1262
      80,    74,    80,   108,   113,    83,   127,    83,   127,    96,
 
1263
      78,    75,    78,    75,    75,   113,   121,   113,   113,   113,
 
1264
     113,   113,    75,   121,   113,    95,    74,    74,    82,   113,
 
1265
     113,   117,   113,   117,   113,    60,    61,    62,    63,    64,
 
1266
      65,    66,    67,    68,    69,    70,    71,   109,   116,    56,
 
1267
      58,    59,   109,    74,   109,   109,   113,    80,   113,   113,
 
1268
      75,   113,    79,   113,    79,    83,    83,   108,    78,   108,
 
1269
      78,    75,    81,    75,    83,   113,    75,    81,    75,   113,
 
1270
     113,   113,   113,   113,   113,    33,   113,   113,   117,   117,
 
1271
      33,   113,   124,    80,    75,    81,    75,    81,   109,    81,
 
1272
      81,    51,    98,    98,    79,   108,    79,   108,   113,    51,
 
1273
      52,    53,    54,    55,    83,   113,   109,    57,   109,    75,
 
1274
      81,    82,   125,   126,   113,   117,   109,   113,   109,   113,
 
1275
     113,     4,     5,   113,    78,    79,    79,   113,   113,   113,
 
1276
     113,   113,    81,   113,   113,   113,    75,   126,    75,    81,
 
1277
      80,    80,    81,    75,    81,    75,    75,    75,    81,    99,
 
1278
     113,   113,    83,    75,   113,   113,   113,   113,   109,   113,
 
1279
     109,     4,     5,    79,    81,    75,    81,    75,    75,    75,
 
1280
      75,    81,    75,    75,   113,   113,   109,   109,   109,   109,
 
1281
     113,    81,    75,   113,   109,    81,   113,    81,   113,    81,
 
1282
     113,    81,   113,    81,   113,    81,   113,    81,   113,    81,
 
1283
     113,    81,   113,    81,   113,    81,   113,    75
 
1284
};
 
1285
 
 
1286
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
 
1287
# define YYSIZE_T __SIZE_TYPE__
 
1288
#endif
 
1289
#if ! defined (YYSIZE_T) && defined (size_t)
 
1290
# define YYSIZE_T size_t
 
1291
#endif
 
1292
#if ! defined (YYSIZE_T)
 
1293
# if defined (__STDC__) || defined (__cplusplus)
 
1294
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
 
1295
#  define YYSIZE_T size_t
 
1296
# endif
 
1297
#endif
 
1298
#if ! defined (YYSIZE_T)
 
1299
# define YYSIZE_T unsigned int
 
1300
#endif
 
1301
 
 
1302
#define yyerrok         (yyerrstatus = 0)
 
1303
#define yyclearin       (yychar = YYEMPTY)
 
1304
#define YYEMPTY         (-2)
 
1305
#define YYEOF           0
 
1306
 
 
1307
#define YYACCEPT        goto yyacceptlab
 
1308
#define YYABORT         goto yyabortlab
 
1309
#define YYERROR         goto yyerrlab1
 
1310
 
 
1311
 
 
1312
/* Like YYERROR except do call yyerror.  This remains here temporarily
 
1313
   to ease the transition to the new meaning of YYERROR, for GCC.
 
1314
   Once GCC version 2 has supplanted version 1, this can go.  */
 
1315
 
 
1316
#define YYFAIL          goto yyerrlab
 
1317
 
 
1318
#define YYRECOVERING()  (!!yyerrstatus)
 
1319
 
 
1320
#define YYBACKUP(Token, Value)                                  \
 
1321
do                                                              \
 
1322
  if (yychar == YYEMPTY && yylen == 1)                          \
 
1323
    {                                                           \
 
1324
      yychar = (Token);                                         \
 
1325
      yylval = (Value);                                         \
 
1326
      yytoken = YYTRANSLATE (yychar);                           \
 
1327
      YYPOPSTACK;                                               \
 
1328
      goto yybackup;                                            \
 
1329
    }                                                           \
 
1330
  else                                                          \
 
1331
    {                                                           \
 
1332
      yyerror ("syntax error: cannot back up");\
 
1333
      YYERROR;                                                  \
 
1334
    }                                                           \
 
1335
while (0)
 
1336
 
 
1337
#define YYTERROR        1
 
1338
#define YYERRCODE       256
 
1339
 
 
1340
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
 
1341
   are run).  */
 
1342
 
 
1343
#ifndef YYLLOC_DEFAULT
 
1344
# define YYLLOC_DEFAULT(Current, Rhs, N)         \
 
1345
  Current.first_line   = Rhs[1].first_line;      \
 
1346
  Current.first_column = Rhs[1].first_column;    \
 
1347
  Current.last_line    = Rhs[N].last_line;       \
 
1348
  Current.last_column  = Rhs[N].last_column;
 
1349
#endif
 
1350
 
 
1351
/* YYLEX -- calling `yylex' with the right arguments.  */
 
1352
 
 
1353
#ifdef YYLEX_PARAM
 
1354
# define YYLEX yylex (YYLEX_PARAM)
 
1355
#else
 
1356
# define YYLEX yylex ()
 
1357
#endif
 
1358
 
 
1359
/* Enable debugging if requested.  */
 
1360
#if YYDEBUG
 
1361
 
 
1362
# ifndef YYFPRINTF
 
1363
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
 
1364
#  define YYFPRINTF fprintf
 
1365
# endif
 
1366
 
 
1367
# define YYDPRINTF(Args)                        \
 
1368
do {                                            \
 
1369
  if (yydebug)                                  \
 
1370
    YYFPRINTF Args;                             \
 
1371
} while (0)
 
1372
 
 
1373
# define YYDSYMPRINT(Args)                      \
 
1374
do {                                            \
 
1375
  if (yydebug)                                  \
 
1376
    yysymprint Args;                            \
 
1377
} while (0)
 
1378
 
 
1379
# define YYDSYMPRINTF(Title, Token, Value, Location)            \
 
1380
do {                                                            \
 
1381
  if (yydebug)                                                  \
 
1382
    {                                                           \
 
1383
      YYFPRINTF (stderr, "%s ", Title);                         \
 
1384
      yysymprint (stderr,                                       \
 
1385
                  Token, Value);        \
 
1386
      YYFPRINTF (stderr, "\n");                                 \
 
1387
    }                                                           \
 
1388
} while (0)
 
1389
 
 
1390
/*------------------------------------------------------------------.
 
1391
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
 
1392
| TOP (cinluded).                                                   |
 
1393
`------------------------------------------------------------------*/
 
1394
 
 
1395
#if defined (__STDC__) || defined (__cplusplus)
 
1396
static void
 
1397
yy_stack_print (short *bottom, short *top)
 
1398
#else
 
1399
static void
 
1400
yy_stack_print (bottom, top)
 
1401
    short *bottom;
 
1402
    short *top;
 
1403
#endif
 
1404
{
 
1405
  YYFPRINTF (stderr, "Stack now");
 
1406
  for (/* Nothing. */; bottom <= top; ++bottom)
 
1407
    YYFPRINTF (stderr, " %d", *bottom);
 
1408
  YYFPRINTF (stderr, "\n");
 
1409
}
 
1410
 
 
1411
# define YY_STACK_PRINT(Bottom, Top)                            \
 
1412
do {                                                            \
 
1413
  if (yydebug)                                                  \
 
1414
    yy_stack_print ((Bottom), (Top));                           \
 
1415
} while (0)
 
1416
 
 
1417
 
 
1418
/*------------------------------------------------.
 
1419
| Report that the YYRULE is going to be reduced.  |
 
1420
`------------------------------------------------*/
 
1421
 
 
1422
#if defined (__STDC__) || defined (__cplusplus)
 
1423
static void
 
1424
yy_reduce_print (int yyrule)
 
1425
#else
 
1426
static void
 
1427
yy_reduce_print (yyrule)
 
1428
    int yyrule;
 
1429
#endif
 
1430
{
 
1431
  int yyi;
 
1432
  unsigned int yylineno = yyrline[yyrule];
 
1433
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
 
1434
             yyrule - 1, yylineno);
 
1435
  /* Print the symbols being reduced, and their result.  */
 
1436
  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
 
1437
    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
 
1438
  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
 
1439
}
 
1440
 
 
1441
# define YY_REDUCE_PRINT(Rule)          \
 
1442
do {                                    \
 
1443
  if (yydebug)                          \
 
1444
    yy_reduce_print (Rule);             \
 
1445
} while (0)
 
1446
 
 
1447
/* Nonzero means print parse trace.  It is left uninitialized so that
 
1448
   multiple parsers can coexist.  */
 
1449
int yydebug;
 
1450
#else /* !YYDEBUG */
 
1451
# define YYDPRINTF(Args)
 
1452
# define YYDSYMPRINT(Args)
 
1453
# define YYDSYMPRINTF(Title, Token, Value, Location)
 
1454
# define YY_STACK_PRINT(Bottom, Top)
 
1455
# define YY_REDUCE_PRINT(Rule)
 
1456
#endif /* !YYDEBUG */
 
1457
 
 
1458
 
 
1459
/* YYINITDEPTH -- initial size of the parser's stacks.  */
 
1460
#ifndef YYINITDEPTH
 
1461
# define YYINITDEPTH 200
 
1462
#endif
 
1463
 
 
1464
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
 
1465
   if the built-in stack extension method is used).
 
1466
 
 
1467
   Do not make this value too large; the results are undefined if
 
1468
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
 
1469
   evaluated with infinite-precision integer arithmetic.  */
 
1470
 
 
1471
#if YYMAXDEPTH == 0
 
1472
# undef YYMAXDEPTH
 
1473
#endif
 
1474
 
 
1475
#ifndef YYMAXDEPTH
 
1476
# define YYMAXDEPTH 10000
 
1477
#endif
 
1478
 
 
1479
 
 
1480
 
 
1481
#if YYERROR_VERBOSE
 
1482
 
 
1483
# ifndef yystrlen
 
1484
#  if defined (__GLIBC__) && defined (_STRING_H)
 
1485
#   define yystrlen strlen
 
1486
#  else
 
1487
/* Return the length of YYSTR.  */
 
1488
static YYSIZE_T
 
1489
#   if defined (__STDC__) || defined (__cplusplus)
 
1490
yystrlen (const char *yystr)
 
1491
#   else
 
1492
yystrlen (yystr)
 
1493
     const char *yystr;
 
1494
#   endif
 
1495
{
 
1496
  register const char *yys = yystr;
 
1497
 
 
1498
  while (*yys++ != '\0')
 
1499
    continue;
 
1500
 
 
1501
  return yys - yystr - 1;
 
1502
}
 
1503
#  endif
 
1504
# endif
 
1505
 
 
1506
# ifndef yystpcpy
 
1507
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
 
1508
#   define yystpcpy stpcpy
 
1509
#  else
 
1510
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
 
1511
   YYDEST.  */
 
1512
static char *
 
1513
#   if defined (__STDC__) || defined (__cplusplus)
 
1514
yystpcpy (char *yydest, const char *yysrc)
 
1515
#   else
 
1516
yystpcpy (yydest, yysrc)
 
1517
     char *yydest;
 
1518
     const char *yysrc;
 
1519
#   endif
 
1520
{
 
1521
  register char *yyd = yydest;
 
1522
  register const char *yys = yysrc;
 
1523
 
 
1524
  while ((*yyd++ = *yys++) != '\0')
 
1525
    continue;
 
1526
 
 
1527
  return yyd - 1;
 
1528
}
 
1529
#  endif
 
1530
# endif
 
1531
 
 
1532
#endif /* !YYERROR_VERBOSE */
 
1533
 
 
1534
 
 
1535
 
 
1536
#if YYDEBUG
 
1537
/*--------------------------------.
 
1538
| Print this symbol on YYOUTPUT.  |
 
1539
`--------------------------------*/
 
1540
 
 
1541
#if defined (__STDC__) || defined (__cplusplus)
 
1542
static void
 
1543
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
 
1544
#else
 
1545
static void
 
1546
yysymprint (yyoutput, yytype, yyvaluep)
 
1547
    FILE *yyoutput;
 
1548
    int yytype;
 
1549
    YYSTYPE *yyvaluep;
 
1550
#endif
 
1551
{
 
1552
  /* Pacify ``unused variable'' warnings.  */
 
1553
  (void) yyvaluep;
 
1554
 
 
1555
  if (yytype < YYNTOKENS)
 
1556
    {
 
1557
      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
 
1558
# ifdef YYPRINT
 
1559
      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
 
1560
# endif
 
1561
    }
 
1562
  else
 
1563
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
 
1564
 
 
1565
  switch (yytype)
 
1566
    {
 
1567
      default:
 
1568
        break;
 
1569
    }
 
1570
  YYFPRINTF (yyoutput, ")");
 
1571
}
 
1572
 
 
1573
#endif /* ! YYDEBUG */
 
1574
/*-----------------------------------------------.
 
1575
| Release the memory associated to this symbol.  |
 
1576
`-----------------------------------------------*/
 
1577
 
 
1578
#if defined (__STDC__) || defined (__cplusplus)
 
1579
static void
 
1580
yydestruct (int yytype, YYSTYPE *yyvaluep)
 
1581
#else
 
1582
static void
 
1583
yydestruct (yytype, yyvaluep)
 
1584
    int yytype;
 
1585
    YYSTYPE *yyvaluep;
 
1586
#endif
 
1587
{
 
1588
  /* Pacify ``unused variable'' warnings.  */
 
1589
  (void) yyvaluep;
 
1590
 
 
1591
  switch (yytype)
 
1592
    {
 
1593
 
 
1594
      default:
 
1595
        break;
 
1596
    }
 
1597
}
 
1598
 
 
1599
 
 
1600
/* Prevent warnings from -Wmissing-prototypes.  */
 
1601
 
 
1602
#ifdef YYPARSE_PARAM
 
1603
# if defined (__STDC__) || defined (__cplusplus)
 
1604
int yyparse (void *YYPARSE_PARAM);
 
1605
# else
 
1606
int yyparse ();
 
1607
# endif
 
1608
#else /* ! YYPARSE_PARAM */
 
1609
#if defined (__STDC__) || defined (__cplusplus)
 
1610
int yyparse (void);
 
1611
#else
 
1612
int yyparse ();
 
1613
#endif
 
1614
#endif /* ! YYPARSE_PARAM */
 
1615
 
 
1616
 
 
1617
 
 
1618
/* The lookahead symbol.  */
 
1619
int yychar;
 
1620
 
 
1621
/* The semantic value of the lookahead symbol.  */
 
1622
YYSTYPE yylval;
 
1623
 
 
1624
/* Number of syntax errors so far.  */
 
1625
int yynerrs;
 
1626
 
 
1627
 
 
1628
 
 
1629
/*----------.
 
1630
| yyparse.  |
 
1631
`----------*/
 
1632
 
 
1633
#ifdef YYPARSE_PARAM
 
1634
# if defined (__STDC__) || defined (__cplusplus)
 
1635
int yyparse (void *YYPARSE_PARAM)
 
1636
# else
 
1637
int yyparse (YYPARSE_PARAM)
 
1638
  void *YYPARSE_PARAM;
 
1639
# endif
 
1640
#else /* ! YYPARSE_PARAM */
 
1641
#if defined (__STDC__) || defined (__cplusplus)
 
1642
int
 
1643
yyparse (void)
 
1644
#else
 
1645
int
 
1646
yyparse ()
 
1647
 
 
1648
#endif
 
1649
#endif
 
1650
{
 
1651
  
 
1652
  register int yystate;
 
1653
  register int yyn;
 
1654
  int yyresult;
 
1655
  /* Number of tokens to shift before error messages enabled.  */
 
1656
  int yyerrstatus;
 
1657
  /* Lookahead token as an internal (translated) token number.  */
 
1658
  int yytoken = 0;
 
1659
 
 
1660
  /* Three stacks and their tools:
 
1661
     `yyss': related to states,
 
1662
     `yyvs': related to semantic values,
 
1663
     `yyls': related to locations.
 
1664
 
 
1665
     Refer to the stacks thru separate pointers, to allow yyoverflow
 
1666
     to reallocate them elsewhere.  */
 
1667
 
 
1668
  /* The state stack.  */
 
1669
  short yyssa[YYINITDEPTH];
 
1670
  short *yyss = yyssa;
 
1671
  register short *yyssp;
 
1672
 
 
1673
  /* The semantic value stack.  */
 
1674
  YYSTYPE yyvsa[YYINITDEPTH];
 
1675
  YYSTYPE *yyvs = yyvsa;
 
1676
  register YYSTYPE *yyvsp;
 
1677
 
 
1678
 
 
1679
 
 
1680
#define YYPOPSTACK   (yyvsp--, yyssp--)
 
1681
 
 
1682
  YYSIZE_T yystacksize = YYINITDEPTH;
 
1683
 
 
1684
  /* The variables used to return semantic value and location from the
 
1685
     action routines.  */
 
1686
  YYSTYPE yyval;
 
1687
 
 
1688
 
 
1689
  /* When reducing, the number of symbols on the RHS of the reduced
 
1690
     rule.  */
 
1691
  int yylen;
 
1692
 
 
1693
  YYDPRINTF ((stderr, "Starting parse\n"));
 
1694
 
 
1695
  yystate = 0;
 
1696
  yyerrstatus = 0;
 
1697
  yynerrs = 0;
 
1698
  yychar = YYEMPTY;             /* Cause a token to be read.  */
 
1699
 
 
1700
  /* Initialize stack pointers.
 
1701
     Waste one element of value and location stack
 
1702
     so that they stay on the same level as the state stack.
 
1703
     The wasted elements are never initialized.  */
 
1704
 
 
1705
  yyssp = yyss;
 
1706
  yyvsp = yyvs;
 
1707
 
 
1708
  goto yysetstate;
 
1709
 
 
1710
/*------------------------------------------------------------.
 
1711
| yynewstate -- Push a new state, which is found in yystate.  |
 
1712
`------------------------------------------------------------*/
 
1713
 yynewstate:
 
1714
  /* In all cases, when you get here, the value and location stacks
 
1715
     have just been pushed. so pushing a state here evens the stacks.
 
1716
     */
 
1717
  yyssp++;
 
1718
 
 
1719
 yysetstate:
 
1720
  *yyssp = yystate;
 
1721
 
 
1722
  if (yyss + yystacksize - 1 <= yyssp)
 
1723
    {
 
1724
      /* Get the current used size of the three stacks, in elements.  */
 
1725
      YYSIZE_T yysize = yyssp - yyss + 1;
 
1726
 
 
1727
#ifdef yyoverflow
 
1728
      {
 
1729
        /* Give user a chance to reallocate the stack. Use copies of
 
1730
           these so that the &'s don't force the real ones into
 
1731
           memory.  */
 
1732
        YYSTYPE *yyvs1 = yyvs;
 
1733
        short *yyss1 = yyss;
 
1734
 
 
1735
 
 
1736
        /* Each stack pointer address is followed by the size of the
 
1737
           data in use in that stack, in bytes.  This used to be a
 
1738
           conditional around just the two extra args, but that might
 
1739
           be undefined if yyoverflow is a macro.  */
 
1740
        yyoverflow ("parser stack overflow",
 
1741
                    &yyss1, yysize * sizeof (*yyssp),
 
1742
                    &yyvs1, yysize * sizeof (*yyvsp),
 
1743
 
 
1744
                    &yystacksize);
 
1745
 
 
1746
        yyss = yyss1;
 
1747
        yyvs = yyvs1;
 
1748
      }
 
1749
#else /* no yyoverflow */
 
1750
# ifndef YYSTACK_RELOCATE
 
1751
      goto yyoverflowlab;
 
1752
# else
 
1753
      /* Extend the stack our own way.  */
 
1754
      if (YYMAXDEPTH <= yystacksize)
 
1755
        goto yyoverflowlab;
 
1756
      yystacksize *= 2;
 
1757
      if (YYMAXDEPTH < yystacksize)
 
1758
        yystacksize = YYMAXDEPTH;
 
1759
 
 
1760
      {
 
1761
        short *yyss1 = yyss;
 
1762
        union yyalloc *yyptr =
 
1763
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
 
1764
        if (! yyptr)
 
1765
          goto yyoverflowlab;
 
1766
        YYSTACK_RELOCATE (yyss);
 
1767
        YYSTACK_RELOCATE (yyvs);
 
1768
 
 
1769
#  undef YYSTACK_RELOCATE
 
1770
        if (yyss1 != yyssa)
 
1771
          YYSTACK_FREE (yyss1);
 
1772
      }
 
1773
# endif
 
1774
#endif /* no yyoverflow */
 
1775
 
 
1776
      yyssp = yyss + yysize - 1;
 
1777
      yyvsp = yyvs + yysize - 1;
 
1778
 
 
1779
 
 
1780
      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
 
1781
                  (unsigned long int) yystacksize));
 
1782
 
 
1783
      if (yyss + yystacksize - 1 <= yyssp)
 
1784
        YYABORT;
 
1785
    }
 
1786
 
 
1787
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 
1788
 
 
1789
  goto yybackup;
 
1790
 
 
1791
/*-----------.
 
1792
| yybackup.  |
 
1793
`-----------*/
 
1794
yybackup:
 
1795
 
 
1796
/* Do appropriate processing given the current state.  */
 
1797
/* Read a lookahead token if we need one and don't already have one.  */
 
1798
/* yyresume: */
 
1799
 
 
1800
  /* First try to decide what to do without reference to lookahead token.  */
 
1801
 
 
1802
  yyn = yypact[yystate];
 
1803
  if (yyn == YYPACT_NINF)
 
1804
    goto yydefault;
 
1805
 
 
1806
  /* Not known => get a lookahead token if don't already have one.  */
 
1807
 
 
1808
  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
 
1809
  if (yychar == YYEMPTY)
 
1810
    {
 
1811
      YYDPRINTF ((stderr, "Reading a token: "));
 
1812
      yychar = YYLEX;
 
1813
    }
 
1814
 
 
1815
  if (yychar <= YYEOF)
 
1816
    {
 
1817
      yychar = yytoken = YYEOF;
 
1818
      YYDPRINTF ((stderr, "Now at end of input.\n"));
 
1819
    }
 
1820
  else
 
1821
    {
 
1822
      yytoken = YYTRANSLATE (yychar);
 
1823
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
 
1824
    }
 
1825
 
 
1826
  /* If the proper action on seeing token YYTOKEN is to reduce or to
 
1827
     detect an error, take that action.  */
 
1828
  yyn += yytoken;
 
1829
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
 
1830
    goto yydefault;
 
1831
  yyn = yytable[yyn];
 
1832
  if (yyn <= 0)
 
1833
    {
 
1834
      if (yyn == 0 || yyn == YYTABLE_NINF)
 
1835
        goto yyerrlab;
 
1836
      yyn = -yyn;
 
1837
      goto yyreduce;
 
1838
    }
 
1839
 
 
1840
  if (yyn == YYFINAL)
 
1841
    YYACCEPT;
 
1842
 
 
1843
  /* Shift the lookahead token.  */
 
1844
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
 
1845
 
 
1846
  /* Discard the token being shifted unless it is eof.  */
 
1847
  if (yychar != YYEOF)
 
1848
    yychar = YYEMPTY;
 
1849
 
 
1850
  *++yyvsp = yylval;
 
1851
 
 
1852
 
 
1853
  /* Count tokens shifted since error; after three, turn off error
 
1854
     status.  */
 
1855
  if (yyerrstatus)
 
1856
    yyerrstatus--;
 
1857
 
 
1858
  yystate = yyn;
 
1859
  goto yynewstate;
 
1860
 
 
1861
 
 
1862
/*-----------------------------------------------------------.
 
1863
| yydefault -- do the default action for the current state.  |
 
1864
`-----------------------------------------------------------*/
 
1865
yydefault:
 
1866
  yyn = yydefact[yystate];
 
1867
  if (yyn == 0)
 
1868
    goto yyerrlab;
 
1869
  goto yyreduce;
 
1870
 
 
1871
 
 
1872
/*-----------------------------.
 
1873
| yyreduce -- Do a reduction.  |
 
1874
`-----------------------------*/
 
1875
yyreduce:
 
1876
  /* yyn is the number of a rule to reduce with.  */
 
1877
  yylen = yyr2[yyn];
 
1878
 
 
1879
  /* If YYLEN is nonzero, implement the default value of the action:
 
1880
     `$$ = $1'.
 
1881
 
 
1882
     Otherwise, the following line sets YYVAL to garbage.
 
1883
     This behavior is undocumented and Bison
 
1884
     users should not rely upon it.  Assigning to YYVAL
 
1885
     unconditionally makes the parser a bit smaller, and it avoids a
 
1886
     GCC warning that YYVAL may be used uninitialized.  */
 
1887
  yyval = yyvsp[1-yylen];
 
1888
 
 
1889
 
 
1890
  YY_REDUCE_PRINT (yyn);
 
1891
  switch (yyn)
 
1892
    {
 
1893
        case 2:
 
1894
#line 167 "parser.yxx"
 
1895
    {ParseTreePointer=yyvsp[0].m_pParseNode;}
 
1896
    break;
 
1897
 
 
1898
  case 3:
 
1899
#line 169 "parser.yxx"
 
1900
    {ParseTreePointer->AddLastChild(yyvsp[0].m_pParseNode);}
 
1901
    break;
 
1902
 
 
1903
  case 6:
 
1904
#line 179 "parser.yxx"
 
1905
    {
 
1906
                                                                // Store a pointer to the actual shader.
 
1907
                                                                yyval.m_pParseNode=new CqParseNodeShader(yyvsp[-6].m_Identifier->c_str(),yyvsp[-7].m_ShaderType);
 
1908
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
1909
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-1].m_pParseNode);
 
1910
 
 
1911
                                                                // Now copy any initialisers from the formals list to their respective
 
1912
                                                                // local variable definitions.
 
1913
                                                                CqParseNode* pArgs=yyvsp[-4].m_pParseNode;
 
1914
                                                                ProcessShaderArguments( pArgs );
 
1915
                                                                yyval.m_pParseNode->AddLastChild( yyvsp[-4].m_pParseNode );
 
1916
                                                        }
 
1917
    break;
 
1918
 
 
1919
  case 7:
 
1920
#line 192 "parser.yxx"
 
1921
    {
 
1922
                                                                // Store a pointer to the actual shader.
 
1923
                                                                CqString strName;
 
1924
                                                                if(yyvsp[-6].m_pSymbol.eType&1) strName=CqVarDef::GetVariablePtr(yyvsp[-6].m_pSymbol.VarRef)->strName();
 
1925
                                                                else                    strName=CqFuncDef::GetFunctionPtr(yyvsp[-6].m_pSymbol.FuncRef)->strName();
 
1926
                                                                yyval.m_pParseNode=new CqParseNodeShader(strName.c_str(),yyvsp[-7].m_ShaderType);
 
1927
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
1928
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-1].m_pParseNode);
 
1929
 
 
1930
                                                                // Now copy any initialisers from the formals list to their respective
 
1931
                                                                // local variable definitions.
 
1932
                                                                CqParseNode* pArgs=yyvsp[-4].m_pParseNode;
 
1933
                                                                ProcessShaderArguments( pArgs );
 
1934
                                                                yyval.m_pParseNode->AddLastChild( yyvsp[-4].m_pParseNode );
 
1935
                                                        }
 
1936
    break;
 
1937
 
 
1938
  case 8:
 
1939
#line 208 "parser.yxx"
 
1940
    {
 
1941
                                                                // Store a pointer to the actual shader.
 
1942
                                                                yyval.m_pParseNode=new CqParseNodeShader(yyvsp[-5].m_Identifier->c_str(), yyvsp[-6].m_ShaderType);
 
1943
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
1944
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-1].m_pParseNode);
 
1945
                                                        }
 
1946
    break;
 
1947
 
 
1948
  case 9:
 
1949
#line 215 "parser.yxx"
 
1950
    {
 
1951
                                                                // Store a pointer to the actual shader.
 
1952
                                                                CqString strName;
 
1953
                                                                if(yyvsp[-5].m_pSymbol.eType&1) strName=CqVarDef::GetVariablePtr(yyvsp[-5].m_pSymbol.VarRef)->strName();
 
1954
                                                                else                    strName=CqFuncDef::GetFunctionPtr(yyvsp[-5].m_pSymbol.FuncRef)->strName();
 
1955
                                                                yyval.m_pParseNode=new CqParseNodeShader(strName.c_str(),yyvsp[-6].m_ShaderType);
 
1956
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
1957
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-1].m_pParseNode);
 
1958
                                                        }
 
1959
    break;
 
1960
 
 
1961
  case 10:
 
1962
#line 228 "parser.yxx"
 
1963
    {
 
1964
                                                                CqParseNodeDeclaration* pDecl=static_cast<CqParseNodeDeclaration*>(yyvsp[-5].m_pParseNode);
 
1965
 
 
1966
                                                                // If no return/or multiple returns, then this is not a valid function.
 
1967
                                                                if((pDecl->Type()!=Type_Void) &&
 
1968
                                                                   (FunctionReturnCountStack.size() <=0 ||
 
1969
                                                                    FunctionReturnCountStack.back() != 1))
 
1970
                                                                        yyerror("Must have one return in function");
 
1971
                                                                
 
1972
                                                                // Make a string of the parameter types.
 
1973
                                                                CqParseNode* pArgs=yyvsp[-4].m_pParseNode;
 
1974
                                                                CqString strArgTypes("");
 
1975
                                                                if(pArgs)
 
1976
                                                                {
 
1977
                                                                        // Each child of the variable_definitions is a CqParseNodeVariable
 
1978
                                                                        CqParseNodeVariable* pVar=static_cast<CqParseNodeVariable*>(pArgs->pFirstChild());
 
1979
                                                                        while(pVar)
 
1980
                                                                        {
 
1981
                                                                                // If storage is not specified, a function parameter defaults to varying.
 
1982
                                                                                pVar->SetDefaultStorage(Type_Varying);
 
1983
                                                                                // Get the type from the variable
 
1984
                                                                                strArgTypes+=CqParseNode::TypeIdentifier(pVar->ResType());
 
1985
                                                                                // TODO: Find out if local function arguments can have default values.
 
1986
                                                                                // If so, they can be found as the child of pVar.
 
1987
                                                                                pVar=static_cast<CqParseNodeVariable*>(pVar->pNext());
 
1988
                                                                        }
 
1989
                                                                }
 
1990
 
 
1991
                                                                // Add the function declaration to the list of local functions.
 
1992
                                                                CqFuncDef funcdef(pDecl->Type(), pDecl->strName(), pDecl->strName(), strArgTypes.c_str(), yyvsp[-1].m_pParseNode, pArgs);
 
1993
                                                                CqFuncDef::AddFunction(funcdef);
 
1994
                                                                yyval.m_pParseNode=new CqParseNode();
 
1995
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
1996
                                                                delete(pDecl);
 
1997
                                                                // Function level namespace is now defunct.
 
1998
                                                                ParseNameSpaceStack.erase(ParseNameSpaceStack.end()-1);
 
1999
                                                                FunctionReturnCountStack.erase(FunctionReturnCountStack.end()-1);
 
2000
                                                        }
 
2001
    break;
 
2002
 
 
2003
  case 11:
 
2004
#line 267 "parser.yxx"
 
2005
    {
 
2006
                                                                CqParseNodeDeclaration* pDecl=static_cast<CqParseNodeDeclaration*>(yyvsp[-4].m_pParseNode);
 
2007
 
 
2008
                                                                // If no return/or multiple returns, then this is not a valid function.
 
2009
                                                                if((pDecl->Type()!=Type_Void) &&
 
2010
                                                                   (FunctionReturnCountStack.size() <=0 ||
 
2011
                                                                    FunctionReturnCountStack.back() != 1))
 
2012
                                                                        yyerror("Must have one return in function");
 
2013
 
 
2014
                                                                // Add the function declaration to the list of local functions.
 
2015
                                                                CqFuncDef funcdef(pDecl->Type(), pDecl->strName(), pDecl->strName(), "", yyvsp[-1].m_pParseNode, 0);
 
2016
                                                                CqFuncDef::AddFunction(funcdef);
 
2017
                                                                yyval.m_pParseNode=new CqParseNode();
 
2018
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2019
                                                                delete(pDecl);
 
2020
                                                                // Function level namespace is now defunct.
 
2021
                                                                ParseNameSpaceStack.erase(ParseNameSpaceStack.end()-1);
 
2022
                                                                FunctionReturnCountStack.erase(FunctionReturnCountStack.end()-1);
 
2023
                                                        }
 
2024
    break;
 
2025
 
 
2026
  case 12:
 
2027
#line 289 "parser.yxx"
 
2028
    {
 
2029
                                                                yyval.m_pParseNode=new CqParseNodeDeclaration((strNameSpace()+*yyvsp[-1].m_Identifier).c_str(),yyvsp[-2].m_TypeAndSpace.Type);
 
2030
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2031
                                                                // Store the name of the function being defined for use in variable namespacing.
 
2032
                                                                ParseNameSpaceStack.push_back(strNameSpace()+*yyvsp[-1].m_Identifier+"::");
 
2033
                                                                // Push a new level onto the FunctionReturnCountStack.
 
2034
                                                                FunctionReturnCountStack.push_back(0);
 
2035
                                                        }
 
2036
    break;
 
2037
 
 
2038
  case 13:
 
2039
#line 297 "parser.yxx"
 
2040
    {   
 
2041
                                                                yyval.m_pParseNode=new CqParseNodeDeclaration((strNameSpace()+*yyvsp[-1].m_Identifier).c_str(),Type_Void);
 
2042
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2043
                                                                // Store the name of the function being defined for use in variable namespacing.
 
2044
                                                                ParseNameSpaceStack.push_back(strNameSpace()+*yyvsp[-1].m_Identifier+"::");
 
2045
                                                                // Push a new level onto the FunctionReturnCountStack.
 
2046
                                                                FunctionReturnCountStack.push_back(0);
 
2047
                                                        }
 
2048
    break;
 
2049
 
 
2050
  case 14:
 
2051
#line 305 "parser.yxx"
 
2052
    {
 
2053
                                                                // TODO: Should warn about duplicate declarations.
 
2054
                                                                CqString strName(strNameSpace());
 
2055
                                                                if(yyvsp[-1].m_pSymbol.eType&1) strName+=CqVarDef::GetVariablePtr(yyvsp[-1].m_pSymbol.VarRef)->strName();
 
2056
                                                                else                    strName+=CqFuncDef::GetFunctionPtr(yyvsp[-1].m_pSymbol.FuncRef)->strName();
 
2057
 
 
2058
                                                                yyval.m_pParseNode=new CqParseNodeDeclaration(strName.c_str(),yyvsp[-2].m_TypeAndSpace.Type);
 
2059
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2060
                                                                // Store the name of the function being defined for use in variable namespacing.
 
2061
                                                                ParseNameSpaceStack.push_back(strName+"::");
 
2062
                                                                // Push a new level onto the FunctionReturnCountStack.
 
2063
                                                                FunctionReturnCountStack.push_back(0);
 
2064
                                                        }
 
2065
    break;
 
2066
 
 
2067
  case 15:
 
2068
#line 318 "parser.yxx"
 
2069
    {   
 
2070
                                                                // TODO: Should warn about duplicate declarations.
 
2071
                                                                CqString strName(strNameSpace());
 
2072
                                                                if(yyvsp[-1].m_pSymbol.eType&1) strName+=CqVarDef::GetVariablePtr(yyvsp[-1].m_pSymbol.VarRef)->strName();
 
2073
                                                                else                    strName+=CqFuncDef::GetFunctionPtr(yyvsp[-1].m_pSymbol.FuncRef)->strName();
 
2074
 
 
2075
                                                                yyval.m_pParseNode=new CqParseNodeDeclaration(strName.c_str(),Type_Void);
 
2076
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2077
                                                                // Store the name of the function being defined for use in variable namespacing.
 
2078
                                                                ParseNameSpaceStack.push_back(strName+"::");
 
2079
                                                                // Push a new level onto the FunctionReturnCountStack.
 
2080
                                                                FunctionReturnCountStack.push_back(0);
 
2081
                                                        }
 
2082
    break;
 
2083
 
 
2084
  case 16:
 
2085
#line 334 "parser.yxx"
 
2086
    { 
 
2087
                                                                yyval.m_ShaderType = Type_Lightsource;
 
2088
                                                        }
 
2089
    break;
 
2090
 
 
2091
  case 17:
 
2092
#line 337 "parser.yxx"
 
2093
    { 
 
2094
                                                                yyval.m_ShaderType = Type_Surface;
 
2095
                                                        }
 
2096
    break;
 
2097
 
 
2098
  case 18:
 
2099
#line 340 "parser.yxx"
 
2100
    { 
 
2101
                                                                yyval.m_ShaderType = Type_Volume;
 
2102
                                                        }
 
2103
    break;
 
2104
 
 
2105
  case 19:
 
2106
#line 343 "parser.yxx"
 
2107
    { 
 
2108
                                                                yyval.m_ShaderType = Type_Displacement;
 
2109
                                                        }
 
2110
    break;
 
2111
 
 
2112
  case 20:
 
2113
#line 346 "parser.yxx"
 
2114
    { 
 
2115
                                                                yyval.m_ShaderType = Type_Transformation;
 
2116
                                                        }
 
2117
    break;
 
2118
 
 
2119
  case 21:
 
2120
#line 349 "parser.yxx"
 
2121
    { 
 
2122
                                                                yyval.m_ShaderType = Type_Imager;
 
2123
                                                        }
 
2124
    break;
 
2125
 
 
2126
  case 22:
 
2127
#line 356 "parser.yxx"
 
2128
    {
 
2129
                                                                // Create a list header, and add the first entry to it.
 
2130
                                                                yyval.m_pParseNode=new CqParseNode();
 
2131
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2132
                                                                CqParseNodeVariable* pVarNode=static_cast<CqParseNodeVariable*>(yyvsp[0].m_pParseNode->pFirstChild());
 
2133
                                                                while(pVarNode!=0)
 
2134
                                                                {
 
2135
                                                                        CqParseNodeVariable* pVarNext=static_cast<CqParseNodeVariable*>(pVarNode->pNext());
 
2136
                                                                        yyval.m_pParseNode->AddLastChild(pVarNode);
 
2137
                                                                        pVarNode=pVarNext;
 
2138
                                                                }
 
2139
                                                        }
 
2140
    break;
 
2141
 
 
2142
  case 23:
 
2143
#line 369 "parser.yxx"
 
2144
    {
 
2145
                                                                // Add this one to the list.
 
2146
                                                                CqParseNodeVariable* pVarNode=static_cast<CqParseNodeVariable*>(yyvsp[0].m_pParseNode->pFirstChild());
 
2147
                                                                while(pVarNode!=0)
 
2148
                                                                {
 
2149
                                                                        CqParseNodeVariable* pVarNext=static_cast<CqParseNodeVariable*>(pVarNode->pNext());
 
2150
                                                                        yyval.m_pParseNode->AddLastChild(pVarNode);
 
2151
                                                                        pVarNode=pVarNext;
 
2152
                                                                }
 
2153
                                                        }
 
2154
    break;
 
2155
 
 
2156
  case 25:
 
2157
#line 384 "parser.yxx"
 
2158
    {
 
2159
                                                                yyval.m_pParseNode=new CqParseNode();
 
2160
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2161
                                                                CqParseNodeDeclaration* pDecl=static_cast<CqParseNodeDeclaration*>(yyvsp[0].m_pParseNode->pFirstChild());
 
2162
                                                                while(pDecl)
 
2163
                                                                {
 
2164
                                                                        TqInt Type=(yyvsp[-1].m_TypeAndSpace.Type);
 
2165
                                                                        
 
2166
                                                                        SqVarRef var;
 
2167
                                                                        TqBool fv=CqVarDef::FindVariable((strNameSpace()+pDecl->strName()).c_str(), var);
 
2168
                                                                        if(fv)
 
2169
                                                                        {
 
2170
                                                                                CqVarDef* pVar=CqVarDef::GetVariablePtr(var);
 
2171
                                                                                // Check if the declaration marked it as an arry
 
2172
                                                                                if(pVar->Type()&Type_Array)
 
2173
                                                                                        Type=(TqInt)(Type|Type_Array);
 
2174
 
 
2175
                                                                                pVar->SetType(Type);
 
2176
                                                                                // Create a variable node, in the case of local variable definition, these nodes will be removed, 
 
2177
                                                                                // and only the intitialisers kept.
 
2178
                                                                                // In the case of function parameters, the variables will be needed for type string construction.
 
2179
                                                                                CqParseNode* pVarNode=new CqParseNodeVariable(var);
 
2180
                                                                                pVarNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2181
                                                                                yyval.m_pParseNode->AddLastChild(pVarNode);
 
2182
 
 
2183
                                                                                // Copy any initialisers
 
2184
                                                                                if(pDecl->pFirstChild())
 
2185
                                                                                {
 
2186
                                                                                        if(Type&Type_Array)
 
2187
                                                                                        {
 
2188
                                                                                                CqParseNode* pArrayInit=new CqParseNode();
 
2189
 
 
2190
                                                                                                CqParseNode* pInitList=pDecl->pFirstChild();
 
2191
                                                                                                CqParseNode* pInit=pInitList->pFirstChild();
 
2192
                                                                                                TqInt i=0;
 
2193
                                                                                                while(pInit!=0)
 
2194
                                                                                                {
 
2195
                                                                                                        CqParseNode* pInit2=pInit->pNext();
 
2196
                                                                                                        CqParseNodeAssignArray* pInitFunc=new CqParseNodeAssignArray(var);
 
2197
                                                                                                        pInitFunc->NoDup();
 
2198
                                                                                                        CqParseNodeFloatConst* pIndex=new CqParseNodeFloatConst(i);
 
2199
 
 
2200
                                                                                                        pInitFunc->AddLastChild(pInit);
 
2201
                                                                                                        pInitFunc->AddLastChild(pIndex);
 
2202
                                                                                                        pArrayInit->AddLastChild(pInitFunc);
 
2203
 
 
2204
                                                                                                        i++;
 
2205
                                                                                                        pInit=pInit2;
 
2206
                                                                                                }
 
2207
                                                                                                pVarNode->AddLastChild(pArrayInit);
 
2208
                                                                                        }
 
2209
                                                                                        else
 
2210
                                                                                        {
 
2211
                                                                                                // Create an assign operator to initialise the variable.
 
2212
                                                                                                CqParseNode* pV=new CqParseNodeAssign(var);
 
2213
                                                                                                pV->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2214
                                                                                                pV->NoDup();
 
2215
                                                                                                pV->AddLastChild(pDecl->pFirstChild());
 
2216
 
 
2217
                                                                                                pVarNode->AddLastChild(pV);
 
2218
                                                                                                pDecl->ClearChild();
 
2219
                                                                                        }
 
2220
                                                                                }
 
2221
                                                                        }
 
2222
 
 
2223
                                                                        CqParseNode* pTemp=pDecl;
 
2224
                                                                        pDecl=static_cast<CqParseNodeDeclaration*>(pDecl->pNext());
 
2225
                                                                        delete(pTemp);
 
2226
                                                                }
 
2227
                                                        }
 
2228
    break;
 
2229
 
 
2230
  case 26:
 
2231
#line 455 "parser.yxx"
 
2232
    {
 
2233
                                                                yyval.m_pParseNode=new CqParseNode();
 
2234
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2235
                                                                CqParseNodeDeclaration* pDecl=static_cast<CqParseNodeDeclaration*>(yyvsp[0].m_pParseNode->pFirstChild());
 
2236
                                                                while(pDecl)
 
2237
                                                                {
 
2238
                                                                        TqInt Type=(yyvsp[-1].m_TypeAndSpace.Type);
 
2239
                                                                        
 
2240
                                                                        SqVarRef var;
 
2241
                                                                        TqBool fv=CqVarDef::FindVariable((strNameSpace()+pDecl->strName()).c_str(), var);
 
2242
                                                                        if(fv)
 
2243
                                                                        {
 
2244
                                                                                CqVarDef* pVar=CqVarDef::GetVariablePtr(var);
 
2245
                                                                                // Check if the declaration marked it as an arry
 
2246
                                                                                if(pVar->Type()&Type_Array)
 
2247
                                                                                        Type=(TqInt)(Type|Type_Array);
 
2248
 
 
2249
                                                                                pVar->SetType(Type);
 
2250
                                                                                // Create a variable node, in the case of local variable definition, these nodes will be removed, 
 
2251
                                                                                // and only the intitialisers kept.
 
2252
                                                                                // In the case of function parameters, the variables will be needed for type string construction.
 
2253
                                                                                CqParseNodeVariable* pVarNode=new CqParseNodeVariable(var);
 
2254
                                                                                pVarNode->SetOutput();
 
2255
                                                                                pVarNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2256
                                                                                yyval.m_pParseNode->AddLastChild(pVarNode);
 
2257
 
 
2258
                                                                                // Copy any initialisers
 
2259
                                                                                if(pDecl->pFirstChild())
 
2260
                                                                                {
 
2261
                                                                                        if(Type&Type_Array)
 
2262
                                                                                        {
 
2263
                                                                                                CqParseNode* pArrayInit=new CqParseNode();
 
2264
 
 
2265
                                                                                                CqParseNode* pInitList=pDecl->pFirstChild();
 
2266
                                                                                                CqParseNode* pInit=pInitList->pFirstChild();
 
2267
                                                                                                TqInt i=0;
 
2268
                                                                                                while(pInit!=0)
 
2269
                                                                                                {
 
2270
                                                                                                        CqParseNode* pInit2=pInit->pNext();
 
2271
                                                                                                        CqParseNodeAssignArray* pInitFunc=new CqParseNodeAssignArray(var);
 
2272
                                                                                                        pInitFunc->NoDup();
 
2273
                                                                                                        CqParseNodeFloatConst* pIndex=new CqParseNodeFloatConst(i);
 
2274
 
 
2275
                                                                                                        pInitFunc->AddLastChild(pInit);
 
2276
                                                                                                        pInitFunc->AddLastChild(pIndex);
 
2277
                                                                                                        pArrayInit->AddLastChild(pInitFunc);
 
2278
 
 
2279
                                                                                                        i++;
 
2280
                                                                                                        pInit=pInit2;
 
2281
                                                                                                }
 
2282
                                                                                                pVarNode->AddLastChild(pArrayInit);
 
2283
                                                                                        }
 
2284
                                                                                        else
 
2285
                                                                                        {
 
2286
                                                                                                // Create an assign operator to initialise the variable.
 
2287
                                                                                                CqParseNode* pV=new CqParseNodeAssign(var);
 
2288
                                                                                                pV->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2289
                                                                                                pV->NoDup();
 
2290
                                                                                                pV->AddLastChild(pDecl->pFirstChild());
 
2291
 
 
2292
                                                                                                pVarNode->AddLastChild(pV);
 
2293
                                                                                                pDecl->ClearChild();
 
2294
                                                                                        }
 
2295
                                                                                }
 
2296
                                                                        }
 
2297
 
 
2298
                                                                        CqParseNode* pTemp=pDecl;
 
2299
                                                                        pDecl=static_cast<CqParseNodeDeclaration*>(pDecl->pNext());
 
2300
                                                                        delete(pTemp);
 
2301
                                                                }
 
2302
                                                        }
 
2303
    break;
 
2304
 
 
2305
  case 27:
 
2306
#line 531 "parser.yxx"
 
2307
    {
 
2308
                                                                yyval.m_pParseNode=new CqParseNode();
 
2309
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2310
                                                                CqParseNodeDeclaration* pDecl=static_cast<CqParseNodeDeclaration*>(yyvsp[0].m_pParseNode->pFirstChild());
 
2311
                                                                while(pDecl)
 
2312
                                                                {
 
2313
                                                                        TqInt Type=(yyvsp[-1].m_TypeAndSpace.Type);
 
2314
                                                                        
 
2315
                                                                        SqVarRef var;
 
2316
                                                                        TqBool fv=CqVarDef::FindVariable((strNameSpace()+pDecl->strName()).c_str(), var);
 
2317
                                                                        if(fv)
 
2318
                                                                        {
 
2319
                                                                                CqVarDef* pVar=CqVarDef::GetVariablePtr(var);
 
2320
                                                                                // Check if the declaration marked it as an arry
 
2321
                                                                                if(pVar->Type()&Type_Array)
 
2322
                                                                                {
 
2323
                                                                                        Type=(TqInt)(Type|Type_Array);
 
2324
                                                                                        if( pVar->ArrayLength() <= 0 )
 
2325
                                                                                                yyerror("Array length must be specified.");
 
2326
                                                                                }
 
2327
 
 
2328
                                                                                pVar->SetType(Type);
 
2329
                                                                                // Create a variable node, in the case of local variable definition, these nodes will be removed, 
 
2330
                                                                                // and only the intitialisers kept.
 
2331
                                                                                // In the case of function parameters, the variables will be needed for type string construction.
 
2332
                                                                                CqParseNode* pVarNode=new CqParseNodeVariable(var);
 
2333
                                                                                pVarNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2334
                                                                                yyval.m_pParseNode->AddLastChild(pVarNode);
 
2335
 
 
2336
                                                                                // Copy any initialisers
 
2337
                                                                                if(pDecl->pFirstChild())
 
2338
                                                                                {
 
2339
                                                                                        if(Type&Type_Array)
 
2340
                                                                                        {
 
2341
                                                                                                CqParseNode* pArrayInit=new CqParseNode();
 
2342
 
 
2343
                                                                                                CqParseNode* pInitList=pDecl->pFirstChild();
 
2344
                                                                                                CqParseNode* pInit=pInitList->pFirstChild();
 
2345
                                                                                                TqInt i=0;
 
2346
                                                                                                while(pInit!=0)
 
2347
                                                                                                {
 
2348
                                                                                                        CqParseNode* pInit2=pInit->pNext();
 
2349
                                                                                                        CqParseNodeAssignArray* pInitFunc=new CqParseNodeAssignArray(var);
 
2350
                                                                                                        pInitFunc->NoDup();
 
2351
                                                                                                        CqParseNodeFloatConst* pIndex=new CqParseNodeFloatConst(i);
 
2352
 
 
2353
                                                                                                        pInitFunc->AddLastChild(pInit);
 
2354
                                                                                                        pInitFunc->AddLastChild(pIndex);
 
2355
                                                                                                        pArrayInit->AddLastChild(pInitFunc);
 
2356
 
 
2357
                                                                                                        i++;
 
2358
                                                                                                        pInit=pInit2;
 
2359
                                                                                                }
 
2360
                                                                                                pVarNode->AddLastChild(pArrayInit);
 
2361
                                                                                        }
 
2362
                                                                                        else
 
2363
                                                                                        {
 
2364
                                                                                                // Create an assign operator to initialise the variable.
 
2365
                                                                                                CqParseNode* pV=new CqParseNodeAssign(var);
 
2366
                                                                                                pV->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2367
                                                                                                pV->NoDup();
 
2368
                                                                                                pV->AddLastChild(pDecl->pFirstChild());
 
2369
 
 
2370
                                                                                                pVarNode->AddLastChild(pV);
 
2371
                                                                                                pDecl->ClearChild();
 
2372
                                                                                        }
 
2373
                                                                                }
 
2374
                                                                        }
 
2375
 
 
2376
                                                                        CqParseNode* pTemp=pDecl;
 
2377
                                                                        pDecl=static_cast<CqParseNodeDeclaration*>(pDecl->pNext());
 
2378
                                                                        delete(pTemp);
 
2379
                                                                }
 
2380
                                                        }
 
2381
    break;
 
2382
 
 
2383
  case 28:
 
2384
#line 606 "parser.yxx"
 
2385
    {
 
2386
                                                                yyval.m_pParseNode=new CqParseNode();
 
2387
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2388
                                                                CqParseNodeDeclaration* pDecl=static_cast<CqParseNodeDeclaration*>(yyvsp[0].m_pParseNode->pFirstChild());
 
2389
                                                                while(pDecl)
 
2390
                                                                {
 
2391
                                                                        SqVarRef varLocal, varExtern;
 
2392
                                                                        TqBool fvl=CqVarDef::FindVariable((strNameSpace()+pDecl->strName()).c_str(), varLocal);
 
2393
 
 
2394
                                                                        // As this is an extern, we need to repeatedly check in the previous namespaces
 
2395
                                                                        // until we find the variable they are referring to.
 
2396
                                                                        TqBool fve=TqFalse;
 
2397
                                                                        if(!ParseNameSpaceStack.empty())
 
2398
                                                                        {
 
2399
                                                                                std::vector<CqString>::reverse_iterator i=ParseNameSpaceStack.rbegin()+1;
 
2400
                                                                                while(!fve && i!=ParseNameSpaceStack.rend())
 
2401
                                                                                {
 
2402
                                                                                        CqString strNS=*i;
 
2403
                                                                                        fve=CqVarDef::FindVariable((strNS+pDecl->strName()).c_str(), varExtern);
 
2404
                                                                                        i++;
 
2405
                                                                                }
 
2406
                                                                        }
 
2407
                                                                        if(!fve)
 
2408
                                                                        {
 
2409
                                                                                // If not found in the namespaces defined in the code, check the global namespace.
 
2410
                                                                                fve=CqVarDef::FindStandardVariable(pDecl->strName(), varExtern);
 
2411
                                                                        }
 
2412
 
 
2413
                                                                        // If we found a candidate...
 
2414
                                                                        if(fve && fvl)
 
2415
                                                                        {
 
2416
                                                                                CqVarDef* pvarLocal=CqVarDef::GetVariablePtr(varLocal);
 
2417
                                                                                CqVarDef* pvarExtern=CqVarDef::GetVariablePtr(varExtern);
 
2418
                                                                                CqParseNode* pVarNode=new CqParseNodeVariable(varLocal);
 
2419
                                                                                pvarLocal->SetExtern(TqTrue, varExtern);
 
2420
                                                                                pvarLocal->SetType(pvarExtern->Type());
 
2421
                                                                                pVarNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2422
                                                                                yyval.m_pParseNode->AddLastChild(pVarNode);
 
2423
                                                                        }
 
2424
                                                                        else
 
2425
                                                                                yyerror("extern not found");
 
2426
 
 
2427
                                                                        CqParseNode* pTemp=pDecl;
 
2428
                                                                        pDecl=static_cast<CqParseNodeDeclaration*>(pDecl->pNext());
 
2429
                                                                        delete(pTemp);
 
2430
                                                                }
 
2431
                                                        }
 
2432
    break;
 
2433
 
 
2434
  case 29:
 
2435
#line 656 "parser.yxx"
 
2436
    {
 
2437
                                                                yyval.m_TypeAndSpace.Type=(TqInt)(yyvsp[0].m_TypeAndSpace.Type|yyvsp[-1].m_VarType);
 
2438
                                                                yyval.m_TypeAndSpace.Space=yyvsp[0].m_TypeAndSpace.Space;
 
2439
                                                        }
 
2440
    break;
 
2441
 
 
2442
  case 31:
 
2443
#line 664 "parser.yxx"
 
2444
    {
 
2445
                                                                // Create a list header and add the first element.
 
2446
                                                                yyval.m_pParseNode=new CqParseNode();
 
2447
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2448
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
2449
                                                        }
 
2450
    break;
 
2451
 
 
2452
  case 32:
 
2453
#line 671 "parser.yxx"
 
2454
    {
 
2455
                                                                // This one to the list.
 
2456
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
2457
                                                        }
 
2458
    break;
 
2459
 
 
2460
  case 33:
 
2461
#line 678 "parser.yxx"
 
2462
    {
 
2463
                                                                // Create a new variable declaration based on the specified name.
 
2464
                                                                yyval.m_pParseNode=new CqParseNodeDeclaration(yyvsp[-1].m_Identifier->c_str());
 
2465
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2466
                                                                CqVarDef vardef(Type_Void, (strNameSpace()+*yyvsp[-1].m_Identifier).c_str());
 
2467
                                                                CqVarDef::AddVariable(vardef);
 
2468
                                                                // Add the initialiser as the first child of the declaration.
 
2469
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
2470
                                                        }
 
2471
    break;
 
2472
 
 
2473
  case 34:
 
2474
#line 687 "parser.yxx"
 
2475
    {
 
2476
                                                                // Create a new variable declaration based on the specified name.
 
2477
                                                                yyval.m_pParseNode=new CqParseNodeDeclaration(yyvsp[0].m_Identifier->c_str());
 
2478
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2479
                                                                CqVarDef vardef(Type_Void, (strNameSpace()+*yyvsp[0].m_Identifier).c_str());
 
2480
                                                                CqVarDef::AddVariable(vardef);
 
2481
                                                        }
 
2482
    break;
 
2483
 
 
2484
  case 35:
 
2485
#line 694 "parser.yxx"
 
2486
    {
 
2487
                                                                // Create a new variable declaration based on the specified name.
 
2488
                                                                yyval.m_pParseNode=new CqParseNodeDeclaration(yyvsp[-3].m_Identifier->c_str());
 
2489
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2490
                                                                CqVarDef vardef(Type_Array, (strNameSpace()+*yyvsp[-3].m_Identifier).c_str(), static_cast<TqInt>(yyvsp[-1].m_FloatConst));
 
2491
                                                                CqVarDef::AddVariable(vardef);
 
2492
                                                        }
 
2493
    break;
 
2494
 
 
2495
  case 36:
 
2496
#line 702 "parser.yxx"
 
2497
    {
 
2498
                                                                // Create a new variable declaration based on the specified name.
 
2499
                                                                yyval.m_pParseNode=new CqParseNodeDeclaration(yyvsp[-4].m_Identifier->c_str());
 
2500
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2501
                                                                CqVarDef vardef(Type_Array, (strNameSpace()+*yyvsp[-4].m_Identifier).c_str(), static_cast<TqInt>(yyvsp[-2].m_FloatConst));
 
2502
                                                                CqVarDef::AddVariable(vardef);
 
2503
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
2504
                                                        }
 
2505
    break;
 
2506
 
 
2507
  case 37:
 
2508
#line 710 "parser.yxx"
 
2509
    {
 
2510
                                                                // Create a new variable declaration based on the specified name.
 
2511
                                                                yyval.m_pParseNode=new CqParseNodeDeclaration(yyvsp[-2].m_Identifier->c_str());
 
2512
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2513
                                                                CqVarDef vardef(Type_Array, (strNameSpace()+*yyvsp[-2].m_Identifier).c_str(), 0);
 
2514
                                                                CqVarDef::AddVariable(vardef);
 
2515
                                                        }
 
2516
    break;
 
2517
 
 
2518
  case 38:
 
2519
#line 717 "parser.yxx"
 
2520
    {
 
2521
                                                                // Create a new declaration based on the name.
 
2522
                                                                // TODO: Should warn about duplicate declarations.
 
2523
                                                                CqString strName("");
 
2524
                                                                if(yyvsp[-1].m_pSymbol.eType&1) strName=CqVarDef::GetVariablePtr(yyvsp[-1].m_pSymbol.VarRef)->strName();
 
2525
                                                                else                    strName=CqFuncDef::GetFunctionPtr(yyvsp[-1].m_pSymbol.FuncRef)->strName();
 
2526
 
 
2527
                                                                yyval.m_pParseNode=new CqParseNodeDeclaration(strName.c_str());
 
2528
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2529
                                                                CqVarDef vardef(Type_Void, (strNameSpace()+strName).c_str());
 
2530
                                                                CqVarDef::AddVariable(vardef);
 
2531
                                                                // Add the initialiser as the first child of the declaration.
 
2532
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
2533
                                                        }
 
2534
    break;
 
2535
 
 
2536
  case 39:
 
2537
#line 731 "parser.yxx"
 
2538
    {
 
2539
                                                                CqString strName("");
 
2540
                                                                if(yyvsp[0].m_pSymbol.eType&1)  strName=CqVarDef::GetVariablePtr(yyvsp[0].m_pSymbol.VarRef)->strName();
 
2541
                                                                else                    strName=CqFuncDef::GetFunctionPtr(yyvsp[0].m_pSymbol.FuncRef)->strName();
 
2542
 
 
2543
                                                                yyval.m_pParseNode=new CqParseNodeDeclaration(strName.c_str());
 
2544
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2545
                                                                CqVarDef vardef(Type_Void, (strNameSpace()+strName).c_str());
 
2546
                                                                CqVarDef::AddVariable(vardef);
 
2547
                                                        }
 
2548
    break;
 
2549
 
 
2550
  case 40:
 
2551
#line 741 "parser.yxx"
 
2552
    {
 
2553
                                                                CqString strName("");
 
2554
                                                                if(yyvsp[-3].m_pSymbol.eType&1) strName=CqVarDef::GetVariablePtr(yyvsp[-3].m_pSymbol.VarRef)->strName();
 
2555
                                                                else                    strName=CqFuncDef::GetFunctionPtr(yyvsp[-3].m_pSymbol.FuncRef)->strName();
 
2556
 
 
2557
                                                                yyval.m_pParseNode=new CqParseNodeDeclaration(strName.c_str());
 
2558
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2559
                                                                CqVarDef vardef(Type_Array, (strNameSpace()+strName).c_str(), static_cast<TqInt>(yyvsp[-1].m_FloatConst));
 
2560
                                                                CqVarDef::AddVariable(vardef);
 
2561
                                                        }
 
2562
    break;
 
2563
 
 
2564
  case 41:
 
2565
#line 752 "parser.yxx"
 
2566
    {
 
2567
                                                                CqString strName("");
 
2568
                                                                if(yyvsp[-4].m_pSymbol.eType&1) strName=CqVarDef::GetVariablePtr(yyvsp[-4].m_pSymbol.VarRef)->strName();
 
2569
                                                                else                    strName=CqFuncDef::GetFunctionPtr(yyvsp[-4].m_pSymbol.FuncRef)->strName();
 
2570
 
 
2571
                                                                yyval.m_pParseNode=new CqParseNodeDeclaration(strName.c_str());
 
2572
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2573
                                                                CqVarDef vardef(Type_Array, (strNameSpace()+strName).c_str(), static_cast<TqInt>(yyvsp[-2].m_FloatConst));
 
2574
                                                                CqVarDef::AddVariable(vardef);
 
2575
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
2576
                                                        }
 
2577
    break;
 
2578
 
 
2579
  case 42:
 
2580
#line 763 "parser.yxx"
 
2581
    {
 
2582
                                                                CqString strName("");
 
2583
                                                                if(yyvsp[-2].m_pSymbol.eType&1) strName=CqVarDef::GetVariablePtr(yyvsp[-2].m_pSymbol.VarRef)->strName();
 
2584
                                                                else                    strName=CqFuncDef::GetFunctionPtr(yyvsp[-2].m_pSymbol.FuncRef)->strName();
 
2585
 
 
2586
                                                                yyval.m_pParseNode=new CqParseNodeDeclaration(strName.c_str());
 
2587
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2588
                                                                CqVarDef vardef(Type_Array, (strNameSpace()+strName).c_str(), 0);
 
2589
                                                                CqVarDef::AddVariable(vardef);
 
2590
                                                        }
 
2591
    break;
 
2592
 
 
2593
  case 43:
 
2594
#line 776 "parser.yxx"
 
2595
    {
 
2596
                                                                yyval.m_pParseNode=yyvsp[0].m_pParseNode;
 
2597
                                                        }
 
2598
    break;
 
2599
 
 
2600
  case 44:
 
2601
#line 783 "parser.yxx"
 
2602
    {
 
2603
                                                                CqParseNode* pArrayInit=new CqParseNode();
 
2604
                                                                CqParseNode* pInit=yyvsp[-1].m_pParseNode->pFirstChild();
 
2605
                                                                while(pInit)
 
2606
                                                                {
 
2607
                                                                        CqParseNode* pInit2=pInit->pNext();
 
2608
                                                                        pArrayInit->AddLastChild(pInit);
 
2609
                                                                        pInit=pInit2;
 
2610
                                                                }
 
2611
                                                                yyval.m_pParseNode=pArrayInit;
 
2612
                                                        }
 
2613
    break;
 
2614
 
 
2615
  case 45:
 
2616
#line 797 "parser.yxx"
 
2617
    {
 
2618
                                                                // Create a list header and add the first element.
 
2619
                                                                yyval.m_pParseNode=new CqParseNode();
 
2620
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2621
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
2622
                                                        }
 
2623
    break;
 
2624
 
 
2625
  case 46:
 
2626
#line 804 "parser.yxx"
 
2627
    {
 
2628
                                                                // This one to the list.
 
2629
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
2630
                                                        }
 
2631
    break;
 
2632
 
 
2633
  case 47:
 
2634
#line 811 "parser.yxx"
 
2635
    {   yyval.m_VarType=Type_Varying;   }
 
2636
    break;
 
2637
 
 
2638
  case 48:
 
2639
#line 812 "parser.yxx"
 
2640
    {   yyval.m_VarType=Type_Uniform;   }
 
2641
    break;
 
2642
 
 
2643
  case 49:
 
2644
#line 816 "parser.yxx"
 
2645
    {   
 
2646
                                                                yyval.m_TypeAndSpace.Type=Type_Float;           
 
2647
                                                                yyval.m_TypeAndSpace.Space=0;
 
2648
                                                        }
 
2649
    break;
 
2650
 
 
2651
  case 50:
 
2652
#line 820 "parser.yxx"
 
2653
    {
 
2654
                                                                yyval.m_TypeAndSpace.Type=Type_String;  
 
2655
                                                                yyval.m_TypeAndSpace.Space=0;
 
2656
                                                        }
 
2657
    break;
 
2658
 
 
2659
  case 51:
 
2660
#line 824 "parser.yxx"
 
2661
    {
 
2662
                                                                yyval.m_TypeAndSpace.Type=Type_Void;
 
2663
                                                                yyval.m_TypeAndSpace.Space=0;
 
2664
                                                        }
 
2665
    break;
 
2666
 
 
2667
  case 57:
 
2668
#line 836 "parser.yxx"
 
2669
    {
 
2670
                                                                yyval.m_TypeAndSpace.Type=Type_Point;           
 
2671
                                                                yyval.m_TypeAndSpace.Space=yyvsp[0].m_Identifier;
 
2672
                                                        }
 
2673
    break;
 
2674
 
 
2675
  case 58:
 
2676
#line 840 "parser.yxx"
 
2677
    {
 
2678
                                                                yyval.m_TypeAndSpace.Type=Type_Point;           
 
2679
                                                                yyval.m_TypeAndSpace.Space=0;
 
2680
                                                        }
 
2681
    break;
 
2682
 
 
2683
  case 59:
 
2684
#line 847 "parser.yxx"
 
2685
    {
 
2686
                                                                yyval.m_TypeAndSpace.Type=Type_Color;           
 
2687
                                                                yyval.m_TypeAndSpace.Space=yyvsp[0].m_Identifier;
 
2688
                                                        }
 
2689
    break;
 
2690
 
 
2691
  case 60:
 
2692
#line 851 "parser.yxx"
 
2693
    {
 
2694
                                                                yyval.m_TypeAndSpace.Type=Type_Color;           
 
2695
                                                                yyval.m_TypeAndSpace.Space=0;
 
2696
                                                        }
 
2697
    break;
 
2698
 
 
2699
  case 61:
 
2700
#line 858 "parser.yxx"
 
2701
    {
 
2702
                                                                yyval.m_TypeAndSpace.Type=Type_Vector;          
 
2703
                                                                yyval.m_TypeAndSpace.Space=yyvsp[0].m_Identifier;
 
2704
                                                        }
 
2705
    break;
 
2706
 
 
2707
  case 62:
 
2708
#line 862 "parser.yxx"
 
2709
    {
 
2710
                                                                yyval.m_TypeAndSpace.Type=Type_Vector;          
 
2711
                                                                yyval.m_TypeAndSpace.Space=0;
 
2712
                                                        }
 
2713
    break;
 
2714
 
 
2715
  case 63:
 
2716
#line 869 "parser.yxx"
 
2717
    {
 
2718
                                                                yyval.m_TypeAndSpace.Type=Type_Normal;          
 
2719
                                                                yyval.m_TypeAndSpace.Space=yyvsp[0].m_Identifier;
 
2720
                                                        }
 
2721
    break;
 
2722
 
 
2723
  case 64:
 
2724
#line 873 "parser.yxx"
 
2725
    {
 
2726
                                                                yyval.m_TypeAndSpace.Type=Type_Normal;          
 
2727
                                                                yyval.m_TypeAndSpace.Space=0;
 
2728
                                                        }
 
2729
    break;
 
2730
 
 
2731
  case 65:
 
2732
#line 880 "parser.yxx"
 
2733
    {
 
2734
                                                                yyval.m_TypeAndSpace.Type=Type_Matrix;          
 
2735
                                                                yyval.m_TypeAndSpace.Space=yyvsp[0].m_Identifier;
 
2736
                                                        }
 
2737
    break;
 
2738
 
 
2739
  case 66:
 
2740
#line 884 "parser.yxx"
 
2741
    {
 
2742
                                                                yyval.m_TypeAndSpace.Type=Type_Matrix;          
 
2743
                                                                yyval.m_TypeAndSpace.Space=0;
 
2744
                                                        }
 
2745
    break;
 
2746
 
 
2747
  case 68:
 
2748
#line 895 "parser.yxx"
 
2749
    {
 
2750
                                                                // Create a list header and add the first element.
 
2751
                                                                yyval.m_pParseNode=new CqParseNode();
 
2752
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2753
                                                                yyval.m_pParseNode->AddFirstChild(yyvsp[0].m_pParseNode);
 
2754
                                                        }
 
2755
    break;
 
2756
 
 
2757
  case 69:
 
2758
#line 902 "parser.yxx"
 
2759
    {
 
2760
                                                                // Add this one to the list.
 
2761
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
2762
                                                        }
 
2763
    break;
 
2764
 
 
2765
  case 70:
 
2766
#line 909 "parser.yxx"
 
2767
    {yyval.m_pParseNode->NoDup();}
 
2768
    break;
 
2769
 
 
2770
  case 71:
 
2771
#line 910 "parser.yxx"
 
2772
    {
 
2773
                                                                if(yyval.m_pParseNode->ResType()!=Type_Void)
 
2774
                                                                {
 
2775
                                                                        yyval.m_pParseNode=new CqParseNodeDrop();
 
2776
                                                                        yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2777
                                                                        yyval.m_pParseNode->AddLastChild(yyvsp[-1].m_pParseNode);
 
2778
                                                                }
 
2779
                                                        }
 
2780
    break;
 
2781
 
 
2782
  case 72:
 
2783
#line 918 "parser.yxx"
 
2784
    {
 
2785
                                                                if(yyval.m_pParseNode->ResType()!=Type_Void)
 
2786
                                                                {
 
2787
                                                                        yyval.m_pParseNode=new CqParseNodeDrop();
 
2788
                                                                        yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2789
                                                                        yyval.m_pParseNode->AddLastChild(yyvsp[-1].m_pParseNode);
 
2790
                                                                }
 
2791
                                                        }
 
2792
    break;
 
2793
 
 
2794
  case 73:
 
2795
#line 926 "parser.yxx"
 
2796
    {
 
2797
                                                                yyval.m_pParseNode=new CqParseNodeDrop();
 
2798
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2799
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-1].m_pParseNode);
 
2800
                                                        }
 
2801
    break;
 
2802
 
 
2803
  case 74:
 
2804
#line 932 "parser.yxx"
 
2805
    {
 
2806
                                                                yyval.m_pParseNode=new CqParseNode();
 
2807
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2808
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-1].m_pParseNode);
 
2809
                                                                // Increment the count of returns for the current function.
 
2810
                                                                if(FunctionReturnCountStack.size() > 0)
 
2811
                                                                        FunctionReturnCountStack.back()++;
 
2812
                                                        }
 
2813
    break;
 
2814
 
 
2815
  case 77:
 
2816
#line 943 "parser.yxx"
 
2817
    {
 
2818
                                                                // Remove the variable nodes from these leaving just the 
 
2819
                                                                // intialisation code.
 
2820
                                                                // Each child of the variable_definitions is a CqParseNodeVariable
 
2821
                                                                CqParseNodeVariable* pVar=static_cast<CqParseNodeVariable*>(yyvsp[-1].m_pParseNode->pFirstChild());
 
2822
                                                                while(pVar)
 
2823
                                                                {
 
2824
                                                                        CqParseNodeVariable* pTemp=static_cast<CqParseNodeVariable*>(pVar->pNext());
 
2825
 
 
2826
                                                                        // If storage is not specified, local variable defaults to varying.
 
2827
                                                                        pVar->SetDefaultStorage(Type_Varying);
 
2828
                                                                        
 
2829
                                                                        // Relink the initialisers, if any, after the variable.
 
2830
                                                                        if(pVar->pFirstChild())
 
2831
                                                                        {
 
2832
                                                                                // Make sure that any change in the storage type is communicated to the initialiser
 
2833
                                                                                pVar->pFirstChild()->UpdateStorageStatus();
 
2834
                                                                                CqParseNode* pVarying=pVar->pFirstChild();
 
2835
                                                                                pVarying->LinkAfter(pVar);
 
2836
                                                                        }
 
2837
                                                                        pVar->UnLink();
 
2838
                                                                        delete(pVar);
 
2839
                                                                        pVar=pTemp;
 
2840
                                                                }
 
2841
                                                        }
 
2842
    break;
 
2843
 
 
2844
  case 79:
 
2845
#line 969 "parser.yxx"
 
2846
    {   yyval.m_pParseNode=yyvsp[-1].m_pParseNode;      }
 
2847
    break;
 
2848
 
 
2849
  case 80:
 
2850
#line 970 "parser.yxx"
 
2851
    {   yyval.m_pParseNode=new CqParseNode(); }
 
2852
    break;
 
2853
 
 
2854
  case 81:
 
2855
#line 971 "parser.yxx"
 
2856
    {   yyval.m_pParseNode=new CqParseNode(); }
 
2857
    break;
 
2858
 
 
2859
  case 82:
 
2860
#line 973 "parser.yxx"
 
2861
    {
 
2862
                                                                CqParseNode* pNew=new CqParseNodeConditional();
 
2863
                                                                pNew->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2864
                                                                pNew->AddLastChild(yyvsp[-1].m_pParseNode);
 
2865
                                                                pNew->AddLastChild(yyvsp[0].m_pParseNode);
 
2866
                                                                yyval.m_pParseNode=pNew;
 
2867
                                                        }
 
2868
    break;
 
2869
 
 
2870
  case 83:
 
2871
#line 980 "parser.yxx"
 
2872
    {
 
2873
                                                                CqParseNode* relation=new CqParseNodeRelOp(Op_NE);
 
2874
                                                                relation->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2875
                                                                relation->AddFirstChild(yyvsp[-1].m_pParseNode);
 
2876
                                                                CqParseNode* pcomp=new CqParseNodeFloatConst(0);
 
2877
                                                                relation->AddLastChild(pcomp);
 
2878
 
 
2879
                                                                CqParseNode* pNew=new CqParseNodeConditional();
 
2880
                                                                pNew->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2881
                                                                pNew->AddLastChild(relation);
 
2882
                                                                pNew->AddLastChild(yyvsp[0].m_pParseNode);
 
2883
                                                                yyval.m_pParseNode=pNew;
 
2884
 
 
2885
                                                        }
 
2886
    break;
 
2887
 
 
2888
  case 84:
 
2889
#line 995 "parser.yxx"
 
2890
    {
 
2891
                                                                CqParseNode* pNew=new CqParseNodeConditional();
 
2892
                                                                pNew->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2893
                                                                pNew->AddLastChild(yyvsp[-3].m_pParseNode);
 
2894
                                                                pNew->AddLastChild(yyvsp[-2].m_pParseNode);
 
2895
                                                                pNew->AddLastChild(yyvsp[0].m_pParseNode);
 
2896
                                                                yyval.m_pParseNode=pNew;
 
2897
                                                        }
 
2898
    break;
 
2899
 
 
2900
  case 85:
 
2901
#line 1003 "parser.yxx"
 
2902
    {
 
2903
                                                                CqParseNode* relation=new CqParseNodeRelOp(Op_NE);
 
2904
                                                                relation->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2905
                                                                relation->AddFirstChild(yyvsp[-3].m_pParseNode);
 
2906
                                                                CqParseNode* pcomp=new CqParseNodeFloatConst(0);
 
2907
                                                                relation->AddLastChild(pcomp);
 
2908
                                                                CqParseNode* pNew=new CqParseNodeConditional();
 
2909
                                                                
 
2910
                                                                pNew->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2911
                                                                pNew->AddLastChild(relation);
 
2912
                                                                pNew->AddLastChild(yyvsp[-2].m_pParseNode);
 
2913
                                                                pNew->AddLastChild(yyvsp[0].m_pParseNode);
 
2914
                                                                yyval.m_pParseNode=pNew;
 
2915
                                                        }
 
2916
    break;
 
2917
 
 
2918
  case 86:
 
2919
#line 1022 "parser.yxx"
 
2920
    {
 
2921
                                                                yyval.m_pParseNode=new CqParseNodeWhileConstruct();
 
2922
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2923
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-1].m_pParseNode);
 
2924
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
2925
                                                        }
 
2926
    break;
 
2927
 
 
2928
  case 87:
 
2929
#line 1028 "parser.yxx"
 
2930
    {
 
2931
                                                                CqParseNode* relation=new CqParseNodeRelOp(Op_NE);
 
2932
                                                                relation->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2933
                                                                relation->AddFirstChild(yyvsp[-1].m_pParseNode);
 
2934
                                                                CqParseNode* pcomp=new CqParseNodeFloatConst(0);
 
2935
                                                                relation->AddLastChild(pcomp);
 
2936
                                                                CqParseNode* pNew=new CqParseNodeConditional();
 
2937
 
 
2938
                                                                yyval.m_pParseNode=new CqParseNodeWhileConstruct();
 
2939
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2940
                                                                yyval.m_pParseNode->AddLastChild(relation);
 
2941
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
2942
                                                        }
 
2943
    break;
 
2944
 
 
2945
  case 88:
 
2946
#line 1042 "parser.yxx"
 
2947
    {
 
2948
                                                                yyval.m_pParseNode=new CqParseNode();
 
2949
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2950
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-6].m_pParseNode);
 
2951
                                                                CqParseNode* pW=new CqParseNodeWhileConstruct();
 
2952
                                                                pW->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2953
                                                                yyval.m_pParseNode->AddLastChild(pW);
 
2954
                                                                pW->AddLastChild(yyvsp[-4].m_pParseNode);
 
2955
                                                                pW->AddLastChild(yyvsp[0].m_pParseNode);
 
2956
                                                                pW->AddLastChild(yyvsp[-2].m_pParseNode);
 
2957
                                                                // Make sure that any assigns in the two expressions don't dup
 
2958
                                                                yyvsp[-6].m_pParseNode->NoDup();
 
2959
                                                                yyvsp[-2].m_pParseNode->NoDup();
 
2960
                                                        }
 
2961
    break;
 
2962
 
 
2963
  case 89:
 
2964
#line 1057 "parser.yxx"
 
2965
    {
 
2966
                                                                CqParseNode* relation=new CqParseNodeRelOp(Op_NE);
 
2967
                                                                relation->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2968
                                                                relation->AddFirstChild(yyvsp[-4].m_pParseNode);
 
2969
                                                                CqParseNode* pcomp=new CqParseNodeFloatConst(0);
 
2970
                                                                relation->AddLastChild(pcomp);
 
2971
 
 
2972
                                                                CqParseNode* pNew=new CqParseNodeConditional();
 
2973
                                                                yyval.m_pParseNode=new CqParseNode();
 
2974
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2975
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-6].m_pParseNode);
 
2976
                                                                CqParseNode* pW=new CqParseNodeWhileConstruct();
 
2977
                                                                pW->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2978
                                                                yyval.m_pParseNode->AddLastChild(pW);
 
2979
                                                                pW->AddLastChild(relation);
 
2980
                                                                pW->AddLastChild(yyvsp[0].m_pParseNode);
 
2981
                                                                pW->AddLastChild(yyvsp[-2].m_pParseNode);
 
2982
                                                                // Make sure that any assigns in the two expressions don't dup
 
2983
                                                                yyvsp[-6].m_pParseNode->NoDup();
 
2984
                                                                yyvsp[-2].m_pParseNode->NoDup();
 
2985
                                                        }
 
2986
    break;
 
2987
 
 
2988
  case 90:
 
2989
#line 1079 "parser.yxx"
 
2990
    {
 
2991
                                                                yyval.m_pParseNode=new CqParseNodeSolarConstruct();
 
2992
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
2993
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
2994
                                                        }
 
2995
    break;
 
2996
 
 
2997
  case 91:
 
2998
#line 1085 "parser.yxx"
 
2999
    {
 
3000
                                                                yyval.m_pParseNode=new CqParseNodeSolarConstruct(TqTrue);
 
3001
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3002
                                                                CqParseNode* pArg=new CqParseNode();
 
3003
                                                                pArg->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3004
                                                                pArg->AddFirstChild(yyvsp[-4].m_pParseNode);
 
3005
                                                                pArg->AddFirstChild(yyvsp[-2].m_pParseNode);
 
3006
                                                                yyval.m_pParseNode->AddLastChild(pArg);
 
3007
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
3008
                                                                // Make sure that any assigns in the two expressions don't dup
 
3009
                                                                yyvsp[-4].m_pParseNode->NoDup();
 
3010
                                                                yyvsp[-2].m_pParseNode->NoDup();
 
3011
                                                        }
 
3012
    break;
 
3013
 
 
3014
  case 92:
 
3015
#line 1099 "parser.yxx"
 
3016
    {
 
3017
                                                                yyval.m_pParseNode=new CqParseNodeIlluminateConstruct();
 
3018
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3019
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-2].m_pParseNode);
 
3020
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
3021
                                                                // Make sure that any assigns in the two expressions don't dup
 
3022
                                                                yyvsp[-2].m_pParseNode->NoDup();
 
3023
                                                        }
 
3024
    break;
 
3025
 
 
3026
  case 93:
 
3027
#line 1108 "parser.yxx"
 
3028
    {
 
3029
                                                                yyval.m_pParseNode=new CqParseNodeIlluminateConstruct(TqTrue);
 
3030
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3031
                                                                CqParseNode* pArg=new CqParseNode();
 
3032
                                                                pArg->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3033
                                                                pArg->AddFirstChild(yyvsp[-6].m_pParseNode);
 
3034
                                                                pArg->AddFirstChild(yyvsp[-4].m_pParseNode);
 
3035
                                                                pArg->AddFirstChild(yyvsp[-2].m_pParseNode);
 
3036
                                                                yyval.m_pParseNode->AddLastChild(pArg);
 
3037
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
3038
                                                                // Make sure that any assigns in the two expressions don't dup
 
3039
                                                                yyvsp[-6].m_pParseNode->NoDup();
 
3040
                                                                yyvsp[-4].m_pParseNode->NoDup();
 
3041
                                                                yyvsp[-2].m_pParseNode->NoDup();
 
3042
                                                        }
 
3043
    break;
 
3044
 
 
3045
  case 94:
 
3046
#line 1124 "parser.yxx"
 
3047
    {
 
3048
                                                                yyval.m_pParseNode=new CqParseNodeIlluminanceConstruct();
 
3049
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3050
                                                                CqParseNode* pArg=new CqParseNode();
 
3051
                                                                pArg->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3052
                                                                pArg->AddFirstChild(new CqParseNodeStringConst(""));    // [category]
 
3053
                                                                pArg->AddFirstChild(yyvsp[-2].m_pParseNode);
 
3054
                                                                yyval.m_pParseNode->AddLastChild(pArg);
 
3055
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
3056
                                                                // Make sure that any assigns in the two expressions don't dup
 
3057
                                                                yyvsp[-2].m_pParseNode->NoDup();
 
3058
                                                        }
 
3059
    break;
 
3060
 
 
3061
  case 95:
 
3062
#line 1137 "parser.yxx"
 
3063
    {
 
3064
                                                                yyval.m_pParseNode=new CqParseNodeIlluminanceConstruct();
 
3065
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3066
                                                                CqParseNode* pArg=new CqParseNode();
 
3067
                                                                pArg->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3068
                                                                pArg->AddFirstChild(yyvsp[-4].m_pParseNode);
 
3069
                                                                pArg->AddFirstChild(yyvsp[-2].m_pParseNode);
 
3070
                                                                yyval.m_pParseNode->AddLastChild(pArg);
 
3071
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
3072
                                                                // Make sure that any assigns in the two expressions don't dup
 
3073
                                                                yyvsp[-4].m_pParseNode->NoDup();
 
3074
                                                                yyvsp[-2].m_pParseNode->NoDup();
 
3075
                                                        }
 
3076
    break;
 
3077
 
 
3078
  case 96:
 
3079
#line 1151 "parser.yxx"
 
3080
    {
 
3081
                                                                yyval.m_pParseNode=new CqParseNodeIlluminanceConstruct(TqTrue);
 
3082
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3083
                                                                CqParseNode* pArg=new CqParseNode();
 
3084
                                                                pArg->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3085
                                                                pArg->AddFirstChild(new CqParseNodeStringConst(""));    // [category]
 
3086
                                                                pArg->AddFirstChild(yyvsp[-6].m_pParseNode);
 
3087
                                                                pArg->AddFirstChild(yyvsp[-4].m_pParseNode);
 
3088
                                                                pArg->AddFirstChild(yyvsp[-2].m_pParseNode);
 
3089
                                                                yyval.m_pParseNode->AddLastChild(pArg);
 
3090
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
3091
                                                                // Make sure that any assigns in the two expressions don't dup
 
3092
                                                                yyvsp[-6].m_pParseNode->NoDup();
 
3093
                                                                yyvsp[-4].m_pParseNode->NoDup();
 
3094
                                                                yyvsp[-2].m_pParseNode->NoDup();
 
3095
                                                        }
 
3096
    break;
 
3097
 
 
3098
  case 97:
 
3099
#line 1168 "parser.yxx"
 
3100
    {
 
3101
                                                                yyval.m_pParseNode=new CqParseNodeIlluminanceConstruct(TqTrue);
 
3102
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3103
                                                                CqParseNode* pArg=new CqParseNode();
 
3104
                                                                pArg->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3105
                                                                pArg->AddFirstChild(yyvsp[-8].m_pParseNode);
 
3106
                                                                pArg->AddFirstChild(yyvsp[-6].m_pParseNode);
 
3107
                                                                pArg->AddFirstChild(yyvsp[-4].m_pParseNode);
 
3108
                                                                pArg->AddFirstChild(yyvsp[-2].m_pParseNode);
 
3109
                                                                yyval.m_pParseNode->AddLastChild(pArg);
 
3110
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
3111
                                                                // Make sure that any assigns in the two expressions don't dup
 
3112
                                                                yyvsp[-8].m_pParseNode->NoDup();
 
3113
                                                                yyvsp[-6].m_pParseNode->NoDup();
 
3114
                                                                yyvsp[-4].m_pParseNode->NoDup();
 
3115
                                                                yyvsp[-2].m_pParseNode->NoDup();
 
3116
                                                        }
 
3117
    break;
 
3118
 
 
3119
  case 100:
 
3120
#line 1193 "parser.yxx"
 
3121
    {   
 
3122
                                                                yyval.m_pParseNode=new CqParseNode();   
 
3123
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3124
                                                        }
 
3125
    break;
 
3126
 
 
3127
  case 101:
 
3128
#line 1197 "parser.yxx"
 
3129
    {
 
3130
                                                                yyval.m_pParseNode=new CqParseNode();   
 
3131
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3132
                                                        }
 
3133
    break;
 
3134
 
 
3135
  case 103:
 
3136
#line 1207 "parser.yxx"
 
3137
    {
 
3138
                                                                std::vector<SqFuncRef> func;
 
3139
                                                                CqFuncDef::FindFunction("operator.", func);
 
3140
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3141
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3142
                                                                pFunc->AddLastChild(yyvsp[-2].m_pParseNode);
 
3143
                                                                pFunc->AddLastChild(yyvsp[0].m_pParseNode);
 
3144
 
 
3145
                                                                yyval.m_pParseNode=pFunc;
 
3146
                                                        }
 
3147
    break;
 
3148
 
 
3149
  case 104:
 
3150
#line 1218 "parser.yxx"
 
3151
    {
 
3152
                                                                std::vector<SqFuncRef> func;
 
3153
                                                                CqFuncDef::FindFunction("operator/", func);
 
3154
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3155
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3156
                                                                pFunc->AddLastChild(yyvsp[-2].m_pParseNode);
 
3157
                                                                pFunc->AddLastChild(yyvsp[0].m_pParseNode);
 
3158
 
 
3159
                                                                yyval.m_pParseNode=pFunc;
 
3160
                                                        }
 
3161
    break;
 
3162
 
 
3163
  case 105:
 
3164
#line 1229 "parser.yxx"
 
3165
    {
 
3166
                                                                std::vector<SqFuncRef> func;
 
3167
                                                                CqFuncDef::FindFunction("operator*", func);
 
3168
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3169
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3170
                                                                pFunc->AddLastChild(yyvsp[-2].m_pParseNode);
 
3171
                                                                pFunc->AddLastChild(yyvsp[0].m_pParseNode);
 
3172
 
 
3173
                                                                yyval.m_pParseNode=pFunc;
 
3174
                                                        }
 
3175
    break;
 
3176
 
 
3177
  case 106:
 
3178
#line 1240 "parser.yxx"
 
3179
    {
 
3180
                                                                std::vector<SqFuncRef> func;
 
3181
                                                                CqFuncDef::FindFunction("operator^", func);
 
3182
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3183
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3184
                                                                pFunc->AddLastChild(yyvsp[-2].m_pParseNode);
 
3185
                                                                pFunc->AddLastChild(yyvsp[0].m_pParseNode);
 
3186
 
 
3187
                                                                yyval.m_pParseNode=pFunc;
 
3188
                                                        }
 
3189
    break;
 
3190
 
 
3191
  case 107:
 
3192
#line 1251 "parser.yxx"
 
3193
    {
 
3194
                                                                std::vector<SqFuncRef> func;
 
3195
                                                                CqFuncDef::FindFunction("operator+", func);
 
3196
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3197
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3198
                                                                pFunc->AddLastChild(yyvsp[-2].m_pParseNode);
 
3199
                                                                pFunc->AddLastChild(yyvsp[0].m_pParseNode);
 
3200
 
 
3201
                                                                yyval.m_pParseNode=pFunc;
 
3202
                                                        }
 
3203
    break;
 
3204
 
 
3205
  case 108:
 
3206
#line 1262 "parser.yxx"
 
3207
    {
 
3208
                                                                std::vector<SqFuncRef> func;
 
3209
                                                                CqFuncDef::FindFunction("operator-", func);
 
3210
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3211
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3212
                                                                pFunc->AddLastChild(yyvsp[-2].m_pParseNode);
 
3213
                                                                pFunc->AddLastChild(yyvsp[0].m_pParseNode);
 
3214
 
 
3215
                                                                yyval.m_pParseNode=pFunc;
 
3216
                                                        }
 
3217
    break;
 
3218
 
 
3219
  case 109:
 
3220
#line 1273 "parser.yxx"
 
3221
    {
 
3222
                                                                std::vector<SqFuncRef> func;
 
3223
                                                                CqFuncDef::FindFunction("operatorneg", func);
 
3224
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3225
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3226
                                                                pFunc->AddFirstChild(yyvsp[0].m_pParseNode);
 
3227
 
 
3228
                                                                yyval.m_pParseNode=pFunc;
 
3229
                                                        }
 
3230
    break;
 
3231
 
 
3232
  case 111:
 
3233
#line 1284 "parser.yxx"
 
3234
    {
 
3235
                                                                CqParseNode* pNew=new CqParseNodeQCond();
 
3236
                                                                pNew->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3237
                                                                pNew->AddLastChild(yyvsp[-4].m_pParseNode);
 
3238
                                                                pNew->AddLastChild(yyvsp[-2].m_pParseNode);
 
3239
                                                                pNew->AddLastChild(yyvsp[0].m_pParseNode);
 
3240
                                                                yyval.m_pParseNode=pNew;
 
3241
                                                        }
 
3242
    break;
 
3243
 
 
3244
  case 112:
 
3245
#line 1296 "parser.yxx"
 
3246
    {
 
3247
                                                                yyval.m_pParseNode=new CqParseNode();
 
3248
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3249
                                                                CqParseNode* pCast=new CqParseNodeCast(yyvsp[-1].m_TypeAndSpace.Type);
 
3250
                                                                pCast->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3251
                                                                pCast->AddFirstChild(yyvsp[0].m_pParseNode);
 
3252
                                                                
 
3253
                                                                TqInt Type=(TqInt)(yyvsp[-1].m_TypeAndSpace.Type&Type_Mask);
 
3254
                                                                CqString* pSpace=yyvsp[-1].m_TypeAndSpace.Space;
 
3255
                                                                // Check if the type has a valid space associated
 
3256
                                                                if(pSpace!=0 && pSpace->compare("")!=0 && 
 
3257
                                                                  ((Type==Type_Point) ||
 
3258
                                                                   (Type==Type_Normal) ||
 
3259
                                                                   (Type==Type_Vector) ||
 
3260
                                                                   (Type==Type_Matrix) ||
 
3261
                                                                   (Type==Type_Color) ))
 
3262
                                                                {
 
3263
                                                                        // Create a transform function.
 
3264
                                                                        std::vector<SqFuncRef> funcTrans;
 
3265
                                                                        CqString strTrans("transform");;
 
3266
                                                                        if(Type==Type_Normal)   strTrans="ntransform";
 
3267
                                                                        else if(Type==Type_Vector)      strTrans="vtransform";
 
3268
                                                                        else if(Type==Type_Matrix)      strTrans="mtransform";
 
3269
                                                                        else if(Type==Type_Color)       strTrans="ctransform";
 
3270
                                                                        if(FindFunction(strTrans.c_str(), funcTrans))
 
3271
                                                                        {
 
3272
                                                                                yyval.m_pParseNode=new CqParseNodeFunctionCall(funcTrans);
 
3273
                                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3274
                                                                        
 
3275
                                                                                // And create a holder for the arguments.
 
3276
                                                                                CqParseNode* pFromSpace=new CqParseNodeStringConst((*yyvsp[-1].m_TypeAndSpace.Space).c_str());
 
3277
                                                                                CqParseNode* pToSpace;
 
3278
                                                                                if(Type != Type_Color)  pToSpace = new CqParseNodeStringConst("current");
 
3279
                                                                                else                                    pToSpace = new CqParseNodeStringConst("rgb");
 
3280
                                                                                yyval.m_pParseNode->AddLastChild(pFromSpace);
 
3281
                                                                                yyval.m_pParseNode->AddLastChild(pToSpace);
 
3282
                                                                                yyval.m_pParseNode->AddLastChild(pCast);
 
3283
                                                                        }
 
3284
                                                                }
 
3285
                                                                else
 
3286
                                                                        yyval.m_pParseNode->AddFirstChild(pCast);
 
3287
                                                        }
 
3288
    break;
 
3289
 
 
3290
  case 113:
 
3291
#line 1342 "parser.yxx"
 
3292
    {   
 
3293
                                                                yyval.m_pParseNode=new CqParseNodeFloatConst(yyvsp[0].m_FloatConst);
 
3294
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3295
                                                        }
 
3296
    break;
 
3297
 
 
3298
  case 115:
 
3299
#line 1347 "parser.yxx"
 
3300
    {
 
3301
                                                                yyval.m_pParseNode=new CqParseNodeVariable(yyvsp[0].m_pSymbol.VarRef);  
 
3302
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3303
                                                        }
 
3304
    break;
 
3305
 
 
3306
  case 116:
 
3307
#line 1351 "parser.yxx"
 
3308
    {
 
3309
                                                                yyval.m_pParseNode=new CqParseNodeVariableArray(yyvsp[-3].m_pSymbol.VarRef);
 
3310
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-1].m_pParseNode);
 
3311
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3312
                                                        }
 
3313
    break;
 
3314
 
 
3315
  case 117:
 
3316
#line 1356 "parser.yxx"
 
3317
    {
 
3318
                                                                yyval.m_pParseNode=new CqParseNodeStringConst(yyvsp[0].m_Identifier->c_str());
 
3319
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3320
                                                        }
 
3321
    break;
 
3322
 
 
3323
  case 122:
 
3324
#line 1364 "parser.yxx"
 
3325
    {   
 
3326
                                                                yyval.m_pParseNode=yyvsp[-1].m_pParseNode;
 
3327
                                                        }
 
3328
    break;
 
3329
 
 
3330
  case 123:
 
3331
#line 1368 "parser.yxx"
 
3332
    {
 
3333
                                                                yyval.m_pParseNode=new CqParseNodeTriple();
 
3334
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3335
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-5].m_pParseNode);
 
3336
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-3].m_pParseNode);
 
3337
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-1].m_pParseNode);
 
3338
                                                        }
 
3339
    break;
 
3340
 
 
3341
  case 124:
 
3342
#line 1376 "parser.yxx"
 
3343
    {
 
3344
                                                                yyval.m_pParseNode=new CqParseNodeHexTuple();
 
3345
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3346
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-31].m_pParseNode);
 
3347
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-29].m_pParseNode);
 
3348
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-27].m_pParseNode);
 
3349
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-25].m_pParseNode);
 
3350
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-23].m_pParseNode);
 
3351
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-21].m_pParseNode);
 
3352
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-19].m_pParseNode);
 
3353
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-17].m_pParseNode);
 
3354
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-15].m_pParseNode);
 
3355
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-13].m_pParseNode);
 
3356
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-11].m_pParseNode);
 
3357
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-9].m_pParseNode);
 
3358
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-7].m_pParseNode);
 
3359
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-5].m_pParseNode);
 
3360
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-3].m_pParseNode);
 
3361
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-1].m_pParseNode);
 
3362
                                                        }
 
3363
    break;
 
3364
 
 
3365
  case 125:
 
3366
#line 1399 "parser.yxx"
 
3367
    {   yyval.m_pParseNode=new CqParseNodeRelOp(Op_G);  }
 
3368
    break;
 
3369
 
 
3370
  case 126:
 
3371
#line 1400 "parser.yxx"
 
3372
    {   yyval.m_pParseNode=new CqParseNodeRelOp(Op_GE); }
 
3373
    break;
 
3374
 
 
3375
  case 127:
 
3376
#line 1401 "parser.yxx"
 
3377
    {   yyval.m_pParseNode=new CqParseNodeRelOp(Op_L);  }
 
3378
    break;
 
3379
 
 
3380
  case 128:
 
3381
#line 1402 "parser.yxx"
 
3382
    {   yyval.m_pParseNode=new CqParseNodeRelOp(Op_LE); }
 
3383
    break;
 
3384
 
 
3385
  case 129:
 
3386
#line 1403 "parser.yxx"
 
3387
    {   yyval.m_pParseNode=new CqParseNodeRelOp(Op_EQ); }
 
3388
    break;
 
3389
 
 
3390
  case 130:
 
3391
#line 1404 "parser.yxx"
 
3392
    {   yyval.m_pParseNode=new CqParseNodeRelOp(Op_NE); }
 
3393
    break;
 
3394
 
 
3395
  case 131:
 
3396
#line 1408 "parser.yxx"
 
3397
    {
 
3398
                                                                yyval.m_pParseNode=yyvsp[-1].m_pParseNode;
 
3399
                                                        }
 
3400
    break;
 
3401
 
 
3402
  case 132:
 
3403
#line 1412 "parser.yxx"
 
3404
    {
 
3405
                                                                yyval.m_pParseNode=yyvsp[-1].m_pParseNode;
 
3406
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3407
                                                                yyval.m_pParseNode->AddFirstChild(yyvsp[-2].m_pParseNode);
 
3408
                                                                yyval.m_pParseNode->AddFirstChild(yyvsp[0].m_pParseNode);
 
3409
                                                        }
 
3410
    break;
 
3411
 
 
3412
  case 133:
 
3413
#line 1419 "parser.yxx"
 
3414
    {
 
3415
                                                                yyval.m_pParseNode=new CqParseNodeLogicalOp(Op_LogAnd);
 
3416
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3417
                                                                yyval.m_pParseNode->AddFirstChild(yyvsp[-2].m_pParseNode);
 
3418
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
3419
                                                        }
 
3420
    break;
 
3421
 
 
3422
  case 134:
 
3423
#line 1426 "parser.yxx"
 
3424
    {
 
3425
                                                                yyval.m_pParseNode=new CqParseNodeLogicalOp(Op_LogOr);
 
3426
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3427
                                                                yyval.m_pParseNode->AddFirstChild(yyvsp[-2].m_pParseNode);
 
3428
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
3429
                                                        }
 
3430
    break;
 
3431
 
 
3432
  case 135:
 
3433
#line 1432 "parser.yxx"
 
3434
    {
 
3435
                                                                yyval.m_pParseNode=new CqParseNodeUnaryOp(Op_LogicalNot);
 
3436
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3437
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
3438
                                                        }
 
3439
    break;
 
3440
 
 
3441
  case 136:
 
3442
#line 1441 "parser.yxx"
 
3443
    {
 
3444
                                                                yyval.m_pParseNode=new CqParseNodeAssign(yyvsp[-2].m_pSymbol.VarRef);
 
3445
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3446
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
3447
                                                        }
 
3448
    break;
 
3449
 
 
3450
  case 137:
 
3451
#line 1447 "parser.yxx"
 
3452
    {
 
3453
                                                                yyval.m_pParseNode=new CqParseNodeAssign(yyvsp[-2].m_pSymbol.VarRef);
 
3454
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3455
                                                                
 
3456
                                                                std::vector<SqFuncRef> func;
 
3457
                                                                CqFuncDef::FindFunction("operator+", func);
 
3458
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3459
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3460
                                                                pFunc->AddLastChild(new CqParseNodeVariable(yyvsp[-2].m_pSymbol.VarRef));
 
3461
                                                                pFunc->AddLastChild(yyvsp[0].m_pParseNode);
 
3462
 
 
3463
                                                                yyval.m_pParseNode->AddLastChild(pFunc);
 
3464
                                                        }
 
3465
    break;
 
3466
 
 
3467
  case 138:
 
3468
#line 1461 "parser.yxx"
 
3469
    {
 
3470
                                                                yyval.m_pParseNode=new CqParseNodeAssign(yyvsp[-2].m_pSymbol.VarRef);
 
3471
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3472
                                                                
 
3473
                                                                std::vector<SqFuncRef> func;
 
3474
                                                                CqFuncDef::FindFunction("operator-", func);
 
3475
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3476
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3477
                                                                pFunc->AddLastChild(new CqParseNodeVariable(yyvsp[-2].m_pSymbol.VarRef));
 
3478
                                                                pFunc->AddLastChild(yyvsp[0].m_pParseNode);
 
3479
 
 
3480
                                                                yyval.m_pParseNode->AddLastChild(pFunc);
 
3481
                                                        }
 
3482
    break;
 
3483
 
 
3484
  case 139:
 
3485
#line 1475 "parser.yxx"
 
3486
    {
 
3487
                                                                yyval.m_pParseNode=new CqParseNodeAssign(yyvsp[-2].m_pSymbol.VarRef);
 
3488
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3489
                                                                
 
3490
                                                                std::vector<SqFuncRef> func;
 
3491
                                                                CqFuncDef::FindFunction("operator*", func);
 
3492
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3493
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3494
                                                                pFunc->AddLastChild(new CqParseNodeVariable(yyvsp[-2].m_pSymbol.VarRef));
 
3495
                                                                pFunc->AddLastChild(yyvsp[0].m_pParseNode);
 
3496
 
 
3497
                                                                yyval.m_pParseNode->AddLastChild(pFunc);
 
3498
                                                        }
 
3499
    break;
 
3500
 
 
3501
  case 140:
 
3502
#line 1489 "parser.yxx"
 
3503
    {
 
3504
                                                                yyval.m_pParseNode=new CqParseNodeAssign(yyvsp[-2].m_pSymbol.VarRef);
 
3505
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3506
                                                                
 
3507
                                                                std::vector<SqFuncRef> func;
 
3508
                                                                CqFuncDef::FindFunction("operator/", func);
 
3509
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3510
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3511
                                                                pFunc->AddLastChild(new CqParseNodeVariable(yyvsp[-2].m_pSymbol.VarRef));
 
3512
                                                                pFunc->AddLastChild(yyvsp[0].m_pParseNode);
 
3513
 
 
3514
                                                                yyval.m_pParseNode->AddLastChild(pFunc);
 
3515
                                                        }
 
3516
    break;
 
3517
 
 
3518
  case 141:
 
3519
#line 1503 "parser.yxx"
 
3520
    {
 
3521
                                                                yyval.m_pParseNode=new CqParseNodeAssignArray(yyvsp[-5].m_pSymbol.VarRef);
 
3522
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3523
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
3524
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-3].m_pParseNode);
 
3525
                                                        }
 
3526
    break;
 
3527
 
 
3528
  case 142:
 
3529
#line 1510 "parser.yxx"
 
3530
    {
 
3531
                                                                yyval.m_pParseNode=new CqParseNodeAssignArray(yyvsp[-5].m_pSymbol.VarRef);
 
3532
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3533
                                                                
 
3534
                                                                std::vector<SqFuncRef> func;
 
3535
                                                                CqFuncDef::FindFunction("operator+", func);
 
3536
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3537
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3538
                                                                CqParseNodeVariableArray* pVar=new CqParseNodeVariableArray(yyvsp[-5].m_pSymbol.VarRef);
 
3539
                                                                pVar->AddLastChild(yyvsp[-3].m_pParseNode->Clone());
 
3540
                                                                pFunc->AddLastChild(pVar);
 
3541
 
 
3542
                                                                pFunc->AddLastChild(yyvsp[0].m_pParseNode);
 
3543
 
 
3544
                                                                yyval.m_pParseNode->AddLastChild(pFunc);
 
3545
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-3].m_pParseNode);
 
3546
                                                        }
 
3547
    break;
 
3548
 
 
3549
  case 143:
 
3550
#line 1528 "parser.yxx"
 
3551
    {
 
3552
                                                                yyval.m_pParseNode=new CqParseNodeAssignArray(yyvsp[-5].m_pSymbol.VarRef);
 
3553
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3554
                                                                
 
3555
                                                                std::vector<SqFuncRef> func;
 
3556
                                                                CqFuncDef::FindFunction("operator-", func);
 
3557
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3558
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3559
                                                                CqParseNodeVariableArray* pVar=new CqParseNodeVariableArray(yyvsp[-5].m_pSymbol.VarRef);
 
3560
                                                                pVar->AddLastChild(yyvsp[-3].m_pParseNode->Clone());
 
3561
                                                                pFunc->AddLastChild(pVar);
 
3562
 
 
3563
                                                                pFunc->AddLastChild(yyvsp[0].m_pParseNode);
 
3564
 
 
3565
                                                                yyval.m_pParseNode->AddLastChild(pFunc);
 
3566
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-3].m_pParseNode);
 
3567
                                                        }
 
3568
    break;
 
3569
 
 
3570
  case 144:
 
3571
#line 1546 "parser.yxx"
 
3572
    {
 
3573
                                                                yyval.m_pParseNode=new CqParseNodeAssignArray(yyvsp[-5].m_pSymbol.VarRef);
 
3574
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3575
                                                                
 
3576
                                                                std::vector<SqFuncRef> func;
 
3577
                                                                CqFuncDef::FindFunction("operator*", func);
 
3578
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3579
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3580
                                                                CqParseNodeVariableArray* pVar=new CqParseNodeVariableArray(yyvsp[-5].m_pSymbol.VarRef);
 
3581
                                                                pVar->AddLastChild(yyvsp[-3].m_pParseNode->Clone());
 
3582
                                                                pFunc->AddLastChild(pVar);
 
3583
 
 
3584
                                                                pFunc->AddLastChild(yyvsp[0].m_pParseNode);
 
3585
 
 
3586
                                                                yyval.m_pParseNode->AddLastChild(pFunc);
 
3587
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-3].m_pParseNode);
 
3588
                                                        }
 
3589
    break;
 
3590
 
 
3591
  case 145:
 
3592
#line 1564 "parser.yxx"
 
3593
    {
 
3594
                                                                yyval.m_pParseNode=new CqParseNodeAssignArray(yyvsp[-5].m_pSymbol.VarRef);
 
3595
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3596
                                                                
 
3597
                                                                std::vector<SqFuncRef> func;
 
3598
                                                                CqFuncDef::FindFunction("operator/", func);
 
3599
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3600
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3601
                                                                CqParseNodeVariableArray* pVar=new CqParseNodeVariableArray(yyvsp[-5].m_pSymbol.VarRef);
 
3602
                                                                pVar->AddLastChild(yyvsp[-3].m_pParseNode->Clone());
 
3603
                                                                pFunc->AddLastChild(pVar);
 
3604
 
 
3605
                                                                pFunc->AddLastChild(yyvsp[0].m_pParseNode);
 
3606
 
 
3607
                                                                yyval.m_pParseNode->AddLastChild(pFunc);
 
3608
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-3].m_pParseNode);
 
3609
                                                        }
 
3610
    break;
 
3611
 
 
3612
  case 146:
 
3613
#line 1585 "parser.yxx"
 
3614
    {
 
3615
                                                                std::vector<SqFuncRef> func;
 
3616
                                                                CqFuncDef::FindFunction(CqFuncDef::GetFunctionPtr(yyvsp[-3].m_pSymbol.FuncRef)->strName(), func);
 
3617
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3618
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3619
                                                                while(yyvsp[-1].m_pParseNode->pFirstChild()!=0) pFunc->AddLastChild(yyvsp[-1].m_pParseNode->pFirstChild());
 
3620
 
 
3621
                                                                yyval.m_pParseNode=pFunc;
 
3622
                                                        }
 
3623
    break;
 
3624
 
 
3625
  case 147:
 
3626
#line 1594 "parser.yxx"
 
3627
    {
 
3628
                                                                std::vector<SqFuncRef> func;
 
3629
                                                                CqFuncDef::FindFunction(CqFuncDef::GetFunctionPtr(yyvsp[-2].m_pSymbol.FuncRef)->strName(), func);
 
3630
                                                                CqParseNodeFunctionCall* pFunc=new CqParseNodeFunctionCall(func);
 
3631
                                                                pFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3632
 
 
3633
                                                                yyval.m_pParseNode=pFunc;
 
3634
                                                        }
 
3635
    break;
 
3636
 
 
3637
  case 148:
 
3638
#line 1606 "parser.yxx"
 
3639
    {
 
3640
                                                                std::cerr << warning << "Unresolved function " << yyvsp[-3].m_Identifier->c_str() << " will be treated as a DSO at runtime" << std::endl;
 
3641
                                                                CqParseNode* pArgs=yyvsp[-1].m_pParseNode;
 
3642
                                                                CqString strArgTypes("");
 
3643
                                                                if(pArgs)
 
3644
                                                                {
 
3645
                                                                        CqParseNode* pArg=static_cast<CqParseNode*>(pArgs->pFirstChild());
 
3646
                                                                        while(pArg)
 
3647
                                                                        {
 
3648
                                                                                strArgTypes+=CqParseNode::TypeIdentifier(pArg->ResType());
 
3649
                                                                                pArg=static_cast<CqParseNode*>(pArg->pNext());
 
3650
                                                                        }
 
3651
                                                                };
 
3652
 
 
3653
                                                                CqFuncDef func_spec(Type_Nil,yyvsp[-3].m_Identifier->c_str(),"unresolved",strArgTypes.c_str(), (CqParseNode*)NULL, pArgs);
 
3654
                                                                CqParseNodeUnresolvedCall* pUFunc=new CqParseNodeUnresolvedCall(func_spec);
 
3655
                                                                pUFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3656
                                                                while(yyvsp[-1].m_pParseNode->pFirstChild()!=0) pUFunc->AddLastChild(yyvsp[-1].m_pParseNode->pFirstChild());
 
3657
 
 
3658
                                                                yyval.m_pParseNode=pUFunc;
 
3659
                                                        }
 
3660
    break;
 
3661
 
 
3662
  case 149:
 
3663
#line 1628 "parser.yxx"
 
3664
    {
 
3665
                                                                // Need to emit a warning.
 
3666
                                                                // This should in theory be the eaiest case to handle
 
3667
                                                                // since there are no arguments that might need casting
 
3668
                                                                // later.
 
3669
                                                                std::cerr << warning << "Unresolved function " << yyvsp[-2].m_Identifier->c_str() << " will be treated as a DSO at runtime" << std::endl;
 
3670
                                                                CqFuncDef func_spec(Type_Nil, yyvsp[-2].m_Identifier->c_str(), "unresolved","");
 
3671
                                                                CqParseNodeUnresolvedCall* pUFunc=new CqParseNodeUnresolvedCall(func_spec);
 
3672
                                                                pUFunc->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3673
 
 
3674
                                                                yyval.m_pParseNode=pUFunc;
 
3675
                                                        }
 
3676
    break;
 
3677
 
 
3678
  case 150:
 
3679
#line 1643 "parser.yxx"
 
3680
    {
 
3681
                                                                // Create a list header, and add the first entry.
 
3682
                                                                        yyval.m_pParseNode=new CqParseNode();
 
3683
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3684
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
3685
                                                        }
 
3686
    break;
 
3687
 
 
3688
  case 151:
 
3689
#line 1650 "parser.yxx"
 
3690
    {
 
3691
                                                                // Add this entry to the list.
 
3692
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
3693
                                                        }
 
3694
    break;
 
3695
 
 
3696
  case 152:
 
3697
#line 1658 "parser.yxx"
 
3698
    {   
 
3699
                                                                // Add the texture_filename as the first argument
 
3700
                                                                yyval.m_pParseNode->AddFirstChild(yyvsp[-3].m_pParseNode);
 
3701
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-2].m_pParseNode);
 
3702
                                                                // Add all texture_arguments as further arguments to the function.
 
3703
                                                                CqParseNode* pParam=yyvsp[-1].m_pParseNode->pFirstChild();
 
3704
                                                                while(pParam!=0)
 
3705
                                                                {
 
3706
                                                                        CqParseNode* pTemp=pParam->pNext();
 
3707
                                                                        yyval.m_pParseNode->AddLastChild(pParam);
 
3708
                                                                        pParam=pTemp;
 
3709
                                                                }
 
3710
                                                        }
 
3711
    break;
 
3712
 
 
3713
  case 153:
 
3714
#line 1672 "parser.yxx"
 
3715
    {   
 
3716
                                                                // Add the texture_filename as the first argument
 
3717
                                                                yyval.m_pParseNode->AddFirstChild(yyvsp[-2].m_pParseNode);
 
3718
                                                                yyval.m_pParseNode->AddLastChild(new CqParseNodeFloatConst(0));
 
3719
                                                                // Add all texture_arguments as further arguments to the function.
 
3720
                                                                CqParseNode* pParam=yyvsp[-1].m_pParseNode->pFirstChild();
 
3721
                                                                while(pParam!=0)
 
3722
                                                                {
 
3723
                                                                        CqParseNode* pTemp=pParam->pNext();
 
3724
                                                                        yyval.m_pParseNode->AddLastChild(pParam);
 
3725
                                                                        pParam=pTemp;
 
3726
                                                                }
 
3727
                                                        }
 
3728
    break;
 
3729
 
 
3730
  case 154:
 
3731
#line 1686 "parser.yxx"
 
3732
    {   
 
3733
                                                                // Add the texture_filename as the first argument
 
3734
                                                                yyval.m_pParseNode->AddFirstChild(yyvsp[-2].m_pParseNode);
 
3735
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[-1].m_pParseNode);
 
3736
                                                        }
 
3737
    break;
 
3738
 
 
3739
  case 155:
 
3740
#line 1692 "parser.yxx"
 
3741
    {   
 
3742
                                                                // Add the texture_filename as the first argument
 
3743
                                                                yyval.m_pParseNode->AddFirstChild(yyvsp[-1].m_pParseNode);
 
3744
                                                                yyval.m_pParseNode->AddLastChild(new CqParseNodeFloatConst(0));
 
3745
                                                        }
 
3746
    break;
 
3747
 
 
3748
  case 156:
 
3749
#line 1700 "parser.yxx"
 
3750
    {
 
3751
                                                                std::vector<SqFuncRef> func;
 
3752
                                                                CqFuncDef::FindFunction("texture", func);
 
3753
                                                                yyval.m_pParseNode=new CqParseNodeFunctionCall(func);
 
3754
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3755
                                                        }
 
3756
    break;
 
3757
 
 
3758
  case 157:
 
3759
#line 1706 "parser.yxx"
 
3760
    {
 
3761
                                                                std::vector<SqFuncRef> func;
 
3762
                                                                CqFuncDef::FindFunction("environment", func);
 
3763
                                                                yyval.m_pParseNode=new CqParseNodeFunctionCall(func);
 
3764
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3765
                                                        }
 
3766
    break;
 
3767
 
 
3768
  case 158:
 
3769
#line 1712 "parser.yxx"
 
3770
    {
 
3771
                                                                std::vector<SqFuncRef> func;
 
3772
                                                                CqFuncDef::FindFunction("bump", func);
 
3773
                                                                yyval.m_pParseNode=new CqParseNodeFunctionCall(func);
 
3774
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3775
                                                        }
 
3776
    break;
 
3777
 
 
3778
  case 159:
 
3779
#line 1718 "parser.yxx"
 
3780
    {
 
3781
                                                                std::vector<SqFuncRef> func;
 
3782
                                                                CqFuncDef::FindFunction("shadow", func);
 
3783
                                                                yyval.m_pParseNode=new CqParseNodeFunctionCall(func);
 
3784
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3785
                                                        }
 
3786
    break;
 
3787
 
 
3788
  case 160:
 
3789
#line 1724 "parser.yxx"
 
3790
    {
 
3791
                                                                std::vector<SqFuncRef> func;
 
3792
                                                                CqFuncDef::FindFunction("occlusion", func);
 
3793
                                                                yyval.m_pParseNode=new CqParseNodeFunctionCall(func);
 
3794
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3795
                                                        }
 
3796
    break;
 
3797
 
 
3798
  case 161:
 
3799
#line 1733 "parser.yxx"
 
3800
    {   
 
3801
                                                                yyval.m_pParseNode=yyvsp[0].m_pParseNode;       
 
3802
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3803
                                                        }
 
3804
    break;
 
3805
 
 
3806
  case 162:
 
3807
#line 1740 "parser.yxx"
 
3808
    {   yyval.m_pParseNode=yyvsp[-1].m_pParseNode; }
 
3809
    break;
 
3810
 
 
3811
  case 163:
 
3812
#line 1744 "parser.yxx"
 
3813
    {
 
3814
                                                                // Create a list header and add the first entry.
 
3815
                                                                yyval.m_pParseNode=new CqParseNode();
 
3816
                                                                yyval.m_pParseNode->SetPos(ParseLineNumber,ParseStreamName.c_str());
 
3817
                                                                yyval.m_pParseNode->AddFirstChild(yyvsp[0].m_pParseNode);
 
3818
                                                        }
 
3819
    break;
 
3820
 
 
3821
  case 164:
 
3822
#line 1751 "parser.yxx"
 
3823
    {
 
3824
                                                                // Add this entry to the list.
 
3825
                                                                yyval.m_pParseNode->AddLastChild(yyvsp[0].m_pParseNode);
 
3826
                                                        }
 
3827
    break;
 
3828
 
 
3829
  case 166:
 
3830
#line 1764 "parser.yxx"
 
3831
    {yyval.m_CommType=CommTypeAtmosphere;}
 
3832
    break;
 
3833
 
 
3834
  case 167:
 
3835
#line 1765 "parser.yxx"
 
3836
    {yyval.m_CommType=CommTypeDisplacement;}
 
3837
    break;
 
3838
 
 
3839
  case 168:
 
3840
#line 1766 "parser.yxx"
 
3841
    {yyval.m_CommType=CommTypeLightsource;}
 
3842
    break;
 
3843
 
 
3844
  case 169:
 
3845
#line 1767 "parser.yxx"
 
3846
    {yyval.m_CommType=CommTypeSurface;}
 
3847
    break;
 
3848
 
 
3849
  case 170:
 
3850
#line 1768 "parser.yxx"
 
3851
    {yyval.m_CommType=CommTypeAttribute;}
 
3852
    break;
 
3853
 
 
3854
  case 171:
 
3855
#line 1769 "parser.yxx"
 
3856
    {yyval.m_CommType=CommTypeOption;}
 
3857
    break;
 
3858
 
 
3859
  case 172:
 
3860
#line 1770 "parser.yxx"
 
3861
    {yyval.m_CommType=CommTypeRendererInfo;}
 
3862
    break;
 
3863
 
 
3864
  case 173:
 
3865
#line 1771 "parser.yxx"
 
3866
    {yyval.m_CommType=CommTypeIncident;}
 
3867
    break;
 
3868
 
 
3869
  case 174:
 
3870
#line 1772 "parser.yxx"
 
3871
    {yyval.m_CommType=CommTypeOpposite;}
 
3872
    break;
 
3873
 
 
3874
  case 175:
 
3875
#line 1773 "parser.yxx"
 
3876
    {yyval.m_CommType=CommTypeTextureInfo;}
 
3877
    break;
 
3878
 
 
3879
  case 176:
 
3880
#line 1779 "parser.yxx"
 
3881
    {
 
3882
                                                                CqVarDef* pVD=0;
 
3883
                                                                TqBool fError=TqFalse;
 
3884
                                                                
 
3885
                                                                if((yyvsp[-3].m_pParseNode->ResType()&Type_Mask)!=Type_String)  fError=TqTrue;
 
3886
 
 
3887
                                                                // Get the variable, error if not a variable.
 
3888
                                                                if(yyvsp[-1].m_pSymbol.eType&1) pVD=CqVarDef::GetVariablePtr(yyvsp[-1].m_pSymbol.VarRef);
 
3889
                                                                
 
3890
                                                                if(pVD!=0 && !fError)
 
3891
                                                                {
 
3892
                                                                        yyval.m_pParseNode=new CqParseNodeCommFunction(yyvsp[-5].m_CommType, yyvsp[-1].m_pSymbol.VarRef);
 
3893
                                                                        yyval.m_pParseNode->AddLastChild(yyvsp[-3].m_pParseNode);
 
3894
                                                                }
 
3895
                                                                else
 
3896
                                                                {
 
3897
                                                                        yyerror("invalid variable reference");
 
3898
                                                                        yyval.m_pParseNode=new CqParseNode();
 
3899
                                                                }
 
3900
                                                        }
 
3901
    break;
 
3902
 
 
3903
  case 177:
 
3904
#line 1801 "parser.yxx"
 
3905
    {
 
3906
                                                                CqVarDef* pVD=0;
 
3907
                                                                TqBool fError=TqFalse;
 
3908
                                                                
 
3909
                                if((yyvsp[-5].m_pParseNode->ResType()&Type_Mask)!=Type_String)  fError=TqTrue;
 
3910
 
 
3911
                                                            if((yyvsp[-3].m_pParseNode->ResType()&Type_Mask)!=Type_String)      fError=TqTrue;
 
3912
 
 
3913
                                                                // Get the variable, error if not a variable.
 
3914
                                                                if(yyvsp[-1].m_pSymbol.eType&1) pVD=CqVarDef::GetVariablePtr(yyvsp[-1].m_pSymbol.VarRef);
 
3915
                                                                
 
3916
                                                                if(pVD!=0 && !fError)
 
3917
                                                                {
 
3918
                                    
 
3919
                                        CqParseNode* pArgs=yyvsp[-5].m_pParseNode;
 
3920
                                    CqParseNodeStringConst* pString = (CqParseNodeStringConst *) pArgs;
 
3921
                                    CqString strArg("");
 
3922
                                    strArg += pString->strValue();
 
3923
                                                                        
 
3924
                                                                        yyval.m_pParseNode=new CqParseNodeCommFunction(yyvsp[-7].m_CommType, strArg, yyvsp[-1].m_pSymbol.VarRef);
 
3925
                                                                    yyval.m_pParseNode->AddLastChild(yyvsp[-3].m_pParseNode);
 
3926
                                                                }
 
3927
                                                                else
 
3928
                                                                {
 
3929
                                                                        yyerror("invalid variable reference");
 
3930
                                                                        yyval.m_pParseNode=new CqParseNode();
 
3931
                                                                }
 
3932
                                                        }
 
3933
    break;
 
3934
 
 
3935
  case 178:
 
3936
#line 1830 "parser.yxx"
 
3937
    {
 
3938
                                                                CqVarDef* pVD=0;
 
3939
                                                                TqBool fError=TqFalse;
 
3940
                                                                
 
3941
                                                                if((yyvsp[-3].m_pParseNode->ResType()&Type_Mask)!=Type_String)  fError=TqTrue;
 
3942
 
 
3943
                                                                // Get the variable, error if not a variable.
 
3944
                                                                if(yyvsp[-1].m_pSymbol.eType&1) pVD=CqVarDef::GetVariablePtr(yyvsp[-1].m_pSymbol.VarRef);
 
3945
                                                                
 
3946
                                                                if(pVD!=0 && !fError)
 
3947
                                                                {
 
3948
                                                                        yyval.m_pParseNode=new CqParseNodeCommFunction(yyvsp[-5].m_CommType, yyvsp[-1].m_pSymbol.VarRef);
 
3949
                                                                        yyval.m_pParseNode->AddLastChild(yyvsp[-3].m_pParseNode);
 
3950
                                                                }
 
3951
                                                                else
 
3952
                                                                {
 
3953
                                                                        yyerror("invalid variable reference");
 
3954
                                                                        yyval.m_pParseNode=new CqParseNode();
 
3955
                                                                }
 
3956
                                                        }
 
3957
    break;
 
3958
 
 
3959
  case 179:
 
3960
#line 1852 "parser.yxx"
 
3961
    {
 
3962
                                                                CqVarDef* pVD=0;
 
3963
                                                                TqBool fError=TqFalse;
 
3964
                                                                
 
3965
                                if((yyvsp[-5].m_pParseNode->ResType()&Type_Mask)!=Type_String)  fError=TqTrue;
 
3966
 
 
3967
                                                            if((yyvsp[-3].m_pParseNode->ResType()&Type_Mask)!=Type_String)      fError=TqTrue;
 
3968
 
 
3969
                                                                // Get the variable, error if not a variable.
 
3970
                                                                if(yyvsp[-1].m_pSymbol.eType&1) pVD=CqVarDef::GetVariablePtr(yyvsp[-1].m_pSymbol.VarRef);
 
3971
                                                                
 
3972
                                                                if(pVD!=0 && !fError)
 
3973
                                                                {
 
3974
                                    
 
3975
                                        CqParseNode* pArgs=yyvsp[-5].m_pParseNode;
 
3976
                                    CqParseNodeStringConst* pString = (CqParseNodeStringConst *) pArgs;
 
3977
                                    CqString strArg("");
 
3978
                                    strArg += pString->strValue();
 
3979
                                                                        
 
3980
                                                                        yyval.m_pParseNode=new CqParseNodeCommFunction(yyvsp[-7].m_CommType, strArg, yyvsp[-1].m_pSymbol.VarRef);
 
3981
                                                                    yyval.m_pParseNode->AddLastChild(yyvsp[-3].m_pParseNode);
 
3982
                                                                }
 
3983
                                                                else
 
3984
                                                                {
 
3985
                                                                        yyerror("invalid variable reference");
 
3986
                                                                        yyval.m_pParseNode=new CqParseNode();
 
3987
                                                                }
 
3988
                                                        }
 
3989
    break;
 
3990
 
 
3991
 
 
3992
    }
 
3993
 
 
3994
/* Line 999 of yacc.c.  */
 
3995
#line 3995 "y.tab.c"
 
3996
 
 
3997
  yyvsp -= yylen;
 
3998
  yyssp -= yylen;
 
3999
 
 
4000
 
 
4001
  YY_STACK_PRINT (yyss, yyssp);
 
4002
 
 
4003
  *++yyvsp = yyval;
 
4004
 
 
4005
 
 
4006
  /* Now `shift' the result of the reduction.  Determine what state
 
4007
     that goes to, based on the state we popped back to and the rule
 
4008
     number reduced by.  */
 
4009
 
 
4010
  yyn = yyr1[yyn];
 
4011
 
 
4012
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
 
4013
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
 
4014
    yystate = yytable[yystate];
 
4015
  else
 
4016
    yystate = yydefgoto[yyn - YYNTOKENS];
 
4017
 
 
4018
  goto yynewstate;
 
4019
 
 
4020
 
 
4021
/*------------------------------------.
 
4022
| yyerrlab -- here on detecting error |
 
4023
`------------------------------------*/
 
4024
yyerrlab:
 
4025
  /* If not already recovering from an error, report this error.  */
 
4026
  if (!yyerrstatus)
 
4027
    {
 
4028
      ++yynerrs;
 
4029
#if YYERROR_VERBOSE
 
4030
      yyn = yypact[yystate];
 
4031
 
 
4032
      if (YYPACT_NINF < yyn && yyn < YYLAST)
 
4033
        {
 
4034
          YYSIZE_T yysize = 0;
 
4035
          int yytype = YYTRANSLATE (yychar);
 
4036
          char *yymsg;
 
4037
          int yyx, yycount;
 
4038
 
 
4039
          yycount = 0;
 
4040
          /* Start YYX at -YYN if negative to avoid negative indexes in
 
4041
             YYCHECK.  */
 
4042
          for (yyx = yyn < 0 ? -yyn : 0;
 
4043
               yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
 
4044
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
 
4045
              yysize += yystrlen (yytname[yyx]) + 15, yycount++;
 
4046
          yysize += yystrlen ("syntax error, unexpected ") + 1;
 
4047
          yysize += yystrlen (yytname[yytype]);
 
4048
          yymsg = (char *) YYSTACK_ALLOC (yysize);
 
4049
          if (yymsg != 0)
 
4050
            {
 
4051
              char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
 
4052
              yyp = yystpcpy (yyp, yytname[yytype]);
 
4053
 
 
4054
              if (yycount < 5)
 
4055
                {
 
4056
                  yycount = 0;
 
4057
                  for (yyx = yyn < 0 ? -yyn : 0;
 
4058
                       yyx < (int) (sizeof (yytname) / sizeof (char *));
 
4059
                       yyx++)
 
4060
                    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
 
4061
                      {
 
4062
                        const char *yyq = ! yycount ? ", expecting " : " or ";
 
4063
                        yyp = yystpcpy (yyp, yyq);
 
4064
                        yyp = yystpcpy (yyp, yytname[yyx]);
 
4065
                        yycount++;
 
4066
                      }
 
4067
                }
 
4068
              yyerror (yymsg);
 
4069
              YYSTACK_FREE (yymsg);
 
4070
            }
 
4071
          else
 
4072
            yyerror ("syntax error; also virtual memory exhausted");
 
4073
        }
 
4074
      else
 
4075
#endif /* YYERROR_VERBOSE */
 
4076
        yyerror ("syntax error");
 
4077
    }
 
4078
 
 
4079
 
 
4080
 
 
4081
  if (yyerrstatus == 3)
 
4082
    {
 
4083
      /* If just tried and failed to reuse lookahead token after an
 
4084
         error, discard it.  */
 
4085
 
 
4086
      /* Return failure if at end of input.  */
 
4087
      if (yychar == YYEOF)
 
4088
        {
 
4089
          /* Pop the error token.  */
 
4090
          YYPOPSTACK;
 
4091
          /* Pop the rest of the stack.  */
 
4092
          while (yyss < yyssp)
 
4093
            {
 
4094
              YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
 
4095
              yydestruct (yystos[*yyssp], yyvsp);
 
4096
              YYPOPSTACK;
 
4097
            }
 
4098
          YYABORT;
 
4099
        }
 
4100
 
 
4101
      YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
 
4102
      yydestruct (yytoken, &yylval);
 
4103
      yychar = YYEMPTY;
 
4104
 
 
4105
    }
 
4106
 
 
4107
  /* Else will try to reuse lookahead token after shifting the error
 
4108
     token.  */
 
4109
  goto yyerrlab1;
 
4110
 
 
4111
 
 
4112
/*----------------------------------------------------.
 
4113
| yyerrlab1 -- error raised explicitly by an action.  |
 
4114
`----------------------------------------------------*/
 
4115
yyerrlab1:
 
4116
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
 
4117
 
 
4118
  for (;;)
 
4119
    {
 
4120
      yyn = yypact[yystate];
 
4121
      if (yyn != YYPACT_NINF)
 
4122
        {
 
4123
          yyn += YYTERROR;
 
4124
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
 
4125
            {
 
4126
              yyn = yytable[yyn];
 
4127
              if (0 < yyn)
 
4128
                break;
 
4129
            }
 
4130
        }
 
4131
 
 
4132
      /* Pop the current state because it cannot handle the error token.  */
 
4133
      if (yyssp == yyss)
 
4134
        YYABORT;
 
4135
 
 
4136
      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
 
4137
      yydestruct (yystos[yystate], yyvsp);
 
4138
      yyvsp--;
 
4139
      yystate = *--yyssp;
 
4140
 
 
4141
      YY_STACK_PRINT (yyss, yyssp);
 
4142
    }
 
4143
 
 
4144
  if (yyn == YYFINAL)
 
4145
    YYACCEPT;
 
4146
 
 
4147
  YYDPRINTF ((stderr, "Shifting error token, "));
 
4148
 
 
4149
  *++yyvsp = yylval;
 
4150
 
 
4151
 
 
4152
  yystate = yyn;
 
4153
  goto yynewstate;
 
4154
 
 
4155
 
 
4156
/*-------------------------------------.
 
4157
| yyacceptlab -- YYACCEPT comes here.  |
 
4158
`-------------------------------------*/
 
4159
yyacceptlab:
 
4160
  yyresult = 0;
 
4161
  goto yyreturn;
 
4162
 
 
4163
/*-----------------------------------.
 
4164
| yyabortlab -- YYABORT comes here.  |
 
4165
`-----------------------------------*/
 
4166
yyabortlab:
 
4167
  yyresult = 1;
 
4168
  goto yyreturn;
 
4169
 
 
4170
#ifndef yyoverflow
 
4171
/*----------------------------------------------.
 
4172
| yyoverflowlab -- parser overflow comes here.  |
 
4173
`----------------------------------------------*/
 
4174
yyoverflowlab:
 
4175
  yyerror ("parser stack overflow");
 
4176
  yyresult = 2;
 
4177
  /* Fall through.  */
 
4178
#endif
 
4179
 
 
4180
yyreturn:
 
4181
#ifndef yyoverflow
 
4182
  if (yyss != yyssa)
 
4183
    YYSTACK_FREE (yyss);
 
4184
#endif
 
4185
  return yyresult;
 
4186
}
 
4187
 
 
4188
 
 
4189
#line 1883 "parser.yxx"
 
4190
 
 
4191
 
 
4192
namespace Aqsis
 
4193
{
 
4194
 
 
4195
TqBool FindVariable(const char* name, SqVarRef& Ref)
 
4196
{
 
4197
        // First search in the current namespace, then in the global namespace.
 
4198
        CqString strLocalVar(strNameSpace()+name);
 
4199
        
 
4200
        if(CqVarDef::FindVariable(strLocalVar.c_str(), Ref))    return(TqTrue);
 
4201
        else    return(CqVarDef::FindVariable(name, Ref));
 
4202
 
 
4203
        
 
4204
}
 
4205
 
 
4206
 
 
4207
TqBool FindFunction(const char* name, std::vector<SqFuncRef>& Ref)
 
4208
{
 
4209
        // Search in the namespaces from local to global in order.
 
4210
        CqString strNS(strNameSpace());
 
4211
        
 
4212
        do
 
4213
        {
 
4214
                CqString strLocalFunc(strNS+name);
 
4215
                if(CqFuncDef::FindFunction(strLocalFunc.c_str(), Ref))
 
4216
                        return(TqTrue);
 
4217
 
 
4218
                // Extract the next namespace up.
 
4219
                if( ( strNS.size() > 2 ) && ( strNS.substr( strNS.size()-2 ) == "::" ) )
 
4220
                {
 
4221
                        strNS = strNS.substr( 0, strNS.size()-2 );
 
4222
                        strNS = strNS.substr(0, strNS.rfind("::")+strlen("::"));
 
4223
                }
 
4224
 
 
4225
        }while( strNS.find_last_of("::") != std::string::npos );
 
4226
        
 
4227
        return(CqFuncDef::FindFunction(name, Ref));
 
4228
}
 
4229
 
 
4230
 
 
4231
void TypeCheck()
 
4232
{
 
4233
        // Typecheck any declared variables.
 
4234
        TqUint i;
 
4235
        for(i=0; i<gLocalVars.size(); i++)
 
4236
        {
 
4237
                if(gLocalVars[i].pDefValue()!=0)
 
4238
                        gLocalVars[i].pDefValue()->TypeCheck(CqParseNode::pAllTypes(), Type_Last-1);
 
4239
        }
 
4240
 
 
4241
        // Typecheck any local functions.
 
4242
        for(i=0; i<gLocalFuncs.size(); i++)
 
4243
        {
 
4244
                if(gLocalFuncs[i].pDef()!=0)
 
4245
                {
 
4246
//                      TqInt RetType=gLocalFuncs[i].Type();
 
4247
                        gLocalFuncs[i].pDefNode()->TypeCheck(CqParseNode::pAllTypes(), Type_Last-1);
 
4248
                }
 
4249
        }
 
4250
 
 
4251
        if(ParseTreePointer)
 
4252
                ParseTreePointer->TypeCheck(CqParseNode::pAllTypes(), Type_Last-1);
 
4253
}
 
4254
 
 
4255
 
 
4256
void Optimise()
 
4257
{
 
4258
        // Optimise any local functions.
 
4259
        TqUint i;
 
4260
        for(i=0; i<gLocalFuncs.size(); i++)
 
4261
        {
 
4262
                if(gLocalFuncs[i].pDef()!=0)
 
4263
                        gLocalFuncs[i].pDefNode()->Optimise();
 
4264
        }
 
4265
 
 
4266
        if(ParseTreePointer)
 
4267
                ParseTreePointer->Optimise();
 
4268
}
 
4269
 
 
4270
 
 
4271
CqString strNameSpace() 
 
4272
{
 
4273
        CqString strRes("");
 
4274
 
 
4275
        if(!ParseNameSpaceStack.empty())
 
4276
                strRes=ParseNameSpaceStack.back();
 
4277
 
 
4278
        return(strRes);
 
4279
}
 
4280
 
 
4281
void InitStandardNamespace()
 
4282
{
 
4283
        ParseNameSpaceStack.push_back("");
 
4284
}
 
4285
 
 
4286
void ProcessShaderArguments( CqParseNode* pArgs )
 
4287
{
 
4288
        if(pArgs)
 
4289
        {
 
4290
                // Each child of the variable_definitions is a CqParseNodeVariable
 
4291
                CqParseNodeVariable* pVar=static_cast<CqParseNodeVariable*>(pArgs->pFirstChild());
 
4292
 
 
4293
                while(pVar)
 
4294
                {
 
4295
                        // If storage is not specified, a shader parameter defaults to uniform.
 
4296
                        pVar->SetDefaultStorage(Type_Uniform);
 
4297
                        // Force the variable to be a parameter.
 
4298
                        pVar->SetParam();
 
4299
 
 
4300
                        // Check if a default value has been specified.
 
4301
                        CqParseNode* pDefValue=pVar->pFirstChild();
 
4302
                        if(pDefValue!=0)
 
4303
                        {
 
4304
                                // Get a pointer to the local variable.
 
4305
                                CqVarDef* pVarDef=CqVarDef::GetVariablePtr(pVar->VarRef());
 
4306
                                if(pVarDef!=0)
 
4307
                                {
 
4308
                                        CqParseNode Node;
 
4309
                                        pDefValue->UnLink();
 
4310
                                        CqParseNodeCast* pCast=new CqParseNodeCast(pVarDef->Type());
 
4311
                                        Node.AddLastChild(pCast);
 
4312
                                        pCast->AddLastChild(pDefValue);
 
4313
                                        Node.Optimise();
 
4314
                                        pVarDef->SetpDefValue(Node.pFirstChild());
 
4315
                                        pVar->AddFirstChild( Node.pFirstChild() );
 
4316
                                }
 
4317
                        }
 
4318
                        pVar=static_cast<CqParseNodeVariable*>(pVar->pNext());
 
4319
                }
 
4320
        }
 
4321
}
 
4322
 
 
4323
 
 
4324
} // End Namespace
 
4325
 
 
4326
static void yyerror(const CqString Message)
 
4327
{
 
4328
        ParseSucceeded = false;
 
4329
        //(*ParseErrorStream) << "libslparse > parser > error: " << Message.c_str() << " at " << ParseStreamName.c_str() << " line " << ParseLineNumber << std::endl;
 
4330
        CqString strErr( ParseStreamName.c_str() );
 
4331
        strErr += " : ";
 
4332
        strErr += ParseLineNumber;
 
4333
        strErr += " : ";
 
4334
        strErr += Message.c_str();
 
4335
        throw( strErr );
 
4336
}
 
4337