Revert "ARB prog parser: Fix epic memory leak in lexer / parser interface"
[mesa.git] / src / mesa / shader / program_parse.tab.c
index cb5fa7cd71c84727fa8825002af1b46a36466222..c255e912ed238c0778bcf44ac16e10a06712f344 100644 (file)
@@ -97,6 +97,8 @@
 #include <string.h>
 
 #include "main/mtypes.h"
+#include "main/imports.h"
+#include "program.h"
 #include "prog_parameter.h"
 #include "prog_parameter_layout.h"
 #include "prog_statevars.h"
@@ -111,6 +113,9 @@ extern void yy_delete_buffer(void *);
 static struct asm_symbol *declare_variable(struct asm_parser_state *state,
     char *name, enum asm_type t, struct YYLTYPE *locp);
 
+static int add_state_reference(struct gl_program_parameter_list *param_list,
+    const gl_state_index tokens[STATE_LENGTH]);
+
 static int initialize_symbol_from_state(struct gl_program *prog,
     struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
 
@@ -122,6 +127,8 @@ static int initialize_symbol_from_const(struct gl_program *prog,
 
 static int yyparse(struct asm_parser_state *state);
 
+static char *make_error_string(const char *fmt, ...);
+
 static void yyerror(struct YYLTYPE *locp, struct asm_parser_state *state,
     const char *s);
 
@@ -163,7 +170,7 @@ static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op,
 
 
 /* Line 189 of yacc.c  */
-#line 167 "program_parse.tab.c"
+#line 174 "program_parse.tab.c"
 
 /* Enabling traces.  */
 #ifndef YYDEBUG
@@ -244,7 +251,7 @@ static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op,
      PALETTE = 309,
      PARAMS = 310,
      PLANE = 311,
-     POINT = 312,
+     POINT_TOK = 312,
      POINTSIZE = 313,
      POSITION = 314,
      PRIMARY = 315,
@@ -256,7 +263,7 @@ static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op,
      SCENECOLOR = 321,
      SECONDARY = 322,
      SHININESS = 323,
-     SIZE = 324,
+     SIZE_TOK = 324,
      SPECULAR = 325,
      SPOT = 326,
      STATE = 327,
@@ -275,17 +282,24 @@ static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op,
      TEX_3D = 340,
      TEX_CUBE = 341,
      TEX_RECT = 342,
-     VERTEX = 343,
-     VTXATTRIB = 344,
-     WEIGHT = 345,
-     IDENTIFIER = 346,
-     MASK4 = 347,
-     MASK3 = 348,
-     MASK2 = 349,
-     MASK1 = 350,
-     SWIZZLE = 351,
-     DOT_DOT = 352,
-     DOT = 353
+     TEX_SHADOW1D = 343,
+     TEX_SHADOW2D = 344,
+     TEX_SHADOWRECT = 345,
+     TEX_ARRAY1D = 346,
+     TEX_ARRAY2D = 347,
+     TEX_ARRAYSHADOW1D = 348,
+     TEX_ARRAYSHADOW2D = 349,
+     VERTEX = 350,
+     VTXATTRIB = 351,
+     WEIGHT = 352,
+     IDENTIFIER = 353,
+     MASK4 = 354,
+     MASK3 = 355,
+     MASK2 = 356,
+     MASK1 = 357,
+     SWIZZLE = 358,
+     DOT_DOT = 359,
+     DOT = 360
    };
 #endif
 
@@ -296,7 +310,7 @@ typedef union YYSTYPE
 {
 
 /* Line 214 of yacc.c  */
-#line 100 "program_parse.y"
+#line 107 "program_parse.y"
 
    struct asm_instruction *inst;
    struct asm_symbol *sym;
@@ -310,15 +324,22 @@ typedef union YYSTYPE
    unsigned attrib;
    int integer;
    float real;
-   unsigned state[5];
+   gl_state_index state[STATE_LENGTH];
    int negate;
    struct asm_vector vector;
    gl_inst_opcode opcode;
 
+   struct {
+      unsigned swz;
+      unsigned rgba_valid:1;
+      unsigned xyzw_valid:1;
+      unsigned negate:1;
+   } ext_swizzle;
+
 
 
 /* Line 214 of yacc.c  */
-#line 322 "program_parse.tab.c"
+#line 343 "program_parse.tab.c"
 } YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -342,14 +363,14 @@ typedef struct YYLTYPE
 /* Copy the second part of user declarations.  */
 
 /* Line 264 of yacc.c  */
-#line 233 "program_parse.y"
+#line 249 "program_parse.y"
 
 extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param,
     void *yyscanner);
 
 
 /* Line 264 of yacc.c  */
-#line 353 "program_parse.tab.c"
+#line 374 "program_parse.tab.c"
 
 #ifdef short
 # undef short
@@ -566,20 +587,20 @@ union yyalloc
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  5
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   335
+#define YYLAST   342
 
 /* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  108
+#define YYNTOKENS  115
 /* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  133
+#define YYNNTS  134
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  255
+#define YYNRULES  264
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  424
+#define YYNSTATES  436
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   353
+#define YYMAXUTOK   360
 
 #define YYTRANSLATE(YYX)                                               \
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -591,15 +612,15 @@ static const yytype_uint8 yytranslate[] =
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,   103,   100,   104,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,    99,
-       2,   105,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,   110,   107,   111,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,   106,
+       2,   112,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,   101,     2,   102,     2,     2,     2,     2,     2,     2,
+       2,   108,     2,   109,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,   106,     2,   107,     2,     2,     2,     2,
+       2,     2,     2,   113,     2,   114,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -622,7 +643,8 @@ static const yytype_uint8 yytranslate[] =
       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
-      95,    96,    97,    98
+      95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
+     105
 };
 
 #if YYDEBUG
@@ -633,137 +655,141 @@ static const yytype_uint16 yyprhs[] =
        0,     0,     3,     8,    10,    12,    15,    16,    20,    23,
       24,    27,    30,    32,    34,    36,    38,    40,    42,    44,
       46,    48,    50,    52,    57,    62,    67,    74,    81,    90,
-      99,   102,   105,   107,   109,   111,   113,   115,   122,   126,
-     130,   133,   136,   144,   147,   149,   151,   153,   155,   160,
-     162,   164,   166,   168,   170,   172,   174,   178,   179,   182,
-     185,   187,   189,   191,   193,   195,   197,   199,   201,   203,
-     204,   206,   208,   210,   212,   213,   215,   217,   219,   221,
-     223,   225,   230,   233,   236,   238,   241,   243,   246,   248,
-     251,   256,   261,   263,   264,   268,   270,   272,   275,   277,
-     280,   282,   284,   288,   295,   296,   298,   301,   306,   308,
-     312,   314,   316,   318,   320,   322,   324,   326,   328,   330,
-     332,   335,   338,   341,   344,   347,   350,   353,   356,   359,
-     362,   365,   369,   371,   373,   375,   381,   383,   385,   387,
-     390,   392,   394,   397,   399,   402,   409,   411,   415,   417,
-     419,   421,   423,   425,   430,   432,   434,   436,   438,   440,
-     442,   445,   447,   449,   455,   457,   460,   462,   464,   470,
-     473,   474,   481,   485,   486,   488,   490,   492,   494,   496,
-     499,   501,   503,   506,   511,   516,   517,   519,   521,   523,
-     525,   527,   529,   531,   533,   539,   541,   545,   551,   557,
-     559,   563,   569,   571,   573,   575,   577,   579,   581,   583,
-     585,   587,   591,   597,   605,   615,   618,   621,   623,   625,
-     626,   627,   631,   632,   636,   640,   642,   647,   650,   653,
-     656,   659,   663,   666,   670,   671,   673,   675,   676,   678,
-     680,   681,   683,   685,   686,   688,   690,   691,   695,   696,
-     700,   701,   705,   707,   709,   711
+      99,   102,   105,   107,   109,   111,   113,   115,   117,   119,
+     121,   123,   125,   127,   129,   136,   140,   144,   147,   150,
+     158,   161,   163,   165,   167,   169,   174,   176,   178,   180,
+     182,   184,   186,   188,   192,   193,   196,   199,   201,   203,
+     205,   207,   209,   211,   213,   215,   217,   218,   220,   222,
+     224,   226,   227,   229,   231,   233,   235,   237,   239,   244,
+     247,   250,   252,   255,   257,   260,   262,   265,   270,   275,
+     277,   278,   282,   284,   286,   289,   291,   294,   296,   298,
+     302,   309,   310,   312,   315,   320,   322,   326,   328,   330,
+     332,   334,   336,   338,   340,   342,   344,   346,   349,   352,
+     355,   358,   361,   364,   367,   370,   373,   376,   379,   382,
+     386,   388,   390,   392,   398,   400,   402,   404,   407,   409,
+     411,   414,   416,   419,   426,   428,   432,   434,   436,   438,
+     440,   442,   447,   449,   451,   453,   455,   457,   459,   462,
+     464,   466,   472,   474,   477,   479,   481,   487,   490,   491,
+     498,   502,   503,   505,   507,   509,   511,   513,   516,   518,
+     520,   523,   528,   533,   534,   538,   540,   542,   544,   547,
+     549,   551,   553,   555,   561,   563,   567,   573,   579,   581,
+     585,   591,   593,   595,   597,   599,   601,   603,   605,   607,
+     609,   613,   619,   627,   637,   640,   643,   645,   647,   648,
+     649,   653,   654,   658,   662,   664,   669,   672,   675,   678,
+     681,   685,   688,   692,   693,   695,   697,   698,   700,   702,
+     703,   705,   707,   708,   710,   712,   713,   717,   718,   722,
+     723,   727,   729,   731,   733
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
 static const yytype_int16 yyrhs[] =
 {
-     109,     0,    -1,   110,   111,   113,    12,    -1,     3,    -1,
-       4,    -1,   111,   112,    -1,    -1,     8,    91,    99,    -1,
-     113,   114,    -1,    -1,   115,    99,    -1,   151,    99,    -1,
-     116,    -1,   117,    -1,   118,    -1,   119,    -1,   120,    -1,
-     121,    -1,   122,    -1,   123,    -1,   128,    -1,   124,    -1,
-     125,    -1,    19,   132,   100,   129,    -1,    18,   131,   100,
-     130,    -1,    16,   131,   100,   129,    -1,    14,   131,   100,
-     129,   100,   129,    -1,    13,   131,   100,   130,   100,   130,
-      -1,    17,   131,   100,   130,   100,   130,   100,   130,    -1,
-      15,   131,   100,   130,   100,   126,   100,   127,    -1,    20,
-     130,    -1,    82,   235,    -1,    83,    -1,    84,    -1,    85,
-      -1,    86,    -1,    87,    -1,    21,   131,   100,   136,   100,
-     133,    -1,   221,   136,   148,    -1,   221,   136,   149,    -1,
-     137,   150,    -1,   145,   147,    -1,   134,   100,   134,   100,
-     134,   100,   134,    -1,   221,   135,    -1,    22,    -1,    91,
-      -1,    91,    -1,   153,    -1,   138,   101,   139,   102,    -1,
-     167,    -1,   228,    -1,    91,    -1,    91,    -1,   140,    -1,
-     141,    -1,    22,    -1,   145,   146,   142,    -1,    -1,   103,
-     143,    -1,   104,   144,    -1,    22,    -1,    22,    -1,    91,
-      -1,    95,    -1,    95,    -1,    95,    -1,    95,    -1,    92,
-      -1,    96,    -1,    -1,    92,    -1,    93,    -1,    94,    -1,
-      95,    -1,    -1,   152,    -1,   159,    -1,   222,    -1,   224,
-      -1,   227,    -1,   240,    -1,     7,    91,   105,   153,    -1,
-      88,   154,    -1,    37,   158,    -1,    59,    -1,    90,   156,
-      -1,    52,    -1,    28,   233,    -1,    36,    -1,    73,   234,
-      -1,    49,   101,   157,   102,    -1,    89,   101,   155,   102,
-      -1,    22,    -1,    -1,   101,   157,   102,    -1,    22,    -1,
-      59,    -1,    28,   233,    -1,    36,    -1,    73,   234,    -1,
-     160,    -1,   161,    -1,    10,    91,   163,    -1,    10,    91,
-     101,   162,   102,   164,    -1,    -1,    22,    -1,   105,   166,
-      -1,   105,   106,   165,   107,    -1,   168,    -1,   165,   100,
-     168,    -1,   170,    -1,   205,    -1,   215,    -1,   170,    -1,
-     205,    -1,   216,    -1,   169,    -1,   206,    -1,   215,    -1,
-     170,    -1,    72,   194,    -1,    72,   171,    -1,    72,   173,
-      -1,    72,   176,    -1,    72,   178,    -1,    72,   184,    -1,
-      72,   180,    -1,    72,   187,    -1,    72,   189,    -1,    72,
-     191,    -1,    72,   193,    -1,    46,   232,   172,    -1,   182,
-      -1,    32,    -1,    68,    -1,    42,   101,   183,   102,   174,
-      -1,   182,    -1,    59,    -1,    25,    -1,    71,   175,    -1,
-      39,    -1,    31,    -1,    43,   177,    -1,    24,    -1,   232,
-      66,    -1,    44,   101,   183,   102,   232,   179,    -1,   182,
-      -1,    74,   236,   181,    -1,    28,    -1,    24,    -1,    30,
-      -1,    70,    -1,    22,    -1,    75,   234,   185,   186,    -1,
-      34,    -1,    53,    -1,    78,    -1,    79,    -1,    77,    -1,
-      76,    -1,    35,   188,    -1,    28,    -1,    55,    -1,    27,
-     101,   190,   102,    56,    -1,    22,    -1,    57,   192,    -1,
-      69,    -1,    25,    -1,   196,    65,   101,   199,   102,    -1,
-     196,   195,    -1,    -1,    65,   101,   199,    97,   199,   102,
-      -1,    48,   200,   197,    -1,    -1,   198,    -1,    40,    -1,
-      81,    -1,    41,    -1,    22,    -1,    50,   201,    -1,    62,
-      -1,    51,    -1,    80,   234,    -1,    54,   101,   203,   102,
-      -1,    47,   101,   204,   102,    -1,    -1,   202,    -1,    22,
-      -1,    22,    -1,    22,    -1,   209,    -1,   212,    -1,   207,
-      -1,   210,    -1,    61,    33,   101,   208,   102,    -1,   213,
-      -1,   213,    97,   213,    -1,    61,    33,   101,   213,   102,
-      -1,    61,    45,   101,   211,   102,    -1,   214,    -1,   214,
-      97,   214,    -1,    61,    45,   101,   214,   102,    -1,    22,
-      -1,    22,    -1,   217,    -1,   219,    -1,   218,    -1,   219,
-      -1,   220,    -1,    23,    -1,    22,    -1,   106,   220,   107,
-      -1,   106,   220,   100,   220,   107,    -1,   106,   220,   100,
-     220,   100,   220,   107,    -1,   106,   220,   100,   220,   100,
-     220,   100,   220,   107,    -1,   221,    23,    -1,   221,    22,
-      -1,   103,    -1,   104,    -1,    -1,    -1,    11,   223,   226,
-      -1,    -1,     5,   225,   226,    -1,   226,   100,    91,    -1,
-      91,    -1,     9,    91,   105,   228,    -1,    64,    59,    -1,
-      64,    36,    -1,    64,   229,    -1,    64,    58,    -1,    64,
-      73,   234,    -1,    64,    29,    -1,    28,   230,   231,    -1,
-      -1,    38,    -1,    26,    -1,    -1,    60,    -1,    67,    -1,
-      -1,    38,    -1,    26,    -1,    -1,    60,    -1,    67,    -1,
-      -1,   101,   237,   102,    -1,    -1,   101,   238,   102,    -1,
-      -1,   101,   239,   102,    -1,    22,    -1,    22,    -1,    22,
-      -1,     6,    91,   105,    91,    -1
+     116,     0,    -1,   117,   118,   120,    12,    -1,     3,    -1,
+       4,    -1,   118,   119,    -1,    -1,     8,    98,   106,    -1,
+     120,   121,    -1,    -1,   122,   106,    -1,   158,   106,    -1,
+     123,    -1,   124,    -1,   125,    -1,   126,    -1,   127,    -1,
+     128,    -1,   129,    -1,   130,    -1,   135,    -1,   131,    -1,
+     132,    -1,    19,   139,   107,   136,    -1,    18,   138,   107,
+     137,    -1,    16,   138,   107,   136,    -1,    14,   138,   107,
+     136,   107,   136,    -1,    13,   138,   107,   137,   107,   137,
+      -1,    17,   138,   107,   137,   107,   137,   107,   137,    -1,
+      15,   138,   107,   137,   107,   133,   107,   134,    -1,    20,
+     137,    -1,    82,   243,    -1,    83,    -1,    84,    -1,    85,
+      -1,    86,    -1,    87,    -1,    88,    -1,    89,    -1,    90,
+      -1,    91,    -1,    92,    -1,    93,    -1,    94,    -1,    21,
+     138,   107,   143,   107,   140,    -1,   229,   143,   155,    -1,
+     229,   143,   156,    -1,   144,   157,    -1,   152,   154,    -1,
+     141,   107,   141,   107,   141,   107,   141,    -1,   229,   142,
+      -1,    22,    -1,    98,    -1,    98,    -1,   160,    -1,   145,
+     108,   146,   109,    -1,   174,    -1,   236,    -1,    98,    -1,
+      98,    -1,   147,    -1,   148,    -1,    22,    -1,   152,   153,
+     149,    -1,    -1,   110,   150,    -1,   111,   151,    -1,    22,
+      -1,    22,    -1,    98,    -1,   102,    -1,   102,    -1,   102,
+      -1,   102,    -1,    99,    -1,   103,    -1,    -1,    99,    -1,
+     100,    -1,   101,    -1,   102,    -1,    -1,   159,    -1,   166,
+      -1,   230,    -1,   232,    -1,   235,    -1,   248,    -1,     7,
+      98,   112,   160,    -1,    95,   161,    -1,    37,   165,    -1,
+      59,    -1,    97,   163,    -1,    52,    -1,    28,   241,    -1,
+      36,    -1,    73,   242,    -1,    49,   108,   164,   109,    -1,
+      96,   108,   162,   109,    -1,    22,    -1,    -1,   108,   164,
+     109,    -1,    22,    -1,    59,    -1,    28,   241,    -1,    36,
+      -1,    73,   242,    -1,   167,    -1,   168,    -1,    10,    98,
+     170,    -1,    10,    98,   108,   169,   109,   171,    -1,    -1,
+      22,    -1,   112,   173,    -1,   112,   113,   172,   114,    -1,
+     175,    -1,   172,   107,   175,    -1,   177,    -1,   213,    -1,
+     223,    -1,   177,    -1,   213,    -1,   224,    -1,   176,    -1,
+     214,    -1,   223,    -1,   177,    -1,    72,   201,    -1,    72,
+     178,    -1,    72,   180,    -1,    72,   183,    -1,    72,   185,
+      -1,    72,   191,    -1,    72,   187,    -1,    72,   194,    -1,
+      72,   196,    -1,    72,   198,    -1,    72,   200,    -1,    72,
+     212,    -1,    46,   240,   179,    -1,   189,    -1,    32,    -1,
+      68,    -1,    42,   108,   190,   109,   181,    -1,   189,    -1,
+      59,    -1,    25,    -1,    71,   182,    -1,    39,    -1,    31,
+      -1,    43,   184,    -1,    24,    -1,   240,    66,    -1,    44,
+     108,   190,   109,   240,   186,    -1,   189,    -1,    74,   244,
+     188,    -1,    28,    -1,    24,    -1,    30,    -1,    70,    -1,
+      22,    -1,    75,   242,   192,   193,    -1,    34,    -1,    53,
+      -1,    78,    -1,    79,    -1,    77,    -1,    76,    -1,    35,
+     195,    -1,    28,    -1,    55,    -1,    27,   108,   197,   109,
+      56,    -1,    22,    -1,    57,   199,    -1,    69,    -1,    25,
+      -1,   203,    65,   108,   206,   109,    -1,   203,   202,    -1,
+      -1,    65,   108,   206,   104,   206,   109,    -1,    48,   207,
+     204,    -1,    -1,   205,    -1,    40,    -1,    81,    -1,    41,
+      -1,    22,    -1,    50,   208,    -1,    62,    -1,    51,    -1,
+      80,   242,    -1,    54,   108,   210,   109,    -1,    47,   108,
+     211,   109,    -1,    -1,   108,   209,   109,    -1,    22,    -1,
+      22,    -1,    22,    -1,    29,    63,    -1,   217,    -1,   220,
+      -1,   215,    -1,   218,    -1,    61,    33,   108,   216,   109,
+      -1,   221,    -1,   221,   104,   221,    -1,    61,    33,   108,
+     221,   109,    -1,    61,    45,   108,   219,   109,    -1,   222,
+      -1,   222,   104,   222,    -1,    61,    45,   108,   222,   109,
+      -1,    22,    -1,    22,    -1,   225,    -1,   227,    -1,   226,
+      -1,   227,    -1,   228,    -1,    23,    -1,    22,    -1,   113,
+     228,   114,    -1,   113,   228,   107,   228,   114,    -1,   113,
+     228,   107,   228,   107,   228,   114,    -1,   113,   228,   107,
+     228,   107,   228,   107,   228,   114,    -1,   229,    23,    -1,
+     229,    22,    -1,   110,    -1,   111,    -1,    -1,    -1,    11,
+     231,   234,    -1,    -1,     5,   233,   234,    -1,   234,   107,
+      98,    -1,    98,    -1,     9,    98,   112,   236,    -1,    64,
+      59,    -1,    64,    36,    -1,    64,   237,    -1,    64,    58,
+      -1,    64,    73,   242,    -1,    64,    29,    -1,    28,   238,
+     239,    -1,    -1,    38,    -1,    26,    -1,    -1,    60,    -1,
+      67,    -1,    -1,    38,    -1,    26,    -1,    -1,    60,    -1,
+      67,    -1,    -1,   108,   245,   109,    -1,    -1,   108,   246,
+     109,    -1,    -1,   108,   247,   109,    -1,    22,    -1,    22,
+      -1,    22,    -1,     6,    98,   112,    98,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   240,   240,   243,   251,   260,   261,   264,   282,   283,
-     286,   301,   304,   305,   308,   309,   310,   311,   312,   313,
-     314,   317,   318,   321,   327,   334,   341,   349,   356,   364,
-     375,   381,   387,   388,   389,   390,   391,   394,   406,   419,
-     432,   454,   463,   472,   479,   488,   516,   558,   569,   590,
-     600,   606,   630,   647,   647,   649,   656,   668,   669,   670,
-     673,   685,   697,   715,   726,   738,   740,   741,   742,   743,
-     746,   746,   746,   746,   747,   750,   751,   752,   753,   754,
-     755,   758,   776,   780,   786,   790,   794,   798,   802,   806,
-     810,   814,   820,   831,   831,   832,   834,   838,   842,   846,
-     852,   852,   854,   870,   893,   896,   907,   913,   919,   920,
-     927,   933,   939,   947,   953,   959,   967,   973,   979,   987,
-     988,   991,   992,   993,   994,   995,   996,   997,   998,   999,
-    1000,  1003,  1012,  1016,  1020,  1026,  1035,  1039,  1043,  1047,
-    1051,  1057,  1063,  1070,  1075,  1083,  1093,  1095,  1103,  1109,
-    1113,  1117,  1123,  1134,  1143,  1147,  1152,  1156,  1160,  1164,
-    1170,  1177,  1181,  1187,  1195,  1206,  1213,  1217,  1223,  1233,
-    1244,  1248,  1266,  1275,  1278,  1284,  1288,  1292,  1298,  1309,
-    1314,  1319,  1324,  1329,  1333,  1341,  1344,  1349,  1362,  1370,
-    1383,  1383,  1385,  1385,  1387,  1397,  1402,  1409,  1419,  1428,
-    1433,  1440,  1450,  1460,  1472,  1472,  1473,  1473,  1475,  1482,
-    1487,  1494,  1499,  1505,  1513,  1524,  1528,  1534,  1535,  1536,
-    1539,  1539,  1542,  1542,  1545,  1551,  1559,  1572,  1581,  1590,
-    1594,  1603,  1612,  1623,  1630,  1635,  1644,  1656,  1659,  1668,
-    1679,  1680,  1681,  1684,  1685,  1686,  1689,  1690,  1693,  1694,
-    1697,  1698,  1701,  1712,  1723,  1734
+       0,   256,   256,   259,   267,   279,   280,   283,   305,   306,
+     309,   324,   327,   332,   339,   340,   341,   342,   343,   344,
+     345,   348,   349,   352,   358,   365,   372,   380,   387,   395,
+     440,   447,   453,   454,   455,   456,   457,   458,   459,   460,
+     461,   462,   463,   464,   467,   480,   493,   506,   528,   537,
+     570,   577,   592,   642,   684,   695,   716,   726,   732,   763,
+     780,   780,   782,   789,   801,   802,   803,   806,   818,   830,
+     848,   859,   871,   873,   874,   875,   876,   879,   879,   879,
+     879,   880,   883,   884,   885,   886,   887,   888,   891,   909,
+     913,   919,   923,   927,   931,   940,   949,   953,   958,   964,
+     975,   975,   976,   978,   982,   986,   990,   996,   996,   998,
+    1014,  1037,  1040,  1051,  1057,  1063,  1064,  1071,  1077,  1083,
+    1091,  1097,  1103,  1111,  1117,  1123,  1131,  1132,  1135,  1136,
+    1137,  1138,  1139,  1140,  1141,  1142,  1143,  1144,  1145,  1148,
+    1157,  1161,  1165,  1171,  1180,  1184,  1188,  1197,  1201,  1207,
+    1213,  1220,  1225,  1233,  1243,  1245,  1253,  1259,  1263,  1267,
+    1273,  1284,  1293,  1297,  1302,  1306,  1310,  1314,  1320,  1327,
+    1331,  1337,  1345,  1356,  1363,  1367,  1373,  1383,  1394,  1398,
+    1416,  1425,  1428,  1434,  1438,  1442,  1448,  1459,  1464,  1469,
+    1474,  1479,  1484,  1492,  1495,  1500,  1513,  1521,  1532,  1540,
+    1540,  1542,  1542,  1544,  1554,  1559,  1566,  1576,  1585,  1590,
+    1597,  1607,  1617,  1629,  1629,  1630,  1630,  1632,  1642,  1650,
+    1660,  1668,  1676,  1685,  1696,  1700,  1706,  1707,  1708,  1711,
+    1711,  1714,  1714,  1717,  1723,  1731,  1744,  1753,  1762,  1766,
+    1775,  1784,  1795,  1802,  1807,  1816,  1828,  1831,  1840,  1851,
+    1852,  1853,  1856,  1857,  1858,  1861,  1862,  1865,  1866,  1869,
+    1870,  1873,  1884,  1895,  1906
 };
 #endif
 
@@ -780,12 +806,14 @@ static const char *const yytname[] =
   "EYE", "FOG", "FOGCOORD", "FRAGMENT", "FRONT", "HALF", "INVERSE",
   "INVTRANS", "LIGHT", "LIGHTMODEL", "LIGHTPROD", "LOCAL", "MATERIAL",
   "MAT_PROGRAM", "MATRIX", "MATRIXINDEX", "MODELVIEW", "MVP", "NORMAL",
-  "OBJECT", "PALETTE", "PARAMS", "PLANE", "POINT", "POINTSIZE", "POSITION",
-  "PRIMARY", "PROGRAM", "PROJECTION", "RANGE", "RESULT", "ROW",
-  "SCENECOLOR", "SECONDARY", "SHININESS", "SIZE", "SPECULAR", "SPOT",
+  "OBJECT", "PALETTE", "PARAMS", "PLANE", "POINT_TOK", "POINTSIZE",
+  "POSITION", "PRIMARY", "PROGRAM", "PROJECTION", "RANGE", "RESULT", "ROW",
+  "SCENECOLOR", "SECONDARY", "SHININESS", "SIZE_TOK", "SPECULAR", "SPOT",
   "STATE", "TEXCOORD", "TEXENV", "TEXGEN", "TEXGEN_Q", "TEXGEN_R",
   "TEXGEN_S", "TEXGEN_T", "TEXTURE", "TRANSPOSE", "TEXTURE_UNIT", "TEX_1D",
-  "TEX_2D", "TEX_3D", "TEX_CUBE", "TEX_RECT", "VERTEX", "VTXATTRIB",
+  "TEX_2D", "TEX_3D", "TEX_CUBE", "TEX_RECT", "TEX_SHADOW1D",
+  "TEX_SHADOW2D", "TEX_SHADOWRECT", "TEX_ARRAY1D", "TEX_ARRAY2D",
+  "TEX_ARRAYSHADOW1D", "TEX_ARRAYSHADOW2D", "VERTEX", "VTXATTRIB",
   "WEIGHT", "IDENTIFIER", "MASK4", "MASK3", "MASK2", "MASK1", "SWIZZLE",
   "DOT_DOT", "DOT", "';'", "','", "'['", "']'", "'+'", "'-'", "'='", "'{'",
   "'}'", "$accept", "program", "language", "optionSequence", "option",
@@ -816,15 +844,16 @@ static const char *const yytname[] =
   "stateMatrixRows", "optMatrixRows", "stateMatrixItem",
   "stateOptMatModifier", "stateMatModifier", "stateMatrixRowNum",
   "stateMatrixName", "stateOptModMatNum", "stateModMatNum",
-  "statePaletteMatNum", "stateProgramMatNum", "programSingleItem",
-  "programMultipleItem", "progEnvParams", "progEnvParamNums",
-  "progEnvParam", "progLocalParams", "progLocalParamNums",
-  "progLocalParam", "progEnvParamNum", "progLocalParamNum",
-  "paramConstDecl", "paramConstUse", "paramConstScalarDecl",
-  "paramConstScalarUse", "paramConstVector", "signedFloatConstant",
-  "optionalSign", "TEMP_statement", "@1", "ADDRESS_statement", "@2",
-  "varNameList", "OUTPUT_statement", "resultBinding", "resultColBinding",
-  "optResultFaceType", "optResultColorType", "optFaceType", "optColorType",
+  "statePaletteMatNum", "stateProgramMatNum", "stateDepthItem",
+  "programSingleItem", "programMultipleItem", "progEnvParams",
+  "progEnvParamNums", "progEnvParam", "progLocalParams",
+  "progLocalParamNums", "progLocalParam", "progEnvParamNum",
+  "progLocalParamNum", "paramConstDecl", "paramConstUse",
+  "paramConstScalarDecl", "paramConstScalarUse", "paramConstVector",
+  "signedFloatConstant", "optionalSign", "TEMP_statement", "@1",
+  "ADDRESS_statement", "@2", "varNameList", "OUTPUT_statement",
+  "resultBinding", "resultColBinding", "optResultFaceType",
+  "optResultColorType", "optFaceType", "optColorType",
   "optTexCoordUnitNum", "optTexImageUnitNum", "optLegacyTexUnitNum",
   "texCoordUnitNum", "texImageUnitNum", "legacyTexUnitNum",
   "ALIAS_statement", 0
@@ -845,40 +874,42 @@ static const yytype_uint16 yytoknum[] =
      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
-     345,   346,   347,   348,   349,   350,   351,   352,   353,    59,
-      44,    91,    93,    43,    45,    61,   123,   125
+     345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
+     355,   356,   357,   358,   359,   360,    59,    44,    91,    93,
+      43,    45,    61,   123,   125
 };
 # endif
 
 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_uint8 yyr1[] =
 {
-       0,   108,   109,   110,   110,   111,   111,   112,   113,   113,
-     114,   114,   115,   115,   116,   116,   116,   116,   116,   116,
-     116,   117,   117,   118,   119,   120,   121,   122,   123,   124,
-     125,   126,   127,   127,   127,   127,   127,   128,   129,   130,
-     131,   132,   133,   134,   135,   135,   136,   136,   136,   136,
-     137,   137,   138,   139,   139,   140,   141,   142,   142,   142,
-     143,   144,   145,   146,   147,   148,   149,   149,   149,   149,
-     150,   150,   150,   150,   150,   151,   151,   151,   151,   151,
-     151,   152,   153,   153,   154,   154,   154,   154,   154,   154,
-     154,   154,   155,   156,   156,   157,   158,   158,   158,   158,
-     159,   159,   160,   161,   162,   162,   163,   164,   165,   165,
-     166,   166,   166,   167,   167,   167,   168,   168,   168,   169,
-     169,   170,   170,   170,   170,   170,   170,   170,   170,   170,
-     170,   171,   172,   172,   172,   173,   174,   174,   174,   174,
-     174,   175,   176,   177,   177,   178,   179,   180,   181,   182,
-     182,   182,   183,   184,   185,   185,   186,   186,   186,   186,
-     187,   188,   188,   189,   190,   191,   192,   192,   193,   194,
-     195,   195,   196,   197,   197,   198,   198,   198,   199,   200,
-     200,   200,   200,   200,   200,   201,   201,   202,   203,   204,
-     205,   205,   206,   206,   207,   208,   208,   209,   210,   211,
-     211,   212,   213,   214,   215,   215,   216,   216,   217,   218,
-     218,   219,   219,   219,   219,   220,   220,   221,   221,   221,
-     223,   222,   225,   224,   226,   226,   227,   228,   228,   228,
-     228,   228,   228,   229,   230,   230,   230,   231,   231,   231,
-     232,   232,   232,   233,   233,   233,   234,   234,   235,   235,
-     236,   236,   237,   238,   239,   240
+       0,   115,   116,   117,   117,   118,   118,   119,   120,   120,
+     121,   121,   122,   122,   123,   123,   123,   123,   123,   123,
+     123,   124,   124,   125,   126,   127,   128,   129,   130,   131,
+     132,   133,   134,   134,   134,   134,   134,   134,   134,   134,
+     134,   134,   134,   134,   135,   136,   137,   138,   139,   140,
+     141,   142,   142,   143,   143,   143,   143,   144,   144,   145,
+     146,   146,   147,   148,   149,   149,   149,   150,   151,   152,
+     153,   154,   155,   156,   156,   156,   156,   157,   157,   157,
+     157,   157,   158,   158,   158,   158,   158,   158,   159,   160,
+     160,   161,   161,   161,   161,   161,   161,   161,   161,   162,
+     163,   163,   164,   165,   165,   165,   165,   166,   166,   167,
+     168,   169,   169,   170,   171,   172,   172,   173,   173,   173,
+     174,   174,   174,   175,   175,   175,   176,   176,   177,   177,
+     177,   177,   177,   177,   177,   177,   177,   177,   177,   178,
+     179,   179,   179,   180,   181,   181,   181,   181,   181,   182,
+     183,   184,   184,   185,   186,   187,   188,   189,   189,   189,
+     190,   191,   192,   192,   193,   193,   193,   193,   194,   195,
+     195,   196,   197,   198,   199,   199,   200,   201,   202,   202,
+     203,   204,   204,   205,   205,   205,   206,   207,   207,   207,
+     207,   207,   207,   208,   208,   209,   210,   211,   212,   213,
+     213,   214,   214,   215,   216,   216,   217,   218,   219,   219,
+     220,   221,   222,   223,   223,   224,   224,   225,   226,   226,
+     227,   227,   227,   227,   228,   228,   229,   229,   229,   231,
+     230,   233,   232,   234,   234,   235,   236,   236,   236,   236,
+     236,   236,   237,   238,   238,   238,   239,   239,   239,   240,
+     240,   240,   241,   241,   241,   242,   242,   243,   243,   244,
+     244,   245,   246,   247,   248
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
@@ -887,297 +918,303 @@ static const yytype_uint8 yyr2[] =
        0,     2,     4,     1,     1,     2,     0,     3,     2,     0,
        2,     2,     1,     1,     1,     1,     1,     1,     1,     1,
        1,     1,     1,     4,     4,     4,     6,     6,     8,     8,
-       2,     2,     1,     1,     1,     1,     1,     6,     3,     3,
-       2,     2,     7,     2,     1,     1,     1,     1,     4,     1,
-       1,     1,     1,     1,     1,     1,     3,     0,     2,     2,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     0,
-       1,     1,     1,     1,     0,     1,     1,     1,     1,     1,
-       1,     4,     2,     2,     1,     2,     1,     2,     1,     2,
-       4,     4,     1,     0,     3,     1,     1,     2,     1,     2,
-       1,     1,     3,     6,     0,     1,     2,     4,     1,     3,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     3,     1,     1,     1,     5,     1,     1,     1,     2,
-       1,     1,     2,     1,     2,     6,     1,     3,     1,     1,
-       1,     1,     1,     4,     1,     1,     1,     1,     1,     1,
-       2,     1,     1,     5,     1,     2,     1,     1,     5,     2,
-       0,     6,     3,     0,     1,     1,     1,     1,     1,     2,
-       1,     1,     2,     4,     4,     0,     1,     1,     1,     1,
-       1,     1,     1,     1,     5,     1,     3,     5,     5,     1,
-       3,     5,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     3,     5,     7,     9,     2,     2,     1,     1,     0,
-       0,     3,     0,     3,     3,     1,     4,     2,     2,     2,
-       2,     3,     2,     3,     0,     1,     1,     0,     1,     1,
-       0,     1,     1,     0,     1,     1,     0,     3,     0,     3,
-       0,     3,     1,     1,     1,     4
+       2,     2,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     6,     3,     3,     2,     2,     7,
+       2,     1,     1,     1,     1,     4,     1,     1,     1,     1,
+       1,     1,     1,     3,     0,     2,     2,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     0,     1,     1,     1,
+       1,     0,     1,     1,     1,     1,     1,     1,     4,     2,
+       2,     1,     2,     1,     2,     1,     2,     4,     4,     1,
+       0,     3,     1,     1,     2,     1,     2,     1,     1,     3,
+       6,     0,     1,     2,     4,     1,     3,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     3,
+       1,     1,     1,     5,     1,     1,     1,     2,     1,     1,
+       2,     1,     2,     6,     1,     3,     1,     1,     1,     1,
+       1,     4,     1,     1,     1,     1,     1,     1,     2,     1,
+       1,     5,     1,     2,     1,     1,     5,     2,     0,     6,
+       3,     0,     1,     1,     1,     1,     1,     2,     1,     1,
+       2,     4,     4,     0,     3,     1,     1,     1,     2,     1,
+       1,     1,     1,     5,     1,     3,     5,     5,     1,     3,
+       5,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       3,     5,     7,     9,     2,     2,     1,     1,     0,     0,
+       3,     0,     3,     3,     1,     4,     2,     2,     2,     2,
+       3,     2,     3,     0,     1,     1,     0,     1,     1,     0,
+       1,     1,     0,     1,     1,     0,     3,     0,     3,     0,
+       3,     1,     1,     1,     4
 };
 
 /* 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 yytype_uint8 yydefact[] =
+static const yytype_uint16 yydefact[] =
 {
        0,     3,     4,     0,     6,     1,     9,     0,     5,     0,
-       0,   222,     0,     0,     0,     0,   220,     2,     0,     0,
-       0,     0,     0,     0,     0,   219,     0,     8,     0,    12,
+       0,   231,     0,     0,     0,     0,   229,     2,     0,     0,
+       0,     0,     0,     0,     0,   228,     0,     8,     0,    12,
       13,    14,    15,    16,    17,    18,    19,    21,    22,    20,
-       0,    75,    76,   100,   101,    77,    78,    79,    80,     7,
-       0,     0,     0,     0,     0,     0,     0,    51,     0,    74,
-      50,     0,     0,     0,     0,     0,    62,     0,     0,   217,
-     218,    30,     0,     0,    10,    11,   225,   223,     0,     0,
-       0,   104,   219,   102,   221,   234,   232,   228,   230,   227,
-     246,   229,   219,    70,    71,    72,    73,    40,   219,   219,
-     219,   219,   219,   219,    64,    41,   210,   209,     0,     0,
-       0,     0,    46,   219,    69,     0,    47,    49,   113,   114,
-     190,   191,   115,   206,   207,     0,     0,   255,    81,   226,
-     105,     0,   106,   110,   111,   112,   204,   205,   208,     0,
-     236,   235,   237,     0,   231,     0,     0,     0,     0,    25,
-       0,    24,    23,   243,    98,    96,   246,    83,     0,     0,
-       0,     0,     0,   240,     0,   240,     0,     0,   250,   246,
-     121,   122,   123,   124,   126,   125,   127,   128,   129,   130,
-       0,   243,    88,     0,    86,    84,   246,     0,    93,    82,
-       0,    67,    66,    68,    39,     0,     0,   224,     0,   216,
-     215,   238,   239,   233,   252,     0,   219,   219,     0,     0,
-     219,   244,   245,    97,    99,     0,     0,     0,   161,   162,
-     160,     0,   143,   242,   241,   142,     0,     0,     0,     0,
-     185,   181,     0,   180,   246,   173,   167,   166,   165,     0,
-       0,     0,     0,    87,     0,    89,     0,     0,    85,   219,
-     211,    55,     0,    53,    54,     0,   219,     0,   103,   247,
-      27,    26,    65,    38,   248,     0,     0,   202,     0,   203,
-       0,   164,     0,   152,     0,   144,     0,   149,   150,   133,
-     134,   151,   131,   132,     0,   187,   179,   186,     0,   182,
-     175,   177,   176,   172,   174,   254,     0,   148,   147,   154,
-     155,     0,     0,    95,     0,    92,     0,     0,     0,    48,
-      63,    57,    37,     0,     0,   219,     0,    31,     0,   219,
-     197,   201,     0,     0,   240,   189,     0,   188,     0,   251,
-     159,   158,   156,   157,   153,   178,     0,    90,    91,    94,
-     219,   212,     0,     0,    56,   219,    44,    45,    43,     0,
-       0,     0,   108,   116,   119,   117,   192,   193,   118,   253,
-       0,    32,    33,    34,    35,    36,    29,    28,   163,   138,
-     140,   137,     0,   135,   136,     0,   184,   183,   168,     0,
-      60,    58,    61,    59,     0,     0,     0,   120,   170,   219,
-     107,   249,   141,   139,   145,   146,   219,   213,   219,     0,
-       0,     0,   169,   109,     0,     0,     0,   195,     0,   199,
-       0,   214,   219,   194,     0,   198,     0,     0,    42,   196,
-     200,     0,     0,   171
+       0,    82,    83,   107,   108,    84,    85,    86,    87,     7,
+       0,     0,     0,     0,     0,     0,     0,    58,     0,    81,
+      57,     0,     0,     0,     0,     0,    69,     0,     0,   226,
+     227,    30,     0,     0,    10,    11,   234,   232,     0,     0,
+       0,   111,   228,   109,   230,   243,   241,   237,   239,   236,
+     255,   238,   228,    77,    78,    79,    80,    47,   228,   228,
+     228,   228,   228,   228,    71,    48,   219,   218,     0,     0,
+       0,     0,    53,   228,    76,     0,    54,    56,   120,   121,
+     199,   200,   122,   215,   216,     0,     0,   264,    88,   235,
+     112,     0,   113,   117,   118,   119,   213,   214,   217,     0,
+     245,   244,   246,     0,   240,     0,     0,     0,     0,    25,
+       0,    24,    23,   252,   105,   103,   255,    90,     0,     0,
+       0,     0,     0,     0,   249,     0,   249,     0,     0,   259,
+     255,   128,   129,   130,   131,   133,   132,   134,   135,   136,
+     137,     0,   138,   252,    95,     0,    93,    91,   255,     0,
+     100,    89,     0,    74,    73,    75,    46,     0,     0,   233,
+       0,   225,   224,   247,   248,   242,   261,     0,   228,   228,
+       0,     0,   228,   253,   254,   104,   106,     0,     0,     0,
+     198,   169,   170,   168,     0,   151,   251,   250,   150,     0,
+       0,     0,     0,   193,   189,     0,   188,   255,   181,   175,
+     174,   173,     0,     0,     0,     0,    94,     0,    96,     0,
+       0,    92,   228,   220,    62,     0,    60,    61,     0,   228,
+       0,   110,   256,    27,    26,    72,    45,   257,     0,     0,
+     211,     0,   212,     0,   172,     0,   160,     0,   152,     0,
+     157,   158,   141,   142,   159,   139,   140,     0,     0,   187,
+       0,   190,   183,   185,   184,   180,   182,   263,     0,   156,
+     155,   162,   163,     0,     0,   102,     0,    99,     0,     0,
+       0,    55,    70,    64,    44,     0,     0,   228,     0,    31,
+       0,   228,   206,   210,     0,     0,   249,   197,     0,   195,
+       0,   196,     0,   260,   167,   166,   164,   165,   161,   186,
+       0,    97,    98,   101,   228,   221,     0,     0,    63,   228,
+      51,    52,    50,     0,     0,     0,   115,   123,   126,   124,
+     201,   202,   125,   262,     0,    32,    33,    34,    35,    36,
+      37,    38,    39,    40,    41,    42,    43,    29,    28,   171,
+     146,   148,   145,     0,   143,   144,     0,   192,   194,   191,
+     176,     0,    67,    65,    68,    66,     0,     0,     0,   127,
+     178,   228,   114,   258,   149,   147,   153,   154,   228,   222,
+     228,     0,     0,     0,   177,   116,     0,     0,     0,   204,
+       0,   208,     0,   223,   228,   203,     0,   207,     0,     0,
+      49,   205,   209,     0,     0,   179
 };
 
 /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int16 yydefgoto[] =
 {
       -1,     3,     4,     6,     8,     9,    27,    28,    29,    30,
-      31,    32,    33,    34,    35,    36,    37,    38,   265,   366,
-      39,   146,    71,    58,    67,   312,   313,   348,   114,    59,
-     115,   252,   253,   254,   344,   381,   383,    68,   311,   105,
-     263,   194,    97,    40,    41,   116,   189,   306,   248,   304,
-     157,    42,    43,    44,   131,    83,   258,   351,   132,   117,
-     352,   353,   118,   170,   282,   171,   373,   393,   172,   225,
-     173,   394,   174,   298,   283,   274,   175,   301,   334,   176,
-     220,   177,   272,   178,   238,   179,   387,   402,   180,   293,
-     294,   336,   235,   286,   287,   328,   326,   119,   355,   356,
-     406,   120,   357,   408,   121,   268,   270,   358,   122,   136,
-     123,   124,   138,    72,    45,    55,    46,    50,    77,    47,
-      60,    91,   142,   203,   226,   213,   144,   317,   240,   205,
-     360,   296,    48
+      31,    32,    33,    34,    35,    36,    37,    38,   268,   377,
+      39,   146,    71,    58,    67,   314,   315,   352,   114,    59,
+     115,   255,   256,   257,   348,   393,   395,    68,   313,   105,
+     266,   196,    97,    40,    41,   116,   191,   308,   251,   306,
+     157,    42,    43,    44,   131,    83,   261,   355,   132,   117,
+     356,   357,   118,   171,   285,   172,   384,   405,   173,   228,
+     174,   406,   175,   300,   286,   277,   176,   303,   338,   177,
+     223,   178,   275,   179,   241,   180,   399,   414,   181,   295,
+     296,   340,   238,   289,   330,   332,   328,   182,   119,   359,
+     360,   418,   120,   361,   420,   121,   271,   273,   362,   122,
+     136,   123,   124,   138,    72,    45,    55,    46,    50,    77,
+      47,    60,    91,   142,   205,   229,   215,   144,   319,   243,
+     207,   364,   298,    48
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -371
+#define YYPACT_NINF -369
 static const yytype_int16 yypact[] =
 {
-     159,  -371,  -371,    34,  -371,  -371,    66,    11,  -371,   140,
-     -22,  -371,    25,    37,    51,    53,  -371,  -371,   -28,   -28,
-     -28,   -28,   -28,   -28,    74,   102,   -28,  -371,    80,  -371,
-    -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,
-      82,  -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,
-     120,    -6,   107,   108,    91,   120,    61,  -371,    93,   105,
-    -371,   114,   115,   116,   117,   118,  -371,   119,    87,  -371,
-    -371,  -371,   -15,   121,  -371,  -371,  -371,   122,   129,   -17,
-     160,   201,    -3,  -371,   122,    21,  -371,  -371,  -371,  -371,
-     124,  -371,   102,  -371,  -371,  -371,  -371,  -371,   102,   102,
-     102,   102,   102,   102,  -371,  -371,  -371,  -371,    68,    72,
-       8,   -11,   126,   102,    99,   127,  -371,  -371,  -371,  -371,
-    -371,  -371,  -371,  -371,  -371,   -15,   135,  -371,  -371,  -371,
-    -371,   130,  -371,  -371,  -371,  -371,  -371,  -371,  -371,   185,
-    -371,  -371,    48,   207,  -371,   136,   137,   -15,   138,  -371,
-     139,  -371,  -371,    64,  -371,  -371,   124,  -371,   141,   142,
-     143,     9,   144,    88,   145,    83,    86,    24,   146,   124,
-    -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,
-     175,    64,  -371,   147,  -371,  -371,   124,   148,   150,  -371,
-      73,  -371,  -371,  -371,  -371,   -10,   152,  -371,   151,  -371,
-    -371,  -371,  -371,  -371,  -371,   153,   102,   102,   155,   171,
-     102,  -371,  -371,  -371,  -371,   219,   232,   235,  -371,  -371,
-    -371,   237,  -371,  -371,  -371,  -371,   194,   237,     0,   161,
-     239,  -371,   163,  -371,   124,   -14,  -371,  -371,  -371,   243,
-     238,    58,   166,  -371,   246,  -371,   247,   246,  -371,   102,
-    -371,  -371,   168,  -371,  -371,   176,   102,   167,  -371,  -371,
-    -371,  -371,  -371,  -371,   173,   172,   177,  -371,   174,  -371,
-     178,  -371,   179,  -371,   180,  -371,   181,  -371,  -371,  -371,
-    -371,  -371,  -371,  -371,   253,  -371,  -371,  -371,   256,  -371,
-    -371,  -371,  -371,  -371,  -371,  -371,   182,  -371,  -371,  -371,
-    -371,   125,   257,  -371,   183,  -371,   186,   187,    76,  -371,
-    -371,   106,  -371,   190,    -7,    26,   265,  -371,   103,   102,
-    -371,  -371,   236,    36,    83,  -371,   189,  -371,   191,  -371,
-    -371,  -371,  -371,  -371,  -371,  -371,   192,  -371,  -371,  -371,
-     102,  -371,   273,   274,  -371,   102,  -371,  -371,  -371,    90,
-       8,    77,  -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,
-     195,  -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,
-    -371,  -371,   267,  -371,  -371,    15,  -371,  -371,  -371,    78,
-    -371,  -371,  -371,  -371,   199,   200,   202,  -371,   240,    26,
-    -371,  -371,  -371,  -371,  -371,  -371,   102,  -371,   102,   219,
-     232,   203,  -371,  -371,   193,   206,   208,   205,   209,   215,
-     257,  -371,   102,  -371,   219,  -371,   232,    41,  -371,  -371,
-    -371,   257,   211,  -371
+     143,  -369,  -369,    36,  -369,  -369,    45,   -39,  -369,   169,
+     -33,  -369,   -19,    -6,    -4,    12,  -369,  -369,   -34,   -34,
+     -34,   -34,   -34,   -34,    15,    62,   -34,  -369,    26,  -369,
+    -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,
+      60,  -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,
+      20,    56,   107,   110,    37,    20,    -3,  -369,   111,   109,
+    -369,   113,   114,   116,   117,   118,  -369,   119,   125,  -369,
+    -369,  -369,   -15,   121,  -369,  -369,  -369,   122,   132,   -18,
+     167,   210,   -11,  -369,   122,    63,  -369,  -369,  -369,  -369,
+     130,  -369,    62,  -369,  -369,  -369,  -369,  -369,    62,    62,
+      62,    62,    62,    62,  -369,  -369,  -369,  -369,     9,    72,
+      87,    -1,   131,    62,   104,   134,  -369,  -369,  -369,  -369,
+    -369,  -369,  -369,  -369,  -369,   -15,   142,  -369,  -369,  -369,
+    -369,   135,  -369,  -369,  -369,  -369,  -369,  -369,  -369,   182,
+    -369,  -369,    52,   219,  -369,   138,   139,   -15,   140,  -369,
+     141,  -369,  -369,    61,  -369,  -369,   130,  -369,   144,   145,
+     146,   180,    11,   147,    85,   148,    99,    89,    -2,   149,
+     130,  -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,
+    -369,   184,  -369,    61,  -369,   150,  -369,  -369,   130,   151,
+     152,  -369,    27,  -369,  -369,  -369,  -369,   -10,   154,  -369,
+     153,  -369,  -369,  -369,  -369,  -369,  -369,   155,    62,    62,
+     161,   168,    62,  -369,  -369,  -369,  -369,   229,   244,   246,
+    -369,  -369,  -369,  -369,   247,  -369,  -369,  -369,  -369,   204,
+     247,    17,   163,   164,  -369,   165,  -369,   130,    67,  -369,
+    -369,  -369,   252,   248,    18,   170,  -369,   253,  -369,   255,
+     253,  -369,    62,  -369,  -369,   171,  -369,  -369,   177,    62,
+     172,  -369,  -369,  -369,  -369,  -369,  -369,   173,   175,   176,
+    -369,   178,  -369,   179,  -369,   181,  -369,   183,  -369,   185,
+    -369,  -369,  -369,  -369,  -369,  -369,  -369,   262,   264,  -369,
+     267,  -369,  -369,  -369,  -369,  -369,  -369,  -369,   186,  -369,
+    -369,  -369,  -369,   136,   269,  -369,   187,  -369,   188,   190,
+      43,  -369,  -369,   106,  -369,   193,    -5,    -7,   271,  -369,
+     108,    62,  -369,  -369,   245,     4,    99,  -369,   194,  -369,
+     195,  -369,   196,  -369,  -369,  -369,  -369,  -369,  -369,  -369,
+     197,  -369,  -369,  -369,    62,  -369,   280,   285,  -369,    62,
+    -369,  -369,  -369,    93,    87,    53,  -369,  -369,  -369,  -369,
+    -369,  -369,  -369,  -369,   199,  -369,  -369,  -369,  -369,  -369,
+    -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,
+    -369,  -369,  -369,   278,  -369,  -369,     8,  -369,  -369,  -369,
+    -369,    57,  -369,  -369,  -369,  -369,   203,   205,   206,  -369,
+     250,    -7,  -369,  -369,  -369,  -369,  -369,  -369,    62,  -369,
+      62,   229,   244,   208,  -369,  -369,   198,   211,   202,   213,
+     214,   218,   269,  -369,    62,  -369,   229,  -369,   244,    54,
+    -369,  -369,  -369,   269,   215,  -369
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,
-    -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,
-    -371,   -94,   -88,   149,  -371,  -371,  -326,  -371,   -92,  -371,
-    -371,  -371,  -371,  -371,  -371,  -371,  -371,   123,  -371,  -371,
-    -371,  -371,  -371,  -371,  -371,   241,  -371,  -371,  -371,    70,
-    -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,
-     -74,  -371,   -81,  -371,  -371,  -371,  -371,  -371,  -371,  -371,
-    -371,  -371,  -371,  -371,  -295,    92,  -371,  -371,  -371,  -371,
-    -371,  -371,  -371,  -371,  -371,  -371,  -371,  -371,   -29,  -371,
-    -371,  -368,  -371,  -371,  -371,  -371,  -371,   242,  -371,  -371,
-    -371,  -371,  -371,  -371,  -371,  -370,  -306,   244,  -371,  -371,
-    -371,   -80,  -110,   -82,  -371,  -371,  -371,  -371,   268,  -371,
-     245,  -371,  -371,  -371,  -160,   154,  -146,  -371,  -371,  -371,
-    -371,  -371,  -371
+    -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,
+    -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,
+    -369,   -94,   -88,   133,  -369,  -369,  -334,  -369,   -85,  -369,
+    -369,  -369,  -369,  -369,  -369,  -369,  -369,   128,  -369,  -369,
+    -369,  -369,  -369,  -369,  -369,   251,  -369,  -369,  -369,    77,
+    -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,
+     -72,  -369,   -81,  -369,  -369,  -369,  -369,  -369,  -369,  -369,
+    -369,  -369,  -369,  -369,  -305,   101,  -369,  -369,  -369,  -369,
+    -369,  -369,  -369,  -369,  -369,  -369,  -369,  -369,   -22,  -369,
+    -369,  -336,  -369,  -369,  -369,  -369,  -369,  -369,   254,  -369,
+    -369,  -369,  -369,  -369,  -369,  -369,  -342,  -368,   256,  -369,
+    -369,  -369,   -80,  -110,   -82,  -369,  -369,  -369,  -369,   279,
+    -369,   257,  -369,  -369,  -369,  -161,   156,  -146,  -369,  -369,
+    -369,  -369,  -369,  -369
 };
 
 /* 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 -53
+#define YYTABLE_NINF -60
 static const yytype_int16 yytable[] =
 {
-     139,   133,   137,   190,   145,   228,   149,   106,   107,   152,
-     214,   148,   251,   150,   151,   346,   147,   181,   147,   384,
-     108,   147,   108,   241,   277,   182,   290,   291,   374,   407,
-     278,   139,   279,   196,     5,   160,    56,   218,   183,   277,
-     245,   184,   417,   161,   419,   278,   109,   140,   185,   236,
-     162,   163,   164,   422,   165,   208,   166,   110,   109,   141,
-     277,   369,   186,    57,   219,   167,   278,   292,   280,   110,
-     281,   111,   405,   111,     7,   370,   112,    49,   187,   188,
-     395,    66,   168,   169,   347,   281,   418,   349,   289,    85,
-      86,   113,   299,   237,   409,   371,   153,    87,   350,    78,
-      69,    70,    10,   113,   154,   158,   281,   372,   201,   223,
-     420,   300,   222,   261,   223,   202,    51,   159,   260,    88,
-      89,   224,   266,   385,   211,   147,   224,   155,    52,    69,
-      70,   212,   113,   229,    90,   386,   230,   231,   421,   308,
-     232,   156,    53,   378,    54,    11,    12,    13,   233,    14,
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-      25,    26,     1,     2,   375,    66,   234,   139,    61,    62,
-      63,    64,    65,   249,   314,    73,   340,   389,   396,    74,
-     250,    75,   104,   341,   390,   397,   361,   362,   363,   364,
-     365,   191,    81,    92,   192,   193,    82,    93,    94,    95,
-      96,   330,   331,   332,   333,    69,    70,   199,   200,   342,
-     343,    76,    79,    80,    98,    99,   100,   101,   102,   103,
-     127,   125,   126,   130,    56,   143,   197,   -52,   195,   204,
-     379,   367,   198,   139,   354,   137,   206,   207,   209,   210,
-     242,   267,   215,   216,   217,   221,   227,   239,   244,   246,
-     262,   247,   256,   264,   269,   259,   257,   271,   139,   273,
-     275,   285,   284,   314,   288,   295,   297,   302,   303,   305,
-     309,   310,   318,   315,   316,   325,   320,   319,   327,   335,
-     321,   322,   323,   324,   329,   337,   404,   359,   338,   339,
-     345,   376,   368,   377,   378,   380,   382,   391,   392,   398,
-     411,   399,   414,   400,   410,   401,   412,   139,   354,   137,
-     413,   415,   416,   423,   139,   403,   314,   307,   255,   276,
-     128,   388,     0,    84,   134,   129,   135,     0,     0,     0,
-     314,     0,     0,     0,     0,   243
+     139,   133,   137,   192,   145,   231,   149,   106,   107,   152,
+     216,   148,   254,   150,   151,   396,   147,   350,   147,   108,
+     385,   147,   108,   239,   244,    85,    86,   183,   280,   380,
+      56,   139,   280,    87,   281,   184,     5,   153,   281,   221,
+     198,   280,   248,   381,   421,   154,   109,   281,   185,   282,
+     109,   186,   301,     7,   353,    88,    89,   110,   187,    10,
+     432,   110,   210,   382,    57,   354,   222,   240,   155,   419,
+      90,   302,   188,    49,   284,   383,   417,   111,   284,    51,
+     111,   407,   156,   112,   431,   283,   429,   284,    66,   140,
+     430,   291,    52,   351,    53,   189,   190,   434,   113,    69,
+      70,   141,   113,    69,    70,   158,   113,   292,   293,   225,
+      54,   226,   203,    66,   160,   264,   161,   159,    76,   204,
+     263,   213,   162,   227,   269,   226,   397,   147,   214,   163,
+     164,   165,    74,   166,   252,   167,   232,   227,   398,   233,
+     234,   253,   310,   235,   168,    81,     1,     2,   294,    82,
+     344,   236,    61,    62,    63,    64,    65,   345,   433,    73,
+     401,   169,   170,   390,   408,   386,    75,   402,    78,   237,
+     139,   409,    69,    70,    11,    12,    13,   316,    14,    15,
+      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+      26,   365,   366,   367,   368,   369,   370,   371,   372,   373,
+     374,   375,   376,   193,   201,   202,   194,   195,    93,    94,
+      95,    96,   334,   335,   336,   337,   346,   347,    92,    79,
+      98,    99,    80,   100,   101,   102,   103,   104,   125,   126,
+     127,    56,   130,   378,   391,   139,   358,   137,   143,   -59,
+     199,   206,   197,   220,   200,   208,   209,   211,   212,   245,
+     267,   270,   217,   218,   219,   224,   230,   242,   247,   249,
+     250,   259,   139,   265,   262,   260,   272,   316,   274,   276,
+     278,   287,   288,   290,   297,   305,   299,   307,   304,   312,
+     311,   318,   320,   321,   327,   317,   329,   322,   323,   331,
+     324,   339,   325,   363,   326,   333,   341,   342,   416,   343,
+     349,   379,   392,   387,   388,   389,   390,   394,   403,   404,
+     410,   425,   423,   411,   412,   413,   422,   426,   424,   139,
+     358,   137,   428,   427,   435,   258,   139,   309,   316,   415,
+     128,   279,   400,     0,    84,     0,   134,   129,   135,   246,
+       0,     0,   316
 };
 
 static const yytype_int16 yycheck[] =
 {
-      82,    82,    82,   113,    92,   165,   100,    22,    23,   103,
-     156,    99,    22,   101,   102,    22,    98,    28,   100,   345,
-      37,   103,    37,   169,    24,    36,    40,    41,   323,   399,
-      30,   113,    32,   125,     0,    27,    64,    28,    49,    24,
-     186,    52,   410,    35,   414,    30,    61,    26,    59,    25,
-      42,    43,    44,   421,    46,   147,    48,    72,    61,    38,
-      24,    25,    73,    91,    55,    57,    30,    81,    68,    72,
-      70,    88,   398,    88,     8,    39,    91,    99,    89,    90,
-     375,    91,    74,    75,    91,    70,   412,    61,   234,    28,
-      29,   106,    34,    69,   400,    59,    28,    36,    72,   105,
-     103,   104,    91,   106,    36,    33,    70,    71,    60,    26,
-     416,    53,    24,   207,    26,    67,    91,    45,   206,    58,
-      59,    38,   210,    33,    60,   207,    38,    59,    91,   103,
-     104,    67,   106,    47,    73,    45,    50,    51,    97,   249,
-      54,    73,    91,   102,    91,     5,     6,     7,    62,     9,
-      10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
-      20,    21,     3,     4,   324,    91,    80,   249,    19,    20,
-      21,    22,    23,   100,   256,    26,   100,   100,   100,    99,
-     107,    99,    95,   107,   107,   107,    83,    84,    85,    86,
-      87,    92,   101,   100,    95,    96,   105,    92,    93,    94,
-      95,    76,    77,    78,    79,   103,   104,    22,    23,   103,
-     104,    91,   105,   105,   100,   100,   100,   100,   100,   100,
-      91,   100,   100,    22,    64,   101,    91,   101,   101,    22,
-     340,   319,   102,   315,   315,   315,   100,   100,   100,   100,
-      65,    22,   101,   101,   101,   101,   101,   101,   101,   101,
-      95,   101,   100,    82,    22,   102,   105,    22,   340,    22,
-      66,    22,   101,   345,   101,    22,    28,   101,    22,    22,
-     102,    95,   100,   106,   101,    22,   102,   100,    22,    22,
-     102,   102,   102,   102,   102,   102,   396,    22,   102,   102,
-     100,   102,    56,   102,   102,    22,    22,   102,    31,   100,
-     107,   101,    97,   101,   101,    65,   100,   389,   389,   389,
-     102,   102,    97,   102,   396,   389,   398,   247,   195,   227,
-      79,   350,    -1,    55,    82,    80,    82,    -1,    -1,    -1,
-     412,    -1,    -1,    -1,    -1,   181
+      82,    82,    82,   113,    92,   166,   100,    22,    23,   103,
+     156,    99,    22,   101,   102,   349,    98,    22,   100,    37,
+     325,   103,    37,    25,   170,    28,    29,    28,    24,    25,
+      64,   113,    24,    36,    30,    36,     0,    28,    30,    28,
+     125,    24,   188,    39,   412,    36,    61,    30,    49,    32,
+      61,    52,    34,     8,    61,    58,    59,    72,    59,    98,
+     428,    72,   147,    59,    98,    72,    55,    69,    59,   411,
+      73,    53,    73,   106,    70,    71,   410,    95,    70,    98,
+      95,   386,    73,    98,   426,    68,   422,    70,    98,    26,
+     424,   237,    98,    98,    98,    96,    97,   433,   113,   110,
+     111,    38,   113,   110,   111,    33,   113,    40,    41,    24,
+      98,    26,    60,    98,    27,   209,    29,    45,    98,    67,
+     208,    60,    35,    38,   212,    26,    33,   209,    67,    42,
+      43,    44,   106,    46,   107,    48,    47,    38,    45,    50,
+      51,   114,   252,    54,    57,   108,     3,     4,    81,   112,
+     107,    62,    19,    20,    21,    22,    23,   114,   104,    26,
+     107,    74,    75,   109,   107,   326,   106,   114,   112,    80,
+     252,   114,   110,   111,     5,     6,     7,   259,     9,    10,
+      11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
+      21,    83,    84,    85,    86,    87,    88,    89,    90,    91,
+      92,    93,    94,    99,    22,    23,   102,   103,    99,   100,
+     101,   102,    76,    77,    78,    79,   110,   111,   107,   112,
+     107,   107,   112,   107,   107,   107,   107,   102,   107,   107,
+      98,    64,    22,   321,   344,   317,   317,   317,   108,   108,
+      98,    22,   108,    63,   109,   107,   107,   107,   107,    65,
+      82,    22,   108,   108,   108,   108,   108,   108,   108,   108,
+     108,   107,   344,   102,   109,   112,    22,   349,    22,    22,
+      66,   108,   108,   108,    22,    22,    28,    22,   108,   102,
+     109,   108,   107,   107,    22,   113,    22,   109,   109,    22,
+     109,    22,   109,    22,   109,   109,   109,   109,   408,   109,
+     107,    56,    22,   109,   109,   109,   109,    22,   109,    31,
+     107,   109,   114,   108,   108,    65,   108,   104,   107,   401,
+     401,   401,   104,   109,   109,   197,   408,   250,   410,   401,
+      79,   230,   354,    -1,    55,    -1,    82,    80,    82,   183,
+      -1,    -1,   424
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
-       0,     3,     4,   109,   110,     0,   111,     8,   112,   113,
-      91,     5,     6,     7,     9,    10,    11,    12,    13,    14,
-      15,    16,    17,    18,    19,    20,    21,   114,   115,   116,
-     117,   118,   119,   120,   121,   122,   123,   124,   125,   128,
-     151,   152,   159,   160,   161,   222,   224,   227,   240,    99,
-     225,    91,    91,    91,    91,   223,    64,    91,   131,   137,
-     228,   131,   131,   131,   131,   131,    91,   132,   145,   103,
-     104,   130,   221,   131,    99,    99,    91,   226,   105,   105,
-     105,   101,   105,   163,   226,    28,    29,    36,    58,    59,
-      73,   229,   100,    92,    93,    94,    95,   150,   100,   100,
-     100,   100,   100,   100,    95,   147,    22,    23,    37,    61,
-      72,    88,    91,   106,   136,   138,   153,   167,   170,   205,
-     209,   212,   216,   218,   219,   100,   100,    91,   153,   228,
-      22,   162,   166,   170,   205,   215,   217,   219,   220,   221,
-      26,    38,   230,   101,   234,   130,   129,   221,   130,   129,
-     130,   130,   129,    28,    36,    59,    73,   158,    33,    45,
-      27,    35,    42,    43,    44,    46,    48,    57,    74,    75,
-     171,   173,   176,   178,   180,   184,   187,   189,   191,   193,
-     196,    28,    36,    49,    52,    59,    73,    89,    90,   154,
-     220,    92,    95,    96,   149,   101,   136,    91,   102,    22,
-      23,    60,    67,   231,    22,   237,   100,   100,   136,   100,
-     100,    60,    67,   233,   234,   101,   101,   101,    28,    55,
-     188,   101,    24,    26,    38,   177,   232,   101,   232,    47,
-      50,    51,    54,    62,    80,   200,    25,    69,   192,   101,
-     236,   234,    65,   233,   101,   234,   101,   101,   156,   100,
-     107,    22,   139,   140,   141,   145,   100,   105,   164,   102,
-     130,   129,    95,   148,    82,   126,   130,    22,   213,    22,
-     214,    22,   190,    22,   183,    66,   183,    24,    30,    32,
-      68,    70,   172,   182,   101,    22,   201,   202,   101,   234,
-      40,    41,    81,   197,   198,    22,   239,    28,   181,    34,
-      53,   185,   101,    22,   157,    22,   155,   157,   220,   102,
-      95,   146,   133,   134,   221,   106,   101,   235,   100,   100,
-     102,   102,   102,   102,   102,    22,   204,    22,   203,   102,
-      76,    77,    78,    79,   186,    22,   199,   102,   102,   102,
-     100,   107,   103,   104,   142,   100,    22,    91,   135,    61,
-      72,   165,   168,   169,   170,   206,   207,   210,   215,    22,
-     238,    83,    84,    85,    86,    87,   127,   130,    56,    25,
-      39,    59,    71,   174,   182,   232,   102,   102,   102,   220,
-      22,   143,    22,   144,   134,    33,    45,   194,   196,   100,
-     107,   102,    31,   175,   179,   182,   100,   107,   100,   101,
-     101,    65,   195,   168,   220,   134,   208,   213,   211,   214,
-     101,   107,   100,   102,    97,   102,    97,   199,   134,   213,
-     214,    97,   199,   102
+       0,     3,     4,   116,   117,     0,   118,     8,   119,   120,
+      98,     5,     6,     7,     9,    10,    11,    12,    13,    14,
+      15,    16,    17,    18,    19,    20,    21,   121,   122,   123,
+     124,   125,   126,   127,   128,   129,   130,   131,   132,   135,
+     158,   159,   166,   167,   168,   230,   232,   235,   248,   106,
+     233,    98,    98,    98,    98,   231,    64,    98,   138,   144,
+     236,   138,   138,   138,   138,   138,    98,   139,   152,   110,
+     111,   137,   229,   138,   106,   106,    98,   234,   112,   112,
+     112,   108,   112,   170,   234,    28,    29,    36,    58,    59,
+      73,   237,   107,    99,   100,   101,   102,   157,   107,   107,
+     107,   107,   107,   107,   102,   154,    22,    23,    37,    61,
+      72,    95,    98,   113,   143,   145,   160,   174,   177,   213,
+     217,   220,   224,   226,   227,   107,   107,    98,   160,   236,
+      22,   169,   173,   177,   213,   223,   225,   227,   228,   229,
+      26,    38,   238,   108,   242,   137,   136,   229,   137,   136,
+     137,   137,   136,    28,    36,    59,    73,   165,    33,    45,
+      27,    29,    35,    42,    43,    44,    46,    48,    57,    74,
+      75,   178,   180,   183,   185,   187,   191,   194,   196,   198,
+     200,   203,   212,    28,    36,    49,    52,    59,    73,    96,
+      97,   161,   228,    99,   102,   103,   156,   108,   143,    98,
+     109,    22,    23,    60,    67,   239,    22,   245,   107,   107,
+     143,   107,   107,    60,    67,   241,   242,   108,   108,   108,
+      63,    28,    55,   195,   108,    24,    26,    38,   184,   240,
+     108,   240,    47,    50,    51,    54,    62,    80,   207,    25,
+      69,   199,   108,   244,   242,    65,   241,   108,   242,   108,
+     108,   163,   107,   114,    22,   146,   147,   148,   152,   107,
+     112,   171,   109,   137,   136,   102,   155,    82,   133,   137,
+      22,   221,    22,   222,    22,   197,    22,   190,    66,   190,
+      24,    30,    32,    68,    70,   179,   189,   108,   108,   208,
+     108,   242,    40,    41,    81,   204,   205,    22,   247,    28,
+     188,    34,    53,   192,   108,    22,   164,    22,   162,   164,
+     228,   109,   102,   153,   140,   141,   229,   113,   108,   243,
+     107,   107,   109,   109,   109,   109,   109,    22,   211,    22,
+     209,    22,   210,   109,    76,    77,    78,    79,   193,    22,
+     206,   109,   109,   109,   107,   114,   110,   111,   149,   107,
+      22,    98,   142,    61,    72,   172,   175,   176,   177,   214,
+     215,   218,   223,    22,   246,    83,    84,    85,    86,    87,
+      88,    89,    90,    91,    92,    93,    94,   134,   137,    56,
+      25,    39,    59,    71,   181,   189,   240,   109,   109,   109,
+     109,   228,    22,   150,    22,   151,   141,    33,    45,   201,
+     203,   107,   114,   109,    31,   182,   186,   189,   107,   114,
+     107,   108,   108,    65,   202,   175,   228,   141,   216,   221,
+     219,   222,   108,   114,   107,   109,   104,   109,   104,   206,
+     141,   221,   222,   104,   206,   109
 };
 
 #define yyerrok                (yyerrstatus = 0)
@@ -2031,7 +2068,7 @@ yyreduce:
         case 3:
 
 /* Line 1455 of yacc.c  */
-#line 244 "program_parse.y"
+#line 260 "program_parse.y"
     {
           if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid fragment program header");
@@ -2044,19 +2081,22 @@ yyreduce:
   case 4:
 
 /* Line 1455 of yacc.c  */
-#line 252 "program_parse.y"
+#line 268 "program_parse.y"
     {
           if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex program header");
           }
           state->mode = ARB_fragment;
+
+          state->option.TexRect =
+             (state->ctx->Extensions.NV_texture_rectangle != GL_FALSE);
        ;}
     break;
 
   case 7:
 
 /* Line 1455 of yacc.c  */
-#line 265 "program_parse.y"
+#line 284 "program_parse.y"
     {
           int valid = 0;
 
@@ -2068,7 +2108,11 @@ yyreduce:
 
 
           if (!valid) {
-             yyerror(& (yylsp[(2) - (3)]), state, "invalid option string");
+             const char *const err_str = (state->mode == ARB_vertex)
+                ? "invalid ARB vertex program option"
+                : "invalid ARB fragment program option";
+
+             yyerror(& (yylsp[(2) - (3)]), state, err_str);
              YYERROR;
           }
        ;}
@@ -2077,7 +2121,7 @@ yyreduce:
   case 10:
 
 /* Line 1455 of yacc.c  */
-#line 287 "program_parse.y"
+#line 310 "program_parse.y"
     {
           if ((yyvsp[(1) - (2)].inst) != NULL) {
              if (state->inst_tail == NULL) {
@@ -2094,10 +2138,30 @@ yyreduce:
        ;}
     break;
 
+  case 12:
+
+/* Line 1455 of yacc.c  */
+#line 328 "program_parse.y"
+    {
+          (yyval.inst) = (yyvsp[(1) - (1)].inst);
+          state->prog->NumAluInstructions++;
+       ;}
+    break;
+
+  case 13:
+
+/* Line 1455 of yacc.c  */
+#line 333 "program_parse.y"
+    {
+          (yyval.inst) = (yyvsp[(1) - (1)].inst);
+          state->prog->NumTexInstructions++;
+       ;}
+    break;
+
   case 23:
 
 /* Line 1455 of yacc.c  */
-#line 322 "program_parse.y"
+#line 353 "program_parse.y"
     {
           (yyval.inst) = asm_instruction_ctor(OPCODE_ARL, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
        ;}
@@ -2106,7 +2170,7 @@ yyreduce:
   case 24:
 
 /* Line 1455 of yacc.c  */
-#line 328 "program_parse.y"
+#line 359 "program_parse.y"
     {
           (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (4)].temp_inst).Opcode, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
           (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (4)].temp_inst).SaturateMode;
@@ -2116,7 +2180,7 @@ yyreduce:
   case 25:
 
 /* Line 1455 of yacc.c  */
-#line 335 "program_parse.y"
+#line 366 "program_parse.y"
     {
           (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (4)].temp_inst).Opcode, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
           (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (4)].temp_inst).SaturateMode;
@@ -2126,7 +2190,7 @@ yyreduce:
   case 26:
 
 /* Line 1455 of yacc.c  */
-#line 342 "program_parse.y"
+#line 373 "program_parse.y"
     {
           (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (6)].temp_inst).Opcode, & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL);
           (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (6)].temp_inst).SaturateMode;
@@ -2136,7 +2200,7 @@ yyreduce:
   case 27:
 
 /* Line 1455 of yacc.c  */
-#line 350 "program_parse.y"
+#line 381 "program_parse.y"
     {
           (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (6)].temp_inst).Opcode, & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL);
           (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (6)].temp_inst).SaturateMode;
@@ -2146,7 +2210,7 @@ yyreduce:
   case 28:
 
 /* Line 1455 of yacc.c  */
-#line 358 "program_parse.y"
+#line 389 "program_parse.y"
     {
           (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (8)].temp_inst).Opcode, & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), & (yyvsp[(6) - (8)].src_reg), & (yyvsp[(8) - (8)].src_reg));
           (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (8)].temp_inst).SaturateMode;
@@ -2156,13 +2220,47 @@ yyreduce:
   case 29:
 
 /* Line 1455 of yacc.c  */
-#line 365 "program_parse.y"
+#line 396 "program_parse.y"
     {
           (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (8)].temp_inst).Opcode, & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), NULL, NULL);
           if ((yyval.inst) != NULL) {
+             const GLbitfield tex_mask = (1U << (yyvsp[(6) - (8)].integer));
+             GLbitfield shadow_tex = 0;
+             GLbitfield target_mask = 0;
+
+
              (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (8)].temp_inst).SaturateMode;
              (yyval.inst)->Base.TexSrcUnit = (yyvsp[(6) - (8)].integer);
-             (yyval.inst)->Base.TexSrcTarget = (yyvsp[(8) - (8)].integer);
+
+             if ((yyvsp[(8) - (8)].integer) < 0) {
+                shadow_tex = tex_mask;
+
+                (yyval.inst)->Base.TexSrcTarget = -(yyvsp[(8) - (8)].integer);
+                (yyval.inst)->Base.TexShadow = 1;
+             } else {
+                (yyval.inst)->Base.TexSrcTarget = (yyvsp[(8) - (8)].integer);
+             }
+
+             target_mask = (1U << (yyval.inst)->Base.TexSrcTarget);
+
+             /* If this texture unit was previously accessed and that access
+              * had a different texture target, generate an error.
+              *
+              * If this texture unit was previously accessed and that access
+              * had a different shadow mode, generate an error.
+              */
+             if ((state->prog->TexturesUsed[(yyvsp[(6) - (8)].integer)] != 0)
+                 && ((state->prog->TexturesUsed[(yyvsp[(6) - (8)].integer)] != target_mask)
+                     || ((state->prog->ShadowSamplers & tex_mask)
+                         != shadow_tex))) {
+                yyerror(& (yylsp[(8) - (8)]), state,
+                        "multiple targets used on one texture image unit");
+                YYERROR;
+             }
+
+
+             state->prog->TexturesUsed[(yyvsp[(6) - (8)].integer)] |= target_mask;
+             state->prog->ShadowSamplers |= shadow_tex;
           }
        ;}
     break;
@@ -2170,16 +2268,17 @@ yyreduce:
   case 30:
 
 /* Line 1455 of yacc.c  */
-#line 376 "program_parse.y"
+#line 441 "program_parse.y"
     {
           (yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL);
+          state->fragment.UsesKill = 1;
        ;}
     break;
 
   case 31:
 
 /* Line 1455 of yacc.c  */
-#line 382 "program_parse.y"
+#line 448 "program_parse.y"
     {
           (yyval.integer) = (yyvsp[(2) - (2)].integer);
        ;}
@@ -2188,57 +2287,107 @@ yyreduce:
   case 32:
 
 /* Line 1455 of yacc.c  */
-#line 387 "program_parse.y"
+#line 453 "program_parse.y"
     { (yyval.integer) = TEXTURE_1D_INDEX; ;}
     break;
 
   case 33:
 
 /* Line 1455 of yacc.c  */
-#line 388 "program_parse.y"
+#line 454 "program_parse.y"
     { (yyval.integer) = TEXTURE_2D_INDEX; ;}
     break;
 
   case 34:
 
 /* Line 1455 of yacc.c  */
-#line 389 "program_parse.y"
+#line 455 "program_parse.y"
     { (yyval.integer) = TEXTURE_3D_INDEX; ;}
     break;
 
   case 35:
 
 /* Line 1455 of yacc.c  */
-#line 390 "program_parse.y"
+#line 456 "program_parse.y"
     { (yyval.integer) = TEXTURE_CUBE_INDEX; ;}
     break;
 
   case 36:
 
 /* Line 1455 of yacc.c  */
-#line 391 "program_parse.y"
+#line 457 "program_parse.y"
     { (yyval.integer) = TEXTURE_RECT_INDEX; ;}
     break;
 
   case 37:
 
 /* Line 1455 of yacc.c  */
-#line 395 "program_parse.y"
+#line 458 "program_parse.y"
+    { (yyval.integer) = -TEXTURE_1D_INDEX; ;}
+    break;
+
+  case 38:
+
+/* Line 1455 of yacc.c  */
+#line 459 "program_parse.y"
+    { (yyval.integer) = -TEXTURE_2D_INDEX; ;}
+    break;
+
+  case 39:
+
+/* Line 1455 of yacc.c  */
+#line 460 "program_parse.y"
+    { (yyval.integer) = -TEXTURE_RECT_INDEX; ;}
+    break;
+
+  case 40:
+
+/* Line 1455 of yacc.c  */
+#line 461 "program_parse.y"
+    { (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; ;}
+    break;
+
+  case 41:
+
+/* Line 1455 of yacc.c  */
+#line 462 "program_parse.y"
+    { (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; ;}
+    break;
+
+  case 42:
+
+/* Line 1455 of yacc.c  */
+#line 463 "program_parse.y"
+    { (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; ;}
+    break;
+
+  case 43:
+
+/* Line 1455 of yacc.c  */
+#line 464 "program_parse.y"
+    { (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; ;}
+    break;
+
+  case 44:
+
+/* Line 1455 of yacc.c  */
+#line 468 "program_parse.y"
     {
           /* FIXME: Is this correct?  Should the extenedSwizzle be applied
            * FIXME: to the existing swizzle?
            */
           (yyvsp[(4) - (6)].src_reg).Base.Swizzle = (yyvsp[(6) - (6)].swiz_mask).swizzle;
+          (yyvsp[(4) - (6)].src_reg).Base.Negate = (yyvsp[(6) - (6)].swiz_mask).mask;
 
           (yyval.inst) = asm_instruction_ctor(OPCODE_SWZ, & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), NULL, NULL);
           (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (6)].temp_inst).SaturateMode;
        ;}
     break;
 
-  case 38:
+  case 45:
 
 /* Line 1455 of yacc.c  */
-#line 407 "program_parse.y"
+#line 481 "program_parse.y"
     {
           (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg);
 
@@ -2251,10 +2400,10 @@ yyreduce:
        ;}
     break;
 
-  case 39:
+  case 46:
 
 /* Line 1455 of yacc.c  */
-#line 420 "program_parse.y"
+#line 494 "program_parse.y"
     {
           (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg);
 
@@ -2267,10 +2416,10 @@ yyreduce:
        ;}
     break;
 
-  case 40:
+  case 47:
 
 /* Line 1455 of yacc.c  */
-#line 433 "program_parse.y"
+#line 507 "program_parse.y"
     {
           (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg);
           (yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask;
@@ -2292,10 +2441,10 @@ yyreduce:
        ;}
     break;
 
-  case 41:
+  case 48:
 
 /* Line 1455 of yacc.c  */
-#line 455 "program_parse.y"
+#line 529 "program_parse.y"
     {
           init_dst_reg(& (yyval.dst_reg));
           (yyval.dst_reg).File = PROGRAM_ADDRESS;
@@ -2304,46 +2453,76 @@ yyreduce:
        ;}
     break;
 
-  case 42:
+  case 49:
 
 /* Line 1455 of yacc.c  */
-#line 464 "program_parse.y"
-    {
-          (yyval.swiz_mask).swizzle = MAKE_SWIZZLE4((yyvsp[(1) - (7)].swiz_mask).swizzle, (yyvsp[(3) - (7)].swiz_mask).swizzle,
-                                     (yyvsp[(5) - (7)].swiz_mask).swizzle, (yyvsp[(7) - (7)].swiz_mask).swizzle);
-          (yyval.swiz_mask).mask = ((yyvsp[(1) - (7)].swiz_mask).mask) | ((yyvsp[(3) - (7)].swiz_mask).mask << 1) | ((yyvsp[(5) - (7)].swiz_mask).mask << 2)
-             | ((yyvsp[(7) - (7)].swiz_mask).mask << 3);
+#line 538 "program_parse.y"
+    {
+          const unsigned xyzw_valid =
+             ((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0)
+             | ((yyvsp[(3) - (7)].ext_swizzle).xyzw_valid << 1)
+             | ((yyvsp[(5) - (7)].ext_swizzle).xyzw_valid << 2)
+             | ((yyvsp[(7) - (7)].ext_swizzle).xyzw_valid << 3);
+          const unsigned rgba_valid =
+             ((yyvsp[(1) - (7)].ext_swizzle).rgba_valid << 0)
+             | ((yyvsp[(3) - (7)].ext_swizzle).rgba_valid << 1)
+             | ((yyvsp[(5) - (7)].ext_swizzle).rgba_valid << 2)
+             | ((yyvsp[(7) - (7)].ext_swizzle).rgba_valid << 3);
+
+          /* All of the swizzle components have to be valid in either RGBA
+           * or XYZW.  Note that 0 and 1 are valid in both, so both masks
+           * can have some bits set.
+           *
+           * We somewhat deviate from the spec here.  It would be really hard
+           * to figure out which component is the error, and there probably
+           * isn't a lot of benefit.
+           */
+          if ((rgba_valid != 0x0f) && (xyzw_valid != 0x0f)) {
+             yyerror(& (yylsp[(1) - (7)]), state, "cannot combine RGBA and XYZW swizzle "
+                     "components");
+             YYERROR;
+          }
+
+          (yyval.swiz_mask).swizzle = MAKE_SWIZZLE4((yyvsp[(1) - (7)].ext_swizzle).swz, (yyvsp[(3) - (7)].ext_swizzle).swz, (yyvsp[(5) - (7)].ext_swizzle).swz, (yyvsp[(7) - (7)].ext_swizzle).swz);
+          (yyval.swiz_mask).mask = ((yyvsp[(1) - (7)].ext_swizzle).negate) | ((yyvsp[(3) - (7)].ext_swizzle).negate << 1) | ((yyvsp[(5) - (7)].ext_swizzle).negate << 2)
+             | ((yyvsp[(7) - (7)].ext_swizzle).negate << 3);
        ;}
     break;
 
-  case 43:
+  case 50:
 
 /* Line 1455 of yacc.c  */
-#line 473 "program_parse.y"
+#line 571 "program_parse.y"
     {
-          (yyval.swiz_mask).swizzle = (yyvsp[(2) - (2)].integer);
-          (yyval.swiz_mask).mask = ((yyvsp[(1) - (2)].negate)) ? 1 : 0;
+          (yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle);
+          (yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0;
        ;}
     break;
 
-  case 44:
+  case 51:
 
 /* Line 1455 of yacc.c  */
-#line 480 "program_parse.y"
+#line 578 "program_parse.y"
     {
           if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector");
              YYERROR;
           }
 
-          (yyval.integer) = ((yyvsp[(1) - (1)].integer) == 0) ? SWIZZLE_ZERO : SWIZZLE_ONE;
+          (yyval.ext_swizzle).swz = ((yyvsp[(1) - (1)].integer) == 0) ? SWIZZLE_ZERO : SWIZZLE_ONE;
+
+          /* 0 and 1 are valid for both RGBA swizzle names and XYZW
+           * swizzle names.
+           */
+          (yyval.ext_swizzle).xyzw_valid = 1;
+          (yyval.ext_swizzle).rgba_valid = 1;
        ;}
     break;
 
-  case 45:
+  case 52:
 
 /* Line 1455 of yacc.c  */
-#line 489 "program_parse.y"
+#line 593 "program_parse.y"
     {
           if (strlen((yyvsp[(1) - (1)].string)) > 1) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector");
@@ -2352,17 +2531,39 @@ yyreduce:
 
           switch ((yyvsp[(1) - (1)].string)[0]) {
           case 'x':
-             (yyval.integer) = SWIZZLE_X;
+             (yyval.ext_swizzle).swz = SWIZZLE_X;
+             (yyval.ext_swizzle).xyzw_valid = 1;
              break;
           case 'y':
-             (yyval.integer) = SWIZZLE_Y;
+             (yyval.ext_swizzle).swz = SWIZZLE_Y;
+             (yyval.ext_swizzle).xyzw_valid = 1;
              break;
           case 'z':
-             (yyval.integer) = SWIZZLE_Z;
+             (yyval.ext_swizzle).swz = SWIZZLE_Z;
+             (yyval.ext_swizzle).xyzw_valid = 1;
              break;
           case 'w':
-             (yyval.integer) = SWIZZLE_W;
+             (yyval.ext_swizzle).swz = SWIZZLE_W;
+             (yyval.ext_swizzle).xyzw_valid = 1;
+             break;
+
+          case 'r':
+             (yyval.ext_swizzle).swz = SWIZZLE_X;
+             (yyval.ext_swizzle).rgba_valid = 1;
+             break;
+          case 'g':
+             (yyval.ext_swizzle).swz = SWIZZLE_Y;
+             (yyval.ext_swizzle).rgba_valid = 1;
+             break;
+          case 'b':
+             (yyval.ext_swizzle).swz = SWIZZLE_Z;
+             (yyval.ext_swizzle).rgba_valid = 1;
+             break;
+          case 'a':
+             (yyval.ext_swizzle).swz = SWIZZLE_W;
+             (yyval.ext_swizzle).rgba_valid = 1;
              break;
+
           default:
              yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector");
              YYERROR;
@@ -2371,10 +2572,10 @@ yyreduce:
        ;}
     break;
 
-  case 46:
+  case 53:
 
 /* Line 1455 of yacc.c  */
-#line 517 "program_parse.y"
+#line 643 "program_parse.y"
     {
           struct asm_symbol *const s = (struct asm_symbol *)
              _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
@@ -2402,14 +2603,14 @@ yyreduce:
              (yyval.src_reg).Base.Index = s->param_binding_begin;
              break;
           case at_attrib:
-            (yyval.src_reg).Base.File = PROGRAM_INPUT;
-            (yyval.src_reg).Base.Index = s->attrib_binding;
-            state->prog->InputsRead |= (1U << (yyval.src_reg).Base.Index);
+             (yyval.src_reg).Base.File = PROGRAM_INPUT;
+             (yyval.src_reg).Base.Index = s->attrib_binding;
+             state->prog->InputsRead |= (1U << (yyval.src_reg).Base.Index);
 
-            if (!validate_inputs(& (yylsp[(1) - (1)]), state)) {
-               YYERROR;
-            }
-            break;
+             if (!validate_inputs(& (yylsp[(1) - (1)]), state)) {
+                YYERROR;
+             }
+             break;
 
           default:
              YYERROR;
@@ -2418,10 +2619,10 @@ yyreduce:
        ;}
     break;
 
-  case 47:
+  case 54:
 
 /* Line 1455 of yacc.c  */
-#line 559 "program_parse.y"
+#line 685 "program_parse.y"
     {
           init_src_reg(& (yyval.src_reg));
           (yyval.src_reg).Base.File = PROGRAM_INPUT;
@@ -2434,13 +2635,13 @@ yyreduce:
        ;}
     break;
 
-  case 48:
+  case 55:
 
 /* Line 1455 of yacc.c  */
-#line 570 "program_parse.y"
+#line 696 "program_parse.y"
     {
           if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr
-              && ((yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) {
+              && ((unsigned) (yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) {
              yyerror(& (yylsp[(3) - (4)]), state, "out of bounds array access");
              YYERROR;
           }
@@ -2460,10 +2661,10 @@ yyreduce:
        ;}
     break;
 
-  case 49:
+  case 56:
 
 /* Line 1455 of yacc.c  */
-#line 591 "program_parse.y"
+#line 717 "program_parse.y"
     {
           init_src_reg(& (yyval.src_reg));
           (yyval.src_reg).Base.File = ((yyvsp[(1) - (1)].temp_sym).name != NULL) 
@@ -2473,10 +2674,10 @@ yyreduce:
        ;}
     break;
 
-  case 50:
+  case 57:
 
 /* Line 1455 of yacc.c  */
-#line 601 "program_parse.y"
+#line 727 "program_parse.y"
     {
           init_dst_reg(& (yyval.dst_reg));
           (yyval.dst_reg).File = PROGRAM_OUTPUT;
@@ -2484,10 +2685,10 @@ yyreduce:
        ;}
     break;
 
-  case 51:
+  case 58:
 
 /* Line 1455 of yacc.c  */
-#line 607 "program_parse.y"
+#line 733 "program_parse.y"
     {
           struct asm_symbol *const s = (struct asm_symbol *)
              _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
@@ -2501,20 +2702,27 @@ yyreduce:
           }
 
           init_dst_reg(& (yyval.dst_reg));
-          if (s->type == at_temp) {
+          switch (s->type) {
+          case at_temp:
              (yyval.dst_reg).File = PROGRAM_TEMPORARY;
              (yyval.dst_reg).Index = s->temp_binding;
-          } else {
+             break;
+          case at_output:
+             (yyval.dst_reg).File = PROGRAM_OUTPUT;
+             (yyval.dst_reg).Index = s->output_binding;
+             break;
+          default:
              (yyval.dst_reg).File = s->param_binding_type;
              (yyval.dst_reg).Index = s->param_binding_begin;
+             break;
           }
        ;}
     break;
 
-  case 52:
+  case 59:
 
 /* Line 1455 of yacc.c  */
-#line 631 "program_parse.y"
+#line 764 "program_parse.y"
     {
           struct asm_symbol *const s = (struct asm_symbol *)
              _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
@@ -2531,20 +2739,20 @@ yyreduce:
        ;}
     break;
 
-  case 55:
+  case 62:
 
 /* Line 1455 of yacc.c  */
-#line 650 "program_parse.y"
+#line 783 "program_parse.y"
     {
           init_src_reg(& (yyval.src_reg));
           (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer);
        ;}
     break;
 
-  case 56:
+  case 63:
 
 /* Line 1455 of yacc.c  */
-#line 657 "program_parse.y"
+#line 790 "program_parse.y"
     {
           /* FINISHME: Add support for multiple address registers.
            */
@@ -2556,31 +2764,31 @@ yyreduce:
        ;}
     break;
 
-  case 57:
+  case 64:
 
 /* Line 1455 of yacc.c  */
-#line 668 "program_parse.y"
+#line 801 "program_parse.y"
     { (yyval.integer) = 0; ;}
     break;
 
-  case 58:
+  case 65:
 
 /* Line 1455 of yacc.c  */
-#line 669 "program_parse.y"
+#line 802 "program_parse.y"
     { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;}
     break;
 
-  case 59:
+  case 66:
 
 /* Line 1455 of yacc.c  */
-#line 670 "program_parse.y"
+#line 803 "program_parse.y"
     { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;}
     break;
 
-  case 60:
+  case 67:
 
 /* Line 1455 of yacc.c  */
-#line 674 "program_parse.y"
+#line 807 "program_parse.y"
     {
           if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) {
              yyerror(& (yylsp[(1) - (1)]), state,
@@ -2592,10 +2800,10 @@ yyreduce:
        ;}
     break;
 
-  case 61:
+  case 68:
 
 /* Line 1455 of yacc.c  */
-#line 686 "program_parse.y"
+#line 819 "program_parse.y"
     {
           if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) {
              yyerror(& (yylsp[(1) - (1)]), state,
@@ -2607,10 +2815,10 @@ yyreduce:
        ;}
     break;
 
-  case 62:
+  case 69:
 
 /* Line 1455 of yacc.c  */
-#line 698 "program_parse.y"
+#line 831 "program_parse.y"
     {
           struct asm_symbol *const s = (struct asm_symbol *)
              _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
@@ -2628,10 +2836,10 @@ yyreduce:
        ;}
     break;
 
-  case 63:
+  case 70:
 
 /* Line 1455 of yacc.c  */
-#line 716 "program_parse.y"
+#line 849 "program_parse.y"
     {
           if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector");
@@ -2642,10 +2850,10 @@ yyreduce:
        ;}
     break;
 
-  case 64:
+  case 71:
 
 /* Line 1455 of yacc.c  */
-#line 727 "program_parse.y"
+#line 860 "program_parse.y"
     {
           if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) {
              yyerror(& (yylsp[(1) - (1)]), state,
@@ -2657,24 +2865,24 @@ yyreduce:
        ;}
     break;
 
-  case 69:
+  case 76:
 
 /* Line 1455 of yacc.c  */
-#line 743 "program_parse.y"
+#line 876 "program_parse.y"
     { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;}
     break;
 
-  case 74:
+  case 81:
 
 /* Line 1455 of yacc.c  */
-#line 747 "program_parse.y"
+#line 880 "program_parse.y"
     { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;}
     break;
 
-  case 81:
+  case 88:
 
 /* Line 1455 of yacc.c  */
-#line 759 "program_parse.y"
+#line 892 "program_parse.y"
     {
           struct asm_symbol *const s =
              declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)]));
@@ -2692,102 +2900,113 @@ yyreduce:
        ;}
     break;
 
-  case 82:
+  case 89:
 
 /* Line 1455 of yacc.c  */
-#line 777 "program_parse.y"
+#line 910 "program_parse.y"
     {
           (yyval.attrib) = (yyvsp[(2) - (2)].attrib);
        ;}
     break;
 
-  case 83:
+  case 90:
 
 /* Line 1455 of yacc.c  */
-#line 781 "program_parse.y"
+#line 914 "program_parse.y"
     {
           (yyval.attrib) = (yyvsp[(2) - (2)].attrib);
        ;}
     break;
 
-  case 84:
+  case 91:
 
 /* Line 1455 of yacc.c  */
-#line 787 "program_parse.y"
+#line 920 "program_parse.y"
     {
           (yyval.attrib) = VERT_ATTRIB_POS;
        ;}
     break;
 
-  case 85:
+  case 92:
 
 /* Line 1455 of yacc.c  */
-#line 791 "program_parse.y"
+#line 924 "program_parse.y"
     {
           (yyval.attrib) = VERT_ATTRIB_WEIGHT;
        ;}
     break;
 
-  case 86:
+  case 93:
 
 /* Line 1455 of yacc.c  */
-#line 795 "program_parse.y"
+#line 928 "program_parse.y"
     {
           (yyval.attrib) = VERT_ATTRIB_NORMAL;
        ;}
     break;
 
-  case 87:
+  case 94:
 
 /* Line 1455 of yacc.c  */
-#line 799 "program_parse.y"
+#line 932 "program_parse.y"
     {
+          if (!state->ctx->Extensions.EXT_secondary_color) {
+             yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported");
+             YYERROR;
+          }
+
           (yyval.attrib) = VERT_ATTRIB_COLOR0 + (yyvsp[(2) - (2)].integer);
        ;}
     break;
 
-  case 88:
+  case 95:
 
 /* Line 1455 of yacc.c  */
-#line 803 "program_parse.y"
+#line 941 "program_parse.y"
     {
+          if (!state->ctx->Extensions.EXT_fog_coord) {
+             yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported");
+             YYERROR;
+          }
+
           (yyval.attrib) = VERT_ATTRIB_FOG;
        ;}
     break;
 
-  case 89:
+  case 96:
 
 /* Line 1455 of yacc.c  */
-#line 807 "program_parse.y"
+#line 950 "program_parse.y"
     {
           (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer);
        ;}
     break;
 
-  case 90:
+  case 97:
 
 /* Line 1455 of yacc.c  */
-#line 811 "program_parse.y"
+#line 954 "program_parse.y"
     {
+          yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported");
           YYERROR;
        ;}
     break;
 
-  case 91:
+  case 98:
 
 /* Line 1455 of yacc.c  */
-#line 815 "program_parse.y"
+#line 959 "program_parse.y"
     {
           (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer);
        ;}
     break;
 
-  case 92:
+  case 99:
 
 /* Line 1455 of yacc.c  */
-#line 821 "program_parse.y"
+#line 965 "program_parse.y"
     {
-          if ((yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) {
+          if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference");
              YYERROR;
           }
@@ -2796,46 +3015,46 @@ yyreduce:
        ;}
     break;
 
-  case 96:
+  case 103:
 
 /* Line 1455 of yacc.c  */
-#line 835 "program_parse.y"
+#line 979 "program_parse.y"
     {
           (yyval.attrib) = FRAG_ATTRIB_WPOS;
        ;}
     break;
 
-  case 97:
+  case 104:
 
 /* Line 1455 of yacc.c  */
-#line 839 "program_parse.y"
+#line 983 "program_parse.y"
     {
           (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer);
        ;}
     break;
 
-  case 98:
+  case 105:
 
 /* Line 1455 of yacc.c  */
-#line 843 "program_parse.y"
+#line 987 "program_parse.y"
     {
           (yyval.attrib) = FRAG_ATTRIB_FOGC;
        ;}
     break;
 
-  case 99:
+  case 106:
 
 /* Line 1455 of yacc.c  */
-#line 847 "program_parse.y"
+#line 991 "program_parse.y"
     {
           (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer);
        ;}
     break;
 
-  case 102:
+  case 109:
 
 /* Line 1455 of yacc.c  */
-#line 855 "program_parse.y"
+#line 999 "program_parse.y"
     {
           struct asm_symbol *const s =
              declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)]));
@@ -2851,12 +3070,12 @@ yyreduce:
        ;}
     break;
 
-  case 103:
+  case 110:
 
 /* Line 1455 of yacc.c  */
-#line 871 "program_parse.y"
+#line 1015 "program_parse.y"
     {
-          if (((yyvsp[(4) - (6)].integer) != 0) && ((yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) {
+          if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) {
              yyerror(& (yylsp[(4) - (6)]), state, 
                      "parameter array size and number of bindings must match");
              YYERROR;
@@ -2876,21 +3095,21 @@ yyreduce:
        ;}
     break;
 
-  case 104:
+  case 111:
 
 /* Line 1455 of yacc.c  */
-#line 893 "program_parse.y"
+#line 1037 "program_parse.y"
     {
           (yyval.integer) = 0;
        ;}
     break;
 
-  case 105:
+  case 112:
 
 /* Line 1455 of yacc.c  */
-#line 897 "program_parse.y"
+#line 1041 "program_parse.y"
     {
-          if (((yyvsp[(1) - (1)].integer) < 1) || ((yyvsp[(1) - (1)].integer) >= state->limits->MaxParameters)) {
+          if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) > state->limits->MaxParameters)) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size");
              YYERROR;
           } else {
@@ -2899,38 +3118,38 @@ yyreduce:
        ;}
     break;
 
-  case 106:
+  case 113:
 
 /* Line 1455 of yacc.c  */
-#line 908 "program_parse.y"
+#line 1052 "program_parse.y"
     {
           (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym);
        ;}
     break;
 
-  case 107:
+  case 114:
 
 /* Line 1455 of yacc.c  */
-#line 914 "program_parse.y"
+#line 1058 "program_parse.y"
     {
           (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym);
        ;}
     break;
 
-  case 109:
+  case 116:
 
 /* Line 1455 of yacc.c  */
-#line 921 "program_parse.y"
+#line 1065 "program_parse.y"
     {
           (yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length;
           (yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym);
        ;}
     break;
 
-  case 110:
+  case 117:
 
 /* Line 1455 of yacc.c  */
-#line 928 "program_parse.y"
+#line 1072 "program_parse.y"
     {
           memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
           (yyval.temp_sym).param_binding_begin = ~0;
@@ -2938,10 +3157,10 @@ yyreduce:
        ;}
     break;
 
-  case 111:
+  case 118:
 
 /* Line 1455 of yacc.c  */
-#line 934 "program_parse.y"
+#line 1078 "program_parse.y"
     {
           memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
           (yyval.temp_sym).param_binding_begin = ~0;
@@ -2949,10 +3168,10 @@ yyreduce:
        ;}
     break;
 
-  case 112:
+  case 119:
 
 /* Line 1455 of yacc.c  */
-#line 940 "program_parse.y"
+#line 1084 "program_parse.y"
     {
           memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
           (yyval.temp_sym).param_binding_begin = ~0;
@@ -2960,10 +3179,10 @@ yyreduce:
        ;}
     break;
 
-  case 113:
+  case 120:
 
 /* Line 1455 of yacc.c  */
-#line 948 "program_parse.y"
+#line 1092 "program_parse.y"
     {
           memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
           (yyval.temp_sym).param_binding_begin = ~0;
@@ -2971,10 +3190,10 @@ yyreduce:
        ;}
     break;
 
-  case 114:
+  case 121:
 
 /* Line 1455 of yacc.c  */
-#line 954 "program_parse.y"
+#line 1098 "program_parse.y"
     {
           memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
           (yyval.temp_sym).param_binding_begin = ~0;
@@ -2982,10 +3201,10 @@ yyreduce:
        ;}
     break;
 
-  case 115:
+  case 122:
 
 /* Line 1455 of yacc.c  */
-#line 960 "program_parse.y"
+#line 1104 "program_parse.y"
     {
           memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
           (yyval.temp_sym).param_binding_begin = ~0;
@@ -2993,10 +3212,10 @@ yyreduce:
        ;}
     break;
 
-  case 116:
+  case 123:
 
 /* Line 1455 of yacc.c  */
-#line 968 "program_parse.y"
+#line 1112 "program_parse.y"
     {
           memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
           (yyval.temp_sym).param_binding_begin = ~0;
@@ -3004,10 +3223,10 @@ yyreduce:
        ;}
     break;
 
-  case 117:
+  case 124:
 
 /* Line 1455 of yacc.c  */
-#line 974 "program_parse.y"
+#line 1118 "program_parse.y"
     {
           memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
           (yyval.temp_sym).param_binding_begin = ~0;
@@ -3015,10 +3234,10 @@ yyreduce:
        ;}
     break;
 
-  case 118:
+  case 125:
 
 /* Line 1455 of yacc.c  */
-#line 980 "program_parse.y"
+#line 1124 "program_parse.y"
     {
           memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
           (yyval.temp_sym).param_binding_begin = ~0;
@@ -3026,133 +3245,140 @@ yyreduce:
        ;}
     break;
 
-  case 119:
+  case 126:
 
 /* Line 1455 of yacc.c  */
-#line 987 "program_parse.y"
+#line 1131 "program_parse.y"
     { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;}
     break;
 
-  case 120:
+  case 127:
 
 /* Line 1455 of yacc.c  */
-#line 988 "program_parse.y"
+#line 1132 "program_parse.y"
     { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
     break;
 
-  case 121:
+  case 128:
 
 /* Line 1455 of yacc.c  */
-#line 991 "program_parse.y"
+#line 1135 "program_parse.y"
     { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
     break;
 
-  case 122:
+  case 129:
 
 /* Line 1455 of yacc.c  */
-#line 992 "program_parse.y"
+#line 1136 "program_parse.y"
     { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
     break;
 
-  case 123:
+  case 130:
 
 /* Line 1455 of yacc.c  */
-#line 993 "program_parse.y"
+#line 1137 "program_parse.y"
     { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
     break;
 
-  case 124:
+  case 131:
 
 /* Line 1455 of yacc.c  */
-#line 994 "program_parse.y"
+#line 1138 "program_parse.y"
     { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
     break;
 
-  case 125:
+  case 132:
 
 /* Line 1455 of yacc.c  */
-#line 995 "program_parse.y"
+#line 1139 "program_parse.y"
     { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
     break;
 
-  case 126:
+  case 133:
 
 /* Line 1455 of yacc.c  */
-#line 996 "program_parse.y"
+#line 1140 "program_parse.y"
     { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
     break;
 
-  case 127:
+  case 134:
 
 /* Line 1455 of yacc.c  */
-#line 997 "program_parse.y"
+#line 1141 "program_parse.y"
     { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
     break;
 
-  case 128:
+  case 135:
 
 /* Line 1455 of yacc.c  */
-#line 998 "program_parse.y"
+#line 1142 "program_parse.y"
     { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
     break;
 
-  case 129:
+  case 136:
 
 /* Line 1455 of yacc.c  */
-#line 999 "program_parse.y"
+#line 1143 "program_parse.y"
     { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
     break;
 
-  case 130:
+  case 137:
 
 /* Line 1455 of yacc.c  */
-#line 1000 "program_parse.y"
+#line 1144 "program_parse.y"
     { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
     break;
 
-  case 131:
+  case 138:
 
 /* Line 1455 of yacc.c  */
-#line 1004 "program_parse.y"
-    {
-          memset((yyval.state), 0, sizeof((yyval.state)));
-          (yyval.state)[0] = STATE_MATERIAL;
-          (yyval.state)[1] = (yyvsp[(2) - (3)].integer);
-          (yyval.state)[2] = (yyvsp[(3) - (3)].integer);
+#line 1145 "program_parse.y"
+    { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
+    break;
+
+  case 139:
+
+/* Line 1455 of yacc.c  */
+#line 1149 "program_parse.y"
+    {
+          memset((yyval.state), 0, sizeof((yyval.state)));
+          (yyval.state)[0] = STATE_MATERIAL;
+          (yyval.state)[1] = (yyvsp[(2) - (3)].integer);
+          (yyval.state)[2] = (yyvsp[(3) - (3)].integer);
        ;}
     break;
 
-  case 132:
+  case 140:
 
 /* Line 1455 of yacc.c  */
-#line 1013 "program_parse.y"
+#line 1158 "program_parse.y"
     {
           (yyval.integer) = (yyvsp[(1) - (1)].integer);
        ;}
     break;
 
-  case 133:
+  case 141:
 
 /* Line 1455 of yacc.c  */
-#line 1017 "program_parse.y"
+#line 1162 "program_parse.y"
     {
           (yyval.integer) = STATE_EMISSION;
        ;}
     break;
 
-  case 134:
+  case 142:
 
 /* Line 1455 of yacc.c  */
-#line 1021 "program_parse.y"
+#line 1166 "program_parse.y"
     {
           (yyval.integer) = STATE_SHININESS;
        ;}
     break;
 
-  case 135:
+  case 143:
 
 /* Line 1455 of yacc.c  */
-#line 1027 "program_parse.y"
+#line 1172 "program_parse.y"
     {
           memset((yyval.state), 0, sizeof((yyval.state)));
           (yyval.state)[0] = STATE_LIGHT;
@@ -3161,84 +3387,89 @@ yyreduce:
        ;}
     break;
 
-  case 136:
+  case 144:
 
 /* Line 1455 of yacc.c  */
-#line 1036 "program_parse.y"
+#line 1181 "program_parse.y"
     {
           (yyval.integer) = (yyvsp[(1) - (1)].integer);
        ;}
     break;
 
-  case 137:
+  case 145:
 
 /* Line 1455 of yacc.c  */
-#line 1040 "program_parse.y"
+#line 1185 "program_parse.y"
     {
           (yyval.integer) = STATE_POSITION;
        ;}
     break;
 
-  case 138:
+  case 146:
 
 /* Line 1455 of yacc.c  */
-#line 1044 "program_parse.y"
+#line 1189 "program_parse.y"
     {
+          if (!state->ctx->Extensions.EXT_point_parameters) {
+             yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported");
+             YYERROR;
+          }
+
           (yyval.integer) = STATE_ATTENUATION;
        ;}
     break;
 
-  case 139:
+  case 147:
 
 /* Line 1455 of yacc.c  */
-#line 1048 "program_parse.y"
+#line 1198 "program_parse.y"
     {
           (yyval.integer) = (yyvsp[(2) - (2)].integer);
        ;}
     break;
 
-  case 140:
+  case 148:
 
 /* Line 1455 of yacc.c  */
-#line 1052 "program_parse.y"
+#line 1202 "program_parse.y"
     {
           (yyval.integer) = STATE_HALF_VECTOR;
        ;}
     break;
 
-  case 141:
+  case 149:
 
 /* Line 1455 of yacc.c  */
-#line 1058 "program_parse.y"
+#line 1208 "program_parse.y"
     {
           (yyval.integer) = STATE_SPOT_DIRECTION;
        ;}
     break;
 
-  case 142:
+  case 150:
 
 /* Line 1455 of yacc.c  */
-#line 1064 "program_parse.y"
+#line 1214 "program_parse.y"
     {
           (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0];
           (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1];
        ;}
     break;
 
-  case 143:
+  case 151:
 
 /* Line 1455 of yacc.c  */
-#line 1071 "program_parse.y"
+#line 1221 "program_parse.y"
     {
           memset((yyval.state), 0, sizeof((yyval.state)));
           (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT;
        ;}
     break;
 
-  case 144:
+  case 152:
 
 /* Line 1455 of yacc.c  */
-#line 1076 "program_parse.y"
+#line 1226 "program_parse.y"
     {
           memset((yyval.state), 0, sizeof((yyval.state)));
           (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR;
@@ -3246,10 +3477,10 @@ yyreduce:
        ;}
     break;
 
-  case 145:
+  case 153:
 
 /* Line 1455 of yacc.c  */
-#line 1084 "program_parse.y"
+#line 1234 "program_parse.y"
     {
           memset((yyval.state), 0, sizeof((yyval.state)));
           (yyval.state)[0] = STATE_LIGHTPROD;
@@ -3259,10 +3490,10 @@ yyreduce:
        ;}
     break;
 
-  case 147:
+  case 155:
 
 /* Line 1455 of yacc.c  */
-#line 1096 "program_parse.y"
+#line 1246 "program_parse.y"
     {
           memset((yyval.state), 0, sizeof((yyval.state)));
           (yyval.state)[0] = (yyvsp[(3) - (3)].integer);
@@ -3270,48 +3501,48 @@ yyreduce:
        ;}
     break;
 
-  case 148:
+  case 156:
 
 /* Line 1455 of yacc.c  */
-#line 1104 "program_parse.y"
+#line 1254 "program_parse.y"
     {
           (yyval.integer) = STATE_TEXENV_COLOR;
        ;}
     break;
 
-  case 149:
+  case 157:
 
 /* Line 1455 of yacc.c  */
-#line 1110 "program_parse.y"
+#line 1260 "program_parse.y"
     {
           (yyval.integer) = STATE_AMBIENT;
        ;}
     break;
 
-  case 150:
+  case 158:
 
 /* Line 1455 of yacc.c  */
-#line 1114 "program_parse.y"
+#line 1264 "program_parse.y"
     {
           (yyval.integer) = STATE_DIFFUSE;
        ;}
     break;
 
-  case 151:
+  case 159:
 
 /* Line 1455 of yacc.c  */
-#line 1118 "program_parse.y"
+#line 1268 "program_parse.y"
     {
           (yyval.integer) = STATE_SPECULAR;
        ;}
     break;
 
-  case 152:
+  case 160:
 
 /* Line 1455 of yacc.c  */
-#line 1124 "program_parse.y"
+#line 1274 "program_parse.y"
     {
-          if ((yyvsp[(1) - (1)].integer) >= state->MaxLights) {
+          if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector");
              YYERROR;
           }
@@ -3320,10 +3551,10 @@ yyreduce:
        ;}
     break;
 
-  case 153:
+  case 161:
 
 /* Line 1455 of yacc.c  */
-#line 1135 "program_parse.y"
+#line 1285 "program_parse.y"
     {
           memset((yyval.state), 0, sizeof((yyval.state)));
           (yyval.state)[0] = STATE_TEXGEN;
@@ -3332,92 +3563,92 @@ yyreduce:
        ;}
     break;
 
-  case 154:
+  case 162:
 
 /* Line 1455 of yacc.c  */
-#line 1144 "program_parse.y"
+#line 1294 "program_parse.y"
     {
           (yyval.integer) = STATE_TEXGEN_EYE_S;
        ;}
     break;
 
-  case 155:
+  case 163:
 
 /* Line 1455 of yacc.c  */
-#line 1148 "program_parse.y"
+#line 1298 "program_parse.y"
     {
           (yyval.integer) = STATE_TEXGEN_OBJECT_S;
        ;}
     break;
 
-  case 156:
+  case 164:
 
 /* Line 1455 of yacc.c  */
-#line 1153 "program_parse.y"
+#line 1303 "program_parse.y"
     {
           (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S;
        ;}
     break;
 
-  case 157:
+  case 165:
 
 /* Line 1455 of yacc.c  */
-#line 1157 "program_parse.y"
+#line 1307 "program_parse.y"
     {
           (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S;
        ;}
     break;
 
-  case 158:
+  case 166:
 
 /* Line 1455 of yacc.c  */
-#line 1161 "program_parse.y"
+#line 1311 "program_parse.y"
     {
           (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S;
        ;}
     break;
 
-  case 159:
+  case 167:
 
 /* Line 1455 of yacc.c  */
-#line 1165 "program_parse.y"
+#line 1315 "program_parse.y"
     {
           (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S;
        ;}
     break;
 
-  case 160:
+  case 168:
 
 /* Line 1455 of yacc.c  */
-#line 1171 "program_parse.y"
+#line 1321 "program_parse.y"
     {
           memset((yyval.state), 0, sizeof((yyval.state)));
           (yyval.state)[0] = (yyvsp[(2) - (2)].integer);
        ;}
     break;
 
-  case 161:
+  case 169:
 
 /* Line 1455 of yacc.c  */
-#line 1178 "program_parse.y"
+#line 1328 "program_parse.y"
     {
           (yyval.integer) = STATE_FOG_COLOR;
        ;}
     break;
 
-  case 162:
+  case 170:
 
 /* Line 1455 of yacc.c  */
-#line 1182 "program_parse.y"
+#line 1332 "program_parse.y"
     {
           (yyval.integer) = STATE_FOG_PARAMS;
        ;}
     break;
 
-  case 163:
+  case 171:
 
 /* Line 1455 of yacc.c  */
-#line 1188 "program_parse.y"
+#line 1338 "program_parse.y"
     {
           memset((yyval.state), 0, sizeof((yyval.state)));
           (yyval.state)[0] = STATE_CLIPPLANE;
@@ -3425,12 +3656,12 @@ yyreduce:
        ;}
     break;
 
-  case 164:
+  case 172:
 
 /* Line 1455 of yacc.c  */
-#line 1196 "program_parse.y"
+#line 1346 "program_parse.y"
     {
-          if ((yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) {
+          if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector");
              YYERROR;
           }
@@ -3439,38 +3670,38 @@ yyreduce:
        ;}
     break;
 
-  case 165:
+  case 173:
 
 /* Line 1455 of yacc.c  */
-#line 1207 "program_parse.y"
+#line 1357 "program_parse.y"
     {
           memset((yyval.state), 0, sizeof((yyval.state)));
           (yyval.state)[0] = (yyvsp[(2) - (2)].integer);
        ;}
     break;
 
-  case 166:
+  case 174:
 
 /* Line 1455 of yacc.c  */
-#line 1214 "program_parse.y"
+#line 1364 "program_parse.y"
     {
           (yyval.integer) = STATE_POINT_SIZE;
        ;}
     break;
 
-  case 167:
+  case 175:
 
 /* Line 1455 of yacc.c  */
-#line 1218 "program_parse.y"
+#line 1368 "program_parse.y"
     {
           (yyval.integer) = STATE_POINT_ATTENUATION;
        ;}
     break;
 
-  case 168:
+  case 176:
 
 /* Line 1455 of yacc.c  */
-#line 1224 "program_parse.y"
+#line 1374 "program_parse.y"
     {
           (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0];
           (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1];
@@ -3480,10 +3711,10 @@ yyreduce:
        ;}
     break;
 
-  case 169:
+  case 177:
 
 /* Line 1455 of yacc.c  */
-#line 1234 "program_parse.y"
+#line 1384 "program_parse.y"
     {
           (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0];
           (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1];
@@ -3493,20 +3724,20 @@ yyreduce:
        ;}
     break;
 
-  case 170:
+  case 178:
 
 /* Line 1455 of yacc.c  */
-#line 1244 "program_parse.y"
+#line 1394 "program_parse.y"
     {
           (yyval.state)[2] = 0;
           (yyval.state)[3] = 3;
        ;}
     break;
 
-  case 171:
+  case 179:
 
 /* Line 1455 of yacc.c  */
-#line 1249 "program_parse.y"
+#line 1399 "program_parse.y"
     {
           /* It seems logical that the matrix row range specifier would have
            * to specify a range or more than one row (i.e., $5 > $3).
@@ -3524,10 +3755,10 @@ yyreduce:
        ;}
     break;
 
-  case 172:
+  case 180:
 
 /* Line 1455 of yacc.c  */
-#line 1267 "program_parse.y"
+#line 1417 "program_parse.y"
     {
           (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0];
           (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1];
@@ -3535,55 +3766,55 @@ yyreduce:
        ;}
     break;
 
-  case 173:
+  case 181:
 
 /* Line 1455 of yacc.c  */
-#line 1275 "program_parse.y"
+#line 1425 "program_parse.y"
     {
           (yyval.integer) = 0;
        ;}
     break;
 
-  case 174:
+  case 182:
 
 /* Line 1455 of yacc.c  */
-#line 1279 "program_parse.y"
+#line 1429 "program_parse.y"
     {
           (yyval.integer) = (yyvsp[(1) - (1)].integer);
        ;}
     break;
 
-  case 175:
+  case 183:
 
 /* Line 1455 of yacc.c  */
-#line 1285 "program_parse.y"
+#line 1435 "program_parse.y"
     {
           (yyval.integer) = STATE_MATRIX_INVERSE;
        ;}
     break;
 
-  case 176:
+  case 184:
 
 /* Line 1455 of yacc.c  */
-#line 1289 "program_parse.y"
+#line 1439 "program_parse.y"
     {
           (yyval.integer) = STATE_MATRIX_TRANSPOSE;
        ;}
     break;
 
-  case 177:
+  case 185:
 
 /* Line 1455 of yacc.c  */
-#line 1293 "program_parse.y"
+#line 1443 "program_parse.y"
     {
           (yyval.integer) = STATE_MATRIX_INVTRANS;
        ;}
     break;
 
-  case 178:
+  case 186:
 
 /* Line 1455 of yacc.c  */
-#line 1299 "program_parse.y"
+#line 1449 "program_parse.y"
     {
           if ((yyvsp[(1) - (1)].integer) > 3) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference");
@@ -3594,87 +3825,88 @@ yyreduce:
        ;}
     break;
 
-  case 179:
+  case 187:
 
 /* Line 1455 of yacc.c  */
-#line 1310 "program_parse.y"
+#line 1460 "program_parse.y"
     {
           (yyval.state)[0] = STATE_MODELVIEW_MATRIX;
           (yyval.state)[1] = (yyvsp[(2) - (2)].integer);
        ;}
     break;
 
-  case 180:
+  case 188:
 
 /* Line 1455 of yacc.c  */
-#line 1315 "program_parse.y"
+#line 1465 "program_parse.y"
     {
           (yyval.state)[0] = STATE_PROJECTION_MATRIX;
           (yyval.state)[1] = 0;
        ;}
     break;
 
-  case 181:
+  case 189:
 
 /* Line 1455 of yacc.c  */
-#line 1320 "program_parse.y"
+#line 1470 "program_parse.y"
     {
           (yyval.state)[0] = STATE_MVP_MATRIX;
           (yyval.state)[1] = 0;
        ;}
     break;
 
-  case 182:
+  case 190:
 
 /* Line 1455 of yacc.c  */
-#line 1325 "program_parse.y"
+#line 1475 "program_parse.y"
     {
           (yyval.state)[0] = STATE_TEXTURE_MATRIX;
           (yyval.state)[1] = (yyvsp[(2) - (2)].integer);
        ;}
     break;
 
-  case 183:
+  case 191:
 
 /* Line 1455 of yacc.c  */
-#line 1330 "program_parse.y"
+#line 1480 "program_parse.y"
     {
+          yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported");
           YYERROR;
        ;}
     break;
 
-  case 184:
+  case 192:
 
 /* Line 1455 of yacc.c  */
-#line 1334 "program_parse.y"
+#line 1485 "program_parse.y"
     {
           (yyval.state)[0] = STATE_PROGRAM_MATRIX;
           (yyval.state)[1] = (yyvsp[(3) - (4)].integer);
        ;}
     break;
 
-  case 185:
+  case 193:
 
 /* Line 1455 of yacc.c  */
-#line 1341 "program_parse.y"
+#line 1492 "program_parse.y"
     {
           (yyval.integer) = 0;
        ;}
     break;
 
-  case 186:
+  case 194:
 
 /* Line 1455 of yacc.c  */
-#line 1345 "program_parse.y"
+#line 1496 "program_parse.y"
     {
-          (yyval.integer) = (yyvsp[(1) - (1)].integer);
+          (yyval.integer) = (yyvsp[(2) - (3)].integer);
        ;}
     break;
 
-  case 187:
+  case 195:
 
 /* Line 1455 of yacc.c  */
-#line 1350 "program_parse.y"
+#line 1501 "program_parse.y"
     {
           /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix
            * zero is valid.
@@ -3688,10 +3920,10 @@ yyreduce:
        ;}
     break;
 
-  case 188:
+  case 196:
 
 /* Line 1455 of yacc.c  */
-#line 1363 "program_parse.y"
+#line 1514 "program_parse.y"
     {
           /* Since GL_ARB_matrix_palette isn't supported, just let any value
            * through here.  The error will be generated later.
@@ -3700,12 +3932,12 @@ yyreduce:
        ;}
     break;
 
-  case 189:
+  case 197:
 
 /* Line 1455 of yacc.c  */
-#line 1371 "program_parse.y"
+#line 1522 "program_parse.y"
     {
-          if ((yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) {
+          if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector");
              YYERROR;
           }
@@ -3714,10 +3946,20 @@ yyreduce:
        ;}
     break;
 
-  case 194:
+  case 198:
+
+/* Line 1455 of yacc.c  */
+#line 1533 "program_parse.y"
+    {
+          memset((yyval.state), 0, sizeof((yyval.state)));
+          (yyval.state)[0] = STATE_DEPTH_RANGE;
+       ;}
+    break;
+
+  case 203:
 
 /* Line 1455 of yacc.c  */
-#line 1388 "program_parse.y"
+#line 1545 "program_parse.y"
     {
           memset((yyval.state), 0, sizeof((yyval.state)));
           (yyval.state)[0] = state->state_param_enum;
@@ -3727,30 +3969,30 @@ yyreduce:
        ;}
     break;
 
-  case 195:
+  case 204:
 
 /* Line 1455 of yacc.c  */
-#line 1398 "program_parse.y"
+#line 1555 "program_parse.y"
     {
           (yyval.state)[0] = (yyvsp[(1) - (1)].integer);
           (yyval.state)[1] = (yyvsp[(1) - (1)].integer);
        ;}
     break;
 
-  case 196:
+  case 205:
 
 /* Line 1455 of yacc.c  */
-#line 1403 "program_parse.y"
+#line 1560 "program_parse.y"
     {
           (yyval.state)[0] = (yyvsp[(1) - (3)].integer);
           (yyval.state)[1] = (yyvsp[(3) - (3)].integer);
        ;}
     break;
 
-  case 197:
+  case 206:
 
 /* Line 1455 of yacc.c  */
-#line 1410 "program_parse.y"
+#line 1567 "program_parse.y"
     {
           memset((yyval.state), 0, sizeof((yyval.state)));
           (yyval.state)[0] = state->state_param_enum;
@@ -3760,10 +4002,10 @@ yyreduce:
        ;}
     break;
 
-  case 198:
+  case 207:
 
 /* Line 1455 of yacc.c  */
-#line 1420 "program_parse.y"
+#line 1577 "program_parse.y"
     {
           memset((yyval.state), 0, sizeof((yyval.state)));
           (yyval.state)[0] = state->state_param_enum;
@@ -3773,30 +4015,30 @@ yyreduce:
        ;}
     break;
 
-  case 199:
+  case 208:
 
 /* Line 1455 of yacc.c  */
-#line 1429 "program_parse.y"
+#line 1586 "program_parse.y"
     {
           (yyval.state)[0] = (yyvsp[(1) - (1)].integer);
           (yyval.state)[1] = (yyvsp[(1) - (1)].integer);
        ;}
     break;
 
-  case 200:
+  case 209:
 
 /* Line 1455 of yacc.c  */
-#line 1434 "program_parse.y"
+#line 1591 "program_parse.y"
     {
           (yyval.state)[0] = (yyvsp[(1) - (3)].integer);
           (yyval.state)[1] = (yyvsp[(3) - (3)].integer);
        ;}
     break;
 
-  case 201:
+  case 210:
 
 /* Line 1455 of yacc.c  */
-#line 1441 "program_parse.y"
+#line 1598 "program_parse.y"
     {
           memset((yyval.state), 0, sizeof((yyval.state)));
           (yyval.state)[0] = state->state_param_enum;
@@ -3806,12 +4048,12 @@ yyreduce:
        ;}
     break;
 
-  case 202:
+  case 211:
 
 /* Line 1455 of yacc.c  */
-#line 1451 "program_parse.y"
+#line 1608 "program_parse.y"
     {
-          if ((yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) {
+          if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference");
              YYERROR;
           }
@@ -3819,12 +4061,12 @@ yyreduce:
        ;}
     break;
 
-  case 203:
+  case 212:
 
 /* Line 1455 of yacc.c  */
-#line 1461 "program_parse.y"
+#line 1618 "program_parse.y"
     {
-          if ((yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) {
+          if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference");
              YYERROR;
           }
@@ -3832,139 +4074,154 @@ yyreduce:
        ;}
     break;
 
-  case 208:
+  case 217:
 
 /* Line 1455 of yacc.c  */
-#line 1476 "program_parse.y"
+#line 1633 "program_parse.y"
     {
-          (yyval.vector).count = 1;
+          (yyval.vector).count = 4;
           (yyval.vector).data[0] = (yyvsp[(1) - (1)].real);
+          (yyval.vector).data[1] = (yyvsp[(1) - (1)].real);
+          (yyval.vector).data[2] = (yyvsp[(1) - (1)].real);
+          (yyval.vector).data[3] = (yyvsp[(1) - (1)].real);
        ;}
     break;
 
-  case 209:
+  case 218:
 
 /* Line 1455 of yacc.c  */
-#line 1483 "program_parse.y"
+#line 1643 "program_parse.y"
     {
           (yyval.vector).count = 1;
           (yyval.vector).data[0] = (yyvsp[(1) - (1)].real);
+          (yyval.vector).data[1] = (yyvsp[(1) - (1)].real);
+          (yyval.vector).data[2] = (yyvsp[(1) - (1)].real);
+          (yyval.vector).data[3] = (yyvsp[(1) - (1)].real);
        ;}
     break;
 
-  case 210:
+  case 219:
 
 /* Line 1455 of yacc.c  */
-#line 1488 "program_parse.y"
+#line 1651 "program_parse.y"
     {
           (yyval.vector).count = 1;
           (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer);
+          (yyval.vector).data[1] = (float) (yyvsp[(1) - (1)].integer);
+          (yyval.vector).data[2] = (float) (yyvsp[(1) - (1)].integer);
+          (yyval.vector).data[3] = (float) (yyvsp[(1) - (1)].integer);
        ;}
     break;
 
-  case 211:
+  case 220:
 
 /* Line 1455 of yacc.c  */
-#line 1495 "program_parse.y"
+#line 1661 "program_parse.y"
     {
-          (yyval.vector).count = 1;
+          (yyval.vector).count = 4;
           (yyval.vector).data[0] = (yyvsp[(2) - (3)].real);
+          (yyval.vector).data[1] = 0.0f;
+          (yyval.vector).data[2] = 0.0f;
+          (yyval.vector).data[3] = 1.0f;
        ;}
     break;
 
-  case 212:
+  case 221:
 
 /* Line 1455 of yacc.c  */
-#line 1500 "program_parse.y"
+#line 1669 "program_parse.y"
     {
-          (yyval.vector).count = 2;
+          (yyval.vector).count = 4;
           (yyval.vector).data[0] = (yyvsp[(2) - (5)].real);
           (yyval.vector).data[1] = (yyvsp[(4) - (5)].real);
+          (yyval.vector).data[2] = 0.0f;
+          (yyval.vector).data[3] = 1.0f;
        ;}
     break;
 
-  case 213:
+  case 222:
 
 /* Line 1455 of yacc.c  */
-#line 1507 "program_parse.y"
+#line 1678 "program_parse.y"
     {
-          (yyval.vector).count = 3;
+          (yyval.vector).count = 4;
           (yyval.vector).data[0] = (yyvsp[(2) - (7)].real);
           (yyval.vector).data[1] = (yyvsp[(4) - (7)].real);
-          (yyval.vector).data[1] = (yyvsp[(6) - (7)].real);
+          (yyval.vector).data[2] = (yyvsp[(6) - (7)].real);
+          (yyval.vector).data[3] = 1.0f;
        ;}
     break;
 
-  case 214:
+  case 223:
 
 /* Line 1455 of yacc.c  */
-#line 1515 "program_parse.y"
+#line 1687 "program_parse.y"
     {
           (yyval.vector).count = 4;
           (yyval.vector).data[0] = (yyvsp[(2) - (9)].real);
           (yyval.vector).data[1] = (yyvsp[(4) - (9)].real);
-          (yyval.vector).data[1] = (yyvsp[(6) - (9)].real);
-          (yyval.vector).data[1] = (yyvsp[(8) - (9)].real);
+          (yyval.vector).data[2] = (yyvsp[(6) - (9)].real);
+          (yyval.vector).data[3] = (yyvsp[(8) - (9)].real);
        ;}
     break;
 
-  case 215:
+  case 224:
 
 /* Line 1455 of yacc.c  */
-#line 1525 "program_parse.y"
+#line 1697 "program_parse.y"
     {
           (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real);
        ;}
     break;
 
-  case 216:
+  case 225:
 
 /* Line 1455 of yacc.c  */
-#line 1529 "program_parse.y"
+#line 1701 "program_parse.y"
     {
           (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer));
        ;}
     break;
 
-  case 217:
+  case 226:
 
 /* Line 1455 of yacc.c  */
-#line 1534 "program_parse.y"
+#line 1706 "program_parse.y"
     { (yyval.negate) = FALSE; ;}
     break;
 
-  case 218:
+  case 227:
 
 /* Line 1455 of yacc.c  */
-#line 1535 "program_parse.y"
+#line 1707 "program_parse.y"
     { (yyval.negate) = TRUE;  ;}
     break;
 
-  case 219:
+  case 228:
 
 /* Line 1455 of yacc.c  */
-#line 1536 "program_parse.y"
+#line 1708 "program_parse.y"
     { (yyval.negate) = FALSE; ;}
     break;
 
-  case 220:
+  case 229:
 
 /* Line 1455 of yacc.c  */
-#line 1539 "program_parse.y"
+#line 1711 "program_parse.y"
     { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;}
     break;
 
-  case 222:
+  case 231:
 
 /* Line 1455 of yacc.c  */
-#line 1542 "program_parse.y"
+#line 1714 "program_parse.y"
     { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;}
     break;
 
-  case 224:
+  case 233:
 
 /* Line 1455 of yacc.c  */
-#line 1546 "program_parse.y"
+#line 1718 "program_parse.y"
     {
           if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) {
              YYERROR;
@@ -3972,10 +4229,10 @@ yyreduce:
        ;}
     break;
 
-  case 225:
+  case 234:
 
 /* Line 1455 of yacc.c  */
-#line 1552 "program_parse.y"
+#line 1724 "program_parse.y"
     {
           if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) {
              YYERROR;
@@ -3983,10 +4240,10 @@ yyreduce:
        ;}
     break;
 
-  case 226:
+  case 235:
 
 /* Line 1455 of yacc.c  */
-#line 1560 "program_parse.y"
+#line 1732 "program_parse.y"
     {
           struct asm_symbol *const s =
              declare_variable(state, (yyvsp[(2) - (4)].string), at_output, & (yylsp[(2) - (4)]));
@@ -3999,10 +4256,10 @@ yyreduce:
        ;}
     break;
 
-  case 227:
+  case 236:
 
 /* Line 1455 of yacc.c  */
-#line 1573 "program_parse.y"
+#line 1745 "program_parse.y"
     {
           if (state->mode == ARB_vertex) {
              (yyval.result) = VERT_RESULT_HPOS;
@@ -4013,10 +4270,10 @@ yyreduce:
        ;}
     break;
 
-  case 228:
+  case 237:
 
 /* Line 1455 of yacc.c  */
-#line 1582 "program_parse.y"
+#line 1754 "program_parse.y"
     {
           if (state->mode == ARB_vertex) {
              (yyval.result) = VERT_RESULT_FOGC;
@@ -4027,19 +4284,19 @@ yyreduce:
        ;}
     break;
 
-  case 229:
+  case 238:
 
 /* Line 1455 of yacc.c  */
-#line 1591 "program_parse.y"
+#line 1763 "program_parse.y"
     {
           (yyval.result) = (yyvsp[(2) - (2)].result);
        ;}
     break;
 
-  case 230:
+  case 239:
 
 /* Line 1455 of yacc.c  */
-#line 1595 "program_parse.y"
+#line 1767 "program_parse.y"
     {
           if (state->mode == ARB_vertex) {
              (yyval.result) = VERT_RESULT_PSIZ;
@@ -4050,10 +4307,10 @@ yyreduce:
        ;}
     break;
 
-  case 231:
+  case 240:
 
 /* Line 1455 of yacc.c  */
-#line 1604 "program_parse.y"
+#line 1776 "program_parse.y"
     {
           if (state->mode == ARB_vertex) {
              (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer);
@@ -4064,10 +4321,10 @@ yyreduce:
        ;}
     break;
 
-  case 232:
+  case 241:
 
 /* Line 1455 of yacc.c  */
-#line 1613 "program_parse.y"
+#line 1785 "program_parse.y"
     {
           if (state->mode == ARB_fragment) {
              (yyval.result) = FRAG_RESULT_DEPTH;
@@ -4078,19 +4335,19 @@ yyreduce:
        ;}
     break;
 
-  case 233:
+  case 242:
 
 /* Line 1455 of yacc.c  */
-#line 1624 "program_parse.y"
+#line 1796 "program_parse.y"
     {
           (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer);
        ;}
     break;
 
-  case 234:
+  case 243:
 
 /* Line 1455 of yacc.c  */
-#line 1630 "program_parse.y"
+#line 1802 "program_parse.y"
     {
           (yyval.integer) = (state->mode == ARB_vertex)
              ? VERT_RESULT_COL0
@@ -4098,10 +4355,10 @@ yyreduce:
        ;}
     break;
 
-  case 235:
+  case 244:
 
 /* Line 1455 of yacc.c  */
-#line 1636 "program_parse.y"
+#line 1808 "program_parse.y"
     {
           if (state->mode == ARB_vertex) {
              (yyval.integer) = VERT_RESULT_COL0;
@@ -4112,10 +4369,10 @@ yyreduce:
        ;}
     break;
 
-  case 236:
+  case 245:
 
 /* Line 1455 of yacc.c  */
-#line 1645 "program_parse.y"
+#line 1817 "program_parse.y"
     {
           if (state->mode == ARB_vertex) {
              (yyval.integer) = VERT_RESULT_BFC0;
@@ -4126,19 +4383,19 @@ yyreduce:
        ;}
     break;
 
-  case 237:
+  case 246:
 
 /* Line 1455 of yacc.c  */
-#line 1656 "program_parse.y"
+#line 1828 "program_parse.y"
     {
           (yyval.integer) = 0; 
        ;}
     break;
 
-  case 238:
+  case 247:
 
 /* Line 1455 of yacc.c  */
-#line 1660 "program_parse.y"
+#line 1832 "program_parse.y"
     {
           if (state->mode == ARB_vertex) {
              (yyval.integer) = 0;
@@ -4149,10 +4406,10 @@ yyreduce:
        ;}
     break;
 
-  case 239:
+  case 248:
 
 /* Line 1455 of yacc.c  */
-#line 1669 "program_parse.y"
+#line 1841 "program_parse.y"
     {
           if (state->mode == ARB_vertex) {
              (yyval.integer) = 1;
@@ -4163,96 +4420,96 @@ yyreduce:
        ;}
     break;
 
-  case 240:
+  case 249:
 
 /* Line 1455 of yacc.c  */
-#line 1679 "program_parse.y"
+#line 1851 "program_parse.y"
     { (yyval.integer) = 0; ;}
     break;
 
-  case 241:
+  case 250:
 
 /* Line 1455 of yacc.c  */
-#line 1680 "program_parse.y"
+#line 1852 "program_parse.y"
     { (yyval.integer) = 0; ;}
     break;
 
-  case 242:
+  case 251:
 
 /* Line 1455 of yacc.c  */
-#line 1681 "program_parse.y"
+#line 1853 "program_parse.y"
     { (yyval.integer) = 1; ;}
     break;
 
-  case 243:
+  case 252:
 
 /* Line 1455 of yacc.c  */
-#line 1684 "program_parse.y"
+#line 1856 "program_parse.y"
     { (yyval.integer) = 0; ;}
     break;
 
-  case 244:
+  case 253:
 
 /* Line 1455 of yacc.c  */
-#line 1685 "program_parse.y"
+#line 1857 "program_parse.y"
     { (yyval.integer) = 0; ;}
     break;
 
-  case 245:
+  case 254:
 
 /* Line 1455 of yacc.c  */
-#line 1686 "program_parse.y"
+#line 1858 "program_parse.y"
     { (yyval.integer) = 1; ;}
     break;
 
-  case 246:
+  case 255:
 
 /* Line 1455 of yacc.c  */
-#line 1689 "program_parse.y"
+#line 1861 "program_parse.y"
     { (yyval.integer) = 0; ;}
     break;
 
-  case 247:
+  case 256:
 
 /* Line 1455 of yacc.c  */
-#line 1690 "program_parse.y"
+#line 1862 "program_parse.y"
     { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;}
     break;
 
-  case 248:
+  case 257:
 
 /* Line 1455 of yacc.c  */
-#line 1693 "program_parse.y"
+#line 1865 "program_parse.y"
     { (yyval.integer) = 0; ;}
     break;
 
-  case 249:
+  case 258:
 
 /* Line 1455 of yacc.c  */
-#line 1694 "program_parse.y"
+#line 1866 "program_parse.y"
     { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;}
     break;
 
-  case 250:
+  case 259:
 
 /* Line 1455 of yacc.c  */
-#line 1697 "program_parse.y"
+#line 1869 "program_parse.y"
     { (yyval.integer) = 0; ;}
     break;
 
-  case 251:
+  case 260:
 
 /* Line 1455 of yacc.c  */
-#line 1698 "program_parse.y"
+#line 1870 "program_parse.y"
     { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;}
     break;
 
-  case 252:
+  case 261:
 
 /* Line 1455 of yacc.c  */
-#line 1702 "program_parse.y"
+#line 1874 "program_parse.y"
     {
-          if ((yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) {
+          if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector");
              YYERROR;
           }
@@ -4261,12 +4518,12 @@ yyreduce:
        ;}
     break;
 
-  case 253:
+  case 262:
 
 /* Line 1455 of yacc.c  */
-#line 1713 "program_parse.y"
+#line 1885 "program_parse.y"
     {
-          if ((yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) {
+          if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector");
              YYERROR;
           }
@@ -4275,12 +4532,12 @@ yyreduce:
        ;}
     break;
 
-  case 254:
+  case 263:
 
 /* Line 1455 of yacc.c  */
-#line 1724 "program_parse.y"
+#line 1896 "program_parse.y"
     {
-          if ((yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) {
+          if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) {
              yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector");
              YYERROR;
           }
@@ -4289,10 +4546,10 @@ yyreduce:
        ;}
     break;
 
-  case 255:
+  case 264:
 
 /* Line 1455 of yacc.c  */
-#line 1735 "program_parse.y"
+#line 1907 "program_parse.y"
     {
           struct asm_symbol *exist = (struct asm_symbol *)
              _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string));
@@ -4316,7 +4573,7 @@ yyreduce:
 
 
 /* Line 1455 of yacc.c  */
-#line 4320 "program_parse.tab.c"
+#line 4577 "program_parse.tab.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -4535,7 +4792,7 @@ yyreturn:
 
 
 /* Line 1675 of yacc.c  */
-#line 1755 "program_parse.y"
+#line 1927 "program_parse.y"
 
 
 struct asm_instruction *
@@ -4548,9 +4805,17 @@ asm_instruction_ctor(gl_inst_opcode op,
    struct asm_instruction *inst = calloc(1, sizeof(struct asm_instruction));
 
    if (inst) {
-      _mesa_init_instructions(inst, 1);
+      _mesa_init_instructions(& inst->Base, 1);
       inst->Base.Opcode = op;
-      inst->Base.DstReg = *dst;
+
+      /* In the core ARB extensions only the KIL instruction doesn't have a
+       * destination register.
+       */
+      if (dst == NULL) {
+        init_dst_reg(& inst->Base.DstReg);
+      } else {
+        inst->Base.DstReg = *dst;
+      }
 
       inst->Base.SrcReg[0] = src0->Base;
       inst->SrcReg[0] = *src0;
@@ -4664,6 +4929,8 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
       }
 
       _mesa_symbol_table_add_symbol(state->st, 0, s->name, s);
+      s->next = state->sym;
+      state->sym = s;
    }
 
    return s;
@@ -4679,8 +4946,7 @@ int add_state_reference(struct gl_program_parameter_list *param_list,
 
    name = _mesa_program_state_string(tokens);
    index = _mesa_add_parameter(param_list, PROGRAM_STATE_VAR, name,
-                               size, GL_NONE,
-                               NULL, (gl_state_index *) tokens, 0x0);
+                               size, GL_NONE, NULL, tokens, 0x0);
    param_list->StateFlags |= _mesa_program_state_flags(tokens);
 
    /* free name string here since we duplicated it in add_parameter() */
@@ -4702,6 +4968,7 @@ initialize_symbol_from_state(struct gl_program *prog,
    memcpy(state_tokens, tokens, sizeof(state_tokens));
 
    param_var->type = at_param;
+   param_var->param_binding_type = PROGRAM_STATE_VAR;
 
    /* If we are adding a STATE_MATRIX that has multiple rows, we need to
     * unroll it and call add_state_reference() for each row
@@ -4753,6 +5020,8 @@ initialize_symbol_from_param(struct gl_program *prog,
          || (state_tokens[1] == STATE_LOCAL));
 
    param_var->type = at_param;
+   param_var->param_binding_type = (state_tokens[1] == STATE_ENV)
+     ? PROGRAM_ENV_PARAM : PROGRAM_LOCAL_PARAM;
 
    /* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements,
     * we need to unroll it and call add_state_reference() for each row
@@ -4792,6 +5061,7 @@ initialize_symbol_from_const(struct gl_program *prog,
                                       NULL, 0x0);
 
    param_var->type = at_param;
+   param_var->param_binding_type = PROGRAM_CONSTANT;
 
    if (param_var->param_binding_begin == ~0U)
       param_var->param_binding_begin = idx;
@@ -4801,24 +5071,69 @@ initialize_symbol_from_const(struct gl_program *prog,
 }
 
 
+char *
+make_error_string(const char *fmt, ...)
+{
+   int length;
+   char *str;
+   va_list args;
+
+   va_start(args, fmt);
+
+   /* Call vsnprintf once to determine how large the final string is.  Call it
+    * again to do the actual formatting.  from the vsnprintf manual page:
+    *
+    *    Upon successful return, these functions return the number of
+    *    characters printed  (not including the trailing '\0' used to end
+    *    output to strings).
+    */
+   length = 1 + vsnprintf(NULL, 0, fmt, args);
+
+   str = _mesa_malloc(length);
+   if (str) {
+      vsnprintf(str, length, fmt, args);
+   }
+
+   va_end(args);
+
+   return str;
+}
+
+
 void
 yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s)
 {
-   (void) state;
+   char *err_str;
+
+
+   err_str = make_error_string("glProgramStringARB(%s)\n", s);
+   if (err_str) {
+      _mesa_error(state->ctx, GL_INVALID_OPERATION, err_str);
+      _mesa_free(err_str);
+   }
+
+   err_str = make_error_string("line %u, char %u: error: %s\n",
+                              locp->first_line, locp->first_column, s);
+   _mesa_set_program_error(state->ctx, locp->position, err_str);
 
-   fprintf(stderr, "line %u, char %u: error: %s\n", locp->first_line,
-          locp->first_column, s);
+   if (err_str) {
+      _mesa_free(err_str);
+   }
 }
 
+
 GLboolean
 _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
                        GLsizei len, struct asm_parser_state *state)
 {
-   struct gl_program_constants limits;
    struct asm_instruction *inst;
    unsigned i;
    GLubyte *strz;
+   GLboolean result = GL_FALSE;
+   void *temp;
+   struct asm_symbol *sym;
 
+   state->ctx = ctx;
    state->prog->Target = target;
    state->prog->Parameters = _mesa_new_parameter_list();
 
@@ -4836,36 +5151,16 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
 
    state->st = _mesa_symbol_table_ctor();
 
-   /* All of these limits should come from ctx.
-    */
-   limits.MaxInstructions = 128;
-   limits.MaxAluInstructions = 128;
-   limits.MaxTexInstructions = 128;
-   limits.MaxTexIndirections = 128; 
-   limits.MaxAttribs = 16;
-   limits.MaxTemps = 128;
-   limits.MaxAddressRegs = 1;
-   limits.MaxParameters = 128;
-   limits.MaxLocalParams = 256;
-   limits.MaxEnvParams = 128;
-   limits.MaxNativeInstructions = 128;
-   limits.MaxNativeAluInstructions = 128;
-   limits.MaxNativeTexInstructions = 128;
-   limits.MaxNativeTexIndirections = 128;
-   limits.MaxNativeAttribs = 16;
-   limits.MaxNativeTemps = 128;
-   limits.MaxNativeAddressRegs = 1;
-   limits.MaxNativeParameters = 128;
-   limits.MaxUniformComponents = 0;
-
-   state->limits = & limits;
-
-   state->MaxTextureImageUnits = 16;
-   state->MaxTextureCoordUnits = 8;
-   state->MaxTextureUnits = 8;
-   state->MaxClipPlanes = 6;
-   state->MaxLights = 8;
-   state->MaxProgramMatrices = 8;
+   state->limits = (target == GL_VERTEX_PROGRAM_ARB)
+      ? & ctx->Const.VertexProgram
+      : & ctx->Const.FragmentProgram;
+
+   state->MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits;
+   state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits;
+   state->MaxTextureUnits = ctx->Const.MaxTextureUnits;
+   state->MaxClipPlanes = ctx->Const.MaxClipPlanes;
+   state->MaxLights = ctx->Const.MaxLights;
+   state->MaxProgramMatrices = ctx->Const.MaxProgramMatrices;
 
    state->state_param_enum = (target == GL_VERTEX_PROGRAM_ARB)
       ? STATE_VERTEX_PROGRAM : STATE_FRAGMENT_PROGRAM;
@@ -4877,9 +5172,19 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
    _mesa_program_lexer_dtor(state->scanner);
 
 
+   if (ctx->Program.ErrorPos != -1) {
+      goto error;
+   }
+
    if (! _mesa_layout_parameters(state)) {
-      fprintf(stderr, "error: layout\n");
-      return GL_FALSE;
+      struct YYLTYPE loc;
+
+      loc.first_line = 0;
+      loc.first_column = 0;
+      loc.position = len;
+
+      yyerror(& loc, state, "invalid PARAM usage");
+      goto error;
    }
 
 
@@ -4893,8 +5198,6 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
       struct asm_instruction *const temp = inst->next;
 
       state->prog->Instructions[i] = inst->Base;
-      _mesa_free(inst);
-
       inst = temp;
    }
 
@@ -4906,6 +5209,9 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
    }
    state->prog->NumInstructions++;
 
+   state->prog->NumParameters = state->prog->Parameters->NumParameters;
+   state->prog->NumAttributes = _mesa_bitcount(state->prog->InputsRead);
+
    /*
     * Initialize native counts to logical counts.  The device driver may
     * change them if program is translated into a hardware program.
@@ -4916,6 +5222,28 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
    state->prog->NumNativeAttributes = state->prog->NumAttributes;
    state->prog->NumNativeAddressRegs = state->prog->NumAddressRegs;
 
-   return GL_TRUE;
+   result = GL_TRUE;
+
+error:
+   for (inst = state->inst_head; inst != NULL; inst = temp) {
+      temp = inst->next;
+      _mesa_free(inst);
+   }
+
+   state->inst_head = NULL;
+   state->inst_tail = NULL;
+
+   for (sym = state->sym; sym != NULL; sym = temp) {
+      temp = sym->next;
+
+      _mesa_free((void *) sym->name);
+      _mesa_free(sym);
+   }
+   state->sym = NULL;
+
+   _mesa_symbol_table_dtor(state->st);
+   state->st = NULL;
+
+   return result;
 }