
/*  A Bison parser, made from sl.y
 by  GNU Bison version 1.25
  */

#define YYBISON 1  /* Identify Bison output.  */

#define alloca

#define	SL_SURFACE	258
#define	SL_DISPLACEMENT	259
#define	SL_LIGHT	260
#define	SL_VOLUME	261
#define	SL_TRANSFORMATION	262
#define	SL_IMAGER	263
#define	SL_FOR	264
#define	SL_WHILE	265
#define	SL_IF	266
#define	SL_GATHER	267
#define	SL_ELSE	268
#define	SL_BREAK	269
#define	SL_CONTINUE	270
#define	SL_ILLUMINANCE	271
#define	SL_ILLUMINATE	272
#define	SL_SOLAR	273
#define	SL_RETURN	274
#define	SL_VOID	275
#define	SL_FCN_PI	276
#define	SL_IDENTIFIER_VALUE	277
#define	SL_FLOAT_VALUE	278
#define	SL_COMMA	279
#define	SL_SEMI_COLON	280
#define	SL_OPEN_PARANTHESIS	281
#define	SL_CLOSE_PARANTHESIS	282
#define	SL_OPEN_CRL_PARANTHESIS	283
#define	SL_CLOSE_CRL_PARANTHESIS	284
#define	SL_OPEN_SQR_PARANTHESIS	285
#define	SL_CLOSE_SQR_PARANTHESIS	286
#define	SL_TEXTURE	287
#define	SL_SHADOW	288
#define	SL_ENVIRONMENT	289
#define	SL_BUMP	290
#define	SL_TEXT_VALUE	291
#define	SL_QUESTION	292
#define	SL_COLON	293
#define	SL_FLOAT	294
#define	SL_COLOR	295
#define	SL_POINT	296
#define	SL_VECTOR	297
#define	SL_NORMAL	298
#define	SL_MATRIX	299
#define	SL_STRING	300
#define	SL_COMP_EQUAL	301
#define	SL_COMP_DIFFERENT	302
#define	SL_COMP_GREATER	303
#define	SL_COMP_GREATER_EQUAL	304
#define	SL_COMP_LESS	305
#define	SL_COMP_LESS_EQUAL	306
#define	SL_EQUAL	307
#define	SL_INCREMENT	308
#define	SL_DECREMENT	309
#define	SL_INCREMENT_BY	310
#define	SL_DECREMENT_BY	311
#define	SL_MULTIPLY_BY	312
#define	SL_DIVIDE_BY	313
#define	SL_PLUS	314
#define	SL_MINUS	315
#define	SL_CROSS	316
#define	SL_DIVIDE	317
#define	SL_MULTIPLY	318
#define	SL_DOT	319
#define	SL_OR	320
#define	SL_AND	321
#define	SL_NOT	322
#define	SL_OUTPUT	323
#define	SL_EXTERN	324
#define	SL_UNIFORM	325
#define	SL_VARIABLE	326

#line 60 "sl.y"

//////////////////////////////////////////////////////////////////////////
// Misc C definitions
//////////////////////////////////////////////////////////////////////////
#undef alloca
#include	<stdlib.h>
#include	<string.h>

#include	"common/global.h"
#include	"common/os.h"
#include	"opcodes.h"
#include	"sdr.h"

	void				yyerror(char *);				// Forward definition for stupid yacc
	int					yylex(void );					// Forward definition for stupid yacc
														
//////////////////////////////////////////////////////////////////////////
// Here's the only global CVariable
//////////////////////////////////////////////////////////////////////////
	CScriptContext		*sdr;

//////////////////////////////////////////////////////////////////////////



#line 85 "sl.y"
typedef union {
  char					*string;
  CExpression			*code;
  float					real;
  int					integer;
  CList<CExpression *>	*array;
} YYSTYPE;
#include <stdio.h>

#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif



#define	YYFINAL		453
#define	YYFLAG		32768
#define	YYNTBASE	72

#define YYTRANSLATE(x) ((unsigned)(x) <= 326 ? yytranslate[x] : 183)

static const char yytranslate[] = {     0,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
    36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
    46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
    56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
    66,    67,    68,    69,    70,    71
};

#if YYDEBUG != 0
static const short yyprhs[] = {     0,
     0,     1,     4,     6,     8,     9,    11,    12,    14,    15,
    17,    19,    21,    23,    25,    27,    29,    31,    33,    35,
    37,    42,    45,    47,    51,    55,    60,    64,    66,    67,
    71,    72,    73,    78,    80,    81,    88,    89,    97,   101,
   106,   107,   108,   117,   119,   121,   123,   125,   127,   129,
   133,   135,   136,   140,   141,   144,   147,   148,   153,   154,
   158,   159,   167,   168,   175,   176,   178,   182,   183,   188,
   191,   194,   197,   198,   202,   203,   208,   209,   216,   217,
   225,   228,   230,   232,   234,   236,   237,   241,   242,   244,
   246,   248,   250,   253,   256,   258,   260,   262,   264,   266,
   268,   270,   272,   274,   277,   279,   281,   283,   285,   287,
   289,   291,   293,   297,   300,   304,   307,   311,   314,   319,
   322,   325,   326,   331,   332,   340,   341,   346,   347,   352,
   355,   358,   359,   364,   365,   370,   371,   379,   380,   388,
   394,   400,   401,   409,   410,   418,   420,   430,   440,   442,
   443,   447,   449,   451,   452,   454,   455,   459,   461,   465,
   467,   475,   481,   489,   493,   495,   496,   502,   507,   510,
   515,   517,   523,   531,   541,   553,   559,   567,   577,   589,
   595,   605,   611,   621,   626,   634,   639,   647,   649,   653,
   657,   661,   665,   666,   671,   675,   678,   681,   687,   691,
   695,   697,   699,   701,   703,   705,   707,   710,   712,   717,
   719,   721,   725,   726,   731,   732,   736,   740,   742,   744,
   750,   782,   786,   790,   794,   798,   802,   806,   810,   814,
   818,   822,   826,   829,   831,   833,   836,   839,   842,   846,
   848,   850,   854,   855,   863,   869,   871,   873,   875,   877,
   879,   880,   881,   886
};

static const short yyrhs[] = {    -1,
    73,    83,     0,    70,     0,    71,     0,     0,    69,     0,
     0,    68,     0,     0,    39,     0,    40,     0,    42,     0,
    43,     0,    41,     0,    44,     0,    45,     0,    77,     0,
    78,     0,    79,     0,    80,     0,    75,    76,    74,    81,
     0,    85,    83,     0,    93,     0,    82,    22,    26,     0,
    20,    22,    26,     0,    84,    86,    27,   107,     0,    87,
    25,    86,     0,    87,     0,     0,    82,    88,    89,     0,
     0,     0,    22,    90,    24,    89,     0,    22,     0,     0,
    22,    30,    31,    91,    24,    89,     0,     0,    22,    30,
    23,    31,    92,    24,    89,     0,    22,    30,    31,     0,
    22,    30,    23,    31,     0,     0,     0,    96,    22,    26,
    94,    97,    27,    95,   107,     0,     3,     0,     4,     0,
     5,     0,     6,     0,     7,     0,     8,     0,    98,    25,
    97,     0,    98,     0,     0,    82,    99,   106,     0,     0,
    52,   162,     0,    52,   164,     0,     0,    22,    24,   102,
   101,     0,     0,    22,   103,   100,     0,     0,    22,    30,
    23,    31,    24,   104,   101,     0,     0,    22,    30,    23,
    31,   105,   100,     0,     0,   101,     0,   101,    24,   106,
     0,     0,    28,   108,   118,    29,     0,    82,   111,     0,
    52,   162,     0,    52,   164,     0,     0,    22,   112,   116,
     0,     0,    22,   113,   110,   116,     0,     0,    22,    30,
    23,    31,   114,   116,     0,     0,    22,    30,    23,    31,
   115,   110,   116,     0,    24,   111,     0,    25,     0,   121,
     0,   120,     0,     1,     0,     0,   118,   119,   117,     0,
     0,   141,     0,   126,     0,   148,     0,   153,     0,   128,
    25,     0,   131,    25,     0,   122,     0,   123,     0,   124,
     0,   156,     0,   158,     0,   160,     0,   107,     0,   109,
     0,    85,     0,   173,    25,     0,    25,     0,   149,     0,
   154,     0,   127,     0,   142,     0,   157,     0,   159,     0,
   161,     0,    14,    23,    25,     0,    14,    25,     0,    15,
    23,    25,     0,    15,    25,     0,    19,   162,    25,     0,
    19,    25,     0,    10,    26,   172,    27,     0,   125,   120,
     0,   125,   121,     0,     0,    22,    52,   129,   162,     0,
     0,    22,    30,   162,    31,    52,   130,   162,     0,     0,
    22,    55,   132,   162,     0,     0,    22,    56,   133,   162,
     0,    22,    53,     0,    22,    54,     0,     0,    22,    57,
   134,   162,     0,     0,    22,    58,   135,   162,     0,     0,
    22,    30,   162,    31,    55,   136,   162,     0,     0,    22,
    30,   162,    31,    56,   137,   162,     0,    22,    30,   162,
    31,    53,     0,    22,    30,   162,    31,    54,     0,     0,
    22,    30,   162,    31,    57,   138,   162,     0,     0,    22,
    30,   162,    31,    58,   139,   162,     0,     9,     0,   140,
    26,   143,    25,   145,    25,   146,    27,   120,     0,   140,
    26,   143,    25,   145,    25,   146,    27,   121,     0,   144,
     0,     0,   128,    24,   144,     0,   128,     0,   172,     0,
     0,   147,     0,     0,   128,    24,   147,     0,   128,     0,
   131,    24,   147,     0,   131,     0,    11,    26,   172,    27,
   120,    13,   120,     0,    11,    26,   172,    27,   117,     0,
    11,    26,   172,    27,   120,    13,   121,     0,   150,    24,
   162,     0,   162,     0,     0,    12,    26,   152,   150,    27,
     0,   151,   120,    13,   120,     0,   151,   117,     0,   151,
   120,    13,   121,     0,    16,     0,   155,    26,   162,    27,
   120,     0,   155,    26,   162,    24,   162,    27,   120,     0,
   155,    26,   162,    24,   162,    24,   162,    27,   120,     0,
   155,    26,   162,    24,   162,    24,   162,    24,   162,    27,
   120,     0,   155,    26,   162,    27,   121,     0,   155,    26,
   162,    24,   162,    27,   121,     0,   155,    26,   162,    24,
   162,    24,   162,    27,   121,     0,   155,    26,   162,    24,
   162,    24,   162,    24,   162,    27,   121,     0,    17,    26,
   162,    27,   120,     0,    17,    26,   162,    24,   162,    24,
   162,    27,   120,     0,    17,    26,   162,    27,   121,     0,
    17,    26,   162,    24,   162,    24,   162,    27,   121,     0,
    18,    26,    27,   120,     0,    18,    26,   162,    24,   162,
    27,   120,     0,    18,    26,    27,   121,     0,    18,    26,
   162,    24,   162,    27,   121,     0,   166,     0,   162,    59,
   162,     0,   162,    60,   162,     0,   162,    63,   162,     0,
   162,    62,   162,     0,     0,   162,    64,   163,   162,     0,
   162,    61,   162,     0,    59,   162,     0,    60,   162,     0,
   172,    37,   162,    38,   162,     0,    28,   165,    29,     0,
   162,    24,   165,     0,   162,     0,    21,     0,   128,     0,
   131,     0,   167,     0,   173,     0,    82,   173,     0,    22,
     0,    22,    30,   162,    31,     0,    23,     0,    36,     0,
    26,   162,    27,     0,     0,    82,    36,   168,   170,     0,
     0,    82,   169,   170,     0,    26,   171,    27,     0,    22,
     0,   162,     0,   162,    24,   162,    24,   162,     0,   162,
    24,   162,    24,   162,    24,   162,    24,   162,    24,   162,
    24,   162,    24,   162,    24,   162,    24,   162,    24,   162,
    24,   162,    24,   162,    24,   162,    24,   162,    24,   162,
     0,    26,   172,    27,     0,   172,    66,   172,     0,   172,
    65,   172,     0,   162,    48,   162,     0,   162,    50,   162,
     0,   162,    49,   162,     0,   162,    51,   162,     0,   162,
    46,   162,     0,   162,    47,   162,     0,   172,    46,   172,
     0,   172,    47,   172,     0,    67,   172,     0,   178,     0,
   175,     0,    22,    26,     0,     3,    26,     0,     4,    26,
     0,   174,   180,    27,     0,    36,     0,    22,     0,    30,
   162,    31,     0,     0,   179,    26,   176,   177,    24,   180,
    27,     0,   179,    26,   176,   177,    27,     0,    32,     0,
    33,     0,    34,     0,    35,     0,   181,     0,     0,     0,
   162,    24,   182,   181,     0,   162,     0
};

#endif

#if YYDEBUG != 0
static const short yyrline[] = { 0,
   245,   252,   256,   261,   266,   273,   278,   284,   289,   295,
   302,   307,   312,   317,   324,   331,   340,   345,   350,   355,
   362,   383,   388,   403,   419,   430,   452,   459,   468,   487,
   491,   499,   507,   511,   520,   530,   534,   550,   554,   565,
   588,   601,   606,   623,   627,   632,   637,   642,   647,   657,
   664,   673,   690,   699,   707,   713,   722,   731,   734,   742,
   745,   762,   765,   782,   786,   793,   798,   810,   816,   830,
   851,   857,   865,   875,   878,   888,   892,   911,   914,   934,
   940,   946,   956,   963,   969,   979,   985,   988,   998,  1003,
  1008,  1013,  1018,  1023,  1028,  1033,  1038,  1043,  1048,  1053,
  1058,  1063,  1068,  1073,  1078,  1087,  1092,  1097,  1102,  1107,
  1112,  1117,  1126,  1153,  1182,  1209,  1236,  1267,  1291,  1304,
  1314,  1327,  1337,  1347,  1360,  1401,  1411,  1421,  1431,  1441,
  1452,  1463,  1473,  1483,  1493,  1503,  1516,  1526,  1539,  1549,
  1563,  1577,  1590,  1600,  1613,  1627,  1633,  1650,  1669,  1674,
  1682,  1689,  1698,  1703,  1711,  1716,  1724,  1731,  1736,  1743,
  1752,  1767,  1776,  1793,  1800,  1808,  1816,  1824,  1837,  1844,
  1857,  1865,  1876,  1889,  1904,  1923,  1934,  1947,  1962,  1983,
  1994,  2011,  2022,  2041,  2051,  2066,  2076,  2093,  2098,  2105,
  2112,  2145,  2152,  2159,  2163,  2170,  2176,  2182,  2200,  2209,
  2217,  2225,  2230,  2235,  2240,  2245,  2250,  2257,  2270,  2310,
  2315,  2320,  2331,  2340,  2345,  2353,  2360,  2367,  2374,  2379,
  2388,  2443,  2450,  2457,  2464,  2472,  2480,  2488,  2496,  2504,
  2512,  2520,  2528,  2541,  2581,  2590,  2605,  2620,  2637,  2716,
  2721,  2732,  2739,  2750,  2774,  2798,  2811,  2824,  2837,  2854,
  2858,  2863,  2870,  2872
};
#endif


#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)

static const char * const yytname[] = {   "$","error","$undefined.","SL_SURFACE",
"SL_DISPLACEMENT","SL_LIGHT","SL_VOLUME","SL_TRANSFORMATION","SL_IMAGER","SL_FOR",
"SL_WHILE","SL_IF","SL_GATHER","SL_ELSE","SL_BREAK","SL_CONTINUE","SL_ILLUMINANCE",
"SL_ILLUMINATE","SL_SOLAR","SL_RETURN","SL_VOID","SL_FCN_PI","SL_IDENTIFIER_VALUE",
"SL_FLOAT_VALUE","SL_COMMA","SL_SEMI_COLON","SL_OPEN_PARANTHESIS","SL_CLOSE_PARANTHESIS",
"SL_OPEN_CRL_PARANTHESIS","SL_CLOSE_CRL_PARANTHESIS","SL_OPEN_SQR_PARANTHESIS",
"SL_CLOSE_SQR_PARANTHESIS","SL_TEXTURE","SL_SHADOW","SL_ENVIRONMENT","SL_BUMP",
"SL_TEXT_VALUE","SL_QUESTION","SL_COLON","SL_FLOAT","SL_COLOR","SL_POINT","SL_VECTOR",
"SL_NORMAL","SL_MATRIX","SL_STRING","SL_COMP_EQUAL","SL_COMP_DIFFERENT","SL_COMP_GREATER",
"SL_COMP_GREATER_EQUAL","SL_COMP_LESS","SL_COMP_LESS_EQUAL","SL_EQUAL","SL_INCREMENT",
"SL_DECREMENT","SL_INCREMENT_BY","SL_DECREMENT_BY","SL_MULTIPLY_BY","SL_DIVIDE_BY",
"SL_PLUS","SL_MINUS","SL_CROSS","SL_DIVIDE","SL_MULTIPLY","SL_DOT","SL_OR","SL_AND",
"SL_NOT","SL_OUTPUT","SL_EXTERN","SL_UNIFORM","SL_VARIABLE","slStart","@1","slContainerClass",
"slInheritanceClass","slOutputClass","slFloatSpecifier","slVectorSpecifier",
"slMatrixSpecifier","slStringSpecifier","slTypeSpecifier","slTypeDecl","slShader",
"slFunctionHeader","slFunction","slFunctionParameters","slFunctionParameter",
"@2","slFunctionParameterIdentifierList","@3","@4","@5","slMain","@6","@7","slShaderType",
"slShaderParameters","slShaderParameter","@8","slShaderParameterInitializer",
"slShaderParameterIdentifierToken","@9","@10","@11","@12","slShaderParameterIdentifierList",
"slBlock","@13","slVariableDeclerations","slVariableInitializer","slVariableIdentifierList",
"@14","@15","@16","@17","slVariableIdentifierTail","slStatement","slStatements",
"@18","slMatchedStatement","slUnmatchedStatement","slBreakStatement","slContinueStatement",
"slReturnStatement","slWhileStartStatement","slWhileStatement","slUnmatchedWhileStatement",
"slAssignmentStatement","@19","@20","slUpdateStatement","@21","@22","@23","@24",
"@25","@26","@27","@28","slForStartStatement","slForStatement","slUnmatchedForStatement",
"slForInitStatement","slForInitStatements","slForCheckStatement","slForIncrementStatement",
"slForIncrementStatements","slMatchedIfStatement","slUnmatchedIfStatement","slGatherParameterList",
"slGatherHeader","@29","slMatchedGatherStatement","slUnmatchedGatherStatement",
"slIlluminanceStartStatement","slIlluminanceStatement","slUnmatchedIlluminanceStatement",
"slIlluminateStatement","slUnmatchedIlluminateStatement","slSolarStatement",
"slUnmatchedSolarStatement","slAritmeticExpression","@30","slArrayList","slArrayItems",
"slAritmeticTerminalValue","slAritmeticTypeCast","@31","@32","slVectorMatrixExpression",
"slVMExpression","slBooleanExpression","slFunctionCall","slFunCallHeader","slFunCall",
"slTextureNameSpecifier","slTextureChannelSpecifier","slTextureCall","slTextureName",
"slFunctionCallParameterList","slFunctionCallParameters","@33", NULL
};
#endif

static const short yyr1[] = {     0,
    73,    72,    74,    74,    74,    75,    75,    76,    76,    77,
    78,    78,    78,    78,    79,    80,    81,    81,    81,    81,
    82,    83,    83,    84,    84,    85,    86,    86,    88,    87,
    87,    90,    89,    89,    91,    89,    92,    89,    89,    89,
    94,    95,    93,    96,    96,    96,    96,    96,    96,    97,
    97,    99,    98,    98,   100,   100,   102,   101,   103,   101,
   104,   101,   105,   101,   101,   106,   106,   108,   107,   109,
   110,   110,   112,   111,   113,   111,   114,   111,   115,   111,
   116,   116,   117,   117,   117,   119,   118,   118,   120,   120,
   120,   120,   120,   120,   120,   120,   120,   120,   120,   120,
   120,   120,   120,   120,   120,   121,   121,   121,   121,   121,
   121,   121,   122,   122,   123,   123,   124,   124,   125,   126,
   127,   129,   128,   130,   128,   132,   131,   133,   131,   131,
   131,   134,   131,   135,   131,   136,   131,   137,   131,   131,
   131,   138,   131,   139,   131,   140,   141,   142,   143,   143,
   144,   144,   145,   145,   146,   146,   147,   147,   147,   147,
   148,   149,   149,   150,   150,   152,   151,   153,   154,   154,
   155,   156,   156,   156,   156,   157,   157,   157,   157,   158,
   158,   159,   159,   160,   160,   161,   161,   162,   162,   162,
   162,   162,   163,   162,   162,   162,   162,   162,   164,   165,
   165,   166,   166,   166,   166,   166,   166,   166,   166,   166,
   166,   166,   168,   167,   169,   167,   170,   170,   171,   171,
   171,   172,   172,   172,   172,   172,   172,   172,   172,   172,
   172,   172,   172,   173,   173,   174,   174,   174,   175,   176,
   176,   177,   177,   178,   178,   179,   179,   179,   179,   180,
   180,   182,   181,   181
};

static const short yyr2[] = {     0,
     0,     2,     1,     1,     0,     1,     0,     1,     0,     1,
     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
     4,     2,     1,     3,     3,     4,     3,     1,     0,     3,
     0,     0,     4,     1,     0,     6,     0,     7,     3,     4,
     0,     0,     8,     1,     1,     1,     1,     1,     1,     3,
     1,     0,     3,     0,     2,     2,     0,     4,     0,     3,
     0,     7,     0,     6,     0,     1,     3,     0,     4,     2,
     2,     2,     0,     3,     0,     4,     0,     6,     0,     7,
     2,     1,     1,     1,     1,     0,     3,     0,     1,     1,
     1,     1,     2,     2,     1,     1,     1,     1,     1,     1,
     1,     1,     1,     2,     1,     1,     1,     1,     1,     1,
     1,     1,     3,     2,     3,     2,     3,     2,     4,     2,
     2,     0,     4,     0,     7,     0,     4,     0,     4,     2,
     2,     0,     4,     0,     4,     0,     7,     0,     7,     5,
     5,     0,     7,     0,     7,     1,     9,     9,     1,     0,
     3,     1,     1,     0,     1,     0,     3,     1,     3,     1,
     7,     5,     7,     3,     1,     0,     5,     4,     2,     4,
     1,     5,     7,     9,    11,     5,     7,     9,    11,     5,
     9,     5,     9,     4,     7,     4,     7,     1,     3,     3,
     3,     3,     0,     4,     3,     2,     2,     5,     3,     3,
     1,     1,     1,     1,     1,     1,     2,     1,     4,     1,
     1,     3,     0,     4,     0,     3,     3,     1,     1,     5,
    31,     3,     3,     3,     3,     3,     3,     3,     3,     3,
     3,     3,     2,     1,     1,     2,     2,     2,     3,     1,
     1,     3,     0,     7,     5,     1,     1,     1,     1,     1,
     0,     0,     4,     1
};

static const short yydefact[] = {     1,
     7,    44,    45,    46,    47,    48,    49,     0,     6,     9,
     0,     2,     7,     7,    23,     0,     0,     8,     5,     0,
    29,     0,    28,    22,     0,    25,     3,     4,     0,    24,
     0,     0,     7,    41,    10,    11,    14,    12,    13,    15,
    16,    17,    18,    19,    20,    21,    34,    30,    68,    26,
    27,     7,     0,     0,    88,    52,     0,    51,     0,    39,
     0,    86,    65,    42,     7,    40,     0,    33,    69,     0,
    59,    66,    53,     0,    50,     0,     0,    85,     0,     0,
   146,     0,     0,     0,     0,     0,   171,     0,     0,     7,
     0,   105,   246,   247,   248,   249,     0,   103,   101,   102,
    87,    84,    83,    95,    96,    97,     7,    90,   108,     0,
     0,     0,    89,   109,    91,   106,     0,    92,   107,     0,
    98,   110,    99,   111,   100,   112,     0,     7,   235,   234,
     0,    57,     0,     0,    65,    43,     0,    36,   237,   238,
     7,     7,   166,     0,   114,     0,   116,     7,     7,   202,
   208,   210,   118,     7,   211,     7,     7,     7,   215,   203,
   204,     0,   188,   205,     0,   206,   236,     7,   122,   130,
   131,   126,   128,   132,   134,    73,    70,   120,   121,    93,
    94,   150,   169,    84,     7,   104,   254,     0,   250,     0,
    65,     0,     7,    60,    67,    38,     0,     0,     0,     7,
   113,   115,     0,     7,     0,     7,     0,     0,   196,   197,
   233,     0,   213,     0,   207,   117,     7,     7,     7,     7,
     7,     7,     7,     7,     7,     7,     7,   193,     7,     7,
     7,     7,     7,     0,     7,     7,     7,     7,     7,     0,
     0,     0,     0,   152,     0,   149,     7,     0,   252,   239,
   241,   240,   243,    58,    63,     7,    55,    56,   119,     0,
     0,   165,     7,     7,   184,   186,     7,     0,   212,   222,
     0,   218,     7,   216,   229,   230,   225,   227,   226,   228,
   189,   190,   195,   192,   191,     7,     0,   231,   232,   224,
   223,     0,   123,   127,   129,   133,   135,     0,     0,    82,
    74,     7,     0,     7,     0,     7,   168,   170,     7,     7,
     7,     7,     0,    61,     0,   201,     0,   162,    84,     7,
   167,     0,   180,   182,     0,   209,   214,   219,     0,   194,
     7,   124,   140,   141,   136,   138,   142,   144,    77,    73,
    81,    71,    72,    76,     0,   151,     0,   153,     0,   172,
   176,   253,     0,     7,   245,    65,    64,     7,   199,     7,
   164,     7,     7,     7,   217,   198,     7,     7,     7,     7,
     7,     0,     0,     0,   156,     7,     7,   242,     0,    62,
   200,   161,   163,     0,   185,   187,     0,   125,   137,   139,
   143,   145,    78,     0,     0,   158,   160,     0,   155,     0,
   173,   177,   244,     7,     7,    80,     0,     0,     7,     7,
     7,   181,   183,   220,   157,   159,   147,   148,     0,   174,
   178,     7,     7,     0,   175,   179,     7,     0,     7,     0,
     7,     0,     7,     0,     7,     0,     7,     0,     7,     0,
     7,     0,     7,     0,     7,     0,     7,     0,     7,   221,
     0,     0,     0
};

static const short yydefgoto[] = {   451,
     1,    29,    10,    19,    42,    43,    44,    45,    46,   159,
    12,    13,    98,    22,    23,    31,    48,    54,    67,    76,
    15,    52,    74,    16,    57,    58,    63,   194,    72,   191,
   134,   356,   315,    73,    99,    55,   100,   303,   177,   241,
   242,   372,   373,   301,   101,    62,    70,   102,   103,   104,
   105,   106,   107,   108,   109,   160,   235,   367,   161,   236,
   237,   238,   239,   368,   369,   370,   371,   112,   113,   114,
   245,   246,   347,   398,   399,   115,   116,   261,   117,   200,
   118,   119,   120,   121,   122,   123,   124,   125,   126,   197,
   286,   258,   317,   163,   164,   271,   214,   274,   329,   165,
   166,   128,   129,   253,   313,   130,   131,   188,   189,   311
};

static const short yypact[] = {-32768,
    23,-32768,-32768,-32768,-32768,-32768,-32768,   -17,-32768,   -44,
    31,-32768,    17,    23,-32768,    67,    86,-32768,    49,   100,
-32768,   112,   118,-32768,   129,-32768,-32768,-32768,   255,-32768,
   138,   147,    17,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,    54,-32768,-32768,-32768,
-32768,    36,   -16,   142,-32768,-32768,   149,   152,   148,   163,
   138,   154,   168,-32768,    36,   175,   176,-32768,-32768,   504,
    63,   177,-32768,   147,-32768,   178,   138,-32768,   179,   184,
-32768,   190,   191,   195,   102,   133,-32768,   199,   203,   402,
   645,-32768,-32768,-32768,-32768,-32768,   182,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,   567,-32768,-32768,   207,
   210,   204,-32768,-32768,-32768,-32768,   504,-32768,-32768,   217,
-32768,-32768,-32768,-32768,-32768,-32768,   211,    14,-32768,-32768,
   218,-32768,   222,   197,   168,-32768,   138,-32768,-32768,-32768,
   627,   627,-32768,   225,-32768,   226,-32768,   627,   159,-32768,
  1183,-32768,-32768,   627,-32768,   627,   627,   627,   205,-32768,
-32768,   505,-32768,-32768,    25,-32768,-32768,   627,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,    -7,-32768,-32768,-32768,-32768,
-32768,   234,-32768,   245,   627,-32768,   702,   220,-32768,    -2,
   168,   230,   442,-32768,-32768,-32768,  1202,    29,    76,   627,
-32768,-32768,   618,   567,   730,   627,  1032,   187,    46,    46,
-32768,   236,-32768,    32,-32768,-32768,   627,   627,   627,   627,
   627,   627,   627,   627,   627,   627,   627,-32768,   627,   627,
   627,   627,   627,  1109,   627,   627,   627,   627,   627,   241,
   140,   214,   -14,   244,   251,-32768,   567,   661,-32768,-32768,
-32768,-32768,   240,-32768,   253,   627,  1202,-32768,-32768,   504,
    61,  1202,   627,   567,-32768,-32768,   627,  1130,-32768,-32768,
    32,-32768,   627,-32768,  1063,  1063,  1063,  1063,  1063,  1063,
    46,    46,    90,   219,   219,   627,  1196,   104,   104,   223,
-32768,   340,   263,   263,   263,   263,   263,   257,   262,-32768,
-32768,   442,   140,   627,   234,   587,-32768,-32768,   627,   567,
   627,   627,    94,-32768,   197,   750,   261,-32768,   273,   627,
-32768,   771,-32768,-32768,  1057,   340,-32768,   778,   264,-32768,
   627,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   250,     3,
-32768,  1202,-32768,-32768,  1136,-32768,   267,    25,   668,-32768,
-32768,-32768,  1157,    14,-32768,   168,-32768,   627,-32768,   567,
  1202,   627,   567,   627,-32768,  1202,   627,   627,   627,   627,
   627,   140,   214,   252,   281,   627,   567,-32768,   278,-32768,
-32768,-32768,-32768,  1082,-32768,-32768,   799,   263,   263,   263,
   263,   263,-32768,   140,  1171,   283,   286,   284,-32768,   709,
-32768,-32768,-32768,   567,   627,-32768,   281,   281,   567,   627,
   567,-32768,-32768,   819,-32768,-32768,-32768,-32768,  1088,-32768,
-32768,   627,   567,   840,-32768,-32768,   627,   847,   627,   868,
   627,   888,   627,   909,   627,   916,   627,   937,   627,   957,
   627,   978,   627,   985,   627,  1006,   627,  1026,   627,  1202,
   313,   314,-32768
};

static const short yypgoto[] = {-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,    -1,
   301,-32768,    56,   296,-32768,-32768,   -55,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,   254,-32768,-32768,    15,  -188,-32768,
-32768,-32768,-32768,   196,   -22,-32768,-32768,   -41,    35,-32768,
-32768,-32768,-32768,  -292,  -115,-32768,-32768,  -103,     8,-32768,
-32768,-32768,-32768,-32768,-32768,     7,-32768,-32768,    81,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,    30,-32768,-32768,  -236,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   -89,
-32768,    37,   -21,-32768,-32768,-32768,-32768,    72,-32768,  -133,
    89,-32768,-32768,-32768,-32768,-32768,-32768,    -3,    44,-32768
};


#define	YYLAST		1266


static const short yytable[] = {    11,
   162,   183,   254,   178,    17,    68,    59,   198,   199,    50,
   344,    21,    11,   184,    60,   304,    79,    80,    30,   251,
   208,   138,   240,    18,   211,     2,     3,     4,     5,     6,
     7,    21,   240,   252,   150,   151,   152,   169,   187,   154,
  -251,   -31,     8,   -31,   -75,    93,    94,    95,    96,   155,
    56,   136,    20,   272,   -75,   259,    14,   273,   203,   205,
   -54,   229,   -54,    56,   207,   229,   209,   210,    97,    14,
   230,   231,   156,   157,   230,   231,   110,   -32,   234,   393,
   158,   196,     9,    53,   320,     9,   132,   321,    25,   232,
   233,     9,   133,   232,   233,   248,   288,   289,   290,   291,
   265,   406,   260,   257,     9,    97,   225,   226,   227,   228,
   262,    26,   229,   110,   179,    97,   268,   354,    27,    28,
   355,   230,   231,   110,   144,    30,   145,   275,   276,   277,
   278,   279,   280,   281,   282,   283,   284,   285,    32,   287,
   232,   233,    33,   307,   318,   293,   294,   295,   296,   297,
   111,   226,   227,   228,    34,   146,   319,   147,   127,    47,
   323,    79,    80,   299,   300,    61,   316,   380,   232,   233,
   415,   416,   348,   322,    49,    64,    65,   325,    66,   150,
   151,   152,    69,   328,   154,   204,   -35,   111,   244,    71,
    93,    94,    95,    96,   155,   127,   330,   111,   -37,    77,
   135,   137,    97,   176,   139,   127,   350,    79,    80,   140,
   110,   266,   342,   270,   345,   141,   142,   156,   157,   349,
   143,   187,   353,   229,   148,   158,   212,     9,   149,   182,
   361,   180,   230,   231,   181,   186,    93,    94,    95,    96,
   213,   366,   185,   190,   192,    97,   250,   215,   193,   201,
   202,   232,   233,   110,   308,   243,   382,   247,    97,   385,
   255,   167,    97,   298,   187,   302,   110,   305,   316,   312,
   110,   324,   384,   401,   387,   306,   314,   388,   389,   390,
   391,   392,   228,   340,   111,   360,   400,   339,   233,   359,
   365,   375,   127,    35,    36,    37,    38,    39,    40,    41,
   412,   -79,   395,   332,   403,   417,   407,   420,    97,   408,
   409,   244,   452,   453,    24,   414,   110,   351,    75,   425,
   419,   223,   224,   225,   226,   227,   228,   111,    51,   357,
   195,   394,   424,   341,   346,   127,   381,   428,   343,   430,
   111,   432,   327,   434,   111,   436,     0,   438,   127,   440,
   379,   442,   127,   444,   352,   446,     0,   448,    97,   450,
     0,    97,     0,     0,     0,     0,   110,   383,     0,   110,
   386,     0,     0,     0,     0,    97,     0,     0,     0,     0,
     0,   396,     0,   110,   402,     0,     0,     0,     0,     0,
   111,   332,   333,   334,   335,   336,   337,   338,   127,     0,
     0,     0,    97,     0,    79,    80,     0,    97,     0,    97,
   110,   413,     0,   396,   396,   110,   418,   110,   421,     0,
     0,    97,   150,   151,   152,     0,   153,   154,     0,   110,
   426,     0,     0,    93,    94,    95,    96,   155,     0,     0,
   111,     0,     0,   111,    79,    80,     0,     0,   127,     0,
     0,   127,     0,     0,     0,   397,     0,   111,     0,     0,
   156,   157,   150,   151,   152,   127,     0,   154,   158,   256,
     9,     0,     0,    93,    94,    95,    96,   155,     0,     0,
     0,     0,     0,     0,   111,     0,     0,   397,   397,   111,
     0,   111,   127,     0,     0,     0,     0,   127,     0,   127,
   156,   157,     0,   111,    78,     0,    79,    80,   158,     0,
     9,   127,    81,    82,    83,    84,     0,    85,    86,    87,
    88,    89,    90,     8,     0,    91,     0,     0,    92,   216,
     0,    49,     0,     0,     0,    93,    94,    95,    96,     0,
     0,     0,    -7,    -7,    -7,    -7,    -7,    -7,    -7,     0,
   217,   218,   219,   220,   221,   222,     0,     0,     0,     0,
     0,     0,     0,   223,   224,   225,   226,   227,   228,    79,
    80,    -7,     9,    -7,    -7,    81,    82,    83,    84,     0,
    85,    86,    87,    88,    89,    90,     8,     0,    91,    79,
    80,    92,     0,     0,    49,     0,     0,     0,    93,    94,
    95,    96,     0,     0,     0,     0,     0,   150,   151,   152,
     0,  -154,   154,     0,     0,     0,     0,     0,    93,    94,
    95,    96,   155,     0,     0,     0,     0,     0,     0,    79,
    80,     0,     0,     0,     0,     9,     0,     0,     0,     0,
     0,   263,     0,     0,   264,   156,   157,   150,   151,   152,
     0,     0,   154,   158,     0,     9,     0,     0,    93,    94,
    95,    96,   155,   217,   218,   219,   220,   221,   222,     0,
   167,     0,     0,     0,   168,     0,   223,   224,   225,   226,
   227,   228,     0,     0,   309,   156,   157,   310,     0,     0,
     0,   376,     0,   158,   377,     9,   169,   170,   171,   172,
   173,   174,   175,     0,     0,     0,   217,   218,   219,   220,
   221,   222,     0,   217,   218,   219,   220,   221,   222,   223,
   224,   225,   226,   227,   228,   249,   223,   224,   225,   226,
   227,   228,   410,     0,     0,   411,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,   217,   218,   219,
   220,   221,   222,   267,   217,   218,   219,   220,   221,   222,
   223,   224,   225,   226,   227,   228,     0,   223,   224,   225,
   226,   227,   228,   358,     0,   217,   218,   219,   220,   221,
   222,     0,     0,     0,     0,     0,     0,     0,   223,   224,
   225,   226,   227,   228,   362,   217,   218,   219,   220,   221,
   222,   364,     0,     0,     0,     0,     0,     0,   223,   224,
   225,   226,   227,   228,     0,     0,   217,   218,   219,   220,
   221,   222,   405,   217,   218,   219,   220,   221,   222,   223,
   224,   225,   226,   227,   228,     0,   223,   224,   225,   226,
   227,   228,   422,     0,   217,   218,   219,   220,   221,   222,
     0,     0,     0,     0,     0,     0,     0,   223,   224,   225,
   226,   227,   228,   427,   217,   218,   219,   220,   221,   222,
   429,     0,     0,     0,     0,     0,     0,   223,   224,   225,
   226,   227,   228,     0,     0,   217,   218,   219,   220,   221,
   222,   431,   217,   218,   219,   220,   221,   222,   223,   224,
   225,   226,   227,   228,     0,   223,   224,   225,   226,   227,
   228,   433,     0,   217,   218,   219,   220,   221,   222,     0,
     0,     0,     0,     0,     0,     0,   223,   224,   225,   226,
   227,   228,   435,   217,   218,   219,   220,   221,   222,   437,
     0,     0,     0,     0,     0,     0,   223,   224,   225,   226,
   227,   228,     0,     0,   217,   218,   219,   220,   221,   222,
   439,   217,   218,   219,   220,   221,   222,   223,   224,   225,
   226,   227,   228,     0,   223,   224,   225,   226,   227,   228,
   441,     0,   217,   218,   219,   220,   221,   222,     0,     0,
     0,     0,     0,     0,     0,   223,   224,   225,   226,   227,
   228,   443,   217,   218,   219,   220,   221,   222,   445,     0,
     0,     0,     0,     0,     0,   223,   224,   225,   226,   227,
   228,     0,     0,   217,   218,   219,   220,   221,   222,   447,
   217,   218,   219,   220,   221,   222,   223,   224,   225,   226,
   227,   228,     0,   223,   224,   225,   226,   227,   228,   449,
     0,   217,   218,   219,   220,   221,   222,     0,   269,     0,
     0,     0,     0,     0,   223,   224,   225,   226,   227,   228,
     0,   217,   218,   219,   220,   221,   222,   217,   218,   219,
   220,   221,   222,   363,   223,   224,   225,   226,   227,   228,
   223,   224,   225,   226,   227,   228,     0,     0,     0,     0,
     0,     0,   217,   218,   219,   220,   221,   222,   404,     0,
   219,   220,   221,   222,   423,   223,   224,   225,   226,   227,
   228,   223,   224,   225,   226,   227,   228,   217,   218,   219,
   220,   221,   222,   217,   218,   219,   220,   221,   222,   292,
   223,   224,   225,   226,   227,   228,   223,   224,   225,   226,
   227,   228,     0,     0,   217,   218,   219,   220,   221,   222,
   326,     0,     0,     0,     0,     0,   374,   223,   224,   225,
   226,   227,   228,     0,     0,   217,   218,   219,   220,   221,
   222,   217,   218,   219,   220,   221,   222,   378,   223,   224,
   225,   226,   227,   228,   223,   224,   225,   226,   227,   228,
   168,     0,   217,   218,   219,   220,   221,   222,   167,     0,
     0,     0,   206,     0,     0,   223,   224,   225,   226,   227,
   228,     0,   169,   170,   171,   172,   173,   174,   175,     0,
     0,     0,     0,   331,   169,   170,   171,   172,   173,   174,
   175,   217,   218,   219,   220,   221,   222,   217,   218,   219,
   220,   221,   222,     0,   223,   224,   225,   226,   227,   228,
   223,   224,   225,   226,   227,   228
};

static const short yycheck[] = {     1,
    90,   117,   191,   107,    22,    61,    23,   141,   142,    32,
   303,    13,    14,   117,    31,    30,     3,     4,    26,    22,
   154,    77,    30,    68,   158,     3,     4,     5,     6,     7,
     8,    33,    30,    36,    21,    22,    23,    52,   128,    26,
    27,    25,    20,    27,    52,    32,    33,    34,    35,    36,
    52,    74,    22,    22,    52,    27,     1,    26,   148,   149,
    25,    37,    27,    65,   154,    37,   156,   157,    70,    14,
    46,    47,    59,    60,    46,    47,    70,    24,   168,   372,
    67,   137,    69,    30,    24,    69,    24,    27,    22,    65,
    66,    69,    30,    65,    66,   185,   230,   231,   232,   233,
   204,   394,    27,   193,    69,   107,    61,    62,    63,    64,
   200,    26,    37,   107,   107,   117,   206,    24,    70,    71,
    27,    46,    47,   117,    23,    26,    25,   217,   218,   219,
   220,   221,   222,   223,   224,   225,   226,   227,    27,   229,
    65,    66,    25,   247,   260,   235,   236,   237,   238,   239,
    70,    62,    63,    64,    26,    23,   260,    25,    70,    22,
   264,     3,     4,    24,    25,    24,   256,   356,    65,    66,
   407,   408,   306,   263,    28,    27,    25,   267,    31,    21,
    22,    23,    29,   273,    26,    27,    24,   107,   182,    22,
    32,    33,    34,    35,    36,   107,   286,   117,    24,    24,
    24,    24,   204,    22,    26,   117,   310,     3,     4,    26,
   204,   204,   302,    27,   304,    26,    26,    59,    60,   309,
    26,   311,   312,    37,    26,    67,    22,    69,    26,    26,
   320,    25,    46,    47,    25,    25,    32,    33,    34,    35,
    36,   331,    26,    26,    23,   247,    27,   159,    52,    25,
    25,    65,    66,   247,   247,    22,   360,    13,   260,   363,
    31,    26,   264,    23,   354,    52,   260,    24,   358,    30,
   264,   264,   362,   377,   364,    25,    24,   367,   368,   369,
   370,   371,    64,    22,   204,    13,   376,    31,    66,    29,
    27,    25,   204,    39,    40,    41,    42,    43,    44,    45,
   404,    52,    22,    52,    27,   409,    24,   411,   310,    24,
    27,   305,     0,     0,    14,   405,   310,   310,    65,   423,
   410,    59,    60,    61,    62,    63,    64,   247,    33,   315,
   135,   373,   422,   299,   305,   247,   358,   427,   302,   429,
   260,   431,   271,   433,   264,   435,    -1,   437,   260,   439,
   354,   441,   264,   443,   311,   445,    -1,   447,   360,   449,
    -1,   363,    -1,    -1,    -1,    -1,   360,   360,    -1,   363,
   363,    -1,    -1,    -1,    -1,   377,    -1,    -1,    -1,    -1,
    -1,   375,    -1,   377,   377,    -1,    -1,    -1,    -1,    -1,
   310,    52,    53,    54,    55,    56,    57,    58,   310,    -1,
    -1,    -1,   404,    -1,     3,     4,    -1,   409,    -1,   411,
   404,   404,    -1,   407,   408,   409,   409,   411,   411,    -1,
    -1,   423,    21,    22,    23,    -1,    25,    26,    -1,   423,
   423,    -1,    -1,    32,    33,    34,    35,    36,    -1,    -1,
   360,    -1,    -1,   363,     3,     4,    -1,    -1,   360,    -1,
    -1,   363,    -1,    -1,    -1,   375,    -1,   377,    -1,    -1,
    59,    60,    21,    22,    23,   377,    -1,    26,    67,    28,
    69,    -1,    -1,    32,    33,    34,    35,    36,    -1,    -1,
    -1,    -1,    -1,    -1,   404,    -1,    -1,   407,   408,   409,
    -1,   411,   404,    -1,    -1,    -1,    -1,   409,    -1,   411,
    59,    60,    -1,   423,     1,    -1,     3,     4,    67,    -1,
    69,   423,     9,    10,    11,    12,    -1,    14,    15,    16,
    17,    18,    19,    20,    -1,    22,    -1,    -1,    25,    25,
    -1,    28,    -1,    -1,    -1,    32,    33,    34,    35,    -1,
    -1,    -1,    39,    40,    41,    42,    43,    44,    45,    -1,
    46,    47,    48,    49,    50,    51,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    59,    60,    61,    62,    63,    64,     3,
     4,    68,    69,    70,    71,     9,    10,    11,    12,    -1,
    14,    15,    16,    17,    18,    19,    20,    -1,    22,     3,
     4,    25,    -1,    -1,    28,    -1,    -1,    -1,    32,    33,
    34,    35,    -1,    -1,    -1,    -1,    -1,    21,    22,    23,
    -1,    25,    26,    -1,    -1,    -1,    -1,    -1,    32,    33,
    34,    35,    36,    -1,    -1,    -1,    -1,    -1,    -1,     3,
     4,    -1,    -1,    -1,    -1,    69,    -1,    -1,    -1,    -1,
    -1,    24,    -1,    -1,    27,    59,    60,    21,    22,    23,
    -1,    -1,    26,    67,    -1,    69,    -1,    -1,    32,    33,
    34,    35,    36,    46,    47,    48,    49,    50,    51,    -1,
    26,    -1,    -1,    -1,    30,    -1,    59,    60,    61,    62,
    63,    64,    -1,    -1,    24,    59,    60,    27,    -1,    -1,
    -1,    24,    -1,    67,    27,    69,    52,    53,    54,    55,
    56,    57,    58,    -1,    -1,    -1,    46,    47,    48,    49,
    50,    51,    -1,    46,    47,    48,    49,    50,    51,    59,
    60,    61,    62,    63,    64,    24,    59,    60,    61,    62,
    63,    64,    24,    -1,    -1,    27,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    46,    47,    48,
    49,    50,    51,    24,    46,    47,    48,    49,    50,    51,
    59,    60,    61,    62,    63,    64,    -1,    59,    60,    61,
    62,    63,    64,    24,    -1,    46,    47,    48,    49,    50,
    51,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    59,    60,
    61,    62,    63,    64,    24,    46,    47,    48,    49,    50,
    51,    24,    -1,    -1,    -1,    -1,    -1,    -1,    59,    60,
    61,    62,    63,    64,    -1,    -1,    46,    47,    48,    49,
    50,    51,    24,    46,    47,    48,    49,    50,    51,    59,
    60,    61,    62,    63,    64,    -1,    59,    60,    61,    62,
    63,    64,    24,    -1,    46,    47,    48,    49,    50,    51,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    59,    60,    61,
    62,    63,    64,    24,    46,    47,    48,    49,    50,    51,
    24,    -1,    -1,    -1,    -1,    -1,    -1,    59,    60,    61,
    62,    63,    64,    -1,    -1,    46,    47,    48,    49,    50,
    51,    24,    46,    47,    48,    49,    50,    51,    59,    60,
    61,    62,    63,    64,    -1,    59,    60,    61,    62,    63,
    64,    24,    -1,    46,    47,    48,    49,    50,    51,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    59,    60,    61,    62,
    63,    64,    24,    46,    47,    48,    49,    50,    51,    24,
    -1,    -1,    -1,    -1,    -1,    -1,    59,    60,    61,    62,
    63,    64,    -1,    -1,    46,    47,    48,    49,    50,    51,
    24,    46,    47,    48,    49,    50,    51,    59,    60,    61,
    62,    63,    64,    -1,    59,    60,    61,    62,    63,    64,
    24,    -1,    46,    47,    48,    49,    50,    51,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    59,    60,    61,    62,    63,
    64,    24,    46,    47,    48,    49,    50,    51,    24,    -1,
    -1,    -1,    -1,    -1,    -1,    59,    60,    61,    62,    63,
    64,    -1,    -1,    46,    47,    48,    49,    50,    51,    24,
    46,    47,    48,    49,    50,    51,    59,    60,    61,    62,
    63,    64,    -1,    59,    60,    61,    62,    63,    64,    24,
    -1,    46,    47,    48,    49,    50,    51,    -1,    27,    -1,
    -1,    -1,    -1,    -1,    59,    60,    61,    62,    63,    64,
    -1,    46,    47,    48,    49,    50,    51,    46,    47,    48,
    49,    50,    51,    27,    59,    60,    61,    62,    63,    64,
    59,    60,    61,    62,    63,    64,    -1,    -1,    -1,    -1,
    -1,    -1,    46,    47,    48,    49,    50,    51,    27,    -1,
    48,    49,    50,    51,    27,    59,    60,    61,    62,    63,
    64,    59,    60,    61,    62,    63,    64,    46,    47,    48,
    49,    50,    51,    46,    47,    48,    49,    50,    51,    31,
    59,    60,    61,    62,    63,    64,    59,    60,    61,    62,
    63,    64,    -1,    -1,    46,    47,    48,    49,    50,    51,
    31,    -1,    -1,    -1,    -1,    -1,    31,    59,    60,    61,
    62,    63,    64,    -1,    -1,    46,    47,    48,    49,    50,
    51,    46,    47,    48,    49,    50,    51,    31,    59,    60,
    61,    62,    63,    64,    59,    60,    61,    62,    63,    64,
    30,    -1,    46,    47,    48,    49,    50,    51,    26,    -1,
    -1,    -1,    30,    -1,    -1,    59,    60,    61,    62,    63,
    64,    -1,    52,    53,    54,    55,    56,    57,    58,    -1,
    -1,    -1,    -1,    38,    52,    53,    54,    55,    56,    57,
    58,    46,    47,    48,    49,    50,    51,    46,    47,    48,
    49,    50,    51,    -1,    59,    60,    61,    62,    63,    64,
    59,    60,    61,    62,    63,    64
};
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */

/* Skeleton output parser for bison,
   Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */

/* As a special exception, when this file is copied by Bison into a
   Bison output file, you may use that output file without restriction.
   This special exception was added by the Free Software Foundation
   in version 1.24 of Bison.  */

#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C.  */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
#include <alloca.h>
#else /* not sparc */
#if defined (MSDOS) && !defined (__TURBOC__)
#include <malloc.h>
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>
 #pragma alloca
#else /* not MSDOS, __TURBOC__, or _AIX */
#ifdef __hpux
#ifdef __cplusplus
extern "C" {
void *alloca (unsigned int);
};
#else /* not __cplusplus */
void *alloca ();
#endif /* not __cplusplus */
#endif /* __hpux */
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc.  */
#endif /* not GNU C.  */
#endif /* alloca not defined.  */

/* This is the parser code that is written into each bison parser
  when the %semantic_parser declaration is not specified in the grammar.
  It was written by Richard Stallman by simplifying the hairy parser
  used when %semantic_parser is specified.  */

/* Note: there must be only one dollar sign in this file.
   It is replaced by the list of actions, each action
   as one case of the switch.  */

#define yyerrok		(yyerrstatus = 0)
#define yyclearin	(yychar = YYEMPTY)
#define YYEMPTY		-2
#define YYEOF		0
#define YYACCEPT	return(0)
#define YYABORT 	return(1)
#define YYERROR		goto yyerrlab1
/* Like YYERROR except do call yyerror.
   This remains here temporarily to ease the
   transition to the new meaning of YYERROR, for GCC.
   Once GCC version 2 has supplanted version 1, this can go.  */
#define YYFAIL		goto yyerrlab
#define YYRECOVERING()  (!!yyerrstatus)
#define YYBACKUP(token, value) \
do								\
  if (yychar == YYEMPTY && yylen == 1)				\
    { yychar = (token), yylval = (value);			\
      yychar1 = YYTRANSLATE (yychar);				\
      YYPOPSTACK;						\
      goto yybackup;						\
    }								\
  else								\
    { yyerror ("syntax error: cannot back up"); YYERROR; }	\
while (0)

#define YYTERROR	1
#define YYERRCODE	256

#ifndef YYPURE
#define YYLEX		yylex()
#endif

#ifdef YYPURE
#ifdef YYLSP_NEEDED
#ifdef YYLEX_PARAM
#define YYLEX		yylex(&yylval, &yylloc, YYLEX_PARAM)
#else
#define YYLEX		yylex(&yylval, &yylloc)
#endif
#else /* not YYLSP_NEEDED */
#ifdef YYLEX_PARAM
#define YYLEX		yylex(&yylval, YYLEX_PARAM)
#else
#define YYLEX		yylex(&yylval)
#endif
#endif /* not YYLSP_NEEDED */
#endif

/* If nonreentrant, generate the variables here */

#ifndef YYPURE

int	yychar;			/*  the lookahead symbol		*/
YYSTYPE	yylval;			/*  the semantic value of the		*/
				/*  lookahead symbol			*/

#ifdef YYLSP_NEEDED
YYLTYPE yylloc;			/*  location data for the lookahead	*/
				/*  symbol				*/
#endif

int yynerrs;			/*  number of parse errors so far       */
#endif  /* not YYPURE */

#if YYDEBUG != 0
int yydebug;			/*  nonzero means print parse trace	*/
/* Since this is uninitialized, it does not stop multiple parsers
   from coexisting.  */
#endif

/*  YYINITDEPTH indicates the initial size of the parser's stacks	*/

#ifndef	YYINITDEPTH
#define YYINITDEPTH 200
#endif

/*  YYMAXDEPTH is the maximum size the stacks can grow to
    (effective only if the built-in stack extension method is used).  */

#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif

/* Prevent warning if -Wstrict-prototypes.  */
#ifdef __GNUC__
int yyparse (void);
#endif

#if __GNUC__ > 1		/* GNU C and GNU C++ define this.  */
#define __yy_memcpy(TO,FROM,COUNT)	__builtin_memcpy(TO,FROM,COUNT)
#else				/* not GNU C or C++ */
#ifndef __cplusplus

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__yy_memcpy (to, from, count)
     char *to;
     char *from;
     int count;
{
  register char *f = from;
  register char *t = to;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#else /* __cplusplus */

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__yy_memcpy (char *to, char *from, int count)
{
  register char *f = from;
  register char *t = to;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#endif
#endif


/* The user can define YYPARSE_PARAM as the name of an argument to be passed
   into yyparse.  The argument should have type void *.
   It should actually point to an object.
   Grammar actions can access the variable by casting it
   to the proper pointer type.  */

#ifdef YYPARSE_PARAM
#ifdef __cplusplus
#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
#define YYPARSE_PARAM_DECL
#else /* not __cplusplus */
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
#endif /* not __cplusplus */
#else /* not YYPARSE_PARAM */
#define YYPARSE_PARAM_ARG
#define YYPARSE_PARAM_DECL
#endif /* not YYPARSE_PARAM */

int
yyparse(YYPARSE_PARAM_ARG)
     YYPARSE_PARAM_DECL
{
  register int yystate;
  register int yyn;
  register short *yyssp;
  register YYSTYPE *yyvsp;
  int yyerrstatus;	/*  number of tokens to shift before error messages enabled */
  int yychar1 = 0;		/*  lookahead token as an internal (translated) token number */

  short	yyssa[YYINITDEPTH];	/*  the state stack			*/
  YYSTYPE yyvsa[YYINITDEPTH];	/*  the semantic value stack		*/

  short *yyss = yyssa;		/*  refer to the stacks thru separate pointers */
  YYSTYPE *yyvs = yyvsa;	/*  to allow yyoverflow to reallocate them elsewhere */

#ifdef YYLSP_NEEDED
  YYLTYPE yylsa[YYINITDEPTH];	/*  the location stack			*/
  YYLTYPE *yyls = yylsa;
  YYLTYPE *yylsp;

#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
#else
#define YYPOPSTACK   (yyvsp--, yyssp--)
#endif

  int yystacksize = YYINITDEPTH;

#ifdef YYPURE
  int yychar;
  YYSTYPE yylval;
  int yynerrs;
#ifdef YYLSP_NEEDED
  YYLTYPE yylloc;
#endif
#endif

  YYSTYPE yyval;		/*  the variable used to return		*/
				/*  semantic values from the action	*/
				/*  routines				*/

  int yylen;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Starting parse\n");
#endif

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY;		/* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */

  yyssp = yyss - 1;
  yyvsp = yyvs;
#ifdef YYLSP_NEEDED
  yylsp = yyls;
#endif

/* Push a new state, which is found in  yystate  .  */
/* In all cases, when you get here, the value and location stacks
   have just been pushed. so pushing a state here evens the stacks.  */
yynewstate:

  *++yyssp = yystate;

  if (yyssp >= yyss + yystacksize - 1)
    {
      /* Give user a chance to reallocate the stack */
      /* Use copies of these so that the &'s don't force the real ones into memory. */
      YYSTYPE *yyvs1 = yyvs;
      short *yyss1 = yyss;
#ifdef YYLSP_NEEDED
      YYLTYPE *yyls1 = yyls;
#endif

      /* Get the current used size of the three stacks, in elements.  */
      int size = yyssp - yyss + 1;

#ifdef yyoverflow
      /* Each stack pointer address is followed by the size of
	 the data in use in that stack, in bytes.  */
#ifdef YYLSP_NEEDED
      /* This used to be a conditional around just the two extra args,
	 but that might be undefined if yyoverflow is a macro.  */
      yyoverflow("parser stack overflow",
		 &yyss1, size * sizeof (*yyssp),
		 &yyvs1, size * sizeof (*yyvsp),
		 &yyls1, size * sizeof (*yylsp),
		 &yystacksize);
#else
      yyoverflow("parser stack overflow",
		 &yyss1, size * sizeof (*yyssp),
		 &yyvs1, size * sizeof (*yyvsp),
		 &yystacksize);
#endif

      yyss = yyss1; yyvs = yyvs1;
#ifdef YYLSP_NEEDED
      yyls = yyls1;
#endif
#else /* no yyoverflow */
      /* Extend the stack our own way.  */
      if (yystacksize >= YYMAXDEPTH)
	{
	  yyerror("parser stack overflow");
	  return 2;
	}
      yystacksize *= 2;
      if (yystacksize > YYMAXDEPTH)
	yystacksize = YYMAXDEPTH;
      yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
      __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
      yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
      __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
#ifdef YYLSP_NEEDED
      yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
      __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
#endif
#endif /* no yyoverflow */

      yyssp = yyss + size - 1;
      yyvsp = yyvs + size - 1;
#ifdef YYLSP_NEEDED
      yylsp = yyls + size - 1;
#endif

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Stack size increased to %d\n", yystacksize);
#endif

      if (yyssp >= yyss + yystacksize - 1)
	YYABORT;
    }

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Entering state %d\n", yystate);
#endif

  goto yybackup;
 yybackup:

/* Do appropriate processing given the current state.  */
/* Read a lookahead token if we need one and don't already have one.  */
/* yyresume: */

  /* First try to decide what to do without reference to lookahead token.  */

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* yychar is either YYEMPTY or YYEOF
     or a valid token in external form.  */

  if (yychar == YYEMPTY)
    {
#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Reading a token: ");
#endif
      yychar = YYLEX;
    }

  /* Convert token to internal form (in yychar1) for indexing tables with */

  if (yychar <= 0)		/* This means end of input. */
    {
      yychar1 = 0;
      yychar = YYEOF;		/* Don't call YYLEX any more */

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Now at end of input.\n");
#endif
    }
  else
    {
      yychar1 = YYTRANSLATE(yychar);

#if YYDEBUG != 0
      if (yydebug)
	{
	  fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
	  /* Give the individual parser a way to print the precise meaning
	     of a token, for further debugging info.  */
#ifdef YYPRINT
	  YYPRINT (stderr, yychar, yylval);
#endif
	  fprintf (stderr, ")\n");
	}
#endif
    }

  yyn += yychar1;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
    goto yydefault;

  yyn = yytable[yyn];

  /* yyn is what to do for this token type in this state.
     Negative => reduce, -yyn is rule number.
     Positive => shift, yyn is new state.
       New state is final state => don't bother to shift,
       just return success.
     0, or most negative number => error.  */

  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrlab;

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
#endif

  /* Discard the token being shifted unless it is eof.  */
  if (yychar != YYEOF)
    yychar = YYEMPTY;

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  /* count tokens shifted since error; after three, turn off error status.  */
  if (yyerrstatus) yyerrstatus--;

  yystate = yyn;
  goto yynewstate;

/* Do the default action for the current state.  */
yydefault:

  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;

/* Do a reduction.  yyn is the number of a rule to reduce with.  */
yyreduce:
  yylen = yyr2[yyn];
  if (yylen > 0)
    yyval = yyvsp[1-yylen]; /* implement default value of the action */

#if YYDEBUG != 0
  if (yydebug)
    {
      int i;

      fprintf (stderr, "Reducing via rule %d (line %d), ",
	       yyn, yyrline[yyn]);

      /* Print the symbols being reduced, and their result.  */
      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
	fprintf (stderr, "%s ", yytname[yyrhs[i]]);
      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
    }
#endif


  switch (yyn) {

case 1:
#line 249 "sl.y"
{
			;
    break;}
case 2:
#line 252 "sl.y"
{
			;
    break;}
case 3:
#line 258 "sl.y"
{
				yyval.integer	=	SLC_UNIFORM;
			;
    break;}
case 4:
#line 263 "sl.y"
{
				yyval.integer	=	SLC_VARYING;
			;
    break;}
case 5:
#line 267 "sl.y"
{
				yyval.integer	=	0;
			;
    break;}
case 6:
#line 275 "sl.y"
{
				yyval.integer	=	SLC_EXTERN;
			;
    break;}
case 7:
#line 279 "sl.y"
{
				yyval.integer	=	0;
			;
    break;}
case 8:
#line 286 "sl.y"
{
				yyval.integer	=	SLC_OUTPUT;
			;
    break;}
case 9:
#line 290 "sl.y"
{
				yyval.integer	=	0;
			;
    break;}
case 10:
#line 297 "sl.y"
{
				yyval.integer	=	SLC_FLOAT;
			;
    break;}
case 11:
#line 304 "sl.y"
{
				yyval.integer	=	SLC_VECTOR | SLC_VCOLOR;
			;
    break;}
case 12:
#line 309 "sl.y"
{
				yyval.integer	=	SLC_VECTOR | SLC_VVECTOR;
			;
    break;}
case 13:
#line 314 "sl.y"
{
				yyval.integer	=	SLC_VECTOR | SLC_VNORMAL;
			;
    break;}
case 14:
#line 319 "sl.y"
{
				yyval.integer	=	SLC_VECTOR | SLC_VPOINT;
			;
    break;}
case 15:
#line 326 "sl.y"
{
				yyval.integer	=	SLC_MATRIX;
			;
    break;}
case 16:
#line 333 "sl.y"
{
				yyval.integer	=	SLC_STRING | SLC_UNIFORM;
			;
    break;}
case 17:
#line 342 "sl.y"
{
				yyval.integer	=	yyvsp[0].integer;
			;
    break;}
case 18:
#line 347 "sl.y"
{
				yyval.integer	=	yyvsp[0].integer;
			;
    break;}
case 19:
#line 352 "sl.y"
{
				yyval.integer	=	yyvsp[0].integer;
			;
    break;}
case 20:
#line 357 "sl.y"
{
				yyval.integer	=	yyvsp[0].integer;
			;
    break;}
case 21:
#line 367 "sl.y"
{
				yyval.integer	=	yyvsp[-3].integer | yyvsp[-2].integer | yyvsp[-1].integer | yyvsp[0].integer;
				sdr->desire(yyval.integer);
				sdr->statementLineNo	=	sdr->lineNo;
			;
    break;}
case 22:
#line 386 "sl.y"
{
		;
    break;}
case 23:
#line 390 "sl.y"
{
		;
    break;}
case 24:
#line 407 "sl.y"
{
			CFunction	*thisFunction	=	sdr->newFunction(yyvsp[-1].string);
			
			if (yyvsp[-2].integer & (SLC_OUTPUT | SLC_EXTERN | SLC_RDONLY)) {
				sdr->error("Invalid return type for function %s\n",yyvsp[-1].string);
				yyvsp[-2].integer	&=	~(SLC_OUTPUT | SLC_EXTERN | SLC_RDONLY);
			}

			thisFunction->returnValue	=	new CParameter(yyvsp[-1].string,yyvsp[-2].integer,1);

			sdr->undesire();
		;
    break;}
case 25:
#line 423 "sl.y"
{
			CFunction	*thisFunction	=	sdr->newFunction(yyvsp[-1].string);
			
			thisFunction->returnValue	=	NULL;
		;
    break;}
case 26:
#line 435 "sl.y"
{
			CFunction	*cFun		=	sdr->popFunction();

			cFun->initExpression	=	yyvsp[-2].code;
			cFun->code				=	yyvsp[0].code;

			if (cFun->returnValue != NULL)
				if (cFun->returnValueGiven == FALSE) 
					sdr->error("Return value not given for %s\n",cFun->symbolName);

		;
    break;}
case 27:
#line 456 "sl.y"
{
			yyval.code	=	new CTwoExpressions(yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 28:
#line 461 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 29:
#line 470 "sl.y"
{
			int	type	=	sdr->desired();

			if (type & (SLC_EXTERN)) {
				sdr->error("Invalid parameter type\n");
				type	&=	~(SLC_EXTERN);
			}

			if (type & SLC_OUTPUT) {
				sdr->undesire();
				sdr->desire(type);					// Make sure we mark the desired type as READ-ONLY
			} else {
				sdr->undesire();
				sdr->desire(type | SLC_RDONLY);		// Make sure we mark the desired type as READ-ONLY
			}
		;
    break;}
case 30:
#line 487 "sl.y"
{
			yyval.code					=	yyvsp[0].code;
			sdr->undesire();						// We're done with the type
		;
    break;}
case 31:
#line 492 "sl.y"
{
			yyval.code	=	new CNullExpression;
		;
    break;}
case 32:
#line 501 "sl.y"
{
			CParameter	*cParameter;
			
			cParameter	=	sdr->newParameter(yyvsp[0].string,sdr->desired(),1);	// Add the Parameter to the current CFunction
		;
    break;}
case 33:
#line 508 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 34:
#line 513 "sl.y"
{
			CParameter	*cParameter;
			
			cParameter	=	sdr->newParameter(yyvsp[0].string,sdr->desired(),1);
	
			yyval.code			=	new CNullExpression;
		;
    break;}
case 35:
#line 524 "sl.y"
{
			CParameter	*cParameter;
			
			cParameter	=	sdr->newParameter(yyvsp[-2].string,sdr->desired() | SLC_ARRAY,-1);
		;
    break;}
case 36:
#line 531 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 37:
#line 539 "sl.y"
{
			CParameter	*cParameter;
			
			cParameter	=	sdr->newParameter(yyvsp[-3].string,sdr->desired() | SLC_ARRAY, atoi(yyvsp[-1].string));
			
			if (cParameter->numItems <= 0) {
				sdr->error("Array size for %s is invalid (%s)\n",yyvsp[-3].string,yyvsp[-1].string);
				cParameter->numItems	=	1;
			}
		;
    break;}
case 38:
#line 551 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 39:
#line 558 "sl.y"
{
			CParameter	*cParameter;
			
			cParameter	=	sdr->newParameter(yyvsp[-2].string,sdr->desired() | SLC_ARRAY, -1);
			
			yyval.code	=	new CNullExpression;
		;
    break;}
case 40:
#line 570 "sl.y"
{
			CParameter	*cParameter;
			
			cParameter	=	sdr->newParameter(yyvsp[-3].string,sdr->desired() | SLC_ARRAY, atoi(yyvsp[-1].string));
			
			if (cParameter->numItems <= 0) {
				sdr->error("Array size for %s is invalid (%s)\n",yyvsp[-3].string,yyvsp[-1].string);
				cParameter->numItems	=	1;
			}

			yyval.code	=	new CNullExpression;
		;
    break;}
case 41:
#line 591 "sl.y"
{
			CFunction		*mainFunction	=	sdr->newFunction(constantShaderMain);

			mainFunction->returnValue		=	NULL;

			sdr->shaderName					=	strdup(yyvsp[-1].string);
			sdr->shaderType					=	yyvsp[-2].integer;
			sdr->shaderFunction				=	mainFunction;
		;
    break;}
case 42:
#line 602 "sl.y"
{
			sdr->restoreParameters();
		;
    break;}
case 43:
#line 606 "sl.y"
{
			CFunction	*cFun			=	sdr->popFunction();
			CParameter	*cParameter;

			for (cParameter=cFun->parameters->first();cParameter!=NULL;cParameter=cFun->parameters->next()) {
				sdr->variables->push(cParameter);
			}

			assert(cFun == sdr->shaderFunction);

			cFun->initExpression	=	yyvsp[-3].code;
			cFun->code				=	yyvsp[0].code;
		;
    break;}
case 44:
#line 624 "sl.y"
{
			yyval.integer	=	SLC_SURFACE;
		;
    break;}
case 45:
#line 629 "sl.y"
{
			yyval.integer	=	SLC_DISPLACEMENT;
		;
    break;}
case 46:
#line 634 "sl.y"
{
			yyval.integer	=	SLC_LIGHT;
		;
    break;}
case 47:
#line 639 "sl.y"
{
			yyval.integer	=	SLC_VOLUME;
		;
    break;}
case 48:
#line 644 "sl.y"
{
			yyval.integer	=	SLC_TRANSFORMATION;
		;
    break;}
case 49:
#line 649 "sl.y"
{
			yyval.integer	=	SLC_IMAGER;
		;
    break;}
case 50:
#line 661 "sl.y"
{
			yyval.code	=	new CTwoExpressions(yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 51:
#line 666 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 52:
#line 675 "sl.y"
{
			int	type	=	yyvsp[0].integer;
			
			if (type & SLC_VARYING) {
				// clear this marker, only used to invert the
				// default from varying to uniform
				type &= ~SLC_VARYING;
			} else {	 
				type |= SLC_UNIFORM;	 
			}

			sdr->undesire();
			sdr->desire(type);
		;
    break;}
case 53:
#line 690 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		
			if (yyvsp[-2].integer & (SLC_EXTERN)) {
				sdr->error("Invalid parameter type for the shader\n");
			}

			sdr->undesire();
		;
    break;}
case 54:
#line 700 "sl.y"
{
			yyval.code	=	new CNullExpression;
		;
    break;}
case 55:
#line 710 "sl.y"
{
			yyval.code	=	getAssignment(sdr->variableList,yyvsp[0].code);
		;
    break;}
case 56:
#line 716 "sl.y"
{
			yyval.code	=	getAssignment(sdr->variableList,yyvsp[0].array);
		;
    break;}
case 57:
#line 725 "sl.y"
{
			CParameter	*cParameter	=	sdr->newParameter(yyvsp[-1].string,sdr->desired() | SLC_PARAMETER,1);

			sdr->variableList->push(cParameter);	// Save the parameter so that we can generate init code later
		;
    break;}
case 58:
#line 731 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 59:
#line 736 "sl.y"
{
			CParameter	*cParameter	=	sdr->newParameter(yyvsp[0].string,sdr->desired() | SLC_PARAMETER,1);

			sdr->variableList->push(cParameter);
		;
    break;}
case 60:
#line 742 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 61:
#line 751 "sl.y"
{
			CParameter	*cParameter	=	sdr->newParameter(yyvsp[-4].string,sdr->desired() | SLC_PARAMETER | SLC_ARRAY,atoi(yyvsp[-2].string));

			if (cParameter->numItems <= 0) {
				sdr->error("Array size for %s is invalid (%s)\n",yyvsp[-4].string,yyvsp[-2].string);
				cParameter->numItems	=	1;
			}

			sdr->variableList->push(cParameter);
		;
    break;}
case 62:
#line 762 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 63:
#line 770 "sl.y"
{
			CParameter	*cParameter	=	sdr->newParameter(yyvsp[-3].string,sdr->desired() | SLC_PARAMETER | SLC_ARRAY,atoi(yyvsp[-1].string));

			// Get the parameter
			if (cParameter->numItems <= 0)	{
				sdr->error("Array size for %s is invalid (%s)\n",yyvsp[-3].string,yyvsp[-1].string);
				cParameter->numItems	=	1;
			}

			sdr->variableList->push(cParameter);
		;
    break;}
case 64:
#line 782 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 65:
#line 787 "sl.y"
{
			yyval.code	=	new CNullExpression;
		;
    break;}
case 66:
#line 795 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 67:
#line 802 "sl.y"
{
			yyval.code	=	new CTwoExpressions(yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 68:
#line 812 "sl.y"
{
			CFunction	*cFun	=	sdr->newFunction(constantBlockName);
		;
    break;}
case 69:
#line 817 "sl.y"
{
			CFunction	*cFun	=	sdr->popFunction();

			cFun->code			=	yyvsp[-1].code;

			yyval.code	=	new	CFuncallExpression(cFun,NULL);
		;
    break;}
case 70:
#line 833 "sl.y"
{
			CVariable	*cVar;

			if (yyvsp[-1].integer & (SLC_OUTPUT | SLC_RDONLY)) {
				sdr->error("Invalid container class for local variables\n");
			}

			// Remove the uninitialized variables from the list
			while((cVar = (CVariable *) sdr->variableList->pop()) != NULL);

			sdr->undesire();

			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 71:
#line 854 "sl.y"
{
			yyval.code	=	getAssignment(sdr->variableList,yyvsp[0].code);
		;
    break;}
case 72:
#line 860 "sl.y"
{
			yyval.code	=	getAssignment(sdr->variableList,yyvsp[0].array);
		;
    break;}
case 73:
#line 867 "sl.y"
{
			CVariable	*cVar;

			cVar	=	sdr->newVariable(yyvsp[0].string,sdr->desired(),1);

			sdr->variableList->push(cVar);
		;
    break;}
case 74:
#line 875 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 75:
#line 880 "sl.y"
{
			CVariable	*cVar;

			cVar	=	sdr->newVariable(yyvsp[0].string,sdr->desired(),1);

			sdr->variableList->push(cVar);
		;
    break;}
case 76:
#line 889 "sl.y"
{
			yyval.code	=	new CTwoExpressions(yyvsp[-1].code,yyvsp[0].code);
		;
    break;}
case 77:
#line 898 "sl.y"
{
			CVariable	*cVar;

			cVar	=	sdr->newVariable(yyvsp[-3].string,sdr->desired() | SLC_ARRAY,atoi(yyvsp[-1].string));

			if (cVar->numItems <= 0) {
				sdr->error("Array size is invalid for %s (%s)\n",yyvsp[-3].string,yyvsp[-1].string);
				cVar->numItems	=	1;
			}

			sdr->variableList->push(cVar);
		;
    break;}
case 78:
#line 911 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 79:
#line 919 "sl.y"
{
			CVariable	*cVar;

			cVar	=	sdr->newVariable(yyvsp[-3].string,sdr->desired() | SLC_ARRAY,atoi(yyvsp[-1].string));

		
			if (cVar->numItems <= 0) {
				sdr->error("Array size is invalid for %s (%s)\n",yyvsp[-3].string,yyvsp[-1].string);
				cVar->numItems	=	1;
			}

			sdr->variableList->push(cVar);
		;
    break;}
case 80:
#line 935 "sl.y"
{
			yyval.code	=	new CTwoExpressions(yyvsp[-1].code,yyvsp[0].code);
		;
    break;}
case 81:
#line 943 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 82:
#line 948 "sl.y"
{
			yyval.code	=	new CNullExpression;
		;
    break;}
case 83:
#line 958 "sl.y"
{

			yyval.code	=	yyvsp[0].code;
			assert(sdr->desired() & SLC_NONE);
		;
    break;}
case 84:
#line 965 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
			assert(sdr->desired() & SLC_NONE);
		;
    break;}
case 85:
#line 971 "sl.y"
{
			// Recoverable error happened
			yyval.code	=	new CNullExpression;
			assert(sdr->desired() & SLC_NONE);
		;
    break;}
case 86:
#line 981 "sl.y"
{
			sdr->statementLineNo	=	sdr->lineNo;
		;
    break;}
case 87:
#line 985 "sl.y"
{
			yyval.code	=	new CTwoExpressions(yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 88:
#line 989 "sl.y"
{
			sdr->statementLineNo	=	sdr->lineNo;
			yyval.code	=	new CNullExpression;
		;
    break;}
case 89:
#line 1000 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 90:
#line 1005 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 91:
#line 1010 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 92:
#line 1015 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 93:
#line 1020 "sl.y"
{
			yyval.code	=	yyvsp[-1].code;
		;
    break;}
case 94:
#line 1025 "sl.y"
{
			yyval.code	=	yyvsp[-1].code;
		;
    break;}
case 95:
#line 1030 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 96:
#line 1035 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 97:
#line 1040 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 98:
#line 1045 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 99:
#line 1050 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 100:
#line 1055 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 101:
#line 1060 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 102:
#line 1065 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 103:
#line 1070 "sl.y"
{
			yyval.code	=	new CNullExpression;
		;
    break;}
case 104:
#line 1075 "sl.y"
{
			yyval.code	=	yyvsp[-1].code;
		;
    break;}
case 105:
#line 1080 "sl.y"
{
			yyval.code					=	new CNullExpression;
		;
    break;}
case 106:
#line 1089 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 107:
#line 1094 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 108:
#line 1099 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 109:
#line 1104 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 110:
#line 1109 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 111:
#line 1114 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 112:
#line 1119 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 113:
#line 1128 "sl.y"
{
			CFunction	*cFunction;
			int			bc;
			char		tmp[256];

			if (sscanf(yyvsp[-1].string,"%d",&bc) != 1) sdr->error("Invalid break count: %s\n",yyvsp[-1].string);

			if (bc <= 0) sdr->error("Bad break count: %s\n",yyvsp[-1].string);

			for(cFunction = sdr->functionStack->last(); cFunction != NULL; cFunction = sdr->functionStack->prev()) {
				if (strcmp(cFunction->symbolName,constantLoopName) == 0) bc--;
				else if (strcmp(cFunction->symbolName,constantBlockName) == 0) continue;

				if (bc == 0) break;

				sdr->error("Break target not found\n");
				break;
			}

			if (cFunction == NULL) sdr->error("Break target not found\n");

			sprintf(tmp,"%s\t%s\n",opcodeBreak,yyvsp[-1].string);

			yyval.code	=	new CFixedExpression(tmp);
		;
    break;}
case 114:
#line 1155 "sl.y"
{
			CFunction	*cFunction;
			char		tmp[256];
			int			bc	=	(int) 1;

			sdr->functionStack->push(sdr->lastFunction);
			for(cFunction = sdr->functionStack->last(); cFunction != NULL; cFunction = sdr->functionStack->prev()) {
				if (strcmp(cFunction->symbolName,constantLoopName) == 0) bc--;
				else if (strcmp(cFunction->symbolName,constantBlockName) == 0) continue;

				if (bc == 0) break;

				sdr->error("Break target not found\n");
				break;
			}
			sdr->lastFunction	=	sdr->functionStack->pop();

			if (cFunction == NULL) sdr->error("Break target not found\n");

			sprintf(tmp,"%s\t1\n",opcodeBreak);

			yyval.code	=	new CFixedExpression(tmp);
		;
    break;}
case 115:
#line 1184 "sl.y"
{
			CFunction	*cFunction;
			char		tmp[256];
			int			bc;

			if (sscanf(yyvsp[-1].string,"%d",&bc) != 1) sdr->error("Bad continue count: %s\n",yyvsp[-1].string);

			if (bc <= 0) sdr->error("Bad continue count: %s\n",yyvsp[-1].string);

			for(cFunction = sdr->functionStack->last(); cFunction != NULL; cFunction = sdr->functionStack->prev()) {
				if (strcmp(cFunction->symbolName,constantLoopName) == 0) bc--;
				else if (strcmp(cFunction->symbolName,constantBlockName) == 0) continue;

				if (bc == 0) break;

				sdr->error("Continue target not found\n");
				break;
			}

			if (cFunction == NULL) sdr->error("Continue target not found\n");

			sprintf(tmp,"%s\t%s\n",opcodeContinue,yyvsp[-1].string);

			yyval.code	=	new CFixedExpression(tmp);
		;
    break;}
case 116:
#line 1211 "sl.y"
{
			CFunction	*cFunction;
			char		tmp[256];
			int			bc	=	(int) 1;

			for(cFunction = sdr->functionStack->last(); cFunction != NULL; cFunction = sdr->functionStack->prev()) {
				if (strcmp(cFunction->symbolName,constantLoopName) == 0) bc--;
				else if (strcmp(cFunction->symbolName,constantBlockName) == 0) continue;

				if (bc == 0) break;
				
				sdr->error("Continue target not found\n");
				break;
			}

			if (cFunction == NULL) sdr->error("Continue target not found\n");

			sprintf(tmp,"%s\t1\n",opcodeContinue);

			yyval.code	=	new CFixedExpression(tmp);
		;
    break;}
case 117:
#line 1238 "sl.y"
{
			CFunction	*cFun	=	sdr->lastFunction;
			CExpression	*c;

			// Skip over loops
			for (cFun = sdr->functionStack->last(); cFun != NULL; cFun = sdr->functionStack->prev()) {
				if (strcmp(cFun->symbolName,constantBlockName) == 0) continue;
				if (strcmp(cFun->symbolName,constantLoopName) == 0) continue;
				break;
			}

			if (cFun ==	NULL) {
				sdr->error("Return target not found\n");
				yyval.code	=	new CNullExpression;
			} else {
				if (cFun->returnValue == NULL) {
					sdr->error("Function %s was not expecting a return value\n",cFun->symbolName);
					c	=	new CNullExpression;
				} else {
					// if the return type is uniform, set the return value to uniform
					if (yyvsp[-1].code->type & SLC_UNIFORM) cFun->returnValue->type |= SLC_UNIFORM;
					c	=	new CAssignmentExpression(cFun->returnValue,yyvsp[-1].code);				
				}

				yyval.code	=	c;

				cFun->returnValueGiven	=	TRUE;
			}
		;
    break;}
case 118:
#line 1269 "sl.y"
{
			CFunction	*cFun	=	sdr->lastFunction;

			// Skip over loops
			for (cFun = sdr->functionStack->last(); cFun != NULL; cFun = sdr->functionStack->prev()) {
				if (strcmp(cFun->symbolName,constantBlockName) == 0) continue;
				if (strcmp(cFun->symbolName,constantLoopName) == 0) continue;
				break;
			}

			if (cFun ==	NULL)	sdr->error("Return target not found\n");
			else {
				if (cFun->returnValue != NULL) {
					sdr->error("Function %s was expecting a return value\n",cFun->symbolName);
				}
			}
		;
    break;}
case 119:
#line 1296 "sl.y"
{
			CFunction	*cFun	=	sdr->newFunction(constantLoopName);
			
			yyval.code	=	yyvsp[-1].code;	
		;
    break;}
case 120:
#line 1307 "sl.y"
{
			CFunction	*cFun	=	sdr->popFunction();

			yyval.code	=	new CForLoop(NULL,yyvsp[-1].code,NULL,yyvsp[0].code);
		;
    break;}
case 121:
#line 1317 "sl.y"
{

			CFunction	*cFun	=	sdr->popFunction();

			yyval.code	=	new CForLoop(NULL,yyvsp[-1].code,NULL,yyvsp[0].code);
		;
    break;}
case 122:
#line 1330 "sl.y"
{
			CVariable	*cVar				=	sdr->getVariable(yyvsp[-1].string);

			if (cVar == NULL)	sdr->error("Identifier %s not found\n",yyvsp[-1].string);
			else				sdr->desire(cVar->type);
		;
    break;}
case 123:
#line 1337 "sl.y"
{
			CVariable			*cVar		=	sdr->getVariable(yyvsp[-3].string);

			if (cVar == NULL) {	
				yyval.code	=	new CNullExpression;
			} else {
				yyval.code	=	new CAssignmentExpression(cVar,yyvsp[0].code);
				sdr->undesire();
			}
		;
    break;}
case 124:
#line 1353 "sl.y"
{
			CVariable	*cVar				=	sdr->getVariable(yyvsp[-4].string);

			if (cVar == NULL)	sdr->error("Identifier %s not found\n",yyvsp[-4].string);
			else				sdr->desire(cVar->type);
		;
    break;}
case 125:
#line 1360 "sl.y"
{
			CVariable			*cVar		=	sdr->getVariable(yyvsp[-6].string);

			if (cVar == NULL) {
				yyval.code	=	new CNullExpression;
			} else if (cVar->type & SLC_ARRAY) {
				yyval.code	=	new CArrayAssignmentExpression(cVar,yyvsp[-4].code,yyvsp[0].code);
				sdr->undesire();
			} else {
				CList<CExpression *>	*dummyParams = new CList<CExpression *>;
				CFunctionPrototype		*cFun;

				dummyParams->push(new CTerminalExpression(cVar));
				dummyParams->push(yyvsp[-4].code);
				dummyParams->push(yyvsp[0].code);

				// Check the builtin functions
				for (cFun = sdr->builtinFunctions->first(); cFun != NULL; cFun = sdr->builtinFunctions->next()) {
					if (cFun->match("setcomp",dummyParams,sdr->desired())) break;
				}
				
				if (cFun == NULL) {
					// Cleanup
					CExpression	*cCode;
					while((cCode = dummyParams->pop()) != NULL) {
						delete cCode;
					}
					delete dummyParams;
					// Report error
					sdr->error("Can't assign to non array\n");
					yyval.code	=	new CNullExpression;
				} else {
					yyval.code	=	new CBuiltinExpression(cFun,dummyParams);
				}
				sdr->undesire();
			}
		;
    break;}
case 126:
#line 1404 "sl.y"
{
			CVariable	*cVar				=	sdr->getVariable(yyvsp[-1].string);

			if (cVar == NULL)	sdr->error("Identifier %s not found\n",yyvsp[-1].string);
			else				sdr->desire(cVar->type);
		;
    break;}
case 127:
#line 1411 "sl.y"
{
			CVariable			*cVar		=	sdr->getVariable(yyvsp[-3].string);

			if (cVar == NULL) {
				yyval.code	=	new CNullExpression;
			} else {
				yyval.code	=	new CUpdateExpression(cVar,opcodeAddFloatFloat,opcodeAddVectorVector,FALSE,yyvsp[0].code);
				sdr->undesire();
			}
		;
    break;}
case 128:
#line 1424 "sl.y"
{
			CVariable	*cVar				=	sdr->getVariable(yyvsp[-1].string);

			if (cVar == NULL)	sdr->error("Identifier %s not found\n",yyvsp[-1].string);
			else				sdr->desire(cVar->type);
		;
    break;}
case 129:
#line 1431 "sl.y"
{
			CVariable			*cVar		=	sdr->getVariable(yyvsp[-3].string);

			if (cVar == NULL) {
				yyval.code	=	new CNullExpression;
			} else {
				yyval.code	=	new CUpdateExpression(cVar,opcodeSubFloatFloat,opcodeSubVectorVector,FALSE,yyvsp[0].code);
				sdr->undesire();
			}
		;
    break;}
case 130:
#line 1444 "sl.y"
{
			CVariable	*cVar				=	sdr->getVariable(yyvsp[-1].string);

			if (cVar == NULL)	sdr->error("Identifier %s not found\n",yyvsp[-1].string);
			else {
				yyval.code	=	new CUpdateExpression(cVar,opcodeAddFloatFloat,opcodeAddVectorVector,FALSE,new CConstantTerminalExpression(SLC_FLOAT,strdup("1")));
			}
		;
    break;}
case 131:
#line 1455 "sl.y"
{
			CVariable	*cVar				=	sdr->getVariable(yyvsp[-1].string);

			if (cVar == NULL)	sdr->error("Identifier %s not found\n",yyvsp[-1].string);
			else {
				yyval.code	=	new CUpdateExpression(cVar,opcodeAddFloatFloat,opcodeAddVectorVector,FALSE,new CConstantTerminalExpression(SLC_FLOAT,strdup("-1")));
			}
		;
    break;}
case 132:
#line 1466 "sl.y"
{
			CVariable	*cVar				=	sdr->getVariable(yyvsp[-1].string);

			if (cVar == NULL)	sdr->error("Identifier %s not found\n",yyvsp[-1].string);
			else				sdr->desire(cVar->type);
		;
    break;}
case 133:
#line 1473 "sl.y"
{
			CVariable			*cVar		=	sdr->getVariable(yyvsp[-3].string);

			if (cVar == NULL) {
				yyval.code	=	new CNullExpression;
			} else {
				yyval.code	=	new CUpdateExpression(cVar,opcodeMulFloatFloat,opcodeMulVectorVector,FALSE,yyvsp[0].code);
				sdr->undesire();
			}
		;
    break;}
case 134:
#line 1486 "sl.y"
{
			CVariable	*cVar				=	sdr->getVariable(yyvsp[-1].string);

			if (cVar == NULL)	sdr->error("Identifier %s not found\n",yyvsp[-1].string);
			else				sdr->desire(cVar->type);
		;
    break;}
case 135:
#line 1493 "sl.y"
{
			CVariable			*cVar		=	sdr->getVariable(yyvsp[-3].string);

			if (cVar == NULL) {
				yyval.code	=	new CNullExpression;
			} else {
				yyval.code	=	new CUpdateExpression(cVar,opcodeDivFloatFloat,opcodeDivVectorVector,FALSE,yyvsp[0].code);
				sdr->undesire();
			}
		;
    break;}
case 136:
#line 1509 "sl.y"
{
			CVariable	*cVar				=	sdr->getVariable(yyvsp[-4].string);

			if (cVar == NULL)	sdr->error("Identifier %s not found\n",yyvsp[-4].string);
			else				sdr->desire(cVar->type);
		;
    break;}
case 137:
#line 1516 "sl.y"
{
			CVariable			*cVar		=	sdr->getVariable(yyvsp[-6].string);
			
			if (cVar == NULL) {
				yyval.code	=	new CNullExpression;
			} else {
				yyval.code	=	new CArrayUpdateExpression(cVar,yyvsp[-4].code,yyvsp[0].code,opcodeAddFloatFloat,opcodeAddVectorVector,opcodeAddMatrixMatrix);
				sdr->undesire();
			}
		;
    break;}
case 138:
#line 1532 "sl.y"
{
			CVariable	*cVar				=	sdr->getVariable(yyvsp[-4].string);

			if (cVar == NULL)	sdr->error("Identifier %s not found\n",yyvsp[-4].string);
			else				sdr->desire(cVar->type);
		;
    break;}
case 139:
#line 1539 "sl.y"
{
			CVariable			*cVar		=	sdr->getVariable(yyvsp[-6].string);

			if (cVar == NULL) {
				yyval.code	=	new CNullExpression;
			} else {
				yyval.code	=	new CArrayUpdateExpression(cVar,yyvsp[-4].code,yyvsp[0].code,opcodeSubFloatFloat,opcodeSubVectorVector,opcodeSubMatrixMatrix);
				sdr->undesire();
			}
		;
    break;}
case 140:
#line 1555 "sl.y"
{
			CVariable	*cVar				=	sdr->getVariable(yyvsp[-4].string);

			if (cVar == NULL)	sdr->error("Identifier %s not found\n",yyvsp[-4].string);
			else {
				yyval.code	=	new CArrayUpdateExpression(cVar,yyvsp[-2].code,new CConstantTerminalExpression(SLC_FLOAT,strdup("1")),opcodeAddFloatFloat,opcodeAddVectorVector,opcodeAddMatrixMatrix);
			}
		;
    break;}
case 141:
#line 1569 "sl.y"
{
			CVariable	*cVar				=	sdr->getVariable(yyvsp[-4].string);

			if (cVar == NULL)	sdr->error("Identifier %s not found\n",yyvsp[-4].string);
			else {
				yyval.code	=	new CArrayUpdateExpression(cVar,yyvsp[-2].code,new CConstantTerminalExpression(SLC_FLOAT,strdup("-1")),opcodeAddFloatFloat,opcodeAddVectorVector,opcodeAddMatrixMatrix);
			}
		;
    break;}
case 142:
#line 1583 "sl.y"
{
			CVariable	*cVar				=	sdr->getVariable(yyvsp[-4].string);

			if (cVar == NULL)	sdr->error("Identifier %s not found\n",yyvsp[-4].string);
			else				sdr->desire(cVar->type);
		;
    break;}
case 143:
#line 1590 "sl.y"
{
			CVariable			*cVar		=	sdr->getVariable(yyvsp[-6].string);

			if (cVar == NULL) {
				yyval.code	=	new CNullExpression;
			} else {
				yyval.code	=	new CArrayUpdateExpression(cVar,yyvsp[-4].code,yyvsp[0].code,opcodeMulFloatFloat,opcodeMulVectorVector,opcodeMulMatrixMatrix);
				sdr->undesire();
			}
		;
    break;}
case 144:
#line 1606 "sl.y"
{
			CVariable	*cVar				=	sdr->getVariable(yyvsp[-4].string);

			if (cVar == NULL)	sdr->error("Identifier %s not found\n",yyvsp[-4].string);
			else				sdr->desire(cVar->type);
		;
    break;}
case 145:
#line 1613 "sl.y"
{
			CVariable			*cVar		=	sdr->getVariable(yyvsp[-6].string);

			if (cVar == NULL) {
				yyval.code	=	new CNullExpression;
			} else {
				yyval.code	=	new CArrayUpdateExpression(cVar,yyvsp[-4].code,yyvsp[0].code,opcodeDivFloatFloat,opcodeDivVectorVector,opcodeDivMatrixMatrix);
				sdr->undesire();
			}
		;
    break;}
case 146:
#line 1629 "sl.y"
{
			CFunction	*cFun	=	sdr->newFunction(constantLoopName);
		;
    break;}
case 147:
#line 1643 "sl.y"
{
			CFunction	*cFun	=	sdr->popFunction();

			yyval.code	=	new CForLoop(yyvsp[-6].code,yyvsp[-4].code,yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 148:
#line 1660 "sl.y"
{
			CFunction	*cFun	=	sdr->popFunction();

			yyval.code	=	new CForLoop(yyvsp[-6].code,yyvsp[-4].code,yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 149:
#line 1671 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 150:
#line 1675 "sl.y"
{
			yyval.code	=	new CNullExpression;
		;
    break;}
case 151:
#line 1686 "sl.y"
{
			yyval.code	=	new CTwoExpressions(yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 152:
#line 1691 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 153:
#line 1700 "sl.y"
{
			yyval.code	=	getConversion(SLC_BOOLEAN,yyvsp[0].code);
		;
    break;}
case 154:
#line 1704 "sl.y"
{
			yyval.code	=	new CConstantTerminalExpression(SLC_BOOLEAN | SLC_UNIFORM,strdup("true"));
		;
    break;}
case 155:
#line 1713 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 156:
#line 1717 "sl.y"
{
			yyval.code	=	new CNullExpression;
		;
    break;}
case 157:
#line 1728 "sl.y"
{
			yyval.code	=	new CTwoExpressions(yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 158:
#line 1733 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 159:
#line 1740 "sl.y"
{
			yyval.code	=	new CTwoExpressions(yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 160:
#line 1745 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 161:
#line 1760 "sl.y"
{
			yyval.code	=	new CIfThenElse(yyvsp[-4].code,yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 162:
#line 1773 "sl.y"
{
			yyval.code	=	new CIfThenElse(yyvsp[-2].code,yyvsp[0].code,NULL);
		;
    break;}
case 163:
#line 1784 "sl.y"
{
			yyval.code	=	new CIfThenElse(yyvsp[-4].code,yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 164:
#line 1797 "sl.y"
{
			yyval.array->push(yyvsp[0].code);
		;
    break;}
case 165:
#line 1802 "sl.y"
{
			sdr->actualParameters->push(yyvsp[0].code);
			yyval.array	=	sdr->actualParameters;
		;
    break;}
case 166:
#line 1811 "sl.y"
{
			sdr->actualParameterStack->push(sdr->actualParameters);
			sdr->actualParameters	=	new CList<CExpression *>;
		;
    break;}
case 167:
#line 1817 "sl.y"
{
			yyval.array	=	yyvsp[-1].array;
		;
    break;}
case 168:
#line 1829 "sl.y"
{
			yyval.code	=	new CGatherThenElse(yyvsp[-3].array,yyvsp[-2].code,yyvsp[0].code);
			sdr->actualParameters	=	sdr->actualParameterStack->pop();
		;
    break;}
case 169:
#line 1840 "sl.y"
{
			yyval.code	=	new CGatherThenElse(yyvsp[-1].array,yyvsp[0].code,NULL);
			sdr->actualParameters	=	sdr->actualParameterStack->pop();
		;
    break;}
case 170:
#line 1849 "sl.y"
{
			yyval.code	=	new CGatherThenElse(yyvsp[-3].array,yyvsp[-2].code,yyvsp[0].code);
			sdr->actualParameters	=	sdr->actualParameterStack->pop();
		;
    break;}
case 171:
#line 1859 "sl.y"
{
			CFunction	*cCFunction	=	sdr->newFunction(constantLoopName);

			sdr->requiredShaderContext	|=	SLC_SURFACE;
		;
    break;}
case 172:
#line 1871 "sl.y"
{
			CFunction	*cFun	=	sdr->popFunction();

			yyval.code	=	new CIlluminationLoop(NULL,yyvsp[-2].code,NULL,NULL,yyvsp[0].code);
		;
    break;}
case 173:
#line 1884 "sl.y"
{
			CFunction	*cFun	=	sdr->popFunction();

			yyval.code	=	new CIlluminationLoop(yyvsp[-4].code,yyvsp[-2].code,NULL,NULL,yyvsp[0].code);
		;
    break;}
case 174:
#line 1899 "sl.y"
{
			CFunction	*cFun	=	sdr->popFunction();

			yyval.code	=	new CIlluminationLoop(NULL,yyvsp[-6].code,yyvsp[-4].code,yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 175:
#line 1916 "sl.y"
{
			CFunction	*cFun	=	sdr->popFunction();

			yyval.code	=	new CIlluminationLoop(yyvsp[-8].code,yyvsp[-6].code,yyvsp[-4].code,yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 176:
#line 1929 "sl.y"
{
			CFunction	*cFun	=	sdr->popFunction();

			yyval.code	=	new CIlluminationLoop(NULL,yyvsp[-2].code,NULL,NULL,yyvsp[0].code);
		;
    break;}
case 177:
#line 1942 "sl.y"
{
			CFunction	*cFun	=	sdr->popFunction();

			yyval.code	=	new CIlluminationLoop(yyvsp[-4].code,yyvsp[-2].code,NULL,NULL,yyvsp[0].code);
		;
    break;}
case 178:
#line 1957 "sl.y"
{
			CFunction	*cFun	=	sdr->popFunction();

			yyval.code	=	new CIlluminationLoop(NULL,yyvsp[-6].code,yyvsp[-4].code,yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 179:
#line 1974 "sl.y"
{
			CFunction	*cFun	=	sdr->popFunction();

			yyval.code	=	new CIlluminationLoop(yyvsp[-8].code,yyvsp[-6].code,yyvsp[-4].code,yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 180:
#line 1989 "sl.y"
{
			sdr->requiredShaderContext	|=	SLC_LIGHT;

			yyval.code	=	new CIlluminateSolar(opcodeIlluminate,opcodeEndIlluminate,yyvsp[-2].code,NULL,NULL,yyvsp[0].code);
		;
    break;}
case 181:
#line 2004 "sl.y"
{
			sdr->requiredShaderContext	|=	SLC_LIGHT;

			yyval.code	=	new CIlluminateSolar(opcodeIlluminate,opcodeEndIlluminate,yyvsp[-6].code,yyvsp[-4].code,yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 182:
#line 2017 "sl.y"
{
			sdr->requiredShaderContext	|=	SLC_LIGHT;

			yyval.code	=	new CIlluminateSolar(opcodeIlluminate,opcodeEndIlluminate,yyvsp[-2].code,NULL,NULL,yyvsp[0].code);
		;
    break;}
case 183:
#line 2032 "sl.y"
{
			sdr->requiredShaderContext	|=	SLC_LIGHT;

			yyval.code	=	new CIlluminateSolar(opcodeIlluminate,opcodeEndIlluminate,yyvsp[-6].code,yyvsp[-4].code,yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 184:
#line 2046 "sl.y"
{
			sdr->requiredShaderContext	|=	SLC_LIGHT;

			yyval.code	=	new CIlluminateSolar(opcodeSolar,opcodeEndSolar,NULL,NULL,NULL,yyvsp[0].code);
		;
    break;}
case 185:
#line 2059 "sl.y"
{
			sdr->requiredShaderContext	|=	SLC_LIGHT;

			yyval.code	=	new CIlluminateSolar(opcodeSolar,opcodeEndSolar,yyvsp[-4].code,yyvsp[-2].code,NULL,yyvsp[0].code);
		;
    break;}
case 186:
#line 2071 "sl.y"
{
			sdr->requiredShaderContext	|=	SLC_LIGHT;

			yyval.code	=	new CIlluminateSolar(opcodeSolar,opcodeEndSolar,NULL,NULL,NULL,yyvsp[0].code);
		;
    break;}
case 187:
#line 2084 "sl.y"
{
			sdr->requiredShaderContext	|=	SLC_LIGHT;

			yyval.code	=	new CIlluminateSolar(opcodeSolar,opcodeEndSolar,yyvsp[-4].code,yyvsp[-2].code,NULL,yyvsp[0].code);
		;
    break;}
case 188:
#line 2095 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 189:
#line 2102 "sl.y"
{
			yyval.code	=	getOperation(yyvsp[-2].code,yyvsp[0].code,opcodeAddFloatFloat,opcodeAddVectorVector,opcodeAddMatrixMatrix,NULL,NULL);
		;
    break;}
case 190:
#line 2109 "sl.y"
{
			yyval.code	=	getOperation(yyvsp[-2].code,yyvsp[0].code,opcodeSubFloatFloat,opcodeSubVectorVector,opcodeSubMatrixMatrix,NULL,NULL);
		;
    break;}
case 191:
#line 2116 "sl.y"
{
			yyval.code	=	NULL;

			if (yyvsp[-2].code->type & SLC_MATRIX) {
				if (yyvsp[0].code->type & SLC_VVECTOR) {
					yyval.code	=	new CBinaryExpression(SLC_VECTOR | SLC_VVECTOR,opcodeMulMatrixVector,yyvsp[-2].code,getConversion(SLC_VECTOR,yyvsp[0].code));
				} else if (yyvsp[0].code->type & SLC_VPOINT) {
					yyval.code	=	new CBinaryExpression(SLC_VECTOR | SLC_VPOINT,opcodeMulMatrixPoint,yyvsp[-2].code,getConversion(SLC_VECTOR,yyvsp[0].code));
				} else if (yyvsp[0].code->type & SLC_VNORMAL) {
					yyval.code	=	new CBinaryExpression(SLC_VECTOR | SLC_VNORMAL,opcodeMulMatrixNormal,yyvsp[-2].code,getConversion(SLC_VECTOR,yyvsp[0].code));
				}
			}

			if (yyval.code == NULL) {
				if (yyvsp[0].code->type & SLC_MATRIX) {
					if (yyvsp[-2].code->type & SLC_VVECTOR) {
						yyval.code	=	new CBinaryExpression(SLC_VECTOR | SLC_VVECTOR,opcodeMulVectorMatrix,yyvsp[-2].code,getConversion(SLC_VECTOR,yyvsp[0].code));
					} else if (yyvsp[-2].code->type & SLC_VPOINT) {
						yyval.code	=	new CBinaryExpression(SLC_VECTOR | SLC_VPOINT,opcodeMulPointMatrix,yyvsp[-2].code,getConversion(SLC_VECTOR,yyvsp[0].code));
					} else if (yyvsp[-2].code->type & SLC_VNORMAL) {
						yyval.code	=	new CBinaryExpression(SLC_VECTOR | SLC_VNORMAL,opcodeMulNormalMatrix,yyvsp[-2].code,getConversion(SLC_VECTOR,yyvsp[0].code));
					}
				}
			}


			if (yyval.code == NULL)
				yyval.code	=	getOperation(yyvsp[-2].code,yyvsp[0].code,opcodeMulFloatFloat,opcodeMulVectorVector,opcodeMulMatrixMatrix,NULL,NULL);
		;
    break;}
case 192:
#line 2149 "sl.y"
{
			yyval.code	=	getOperation(yyvsp[-2].code,yyvsp[0].code,opcodeDivFloatFloat,opcodeDivVectorVector,opcodeDivMatrixMatrix,NULL,NULL);
		;
    break;}
case 193:
#line 2155 "sl.y"
{
			sdr->desire(SLC_VECTOR | SLC_VVECTOR);
		;
    break;}
case 194:
#line 2159 "sl.y"
{
			sdr->undesire();
			yyval.code	=	new CBinaryExpression(SLC_FLOAT,opcodeDotProduct,getConversion(SLC_VECTOR,yyvsp[-3].code),getConversion(SLC_VECTOR,yyvsp[0].code));
		;
    break;}
case 195:
#line 2167 "sl.y"
{
			yyval.code	=	new CBinaryExpression(SLC_VECTOR,opcodeCrossProduct,getConversion(SLC_VECTOR,yyvsp[-2].code),getConversion(SLC_VECTOR,yyvsp[0].code));
		;
    break;}
case 196:
#line 2173 "sl.y"
{
			yyval.code	=	yyvsp[0].code;	
		;
    break;}
case 197:
#line 2179 "sl.y"
{
			yyval.code	=	getOperation(yyvsp[0].code,opcodeNegFloat,opcodeNegVector,opcodeNegMatrix,NULL,NULL);
		;
    break;}
case 198:
#line 2188 "sl.y"
{
			int	ft	=	yyvsp[-2].code->type;
			int	st	=	yyvsp[0].code->type;

			if ((yyvsp[-2].code->type & SLC_TYPE_MASK) == (yyvsp[0].code->type & SLC_TYPE_MASK)) {
				yyval.code	=	new CConditionalExpression(yyvsp[-2].code->type,yyvsp[-4].code,yyvsp[-2].code,yyvsp[0].code);
			} else {
				sdr->error("Type mismatch in conditional execution\n");
			}
		;
    break;}
case 199:
#line 2204 "sl.y"
{
			yyval.array	=	yyvsp[-1].array;
		;
    break;}
case 200:
#line 2213 "sl.y"
{
			yyval.array	=	yyvsp[0].array;
			yyval.array->push(yyvsp[-2].code);
		;
    break;}
case 201:
#line 2219 "sl.y"
{
			yyval.array	=	new CList<CExpression *>;
			yyval.array->push(yyvsp[0].code);
		;
    break;}
case 202:
#line 2227 "sl.y"
{
			yyval.code	=	new CConstantTerminalExpression(SLC_FLOAT | SLC_UNIFORM,strdup("3.141592654"));
		;
    break;}
case 203:
#line 2232 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 204:
#line 2237 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 205:
#line 2242 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 206:
#line 2247 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 207:
#line 2253 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
			sdr->undesire();
		;
    break;}
case 208:
#line 2259 "sl.y"
{
	
			CVariable	*cVar	=	sdr->getVariable(yyvsp[0].string);

			if (cVar == NULL) {
				sdr->error("Identifier %s not found\n",yyvsp[0].string);
				yyval.code	=	new CNullExpression;
			} else { 
				yyval.code	=	new CTerminalExpression(cVar);
			}
		;
    break;}
case 209:
#line 2275 "sl.y"
{
			CVariable *cVar	=	sdr->getVariable(yyvsp[-3].string);

			if (cVar == NULL) {
				sdr->error("Identifier %s not found\n",yyvsp[-3].string);
				yyval.code	=	new CNullExpression;
			} else if (cVar->type & SLC_ARRAY) { 
				yyval.code	=	new CArrayExpression(cVar,yyvsp[-1].code);
			} else {
				CList<CExpression *>	*dummyParams = new CList<CExpression *>;
				CFunctionPrototype		*cFun;

				dummyParams->push(new CTerminalExpression(cVar));
				dummyParams->push(yyvsp[-1].code);

				// Check the builtin functions
				for (cFun = sdr->builtinFunctions->first(); cFun != NULL; cFun = sdr->builtinFunctions->next()) {
					if (cFun->match("comp",dummyParams,SLC_FLOAT)) break;
				}
				
				if (cFun == NULL) {
					// Cleanup
					CExpression	*cCode;
					while((cCode = dummyParams->pop()) != NULL) {
						delete cCode;
					}
					delete dummyParams;
					// Report error
					sdr->error("Can't index non array\n");
					yyval.code	=	new CNullExpression;
				} else {
					yyval.code	=	new CBuiltinExpression(cFun,dummyParams);
				}
			}
		;
    break;}
case 210:
#line 2312 "sl.y"
{
			yyval.code	=	new CConstantTerminalExpression(SLC_FLOAT,strdup(yyvsp[0].string));
		;
    break;}
case 211:
#line 2317 "sl.y"
{
			yyval.code	=	new CConstantTerminalExpression(SLC_STRING,strdup(yyvsp[0].string));
		;
    break;}
case 212:
#line 2324 "sl.y"
{	
			yyval.code	=	yyvsp[-1].code;
		;
    break;}
case 213:
#line 2334 "sl.y"
{
			// Change the expected type to float
			sdr->undesire();
			sdr->desire(SLC_FLOAT | (yyvsp[-1].integer & (~(SLC_TYPE_MASK | SLC_SUB_TYPE_MASK))));
		;
    break;}
case 214:
#line 2340 "sl.y"
{
			yyval.code	=	getConversion(yyvsp[-3].integer,yyvsp[-2].string,yyvsp[0].code);

			sdr->undesire();
		;
    break;}
case 215:
#line 2347 "sl.y"
{
			// Change the expected type to float
			sdr->undesire();
			sdr->desire(SLC_FLOAT | (yyvsp[0].integer & (~(SLC_TYPE_MASK | SLC_SUB_TYPE_MASK))));
		;
    break;}
case 216:
#line 2353 "sl.y"
{
			yyval.code	=	getConversion(yyvsp[-2].integer,yyvsp[0].code);

			sdr->undesire();
		;
    break;}
case 217:
#line 2364 "sl.y"
{
			yyval.code	=	yyvsp[-1].code;
		;
    break;}
case 218:
#line 2369 "sl.y"
{
		;
    break;}
case 219:
#line 2376 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 220:
#line 2385 "sl.y"
{
			yyval.code	=	new CVectorExpression(yyvsp[-4].code,yyvsp[-2].code,yyvsp[0].code);
		;
    break;}
case 221:
#line 2420 "sl.y"
{
			CExpression	*elements[16];

			elements[0]		=	yyvsp[-30].code;
			elements[1]		=	yyvsp[-28].code;
			elements[2]		=	yyvsp[-26].code;
			elements[3]		=	yyvsp[-24].code;
			elements[4]		=	yyvsp[-22].code;
			elements[5]		=	yyvsp[-20].code;
			elements[6]		=	yyvsp[-18].code;
			elements[7]		=	yyvsp[-16].code;
			elements[8]		=	yyvsp[-14].code;
			elements[9]		=	yyvsp[-12].code;
			elements[10]	=	yyvsp[-10].code;
			elements[11]	=	yyvsp[-8].code;
			elements[12]	=	yyvsp[-6].code;
			elements[13]	=	yyvsp[-4].code;
			elements[14]	=	yyvsp[-2].code;
			elements[15]	=	yyvsp[0].code;

			yyval.code				=	new CMatrixExpression(elements);
		;
    break;}
case 222:
#line 2447 "sl.y"
{
			yyval.code	=	yyvsp[-1].code;
		;
    break;}
case 223:
#line 2454 "sl.y"
{
			yyval.code	=	getOperation(yyvsp[-2].code,yyvsp[0].code,NULL,NULL,NULL,NULL,opcodeAnd);
		;
    break;}
case 224:
#line 2461 "sl.y"
{
			yyval.code	=	getOperation(yyvsp[-2].code,yyvsp[0].code,NULL,NULL,NULL,NULL,opcodeOr);
		;
    break;}
case 225:
#line 2468 "sl.y"
{
			yyval.code			=	getOperation(yyvsp[-2].code,yyvsp[0].code,opcodeFloatGreater,opcodeVectorGreater,NULL,NULL,NULL);
			yyval.code->type	=	SLC_BOOLEAN | (yyvsp[-2].code->type & yyvsp[0].code->type & SLC_UNIFORM);
		;
    break;}
case 226:
#line 2476 "sl.y"
{
			yyval.code			=	getOperation(yyvsp[-2].code,yyvsp[0].code,opcodeFloatLess,opcodeVectorLess,NULL,NULL,NULL);
			yyval.code->type	=	SLC_BOOLEAN | (yyvsp[-2].code->type & yyvsp[0].code->type & SLC_UNIFORM);
		;
    break;}
case 227:
#line 2484 "sl.y"
{
			yyval.code			=	getOperation(yyvsp[-2].code,yyvsp[0].code,opcodeFloatEGreater,opcodeVectorEGreater,NULL,NULL,NULL);
			yyval.code->type	=	SLC_BOOLEAN | (yyvsp[-2].code->type & yyvsp[0].code->type & SLC_UNIFORM);
		;
    break;}
case 228:
#line 2492 "sl.y"
{
			yyval.code			=	getOperation(yyvsp[-2].code,yyvsp[0].code,opcodeFloatELess,opcodeVectorELess,NULL,NULL,NULL);
			yyval.code->type	=	SLC_BOOLEAN | (yyvsp[-2].code->type & yyvsp[0].code->type & SLC_UNIFORM);
		;
    break;}
case 229:
#line 2500 "sl.y"
{
			yyval.code			=	getOperation(yyvsp[-2].code,yyvsp[0].code,opcodeFloatEqual,opcodeVectorEqual,NULL,opcodeStringEqual,NULL);
			yyval.code->type	=	SLC_BOOLEAN | (yyvsp[-2].code->type & yyvsp[0].code->type & SLC_UNIFORM);
		;
    break;}
case 230:
#line 2508 "sl.y"
{
			yyval.code			=	getOperation(yyvsp[-2].code,yyvsp[0].code,opcodeFloatNotEqual,opcodeVectorNotEqual,NULL,opcodeStringNotEqual,NULL);
			yyval.code->type	=	SLC_BOOLEAN | (yyvsp[-2].code->type & yyvsp[0].code->type & SLC_UNIFORM);
		;
    break;}
case 231:
#line 2516 "sl.y"
{
			yyval.code			=	getOperation(yyvsp[-2].code,yyvsp[0].code,NULL,NULL,NULL,NULL,opcodeAnd);
			yyval.code->type	=	SLC_BOOLEAN | (yyvsp[-2].code->type & yyvsp[0].code->type & SLC_UNIFORM);
		;
    break;}
case 232:
#line 2524 "sl.y"
{
			yyval.code			=	getOperation(yyvsp[-2].code,yyvsp[0].code,NULL,NULL,NULL,NULL,opcodeXor);
			yyval.code->type	=	SLC_BOOLEAN | (yyvsp[-2].code->type & yyvsp[0].code->type & SLC_UNIFORM);
		;
    break;}
case 233:
#line 2531 "sl.y"
{
			yyval.code			=	new CUnaryExpression(SLC_BOOLEAN,opcodeNot,getConversion(SLC_BOOLEAN,yyvsp[0].code));
		;
    break;}
case 234:
#line 2543 "sl.y"
{
			CFunctionPrototype		*cFun;
			CList<CExpression *>	*parameters	=	sdr->actualParameters;	// This is the list of parameters to the function

			char					*funName	=	yyvsp[0].string;

			// Clear the desired type flags
			sdr->undesire();

			// Restore the old parameters
			sdr->actualParameters		=	sdr->actualParameterStack->pop();


			// Check the builtin functions
			for (cFun = sdr->builtinFunctions->first(); cFun != NULL; cFun = sdr->builtinFunctions->next()) {
				if (cFun->perfectMatch(yyvsp[0].string,parameters,sdr->desired())) break;
			}

			if (cFun == NULL) {
				for (cFun = sdr->builtinFunctions->first(); cFun != NULL; cFun = sdr->builtinFunctions->next()) {
					if (cFun->match(yyvsp[0].string,parameters,sdr->desired())) break;
				}
			}

			if (cFun != NULL) {
				yyval.code	=	new CBuiltinExpression(cFun,parameters);
			} else {
				sdr->error("Function %s not found\n",yyvsp[0].string);
				if (parameters->numItems != 0) {
					CExpression	*cCode;
					while((cCode = parameters->pop()) != NULL) {
						delete cCode;
					}
				}
				delete parameters;
				yyval.code	=	new CNullExpression;
			}
		;
    break;}
case 235:
#line 2583 "sl.y"
{
			yyval.code	=	yyvsp[0].code;
		;
    break;}
case 236:
#line 2593 "sl.y"
{
			// Save the old parameters
			sdr->actualParameterStack->push(sdr->actualParameters);
			// Start a new parameter list
			sdr->actualParameters	=	new CList<CExpression *>;

			// Make sure we do not do something stupid with the parameters
			sdr->desire(SLC_NONE);

			// Set the name
			yyval.string	=	yyvsp[-1].string;
		;
    break;}
case 237:
#line 2608 "sl.y"
{
			// Save the old parameters
			sdr->actualParameterStack->push(sdr->actualParameters);
			// Start a new parameter list
			sdr->actualParameters	=	new CList<CExpression *>;

			// Make sure we do not do something stupid with the parameters
			sdr->desire(SLC_NONE);

			// Set the name
			yyval.string	=	"surface";
		;
    break;}
case 238:
#line 2623 "sl.y"
{
			// Save the old parameters
			sdr->actualParameterStack->push(sdr->actualParameters);
			// Start a new parameter list
			sdr->actualParameters	=	new CList<CExpression *>;

			// Make sure we do not do something stupid with the parameters
			sdr->desire(SLC_NONE);

			// Set the name
			yyval.string	=	"displacement";
		;
    break;}
case 239:
#line 2641 "sl.y"
{
			CFunction				*cFun;
			CList<CExpression *>	*parameters	=	sdr->actualParameters;	// This is the list of parameters to the function

			char					*funName	=	yyvsp[-2].string;

			// Clear the desired type flags
			sdr->undesire();

			// Restore the old parameters
			sdr->actualParameters		=	sdr->actualParameterStack->pop();

			// Search for the CFunction here....
			cFun	=	sdr->getFunction(yyvsp[-2].string,parameters);

			if (cFun != NULL) {													// Cool, the function exists
				// A function with the same name is defined ... 
				// Try to match the parameters;
				if (cFun->parameters->numItems == parameters->numItems) {	// The number of parameters match
					// A function with the same name is defined and the number of Parameters match
					yyval.code	=	new CFuncallExpression(cFun,parameters);					
				}
			}

			// If not found, check the predefined CFunctions
			if (cFun == NULL) {
				CFunctionPrototype	*cFun;
				char				*fName	=	yyvsp[-2].string;
				// Check the builtin CFunctions

				for (cFun = sdr->builtinFunctions->first(); cFun != NULL; cFun = sdr->builtinFunctions->next()) {
					if (cFun->perfectMatch(yyvsp[-2].string,parameters,sdr->desired())) break;
				}

				if (cFun == NULL) {
					for (cFun = sdr->builtinFunctions->first(); cFun != NULL; cFun = sdr->builtinFunctions->next()) {
						if (cFun->match(yyvsp[-2].string,parameters,sdr->desired())) break;
					}
				}

				// Check if there is a DSO implementing this function
				if (cFun == NULL) {
					sdr->enumerateDso(yyvsp[-2].string);

					for (cFun = sdr->builtinFunctions->first(); cFun != NULL; cFun = sdr->builtinFunctions->next()) {
						if (cFun->perfectMatch(yyvsp[-2].string,parameters,sdr->desired())) break;
					}

					if (cFun == NULL) {
						for (cFun = sdr->builtinFunctions->first(); cFun != NULL; cFun = sdr->builtinFunctions->next()) {
							if (cFun->match(yyvsp[-2].string,parameters,sdr->desired())) break;
						}
					}
				}

				if (cFun != NULL) {
					yyval.code	=	new CBuiltinExpression(cFun,parameters);
				} else {
					sdr->error("Function %s not found\n",yyvsp[-2].string);
					if (parameters->numItems != 0) {
						CExpression	*cCode;
						while((cCode = parameters->pop()) != NULL) {
							delete cCode;
						}
					}
					delete parameters;
					yyval.code	=	new CNullExpression;
				}

			}
		;
    break;}
case 240:
#line 2718 "sl.y"
{
			yyval.code	=	new CConstantTerminalExpression(SLC_STRING | SLC_UNIFORM,strdup(yyvsp[0].string));
		;
    break;}
case 241:
#line 2723 "sl.y"
{
			CVariable	*cVar	=	sdr->getVariable(yyvsp[0].string);

			if (cVar != NULL)	yyval.code	=	new CTerminalExpression(cVar);
			else				yyval.code	=	new CNullExpression;
		;
    break;}
case 242:
#line 2736 "sl.y"
{
			yyval.code	=	getConversion(SLC_FLOAT | (yyvsp[-1].code->type & SLC_UNIFORM),yyvsp[-1].code);
		;
    break;}
case 243:
#line 2740 "sl.y"
{
			yyval.code	=	new CConstantTerminalExpression(SLC_FLOAT | SLC_UNIFORM,strdup("0"));
		;
    break;}
case 244:
#line 2758 "sl.y"
{
			// Fake the parameters
			CList<CExpression *>	*parameters	=	sdr->actualParameters;	// This is the list of parameters to the function
			CList<CExpression *>	*pl			=	new CList<CExpression *>;
			CExpression				*cExpression;

			pl->push(yyvsp[-4].code);
			pl->push(yyvsp[-3].code);
			for (cExpression=parameters->first();cExpression!=NULL;cExpression=parameters->next())
				pl->push(cExpression);

			delete parameters;
			sdr->actualParameters	=	pl;

			yyval.string						=	yyvsp[-6].string;
		;
    break;}
case 245:
#line 2780 "sl.y"
{
			// Fake the parameters
			CList<CExpression *>	*parameters	=	sdr->actualParameters;	// This is the list of parameters to the function
			CList<CExpression *>	*pl			=	new CList<CExpression *>;
			CExpression				*cExpression;

			pl->push(yyvsp[-2].code);
			pl->push(yyvsp[-1].code);
			for (cExpression=parameters->first();cExpression!=NULL;cExpression=parameters->next())
				pl->push(cExpression);

			delete parameters;
			sdr->actualParameters	=	pl;

			yyval.string						=	yyvsp[-4].string;
		;
    break;}
case 246:
#line 2800 "sl.y"
{
			yyval.string	=	"texture";

			// Save the old parameters
			sdr->actualParameterStack->push(sdr->actualParameters);
			// Start a new parameter list
			sdr->actualParameters	=	new CList<CExpression *>;

			// Make sure we do not do something stupid with the parameters
			sdr->desire(SLC_NONE);
		;
    break;}
case 247:
#line 2813 "sl.y"
{
			yyval.string	=	"shadow";

			// Save the old parameters
			sdr->actualParameterStack->push(sdr->actualParameters);
			// Start a new parameter list
			sdr->actualParameters	=	new CList<CExpression *>;

			// Make sure we do not do something stupid with the parameters
			sdr->desire(SLC_NONE);
		;
    break;}
case 248:
#line 2826 "sl.y"
{
			yyval.string	=	"environment";

			// Save the old parameters
			sdr->actualParameterStack->push(sdr->actualParameters);
			// Start a new parameter list
			sdr->actualParameters	=	new CList<CExpression *>;

			// Make sure we do not do something stupid with the parameters
			sdr->desire(SLC_NONE);
		;
    break;}
case 249:
#line 2839 "sl.y"
{
			yyval.string	=	"bump";

			// Save the old parameters
			sdr->actualParameterStack->push(sdr->actualParameters);
			// Start a new parameter list
			sdr->actualParameters	=	new CList<CExpression *>;

			// Make sure we do not do something stupid with the parameters
			sdr->desire(SLC_NONE);
		;
    break;}
case 250:
#line 2856 "sl.y"
{
		;
    break;}
case 251:
#line 2859 "sl.y"
{
		;
    break;}
case 252:
#line 2866 "sl.y"
{
			sdr->actualParameters->push(yyvsp[-1].code);
		;
    break;}
case 253:
#line 2870 "sl.y"
{
		;
    break;}
case 254:
#line 2874 "sl.y"
{
			sdr->actualParameters->push(yyvsp[0].code);
		;
    break;}
}
   /* the action file gets copied in in place of this dollarsign */

  yyvsp -= yylen;
  yyssp -= yylen;
#ifdef YYLSP_NEEDED
  yylsp -= yylen;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

  *++yyvsp = yyval;

#ifdef YYLSP_NEEDED
  yylsp++;
  if (yylen == 0)
    {
      yylsp->first_line = yylloc.first_line;
      yylsp->first_column = yylloc.first_column;
      yylsp->last_line = (yylsp-1)->last_line;
      yylsp->last_column = (yylsp-1)->last_column;
      yylsp->text = 0;
    }
  else
    {
      yylsp->last_line = (yylsp+yylen-1)->last_line;
      yylsp->last_column = (yylsp+yylen-1)->last_column;
    }
#endif

  /* Now "shift" the result of the reduction.
     Determine what state that goes to,
     based on the state we popped back to
     and the rule number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTBASE];

  goto yynewstate;

yyerrlab:   /* here on detecting error */

  if (! yyerrstatus)
    /* If not already recovering from an error, report this error.  */
    {
      ++yynerrs;

#ifdef YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (yyn > YYFLAG && yyn < YYLAST)
	{
	  int size = 0;
	  char *msg;
	  int x, count;

	  count = 0;
	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
	  for (x = (yyn < 0 ? -yyn : 0);
	       x < (sizeof(yytname) / sizeof(char *)); x++)
	    if (yycheck[x + yyn] == x)
	      size += strlen(yytname[x]) + 15, count++;
	  msg = (char *) malloc(size + 15);
	  if (msg != 0)
	    {
	      strcpy(msg, "parse error");

	      if (count < 5)
		{
		  count = 0;
		  for (x = (yyn < 0 ? -yyn : 0);
		       x < (sizeof(yytname) / sizeof(char *)); x++)
		    if (yycheck[x + yyn] == x)
		      {
			strcat(msg, count == 0 ? ", expecting `" : " or `");
			strcat(msg, yytname[x]);
			strcat(msg, "'");
			count++;
		      }
		}
	      yyerror(msg);
	      free(msg);
	    }
	  else
	    yyerror ("parse error; also virtual memory exceeded");
	}
      else
#endif /* YYERROR_VERBOSE */
	yyerror("parse error");
    }

  goto yyerrlab1;
yyerrlab1:   /* here on error raised explicitly by an action */

  if (yyerrstatus == 3)
    {
      /* if just tried and failed to reuse lookahead token after an error, discard it.  */

      /* return failure if at end of input */
      if (yychar == YYEOF)
	YYABORT;

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif

      yychar = YYEMPTY;
    }

  /* Else will try to reuse lookahead token
     after shifting the error token.  */

  yyerrstatus = 3;		/* Each real token shifted decrements this */

  goto yyerrhandle;

yyerrdefault:  /* current state does not do anything special for the error token. */

#if 0
  /* This is wrong; only states that explicitly want error tokens
     should shift them.  */
  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  if (yyn) goto yydefault;
#endif

yyerrpop:   /* pop the current state because it cannot handle the error token */

  if (yyssp == yyss) YYABORT;
  yyvsp--;
  yystate = *--yyssp;
#ifdef YYLSP_NEEDED
  yylsp--;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "Error: state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

yyerrhandle:

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yyerrdefault;

  yyn += YYTERROR;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
    goto yyerrdefault;

  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrpop;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrpop;

  if (yyn == YYFINAL)
    YYACCEPT;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting error token, ");
#endif

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  yystate = yyn;
  goto yynewstate;
}
#line 2879 "sl.y"



#include	"lex.sl.cpp"



int	CScriptContext::compile(FILE *in,char *outName) {
	
	sdr		=	this;

	slin	=	in;

	slparse();

	if (compileError == 0) {
		char		*tmp;

		if (outName == NULL) {
			// If there's no compile error, dump the compiled code
			tmp	=	new char[strlen(sdr->shaderName)+5];

			strcpy(tmp,sdr->shaderName);
			strcat(tmp,".sdr");
		} else {
			tmp	=	outName;
		}

		sdr->generateCode(tmp);

		if (tmp != outName) delete [] tmp;

		return TRUE;
	}
	return FALSE;
}


void	yyerror(char *mes) {
	sdr->error("Parse error\n");
}

