/* A Bison parser, made by GNU Bison 1.875.  */

/* Skeleton parser for Yacc-like parsing with Bison,
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, 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.  */

/* Written by Richard Stallman by simplifying the original so called
   ``semantic'' parser.  */

/* All symbols defined below should begin with yy or YY, to avoid
   infringing on user name space.  This should be done even for local
   variables, as they might otherwise be expanded by user macros.
   There are some unavoidable exceptions within include files to
   define necessary library symbols; they are noted "INFRINGES ON
   USER NAME SPACE" below.  */

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

/* Skeleton name.  */
#define YYSKELETON_NAME "yacc.c"

/* Pure parsers.  */
#define YYPURE 0

/* Using locations.  */
#define YYLSP_NEEDED 0

/* If NAME_PREFIX is specified substitute the variables and functions
   names.  */
#define yyparse sdrparse
#define yylex   sdrlex
#define yyerror sdrerror
#define yylval  sdrlval
#define yychar  sdrchar
#define yydebug sdrdebug
#define yynerrs sdrnerrs


/* Tokens.  */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
   /* Put the tokens into the symbol table, so that GDB and other debuggers
      know about them.  */
   enum yytokentype {
     SCRL_PARAMETERS = 258,
     SCRL_VARIABLES = 259,
     SCRL_OUTPUT = 260,
     SCRL_VARYING = 261,
     SCRL_VERTEX = 262,
     SCRL_UNIFORM = 263,
     SCRL_BOOLEAN = 264,
     SCRL_FLOAT = 265,
     SCRL_COLOR = 266,
     SCRL_VECTOR = 267,
     SCRL_NORMAL = 268,
     SCRL_POINT = 269,
     SCRL_MATRIX = 270,
     SCRL_STRING = 271,
     SCRL_SURFACE = 272,
     SCRL_DISPLACEMENT = 273,
     SCRL_IMAGER = 274,
     SCRL_LIGHTSOURCE = 275,
     SCRL_VOLUME = 276,
     SCRL_GENERIC = 277,
     SCRL_DSO = 278,
     SCRL_DOT = 279,
     SCRL_COLON = 280,
     SCRL_EQUAL = 281,
     SCRL_OPEN_PARANTHESIS = 282,
     SCRL_CLOSE_PARANTHESIS = 283,
     SCRL_OPEN_SQR_PARANTHESIS = 284,
     SCRL_CLOSE_SQR_PARANTHESIS = 285,
     SCRL_COMMA = 286,
     SCRL_NL = 287,
     SCRL_TEXT_VALUE = 288,
     SCRL_IDENTIFIER_VALUE = 289,
     SCRL_LABEL_VALUE = 290,
     SCRL_FLOAT_VALUE = 291
   };
#endif
#define SCRL_PARAMETERS 258
#define SCRL_VARIABLES 259
#define SCRL_OUTPUT 260
#define SCRL_VARYING 261
#define SCRL_VERTEX 262
#define SCRL_UNIFORM 263
#define SCRL_BOOLEAN 264
#define SCRL_FLOAT 265
#define SCRL_COLOR 266
#define SCRL_VECTOR 267
#define SCRL_NORMAL 268
#define SCRL_POINT 269
#define SCRL_MATRIX 270
#define SCRL_STRING 271
#define SCRL_SURFACE 272
#define SCRL_DISPLACEMENT 273
#define SCRL_IMAGER 274
#define SCRL_LIGHTSOURCE 275
#define SCRL_VOLUME 276
#define SCRL_GENERIC 277
#define SCRL_DSO 278
#define SCRL_DOT 279
#define SCRL_COLON 280
#define SCRL_EQUAL 281
#define SCRL_OPEN_PARANTHESIS 282
#define SCRL_CLOSE_PARANTHESIS 283
#define SCRL_OPEN_SQR_PARANTHESIS 284
#define SCRL_CLOSE_SQR_PARANTHESIS 285
#define SCRL_COMMA 286
#define SCRL_NL 287
#define SCRL_TEXT_VALUE 288
#define SCRL_IDENTIFIER_VALUE 289
#define SCRL_LABEL_VALUE 290
#define SCRL_FLOAT_VALUE 291




/* Copy the first part of user declarations.  */
#line 1 "sdr.y"

//////////////////////////////////////////////////////////////////////
//
//                             Pixie
//
// Copyright © 1999 - 2003, Okan Arikan
//
// Contact: okan@cs.berkeley.edu
//
// This library 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 of the License, or (at your option) any later version.
// 
// This library 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 library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
//
//  File				:	sl.y
//  Classes				:	-
//  Description			:	This is the parser file for CShader
//
////////////////////////////////////////////////////////////////////////
#undef alloca
#include <math.h>
#include <string.h>

#include "common/algebra.h"
#include "common/os.h"
#include "sdr.h"


/////////////////////////////////////////////////////////////////////////////////////
//   First some temporary data structures used during the script parsing


// Some forward definitions
		void							sdrerror(char *);			// Forward definition for stupid yacc
		int								sdrlex(void );				// Forward definition for stupid yacc

///////////////////////////////////////////////////////////////////////
// Function				:
// Description			:
// Return Value			:
// Comments				:
// Date last edited		:
static	void	processEscapes(char *str) {
	char	*cstr;

	while((cstr = strchr(str,'\\')) != NULL) {
		switch(cstr[1]) {
		case 'n':
			cstr[0]	=	'\n';
			break;
		case 't':
			cstr[0]	=	'\t';
			break;
		case 'r':
			cstr[0]	=	'\r';
			break;
		default:
			if (((cstr[1] >= 'a') && (cstr[1] <= 'z')) || ((cstr[1] >= 'A') && (cstr[1] <= 'Z'))) {
				// Unrecognised escape sequence
				sdrerror("Unrecognised escape sequence");
			} else {
				cstr[0]	=	cstr[1];
			}
		}

		{
			int i;

			for (i=2;cstr[i] != '\0';i++) {
				cstr[i-1]	=	cstr[i];
			}

			cstr[i-1]	=	cstr[i];
		}
	}
}



		TSdrParameter	*parameters;
		TSdrParameter	*currentParameter;
		ESdrShaderType	shaderType;



/* Enabling traces.  */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif

/* Enabling verbose error messages.  */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif

#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 97 "sdr.y"
typedef union slval {
	float			real;
	char			string[64];
	matrix			m;
	vector			v;
	TSdrParameter *parameter;
} YYSTYPE;
/* Line 191 of yacc.c.  */
#line 261 "sdr.cpp"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif



/* Copy the second part of user declarations.  */


/* Line 214 of yacc.c.  */
#line 273 "sdr.cpp"

#if ! defined (yyoverflow) || YYERROR_VERBOSE

/* The parser invokes alloca or malloc; define the necessary symbols.  */

# if YYSTACK_USE_ALLOCA
#  define YYSTACK_ALLOC alloca
# else
#  ifndef YYSTACK_USE_ALLOCA
#   if defined (alloca) || defined (_ALLOCA_H)
#    define YYSTACK_ALLOC alloca
#   else
#    ifdef __GNUC__
#     define YYSTACK_ALLOC __builtin_alloca
#    endif
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's `empty if-body' warning. */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# else
#  if defined (__STDC__) || defined (__cplusplus)
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#   define YYSIZE_T size_t
#  endif
#  define YYSTACK_ALLOC malloc
#  define YYSTACK_FREE free
# endif
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */


#if (! defined (yyoverflow) \
     && (! defined (__cplusplus) \
	 || (YYSTYPE_IS_TRIVIAL)))

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  short yyss;
  YYSTYPE yyvs;
  };

/* The size of the maximum gap between one aligned stack and the next.  */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)

/* The size of an array large to enough to hold all stacks, each with
   N elements.  */
# define YYSTACK_BYTES(N) \
     ((N) * (sizeof (short) + sizeof (YYSTYPE))				\
      + YYSTACK_GAP_MAXIMUM)

/* Copy COUNT objects from FROM to TO.  The source and destination do
   not overlap.  */
# ifndef YYCOPY
#  if 1 < __GNUC__
#   define YYCOPY(To, From, Count) \
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
#  else
#   define YYCOPY(To, From, Count)		\
      do					\
	{					\
	  register YYSIZE_T yyi;		\
	  for (yyi = 0; yyi < (Count); yyi++)	\
	    (To)[yyi] = (From)[yyi];		\
	}					\
      while (0)
#  endif
# endif

/* Relocate STACK from its old location to the new one.  The
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
   elements in the stack, and YYPTR gives the new location of the
   stack.  Advance YYPTR to a properly aligned location for the next
   stack.  */
# define YYSTACK_RELOCATE(Stack)					\
    do									\
      {									\
	YYSIZE_T yynewbytes;						\
	YYCOPY (&yyptr->Stack, Stack, yysize);				\
	Stack = &yyptr->Stack;						\
	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
	yyptr += yynewbytes / sizeof (*yyptr);				\
      }									\
    while (0)

#endif

#if defined (__STDC__) || defined (__cplusplus)
   typedef signed char yysigned_char;
#else
   typedef short yysigned_char;
#endif

/* YYFINAL -- State number of the termination state. */
#define YYFINAL  13
/* YYLAST -- Last index in YYTABLE.  */
#define YYLAST   251

/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS  37
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS  47
/* YYNRULES -- Number of rules. */
#define YYNRULES  116
/* YYNRULES -- Number of states. */
#define YYNSTATES  265

/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
#define YYUNDEFTOK  2
#define YYMAXUTOK   291

#define YYTRANSLATE(YYX) 						\
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
static const unsigned 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
};

#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
   YYRHS.  */
static const unsigned short yyprhs[] =
{
       0,     0,     3,     8,    12,    20,    23,    30,    31,    33,
      35,    37,    38,    41,    44,    47,    50,    53,    58,    62,
      63,    64,    67,    68,    71,    73,    75,    77,    79,    81,
      83,    85,    86,    92,    95,    98,   105,   106,   108,   110,
     112,   114,   116,   118,   120,   122,   124,   126,   129,   132,
     135,   137,   142,   145,   151,   156,   162,   163,   168,   174,
     175,   180,   186,   187,   192,   198,   199,   204,   210,   232,
     237,   240,   246,   251,   255,   256,   259,   262,   265,   268,
     271,   274,   277,   280,   283,   289,   292,   298,   301,   307,
     310,   316,   319,   325,   328,   334,   337,   343,   346,   352,
     356,   360,   364,   365,   366,   374,   376,   379,   380,   383,
     386,   388,   390,   392,   394,   402,   436
};

/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yysigned_char yyrhs[] =
{
      38,     0,    -1,    42,    43,    65,    76,    -1,    26,    33,
      36,    -1,    26,    33,    29,    36,    36,    36,    30,    -1,
      26,    36,    -1,    26,    29,    36,    36,    36,    30,    -1,
      -1,    39,    -1,     8,    -1,     6,    -1,    -1,    17,    32,
      -1,    18,    32,    -1,    20,    32,    -1,    21,    32,    -1,
      19,    32,    -1,     3,    25,    32,    44,    -1,    45,    32,
      44,    -1,    -1,    -1,    46,    49,    -1,    -1,    47,    48,
      -1,    54,    -1,    55,    -1,    56,    -1,    58,    -1,    60,
      -1,    62,    -1,    64,    -1,    -1,    53,    52,    34,    50,
      51,    -1,    26,    36,    -1,    26,    33,    -1,    26,    29,
      36,    36,    36,    30,    -1,    -1,    10,    -1,    12,    -1,
      13,    -1,    11,    -1,    14,    -1,    15,    -1,    16,    -1,
       8,    -1,     6,    -1,     7,    -1,     5,     8,    -1,     5,
       6,    -1,     5,     7,    -1,     5,    -1,    10,    34,    26,
      36,    -1,    10,    34,    -1,    10,    34,    29,    36,    30,
      -1,    16,    34,    26,    33,    -1,    16,    34,    29,    36,
      30,    -1,    -1,    11,    34,    57,    40,    -1,    11,    34,
      29,    36,    30,    -1,    -1,    12,    34,    59,    40,    -1,
      12,    34,    29,    36,    30,    -1,    -1,    13,    34,    61,
      40,    -1,    13,    34,    29,    36,    30,    -1,    -1,    14,
      34,    63,    40,    -1,    14,    34,    29,    36,    30,    -1,
      15,    34,    26,    27,    36,    36,    36,    36,    36,    36,
      36,    36,    36,    36,    36,    36,    36,    36,    36,    36,
      28,    -1,    15,    34,    26,    36,    -1,    15,    34,    -1,
      15,    34,    29,    36,    30,    -1,     4,    25,    32,    66,
      -1,    67,    32,    66,    -1,    -1,    41,    68,    -1,    41,
      69,    -1,    41,    70,    -1,    41,    72,    -1,    41,    71,
      -1,    41,    73,    -1,    41,    74,    -1,    41,    75,    -1,
       9,    34,    -1,     9,    34,    29,    36,    30,    -1,    10,
      34,    -1,    10,    34,    29,    36,    30,    -1,    16,    34,
      -1,    16,    34,    29,    36,    30,    -1,    12,    34,    -1,
      12,    34,    29,    36,    30,    -1,    11,    34,    -1,    11,
      34,    29,    36,    30,    -1,    13,    34,    -1,    13,    34,
      29,    36,    30,    -1,    14,    34,    -1,    14,    34,    29,
      36,    30,    -1,    15,    34,    -1,    15,    34,    29,    36,
      30,    -1,    81,    32,    76,    -1,    82,    32,    76,    -1,
      77,    32,    76,    -1,    -1,    -1,    23,    34,    78,    27,
      33,    28,    80,    -1,    34,    -1,    83,    80,    -1,    -1,
      79,    80,    -1,    35,    25,    -1,    33,    -1,    35,    -1,
      34,    -1,    36,    -1,    27,    36,    31,    36,    31,    36,
      28,    -1,    27,    36,    31,    36,    31,    36,    31,    36,
      31,    36,    31,    36,    31,    36,    31,    36,    31,    36,
      31,    36,    31,    36,    31,    36,    31,    36,    31,    36,
      31,    36,    31,    36,    28,    -1,    27,    33,    28,    -1
};

/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
static const unsigned short yyrline[] =
{
       0,   150,   150,   156,   167,   182,   191,   204,   209,   214,
     218,   222,   227,   233,   239,   245,   251,   259,   266,   272,
     277,   277,   289,   289,   303,   305,   307,   309,   311,   313,
     315,   322,   319,   332,   338,   344,   357,   363,   368,   373,
     378,   383,   388,   393,   400,   405,   410,   415,   421,   427,
     433,   440,   452,   462,   477,   489,   506,   504,   516,   533,
     531,   543,   560,   558,   570,   587,   585,   597,   612,   657,
     685,   711,   726,   733,   736,   740,   743,   746,   749,   752,
     755,   758,   761,   766,   771,   782,   787,   797,   802,   812,
     817,   827,   832,   842,   847,   857,   862,   872,   877,   887,
     891,   895,   898,   904,   902,   915,   921,   926,   931,   938,
     945,   949,   953,   957,   961,   971,  1007
};
#endif

#if YYDEBUG || YYERROR_VERBOSE
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
  "$end", "error", "$undefined", "SCRL_PARAMETERS", "SCRL_VARIABLES", 
  "SCRL_OUTPUT", "SCRL_VARYING", "SCRL_VERTEX", "SCRL_UNIFORM", 
  "SCRL_BOOLEAN", "SCRL_FLOAT", "SCRL_COLOR", "SCRL_VECTOR", 
  "SCRL_NORMAL", "SCRL_POINT", "SCRL_MATRIX", "SCRL_STRING", 
  "SCRL_SURFACE", "SCRL_DISPLACEMENT", "SCRL_IMAGER", "SCRL_LIGHTSOURCE", 
  "SCRL_VOLUME", "SCRL_GENERIC", "SCRL_DSO", "SCRL_DOT", "SCRL_COLON", 
  "SCRL_EQUAL", "SCRL_OPEN_PARANTHESIS", "SCRL_CLOSE_PARANTHESIS", 
  "SCRL_OPEN_SQR_PARANTHESIS", "SCRL_CLOSE_SQR_PARANTHESIS", "SCRL_COMMA", 
  "SCRL_NL", "SCRL_TEXT_VALUE", "SCRL_IDENTIFIER_VALUE", 
  "SCRL_LABEL_VALUE", "SCRL_FLOAT_VALUE", "$accept", "start", 
  "slVectorIn", "slVector", "slContainer", "slType", 
  "slParameterDefinitions", "slParameters", "slParameter", "@1", "@2", 
  "slRegularParameter", "slGlobalParameter", "@3", 
  "slGlobalParameterInit", "slGlobalParameterType", 
  "slGlobalParameterContainer", "slFloatParameter", "slStringParameter", 
  "slColorParameter", "@4", "slVectorParameter", "@5", 
  "slNormalParameter", "@6", "slPointParameter", "@7", 
  "slMatrixParameter", "slVariableDefinitions", "slVariables", 
  "slVariable", "slBooleanVariable", "slFloatVariable", 
  "slStringVariable", "slVectorVariable", "slColorVariable", 
  "slNormalVariable", "slPointVariable", "slMatrixVariable", "slCode", 
  "slDSO", "@8", "slOpcode", "slOperandList", "slStatement", 
  "slLabelDefinition", "slOperand", 0
};
#endif

# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
   token YYLEX-NUM.  */
static const unsigned short yytoknum[] =
{
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
     285,   286,   287,   288,   289,   290,   291
};
# endif

/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
static const unsigned char yyr1[] =
{
       0,    37,    38,    39,    39,    39,    39,    39,    40,    41,
      41,    41,    42,    42,    42,    42,    42,    43,    44,    44,
      46,    45,    47,    45,    48,    48,    48,    48,    48,    48,
      48,    50,    49,    51,    51,    51,    51,    52,    52,    52,
      52,    52,    52,    52,    53,    53,    53,    53,    53,    53,
      53,    54,    54,    54,    55,    55,    57,    56,    56,    59,
      58,    58,    61,    60,    60,    63,    62,    62,    64,    64,
      64,    64,    65,    66,    66,    67,    67,    67,    67,    67,
      67,    67,    67,    68,    68,    69,    69,    70,    70,    71,
      71,    72,    72,    73,    73,    74,    74,    75,    75,    76,
      76,    76,    76,    78,    77,    79,    80,    80,    81,    82,
      83,    83,    83,    83,    83,    83,    83
};

/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
static const unsigned char yyr2[] =
{
       0,     2,     4,     3,     7,     2,     6,     0,     1,     1,
       1,     0,     2,     2,     2,     2,     2,     4,     3,     0,
       0,     2,     0,     2,     1,     1,     1,     1,     1,     1,
       1,     0,     5,     2,     2,     6,     0,     1,     1,     1,
       1,     1,     1,     1,     1,     1,     1,     2,     2,     2,
       1,     4,     2,     5,     4,     5,     0,     4,     5,     0,
       4,     5,     0,     4,     5,     0,     4,     5,    21,     4,
       2,     5,     4,     3,     0,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     5,     2,     5,     2,     5,     2,
       5,     2,     5,     2,     5,     2,     5,     2,     5,     3,
       3,     3,     0,     0,     7,     1,     2,     0,     2,     2,
       1,     1,     1,     1,     7,    33,     3
};

/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
   means the default is an error.  */
static const unsigned char yydefact[] =
{
       0,     0,     0,     0,     0,     0,     0,     0,    12,    13,
      16,    14,    15,     1,     0,     0,     0,     0,   102,    22,
       0,     0,   105,     0,     2,     0,   107,     0,     0,    17,
       0,     0,     0,    11,   103,   109,   102,     0,   110,   112,
     111,   113,   108,   107,   102,   102,    22,    50,    45,    46,
      44,    21,     0,     0,     0,     0,     0,     0,     0,     0,
      23,    24,    25,    26,    27,    28,    29,    30,    10,     9,
       0,    72,     0,     0,   101,     0,     0,   106,    99,   100,
      18,    48,    49,    47,    37,    40,    38,    39,    41,    42,
      43,     0,    52,    56,    59,    62,    65,    70,     0,     0,
       0,     0,     0,     0,     0,     0,     0,    75,    76,    77,
      79,    78,    80,    81,    82,    11,     0,   116,     0,    31,
       0,     0,     0,     7,     0,     7,     0,     7,     0,     7,
       0,     0,     0,     0,    83,    85,    91,    89,    93,    95,
      97,    87,    73,     0,     0,    36,    51,     0,     0,     0,
       8,    57,     0,    60,     0,    63,     0,    66,     0,    69,
       0,    54,     0,     0,     0,     0,     0,     0,     0,     0,
       0,   107,     0,     0,    32,    53,    58,     0,     0,     5,
      61,    64,    67,     0,    71,    55,     0,     0,     0,     0,
       0,     0,     0,     0,   104,     0,     0,    34,    33,     0,
       0,     3,     0,    84,    86,    92,    90,    94,    96,    98,
      88,   114,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     6,     0,     0,     0,    35,     4,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,    68,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,   115
};

/* YYDEFGOTO[NTERM-NUM]. */
static const short yydefgoto[] =
{
      -1,     6,   150,   151,    70,     7,    15,    29,    30,    31,
      32,    60,    51,   145,   174,    91,    52,    61,    62,    63,
     123,    64,   125,    65,   127,    66,   129,    67,    18,    71,
      72,   107,   108,   109,   110,   111,   112,   113,   114,    24,
      25,    73,    26,    42,    27,    28,    43
};

/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
   STATE-NUM.  */
#define YYPACT_NINF -122
static const short yypact[] =
{
      43,   -27,    27,    52,    53,    54,    78,    23,  -122,  -122,
    -122,  -122,  -122,  -122,    62,    84,    57,    65,   -21,    61,
      59,    58,  -122,    68,  -122,    63,   -17,    64,    66,  -122,
      67,    26,    35,     1,  -122,  -122,   -21,    37,  -122,  -122,
    -122,  -122,  -122,   -17,   -21,   -21,    61,    75,  -122,  -122,
    -122,  -122,    42,    60,    69,    70,    71,    72,    73,    74,
    -122,  -122,  -122,  -122,  -122,  -122,  -122,  -122,  -122,  -122,
      28,  -122,    77,    83,  -122,    85,    80,  -122,  -122,  -122,
    -122,  -122,  -122,  -122,  -122,  -122,  -122,  -122,  -122,  -122,
    -122,    81,    45,    87,    88,    89,    90,    46,    50,    86,
      91,    92,    93,    95,    96,    97,    98,  -122,  -122,  -122,
    -122,  -122,  -122,  -122,  -122,     1,    79,  -122,    99,  -122,
     100,   101,   102,    76,   103,    76,   104,    76,   105,    76,
      -7,   106,   110,   108,    94,   116,   117,   118,   119,   120,
     121,   122,  -122,   124,   123,   107,  -122,   125,   126,    -8,
    -122,  -122,   127,  -122,   128,  -122,   129,  -122,   130,  -122,
     131,  -122,   132,   133,   134,   135,   136,   137,   138,   139,
     140,   -17,   141,    -6,  -122,  -122,  -122,   142,   -14,  -122,
    -122,  -122,  -122,   143,  -122,  -122,   150,   151,   152,   153,
     154,   155,   156,   157,  -122,    49,   158,  -122,  -122,   159,
     160,  -122,   161,  -122,  -122,  -122,  -122,  -122,  -122,  -122,
    -122,  -122,   162,   163,   164,   165,   166,   172,   168,   175,
     170,   171,   173,   178,  -122,   180,   176,   182,  -122,  -122,
     179,   181,   183,   185,   184,   186,   187,   190,   188,   189,
     191,   195,   192,   193,   194,   200,   196,   197,   198,   204,
     208,   201,  -122,   207,   203,   209,   205,   211,   210,   212,
     213,   214,   215,   216,  -122
};

/* YYPGOTO[NTERM-NUM].  */
static const yysigned_char yypgoto[] =
{
    -122,  -122,  -122,  -121,  -122,  -122,  -122,    51,  -122,  -122,
    -122,  -122,  -122,  -122,  -122,  -122,  -122,  -122,  -122,  -122,
    -122,  -122,  -122,  -122,  -122,  -122,  -122,  -122,  -122,   -15,
    -122,  -122,  -122,  -122,  -122,  -122,  -122,  -122,  -122,   -33,
    -122,  -122,  -122,   -43,  -122,  -122,  -122
};

/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
   positive, shift that token.  If negative, reduce the rule which
   number is the opposite.  If zero, do what YYDEFACT says.
   If YYTABLE_NINF, syntax error.  */
#define YYTABLE_NINF -75
static const short yytable[] =
{
      77,   -74,    21,    74,   153,     8,   155,    68,   157,    69,
      37,    78,    79,    22,    23,   200,    38,    39,    40,    41,
     158,   177,   201,   196,   -74,   178,    14,   197,   179,   159,
     198,    47,    48,    49,    50,   -74,   -74,    99,   100,   101,
     102,   103,   104,   105,   106,    53,    54,    55,    56,    57,
      58,    59,    84,    85,    86,    87,    88,    89,    90,     9,
       1,     2,     3,     4,     5,   -19,   -20,   -20,   -20,   -20,
      75,   120,   130,    76,   121,   131,   132,   211,    13,   133,
     212,    81,    82,    83,    10,    11,    12,    16,    17,    19,
      20,    33,    34,    35,    92,    36,    44,    80,    45,    46,
     142,     0,   149,    93,    94,    95,    96,    97,    98,   115,
     116,   118,   143,   117,     0,   119,   122,   124,   126,   128,
     134,     0,     0,   163,     0,   135,   136,   137,   194,   138,
     139,   140,   141,   173,     0,   144,   146,   147,   148,   152,
     154,   156,   160,   161,   162,   164,   165,   166,   167,   168,
     169,   170,   171,     0,   172,   175,   176,   180,   181,   182,
       0,   184,   185,     0,     0,     0,   183,     0,     0,   186,
     187,   188,   189,   190,   191,   192,   193,   195,   199,   202,
     203,   204,   205,   206,   207,   208,   209,   210,     0,     0,
       0,     0,     0,     0,   213,   214,   215,   216,   217,   218,
     219,   220,   221,   222,   223,   224,   225,   226,   228,   227,
     229,     0,   230,   231,     0,   232,   235,   233,     0,   234,
     236,   239,   237,   238,   240,   241,   243,   242,   244,   245,
     246,   247,   248,   249,   250,   251,   252,   253,   254,   255,
     256,   257,   258,   260,   264,   262,   259,     0,     0,   261,
       0,   263
};

static const short yycheck[] =
{
      43,     0,    23,    36,   125,    32,   127,     6,   129,     8,
      27,    44,    45,    34,    35,    29,    33,    34,    35,    36,
      27,    29,    36,    29,    23,    33,     3,    33,    36,    36,
      36,     5,     6,     7,     8,    34,    35,     9,    10,    11,
      12,    13,    14,    15,    16,    10,    11,    12,    13,    14,
      15,    16,    10,    11,    12,    13,    14,    15,    16,    32,
      17,    18,    19,    20,    21,     4,     5,     6,     7,     8,
      33,    26,    26,    36,    29,    29,    26,    28,     0,    29,
      31,     6,     7,     8,    32,    32,    32,    25,     4,    32,
      25,    32,    34,    25,    34,    32,    32,    46,    32,    32,
     115,    -1,    26,    34,    34,    34,    34,    34,    34,    32,
      27,    31,    33,    28,    -1,    34,    29,    29,    29,    29,
      34,    -1,    -1,    29,    -1,    34,    34,    34,   171,    34,
      34,    34,    34,    26,    -1,    36,    36,    36,    36,    36,
      36,    36,    36,    33,    36,    29,    29,    29,    29,    29,
      29,    29,    28,    -1,    31,    30,    30,    30,    30,    30,
      -1,    30,    30,    -1,    -1,    -1,    36,    -1,    -1,    36,
      36,    36,    36,    36,    36,    36,    36,    36,    36,    36,
      30,    30,    30,    30,    30,    30,    30,    30,    -1,    -1,
      -1,    -1,    -1,    -1,    36,    36,    36,    36,    36,    36,
      36,    36,    36,    31,    36,    30,    36,    36,    30,    36,
      30,    -1,    36,    31,    -1,    36,    31,    36,    -1,    36,
      36,    31,    36,    36,    36,    36,    31,    36,    36,    36,
      36,    31,    36,    36,    36,    31,    28,    36,    31,    36,
      31,    36,    31,    31,    28,    31,    36,    -1,    -1,    36,
      -1,    36
};

/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
   symbol of state STATE-NUM.  */
static const unsigned char yystos[] =
{
       0,    17,    18,    19,    20,    21,    38,    42,    32,    32,
      32,    32,    32,     0,     3,    43,    25,     4,    65,    32,
      25,    23,    34,    35,    76,    77,    79,    81,    82,    44,
      45,    46,    47,    32,    34,    25,    32,    27,    33,    34,
      35,    36,    80,    83,    32,    32,    32,     5,     6,     7,
       8,    49,    53,    10,    11,    12,    13,    14,    15,    16,
      48,    54,    55,    56,    58,    60,    62,    64,     6,     8,
      41,    66,    67,    78,    76,    33,    36,    80,    76,    76,
      44,     6,     7,     8,    10,    11,    12,    13,    14,    15,
      16,    52,    34,    34,    34,    34,    34,    34,    34,     9,
      10,    11,    12,    13,    14,    15,    16,    68,    69,    70,
      71,    72,    73,    74,    75,    32,    27,    28,    31,    34,
      26,    29,    29,    57,    29,    59,    29,    61,    29,    63,
      26,    29,    26,    29,    34,    34,    34,    34,    34,    34,
      34,    34,    66,    33,    36,    50,    36,    36,    36,    26,
      39,    40,    36,    40,    36,    40,    36,    40,    27,    36,
      36,    33,    36,    29,    29,    29,    29,    29,    29,    29,
      29,    28,    31,    26,    51,    30,    30,    29,    33,    36,
      30,    30,    30,    36,    30,    30,    36,    36,    36,    36,
      36,    36,    36,    36,    80,    36,    29,    33,    36,    36,
      29,    36,    36,    30,    30,    30,    30,    30,    30,    30,
      30,    28,    31,    36,    36,    36,    36,    36,    36,    36,
      36,    36,    31,    36,    30,    36,    36,    36,    30,    30,
      36,    31,    36,    36,    36,    31,    36,    36,    36,    31,
      36,    36,    36,    31,    36,    36,    36,    31,    36,    36,
      36,    31,    28,    36,    31,    36,    31,    36,    31,    36,
      31,    36,    31,    36,    28
};

#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
#endif
#if ! defined (YYSIZE_T) && defined (size_t)
# define YYSIZE_T size_t
#endif
#if ! defined (YYSIZE_T)
# if defined (__STDC__) || defined (__cplusplus)
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# endif
#endif
#if ! defined (YYSIZE_T)
# define YYSIZE_T unsigned int
#endif

#define yyerrok		(yyerrstatus = 0)
#define yyclearin	(yychar = YYEMPTY)
#define YYEMPTY		(-2)
#define YYEOF		0

#define YYACCEPT	goto yyacceptlab
#define YYABORT		goto yyabortlab
#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);						\
      yytoken = YYTRANSLATE (yychar);				\
      YYPOPSTACK;						\
      goto yybackup;						\
    }								\
  else								\
    { 								\
      yyerror ("syntax error: cannot back up");\
      YYERROR;							\
    }								\
while (0)

#define YYTERROR	1
#define YYERRCODE	256

/* YYLLOC_DEFAULT -- Compute the default location (before the actions
   are run).  */

#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N)         \
  Current.first_line   = Rhs[1].first_line;      \
  Current.first_column = Rhs[1].first_column;    \
  Current.last_line    = Rhs[N].last_line;       \
  Current.last_column  = Rhs[N].last_column;
#endif

/* YYLEX -- calling `yylex' with the right arguments.  */

#ifdef YYLEX_PARAM
# define YYLEX yylex (YYLEX_PARAM)
#else
# define YYLEX yylex ()
#endif

/* Enable debugging if requested.  */
#if YYDEBUG

# ifndef YYFPRINTF
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
#  define YYFPRINTF fprintf
# endif

# define YYDPRINTF(Args)			\
do {						\
  if (yydebug)					\
    YYFPRINTF Args;				\
} while (0)

# define YYDSYMPRINT(Args)			\
do {						\
  if (yydebug)					\
    yysymprint Args;				\
} while (0)

# define YYDSYMPRINTF(Title, Token, Value, Location)		\
do {								\
  if (yydebug)							\
    {								\
      YYFPRINTF (stderr, "%s ", Title);				\
      yysymprint (stderr, 					\
                  Token, Value);	\
      YYFPRINTF (stderr, "\n");					\
    }								\
} while (0)

/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (cinluded).                                                   |
`------------------------------------------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yy_stack_print (short *bottom, short *top)
#else
static void
yy_stack_print (bottom, top)
    short *bottom;
    short *top;
#endif
{
  YYFPRINTF (stderr, "Stack now");
  for (/* Nothing. */; bottom <= top; ++bottom)
    YYFPRINTF (stderr, " %d", *bottom);
  YYFPRINTF (stderr, "\n");
}

# define YY_STACK_PRINT(Bottom, Top)				\
do {								\
  if (yydebug)							\
    yy_stack_print ((Bottom), (Top));				\
} while (0)


/*------------------------------------------------.
| Report that the YYRULE is going to be reduced.  |
`------------------------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yy_reduce_print (int yyrule)
#else
static void
yy_reduce_print (yyrule)
    int yyrule;
#endif
{
  int yyi;
  unsigned int yylineno = yyrline[yyrule];
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
             yyrule - 1, yylineno);
  /* Print the symbols being reduced, and their result.  */
  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
}

# define YY_REDUCE_PRINT(Rule)		\
do {					\
  if (yydebug)				\
    yy_reduce_print (Rule);		\
} while (0)

/* Nonzero means print parse trace.  It is left uninitialized so that
   multiple parsers can coexist.  */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YYDSYMPRINT(Args)
# define YYDSYMPRINTF(Title, Token, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */


/* YYINITDEPTH -- initial size of the parser's stacks.  */
#ifndef	YYINITDEPTH
# define YYINITDEPTH 200
#endif

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

   Do not make this value too large; the results are undefined if
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
   evaluated with infinite-precision integer arithmetic.  */

#if YYMAXDEPTH == 0
# undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif



#if YYERROR_VERBOSE

# ifndef yystrlen
#  if defined (__GLIBC__) && defined (_STRING_H)
#   define yystrlen strlen
#  else
/* Return the length of YYSTR.  */
static YYSIZE_T
#   if defined (__STDC__) || defined (__cplusplus)
yystrlen (const char *yystr)
#   else
yystrlen (yystr)
     const char *yystr;
#   endif
{
  register const char *yys = yystr;

  while (*yys++ != '\0')
    continue;

  return yys - yystr - 1;
}
#  endif
# endif

# ifndef yystpcpy
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
#   define yystpcpy stpcpy
#  else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   YYDEST.  */
static char *
#   if defined (__STDC__) || defined (__cplusplus)
yystpcpy (char *yydest, const char *yysrc)
#   else
yystpcpy (yydest, yysrc)
     char *yydest;
     const char *yysrc;
#   endif
{
  register char *yyd = yydest;
  register const char *yys = yysrc;

  while ((*yyd++ = *yys++) != '\0')
    continue;

  return yyd - 1;
}
#  endif
# endif

#endif /* !YYERROR_VERBOSE */



#if YYDEBUG
/*--------------------------------.
| Print this symbol on YYOUTPUT.  |
`--------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
#else
static void
yysymprint (yyoutput, yytype, yyvaluep)
    FILE *yyoutput;
    int yytype;
    YYSTYPE *yyvaluep;
#endif
{
  /* Pacify ``unused variable'' warnings.  */
  (void) yyvaluep;

  if (yytype < YYNTOKENS)
    {
      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
# ifdef YYPRINT
      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# endif
    }
  else
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);

  switch (yytype)
    {
      default:
        break;
    }
  YYFPRINTF (yyoutput, ")");
}

#endif /* ! YYDEBUG */
/*-----------------------------------------------.
| Release the memory associated to this symbol.  |
`-----------------------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yydestruct (int yytype, YYSTYPE *yyvaluep)
#else
static void
yydestruct (yytype, yyvaluep)
    int yytype;
    YYSTYPE *yyvaluep;
#endif
{
  /* Pacify ``unused variable'' warnings.  */
  (void) yyvaluep;

  switch (yytype)
    {

      default:
        break;
    }
}


/* Prevent warnings from -Wmissing-prototypes.  */

#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
int yyparse (void *YYPARSE_PARAM);
# else
int yyparse ();
# endif
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
int yyparse (void);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */



/* The lookahead symbol.  */
int yychar;

/* The semantic value of the lookahead symbol.  */
YYSTYPE yylval;

/* Number of syntax errors so far.  */
int yynerrs;



/*----------.
| yyparse.  |
`----------*/

#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
int yyparse (void *YYPARSE_PARAM)
# else
int yyparse (YYPARSE_PARAM)
  void *YYPARSE_PARAM;
# endif
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
int
yyparse (void)
#else
int
yyparse ()

#endif
#endif
{
  
  register int yystate;
  register int yyn;
  int yyresult;
  /* Number of tokens to shift before error messages enabled.  */
  int yyerrstatus;
  /* Lookahead token as an internal (translated) token number.  */
  int yytoken = 0;

  /* Three stacks and their tools:
     `yyss': related to states,
     `yyvs': related to semantic values,
     `yyls': related to locations.

     Refer to the stacks thru separate pointers, to allow yyoverflow
     to reallocate them elsewhere.  */

  /* The state stack.  */
  short	yyssa[YYINITDEPTH];
  short *yyss = yyssa;
  register short *yyssp;

  /* The semantic value stack.  */
  YYSTYPE yyvsa[YYINITDEPTH];
  YYSTYPE *yyvs = yyvsa;
  register YYSTYPE *yyvsp;



#define YYPOPSTACK   (yyvsp--, yyssp--)

  YYSIZE_T yystacksize = YYINITDEPTH;

  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;


  /* When reducing, the number of symbols on the RHS of the reduced
     rule.  */
  int yylen;

  YYDPRINTF ((stderr, "Starting parse\n"));

  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;
  yyvsp = yyvs;

  goto yysetstate;

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

 yysetstate:
  *yyssp = yystate;

  if (yyss + yystacksize - 1 <= yyssp)
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYSIZE_T yysize = yyssp - yyss + 1;

#ifdef yyoverflow
      {
	/* 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;


	/* Each stack pointer address is followed by the size of the
	   data in use in that stack, in bytes.  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, yysize * sizeof (*yyssp),
		    &yyvs1, yysize * sizeof (*yyvsp),

		    &yystacksize);

	yyss = yyss1;
	yyvs = yyvs1;
      }
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
      goto yyoverflowlab;
# else
      /* Extend the stack our own way.  */
      if (YYMAXDEPTH <= yystacksize)
	goto yyoverflowlab;
      yystacksize *= 2;
      if (YYMAXDEPTH < yystacksize)
	yystacksize = YYMAXDEPTH;

      {
	short *yyss1 = yyss;
	union yyalloc *yyptr =
	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
	if (! yyptr)
	  goto yyoverflowlab;
	YYSTACK_RELOCATE (yyss);
	YYSTACK_RELOCATE (yyvs);

#  undef YYSTACK_RELOCATE
	if (yyss1 != yyssa)
	  YYSTACK_FREE (yyss1);
      }
# endif
#endif /* no yyoverflow */

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;


      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
		  (unsigned long int) yystacksize));

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

  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

  goto yybackup;

/*-----------.
| 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 == YYPACT_NINF)
    goto yydefault;

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

  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = YYLEX;
    }

  if (yychar <= YYEOF)
    {
      yychar = yytoken = YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
    }

  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yyn == 0 || yyn == YYTABLE_NINF)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));

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

  *++yyvsp = yylval;


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

  yystate = yyn;
  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- Do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     `$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];


  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
        case 3:
#line 159 "sdr.y"
    {
				currentParameter->space						=	strdup(yyvsp[-1].string);
				currentParameter->defaultValue.vector		=	new float[3];
				currentParameter->defaultValue.vector[0]	=	yyvsp[0].real;
				currentParameter->defaultValue.vector[1]	=	yyvsp[0].real;
				currentParameter->defaultValue.vector[2]	=	yyvsp[0].real;
			;}
    break;

  case 4:
#line 174 "sdr.y"
    {
				currentParameter->space						=	strdup(yyvsp[-5].string);
				currentParameter->defaultValue.vector		=	new float[3];
				currentParameter->defaultValue.vector[0]	=	yyvsp[-3].real;
				currentParameter->defaultValue.vector[1]	=	yyvsp[-2].real;
				currentParameter->defaultValue.vector[2]	=	yyvsp[-1].real;
			;}
    break;

  case 5:
#line 184 "sdr.y"
    {
				currentParameter->defaultValue.vector		=	new float[3];
				currentParameter->defaultValue.vector[0]	=	yyvsp[0].real;
				currentParameter->defaultValue.vector[1]	=	yyvsp[0].real;
				currentParameter->defaultValue.vector[2]	=	yyvsp[0].real;
			;}
    break;

  case 6:
#line 197 "sdr.y"
    {
				currentParameter->defaultValue.vector		=	new float[3];
				currentParameter->defaultValue.vector[0]	=	yyvsp[-3].real;
				currentParameter->defaultValue.vector[1]	=	yyvsp[-2].real;
				currentParameter->defaultValue.vector[2]	=	yyvsp[-1].real;
			;}
    break;

  case 7:
#line 204 "sdr.y"
    {
				currentParameter->defaultValue.vector		=	NULL;
			;}
    break;

  case 8:
#line 210 "sdr.y"
    {
			;}
    break;

  case 9:
#line 215 "sdr.y"
    {
				;}
    break;

  case 10:
#line 219 "sdr.y"
    {
				;}
    break;

  case 11:
#line 222 "sdr.y"
    {
				;}
    break;

  case 12:
#line 229 "sdr.y"
    {
			shaderType	=	SHADER_SURFACE;
		;}
    break;

  case 13:
#line 235 "sdr.y"
    {
			shaderType	=	SHADER_DISPLACEMENT;
		;}
    break;

  case 14:
#line 241 "sdr.y"
    {
			shaderType	=	SHADER_LIGHT;
		;}
    break;

  case 15:
#line 247 "sdr.y"
    {
			shaderType	=	SHADER_VOLUME;
		;}
    break;

  case 16:
#line 253 "sdr.y"
    {
			shaderType	=	SHADER_IMAGER;
		;}
    break;

  case 18:
#line 269 "sdr.y"
    {
		;}
    break;

  case 19:
#line 272 "sdr.y"
    {
		;}
    break;

  case 20:
#line 277 "sdr.y"
    {
			currentParameter						=	new TSdrParameter;
			currentParameter->space					=	NULL;
			currentParameter->numItems				=	1;
			currentParameter->defaultValue.string	=	NULL;
		;}
    break;

  case 21:
#line 284 "sdr.y"
    {
			currentParameter->next	=	parameters;
			parameters				=	currentParameter;
		;}
    break;

  case 22:
#line 289 "sdr.y"
    {
			currentParameter						=	new TSdrParameter;
			currentParameter->space					=	NULL;
			currentParameter->numItems				=	1;
			currentParameter->defaultValue.string	=	NULL;
		;}
    break;

  case 23:
#line 296 "sdr.y"
    {
			currentParameter->next	=	parameters;
			parameters				=	currentParameter;
		;}
    break;

  case 31:
#line 322 "sdr.y"
    {
			currentParameter->name					=	strdup(yyvsp[0].string);
		;}
    break;

  case 32:
#line 326 "sdr.y"
    {
		;}
    break;

  case 33:
#line 334 "sdr.y"
    {
			currentParameter->defaultValue.scalar	=	yyvsp[0].real;
		;}
    break;

  case 34:
#line 340 "sdr.y"
    {
			currentParameter->defaultValue.string	=	strdup(yyvsp[0].string);
		;}
    break;

  case 35:
#line 350 "sdr.y"
    {
			currentParameter->defaultValue.vector		=	new float[3];
			currentParameter->defaultValue.vector[0]	=	yyvsp[-3].real;
			currentParameter->defaultValue.vector[1]	=	yyvsp[-2].real;
			currentParameter->defaultValue.vector[2]	=	yyvsp[-1].real;
		;}
    break;

  case 36:
#line 357 "sdr.y"
    {
			currentParameter->defaultValue.string	=	NULL;
		;}
    break;

  case 37:
#line 364 "sdr.y"
    {
			currentParameter->type	=	TYPE_FLOAT;
		;}
    break;

  case 38:
#line 369 "sdr.y"
    {
			currentParameter->type	=	TYPE_VECTOR;
		;}
    break;

  case 39:
#line 374 "sdr.y"
    {
			currentParameter->type	=	TYPE_NORMAL;
		;}
    break;

  case 40:
#line 379 "sdr.y"
    {
			currentParameter->type	=	TYPE_COLOR;
		;}
    break;

  case 41:
#line 384 "sdr.y"
    {
			currentParameter->type	=	TYPE_POINT;
		;}
    break;

  case 42:
#line 389 "sdr.y"
    {
			currentParameter->type	=	TYPE_MATRIX;
		;}
    break;

  case 43:
#line 394 "sdr.y"
    {
			currentParameter->type	=	TYPE_STRING;
		;}
    break;

  case 44:
#line 401 "sdr.y"
    {
			currentParameter->container	=	CONTAINER_UNIFORM;
		;}
    break;

  case 45:
#line 406 "sdr.y"
    {
			currentParameter->container	=	CONTAINER_VARYING;
		;}
    break;

  case 46:
#line 411 "sdr.y"
    {
			currentParameter->container	=	CONTAINER_VERTEX;
		;}
    break;

  case 47:
#line 417 "sdr.y"
    {
			currentParameter->container	=	CONTAINER_UNIFORM;
		;}
    break;

  case 48:
#line 423 "sdr.y"
    {
			currentParameter->container	=	CONTAINER_VARYING;
		;}
    break;

  case 49:
#line 429 "sdr.y"
    {
			currentParameter->container	=	CONTAINER_VERTEX;
		;}
    break;

  case 50:
#line 434 "sdr.y"
    {
			currentParameter->container	=	CONTAINER_UNIFORM;
		;}
    break;

  case 51:
#line 444 "sdr.y"
    {
			currentParameter->container				=	CONTAINER_UNIFORM;
			currentParameter->type					=	TYPE_FLOAT;
			currentParameter->name					=	strdup(yyvsp[-2].string);
			currentParameter->defaultValue.scalar	=	yyvsp[0].real;
			currentParameter->numItems				=	1;
		;}
    break;

  case 52:
#line 454 "sdr.y"
    {
			currentParameter->container				=	CONTAINER_UNIFORM;
			currentParameter->type					=	TYPE_FLOAT;
			currentParameter->name					=	strdup(yyvsp[0].string);
			currentParameter->defaultValue.scalar	=	0;
			currentParameter->numItems				=	1;
		;}
    break;

  case 53:
#line 467 "sdr.y"
    {
			currentParameter->container				=	CONTAINER_UNIFORM;
			currentParameter->type					=	TYPE_FLOAT;
			currentParameter->name					=	strdup(yyvsp[-3].string);
			currentParameter->defaultValue.scalar	=	0;
			currentParameter->numItems				=	(int) yyvsp[-1].real;
		;}
    break;

  case 54:
#line 481 "sdr.y"
    {
			currentParameter->container				=	CONTAINER_UNIFORM;
			currentParameter->type					=	TYPE_STRING;
			currentParameter->name					=	strdup(yyvsp[-2].string);
			currentParameter->defaultValue.string	=	strdup(yyvsp[0].string);
			currentParameter->numItems				=	1;
		;}
    break;

  case 55:
#line 494 "sdr.y"
    {
			currentParameter->container				=	CONTAINER_UNIFORM;
			currentParameter->type					=	TYPE_STRING;
			currentParameter->name					=	strdup(yyvsp[-3].string);
			currentParameter->defaultValue.string	=	NULL;
			currentParameter->numItems				=	(int) yyvsp[-1].real;
		;}
    break;

  case 56:
#line 506 "sdr.y"
    {
			currentParameter->container				=	CONTAINER_UNIFORM;
			currentParameter->type					=	TYPE_COLOR;
			currentParameter->name					=	strdup(yyvsp[0].string);
			currentParameter->numItems				=	1;
		;}
    break;

  case 57:
#line 513 "sdr.y"
    {
		;}
    break;

  case 58:
#line 521 "sdr.y"
    {
			currentParameter->container				=	CONTAINER_UNIFORM;
			currentParameter->type					=	TYPE_COLOR;
			currentParameter->name					=	strdup(yyvsp[-3].string);
			currentParameter->defaultValue.scalar	=	0;
			currentParameter->numItems				=	(int) yyvsp[-1].real;
		;}
    break;

  case 59:
#line 533 "sdr.y"
    {
			currentParameter->container				=	CONTAINER_UNIFORM;
			currentParameter->type					=	TYPE_VECTOR;
			currentParameter->name					=	strdup(yyvsp[0].string);
			currentParameter->numItems				=	1;
		;}
    break;

  case 60:
#line 540 "sdr.y"
    {
		;}
    break;

  case 61:
#line 548 "sdr.y"
    {
			currentParameter->container				=	CONTAINER_UNIFORM;
			currentParameter->type					=	TYPE_VECTOR;
			currentParameter->name					=	strdup(yyvsp[-3].string);
			currentParameter->defaultValue.scalar	=	0;
			currentParameter->numItems				=	(int) yyvsp[-1].real;
		;}
    break;

  case 62:
#line 560 "sdr.y"
    {
			currentParameter->container				=	CONTAINER_UNIFORM;
			currentParameter->type					=	TYPE_NORMAL;
			currentParameter->name					=	strdup(yyvsp[0].string);
			currentParameter->numItems				=	1;
		;}
    break;

  case 63:
#line 567 "sdr.y"
    {
		;}
    break;

  case 64:
#line 575 "sdr.y"
    {
			currentParameter->container				=	CONTAINER_UNIFORM;
			currentParameter->type					=	TYPE_NORMAL;
			currentParameter->name					=	strdup(yyvsp[-3].string);
			currentParameter->defaultValue.scalar	=	0;
			currentParameter->numItems				=	(int) yyvsp[-1].real;
		;}
    break;

  case 65:
#line 587 "sdr.y"
    {
			currentParameter->container				=	CONTAINER_UNIFORM;
			currentParameter->type					=	TYPE_POINT;
			currentParameter->name					=	strdup(yyvsp[0].string);
			currentParameter->numItems				=	1;
		;}
    break;

  case 66:
#line 594 "sdr.y"
    {
		;}
    break;

  case 67:
#line 602 "sdr.y"
    {
			currentParameter->container				=	CONTAINER_UNIFORM;
			currentParameter->type					=	TYPE_POINT;
			currentParameter->name					=	strdup(yyvsp[-3].string);
			currentParameter->defaultValue.scalar	=	0;
			currentParameter->numItems				=	(int) yyvsp[-1].real;
		;}
    break;

  case 68:
#line 633 "sdr.y"
    {
			currentParameter->container					=	CONTAINER_UNIFORM;
			currentParameter->type						=	TYPE_MATRIX;
			currentParameter->name						=	strdup(yyvsp[-19].string);
			currentParameter->defaultValue.matrix		=	new float[16];
			currentParameter->defaultValue.matrix[0]	=	yyvsp[-16].real;
			currentParameter->defaultValue.matrix[1]	=	yyvsp[-15].real;
			currentParameter->defaultValue.matrix[2]	=	yyvsp[-14].real;
			currentParameter->defaultValue.matrix[3]	=	yyvsp[-13].real;
			currentParameter->defaultValue.matrix[4]	=	yyvsp[-12].real;
			currentParameter->defaultValue.matrix[5]	=	yyvsp[-11].real;
			currentParameter->defaultValue.matrix[6]	=	yyvsp[-10].real;
			currentParameter->defaultValue.matrix[7]	=	yyvsp[-9].real;
			currentParameter->defaultValue.matrix[8]	=	yyvsp[-8].real;
			currentParameter->defaultValue.matrix[9]	=	yyvsp[-7].real;
			currentParameter->defaultValue.matrix[10]	=	yyvsp[-6].real;
			currentParameter->defaultValue.matrix[11]	=	yyvsp[-5].real;
			currentParameter->defaultValue.matrix[12]	=	yyvsp[-4].real;
			currentParameter->defaultValue.matrix[13]	=	yyvsp[-3].real;
			currentParameter->defaultValue.matrix[14]	=	yyvsp[-2].real;
			currentParameter->defaultValue.matrix[15]	=	yyvsp[-1].real;
			currentParameter->numItems					=	1;
		;}
    break;

  case 69:
#line 661 "sdr.y"
    {
			currentParameter->container					=	CONTAINER_UNIFORM;
			currentParameter->type						=	TYPE_MATRIX;
			currentParameter->name						=	strdup(yyvsp[-2].string);
			currentParameter->defaultValue.matrix		=	new float[16];
			currentParameter->defaultValue.matrix[0]	=	yyvsp[0].real;
			currentParameter->defaultValue.matrix[1]	=	0;
			currentParameter->defaultValue.matrix[2]	=	0;
			currentParameter->defaultValue.matrix[3]	=	0;
			currentParameter->defaultValue.matrix[4]	=	0;
			currentParameter->defaultValue.matrix[5]	=	yyvsp[0].real;
			currentParameter->defaultValue.matrix[6]	=	0;
			currentParameter->defaultValue.matrix[7]	=	0;
			currentParameter->defaultValue.matrix[8]	=	0;
			currentParameter->defaultValue.matrix[9]	=	0;
			currentParameter->defaultValue.matrix[10]	=	yyvsp[0].real;
			currentParameter->defaultValue.matrix[11]	=	0;
			currentParameter->defaultValue.matrix[12]	=	0;
			currentParameter->defaultValue.matrix[13]	=	0;
			currentParameter->defaultValue.matrix[14]	=	0;
			currentParameter->defaultValue.matrix[15]	=	yyvsp[0].real;
			currentParameter->numItems					=	1;
		;}
    break;

  case 70:
#line 687 "sdr.y"
    {
			currentParameter->container					=	CONTAINER_UNIFORM;
			currentParameter->type						=	TYPE_MATRIX;
			currentParameter->name						=	strdup(yyvsp[0].string);
			currentParameter->defaultValue.matrix		=	new float[16];
			currentParameter->defaultValue.matrix[0]	=	1;
			currentParameter->defaultValue.matrix[1]	=	0;
			currentParameter->defaultValue.matrix[2]	=	0;
			currentParameter->defaultValue.matrix[3]	=	0;
			currentParameter->defaultValue.matrix[4]	=	0;
			currentParameter->defaultValue.matrix[5]	=	1;
			currentParameter->defaultValue.matrix[6]	=	0;
			currentParameter->defaultValue.matrix[7]	=	0;
			currentParameter->defaultValue.matrix[8]	=	0;
			currentParameter->defaultValue.matrix[9]	=	0;
			currentParameter->defaultValue.matrix[10]	=	1;
			currentParameter->defaultValue.matrix[11]	=	0;
			currentParameter->defaultValue.matrix[12]	=	0;
			currentParameter->defaultValue.matrix[13]	=	0;
			currentParameter->defaultValue.matrix[14]	=	0;
			currentParameter->defaultValue.matrix[15]	=	1;
			currentParameter->numItems					=	1;
		;}
    break;

  case 71:
#line 716 "sdr.y"
    {
			currentParameter->container					=	CONTAINER_UNIFORM;
			currentParameter->type						=	TYPE_MATRIX;
			currentParameter->name						=	strdup(yyvsp[-3].string);
			currentParameter->defaultValue.scalar		=	0;
			currentParameter->numItems					=	(int) yyvsp[-1].real;
		;}
    break;

  case 83:
#line 768 "sdr.y"
    {
		;}
    break;

  case 84:
#line 776 "sdr.y"
    {
		;}
    break;

  case 85:
#line 784 "sdr.y"
    {
		;}
    break;

  case 86:
#line 792 "sdr.y"
    {
		;}
    break;

  case 87:
#line 799 "sdr.y"
    {
		;}
    break;

  case 88:
#line 807 "sdr.y"
    {
		;}
    break;

  case 89:
#line 814 "sdr.y"
    {
		;}
    break;

  case 90:
#line 822 "sdr.y"
    {
		;}
    break;

  case 91:
#line 829 "sdr.y"
    {
		;}
    break;

  case 92:
#line 837 "sdr.y"
    {
		;}
    break;

  case 93:
#line 844 "sdr.y"
    {
		;}
    break;

  case 94:
#line 852 "sdr.y"
    {
		;}
    break;

  case 95:
#line 859 "sdr.y"
    {
		;}
    break;

  case 96:
#line 867 "sdr.y"
    {
		;}
    break;

  case 97:
#line 874 "sdr.y"
    {
		;}
    break;

  case 98:
#line 882 "sdr.y"
    {
		;}
    break;

  case 103:
#line 904 "sdr.y"
    {
		;}
    break;

  case 104:
#line 910 "sdr.y"
    {
		;}
    break;

  case 105:
#line 916 "sdr.y"
    {
		;}
    break;

  case 106:
#line 923 "sdr.y"
    {
		;}
    break;

  case 107:
#line 926 "sdr.y"
    {
		;}
    break;

  case 108:
#line 933 "sdr.y"
    {
		;}
    break;

  case 109:
#line 940 "sdr.y"
    {
		;}
    break;

  case 110:
#line 946 "sdr.y"
    {
		;}
    break;

  case 111:
#line 950 "sdr.y"
    {
		;}
    break;

  case 112:
#line 954 "sdr.y"
    {
		;}
    break;

  case 113:
#line 958 "sdr.y"
    {
		;}
    break;

  case 114:
#line 968 "sdr.y"
    {
		;}
    break;

  case 115:
#line 1004 "sdr.y"
    {
		;}
    break;

  case 116:
#line 1010 "sdr.y"
    {
		;}
    break;


    }

/* Line 999 of yacc.c.  */
#line 2118 "sdr.cpp"

  yyvsp -= yylen;
  yyssp -= yylen;


  YY_STACK_PRINT (yyss, yyssp);

  *++yyvsp = yyval;


  /* 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 - YYNTOKENS] + *yyssp;
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTOKENS];

  goto yynewstate;


/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
#if YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (YYPACT_NINF < yyn && yyn < YYLAST)
	{
	  YYSIZE_T yysize = 0;
	  int yytype = YYTRANSLATE (yychar);
	  char *yymsg;
	  int yyx, yycount;

	  yycount = 0;
	  /* Start YYX at -YYN if negative to avoid negative indexes in
	     YYCHECK.  */
	  for (yyx = yyn < 0 ? -yyn : 0;
	       yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
	    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
	      yysize += yystrlen (yytname[yyx]) + 15, yycount++;
	  yysize += yystrlen ("syntax error, unexpected ") + 1;
	  yysize += yystrlen (yytname[yytype]);
	  yymsg = (char *) YYSTACK_ALLOC (yysize);
	  if (yymsg != 0)
	    {
	      char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
	      yyp = yystpcpy (yyp, yytname[yytype]);

	      if (yycount < 5)
		{
		  yycount = 0;
		  for (yyx = yyn < 0 ? -yyn : 0;
		       yyx < (int) (sizeof (yytname) / sizeof (char *));
		       yyx++)
		    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
		      {
			const char *yyq = ! yycount ? ", expecting " : " or ";
			yyp = yystpcpy (yyp, yyq);
			yyp = yystpcpy (yyp, yytname[yyx]);
			yycount++;
		      }
		}
	      yyerror (yymsg);
	      YYSTACK_FREE (yymsg);
	    }
	  else
	    yyerror ("syntax error; also virtual memory exhausted");
	}
      else
#endif /* YYERROR_VERBOSE */
	yyerror ("syntax error");
    }



  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)
        {
	  /* Pop the error token.  */
          YYPOPSTACK;
	  /* Pop the rest of the stack.  */
	  while (yyss < yyssp)
	    {
	      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
	      yydestruct (yystos[*yyssp], yyvsp);
	      YYPOPSTACK;
	    }
	  YYABORT;
        }

      YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
      yydestruct (yytoken, &yylval);
      yychar = YYEMPTY;

    }

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


/*----------------------------------------------------.
| yyerrlab1 -- error raised explicitly by an action.  |
`----------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;	/* Each real token shifted decrements this.  */

  for (;;)
    {
      yyn = yypact[yystate];
      if (yyn != YYPACT_NINF)
	{
	  yyn += YYTERROR;
	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
	    {
	      yyn = yytable[yyn];
	      if (0 < yyn)
		break;
	    }
	}

      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
	YYABORT;

      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
      yydestruct (yystos[yystate], yyvsp);
      yyvsp--;
      yystate = *--yyssp;

      YY_STACK_PRINT (yyss, yyssp);
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  YYDPRINTF ((stderr, "Shifting error token, "));

  *++yyvsp = yylval;


  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;

/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;

#ifndef yyoverflow
/*----------------------------------------------.
| yyoverflowlab -- parser overflow comes here.  |
`----------------------------------------------*/
yyoverflowlab:
  yyerror ("parser stack overflow");
  yyresult = 2;
  /* Fall through.  */
#endif

yyreturn:
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
  return yyresult;
}


#line 1014 "sdr.y"

#include "lex.sdr.cpp"

int	slLineno	=	0;

///////////////////////////////////////////////////////////////////////
// Function				:	slerror
// Description			:	Parser error function
// Return Value			:
// Comments				:
// Date last edited		:	5/20/2003
void			sdrerror(char *s) {
}


///////////////////////////////////////////////////////////////////////
// Function				:	sdrGet
// Description			:	Parse a shader
// Return Value			:
// Comments				:
// Date last edited		:	5/20/2003
TSdrShader		*sdrGet(const char *in,const char *searchpath) {
	TSdrShader		*cShader;
	char			tmp[512];
	const	char	*currentPath;
	char			*dest;

	memoryManagerInit();

	sdrin	=	NULL;

	if (searchpath != NULL) {
		for (dest=tmp,currentPath=searchpath;;) {
			if ((*currentPath == '\0') || (*currentPath == ':')) {		// End of the current path

				if ((dest - tmp) > 0) {		// Do we have anything to record ?
					dest--;

					if ((*dest == '/') || (*dest == '\\')) {	// The last character has to be a slash
						dest++;
					} else {
						dest++;
						*dest++	=	'/';
					}

					sprintf(dest,in);
					if (strstr(dest,".sdr") == NULL) {
						strcat(dest,".sdr");
					}

					osFixSlashes(tmp);

					if (strncmp(tmp,"\\\\",2) == 0) {
						tmp[1]	=	tmp[2];
						tmp[2]	=	':';
						tmp[3]	=	'\\';

						sdrin	=	fopen(tmp+1,"r");
					} else {
						sdrin	=	fopen(tmp,"r");
					}

					if (sdrin != NULL)	break;
				}

				dest			=	tmp;

				if (*currentPath == '\0')	break;

				currentPath++;
			} else if (*currentPath == '%') {
				const	char	*endOfCurrentPath	=	strchr(currentPath+1,'%');
				char			environmentVariable[OS_MAX_PATH_LENGTH];

				if (endOfCurrentPath!=NULL) {
					const	int		environmentLength	=	endOfCurrentPath - currentPath - 1;
					const	char	*value;

					strncpy(environmentVariable,currentPath+1,environmentLength);
					environmentVariable[environmentLength]	=	'\0';

					value		=	osEnvironment(environmentVariable);
					if (value != NULL) {
						strcpy(dest,value);
						dest	+=	strlen(value);
					}

					currentPath	=	endOfCurrentPath+1;
				} else {
					currentPath++;
				}
			} else if ((*currentPath == '@') || (*currentPath == '&')) {
				currentPath++;
			} else {
				*dest++	=	*currentPath++;
			}
		}
	} else {
		sdrin	=	fopen(in,"r");
	}

	if (sdrin == NULL)	return NULL;

	parameters	=	NULL;

	sdrparse();

	fclose(sdrin);

	cShader	=	new TSdrShader;

	cShader->name		=	strdup(in);
	cShader->type		=	shaderType;
	cShader->parameters	=	parameters;

	return cShader;
}

///////////////////////////////////////////////////////////////////////
// Function				:	sdrDelete
// Description			:	Delete a shader
// Return Value			:
// Comments				:
// Date last edited		:	5/20/2003
void			sdrDelete(TSdrShader *cShader) {
	TSdrParameter	*cParameter;

	while((cParameter = cShader->parameters) != NULL) {
		cShader->parameters	=	cParameter->next;

		free(cParameter->name);
		if (cParameter->space != NULL) {
			free(cParameter->space);
		}

		if (cParameter->numItems == 1) {
			switch(cParameter->type) {
			case TYPE_FLOAT:
				break;
			case TYPE_VECTOR:
			case TYPE_NORMAL:
			case TYPE_POINT:
			case TYPE_COLOR:
				if (cParameter->defaultValue.vector != NULL) {
					delete [] cParameter->defaultValue.vector;
				}
				break;
			case TYPE_MATRIX:
				if (cParameter->defaultValue.matrix != NULL) {
					delete [] cParameter->defaultValue.matrix;
				}
				break;
			case TYPE_STRING:
				if (cParameter->defaultValue.string != NULL) {
					free(cParameter->defaultValue.string);
				}
				break;
			}
		}

		delete cParameter;
	}

	free(cShader->name);
	delete cShader;

	memoryManagerTini();
}



