2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 * \file arbvertparse.c
27 * ARB_vertex_program parser.
37 #include "nvprogram.h"
38 #include "nvvertparse.h"
39 #include "nvvertprog.h"
41 #include "arbvertparse.h"
46 * This is a simple top-down predictive parser. In a nutshell, there are two key
47 * elements to a predictive parser. First, is the 'look ahead' symbol. This is simply
48 * the next token in the input stream. The other component is a stack of symbols.
50 * Given the grammar, we can derive a look ahead table. This is just a 2D array,
51 * where one axis is the non-terminal on top of the stack and the other axis is
52 * the look ahead. Each entry in the array is the production to apply when the pair
53 * of stack symbol & look ahead is encountered. If no production is listed at
54 * a given entry in the table, a parse error occurs if this combination
57 * Since we want to drive the parsing from a couple of huge tables, we have to
58 * save some information later on for processing (e.g. for code generation).
59 * For this, we explicitly recreate the parse tree representing the derivation.
60 * We can then make several passes over the parse tree to perform all additional
61 * processing, and we can be sure the the parse is valid.
63 * The stack is initialized by pushing the start symbol onto it. The look ahead
64 * symbol is initially the first token in the program string.
66 * If there is a non-terminal symbol on top of the stack, the look ahead table
67 * is consulted to find if a production exists for the top of the stack
70 * When we find a matching production, we pop the non-terminal off the top of
71 * the stack (the LHS of the production), and push the tokens on the RHS of
72 * the production onto the stack. Note that we store a pointer to the parse_tree_node
73 * containing the LHS token on the stack. This way, we can setup the children in
74 * the parse tree as we apply the production.
76 * If there is a terminal symbol on top of the stack, we compare it with the
77 * look ahead symbol. If they match, or we don't care about the value of the
78 * terminal (e.g. we know its an integer, but don't necessairly care what
79 * integer), the terminal symbol is popped off the stack and the look ahead
82 * There are a few special nasty cases of productions for which we make special
83 * cases. These aren't found in the production/look-ahead tables, but listed
86 * After the parse tree has been constructed, we make several recusive passes
87 * over it to perform various tasks.
89 * The first pass is made to clean up the state bindings. This is done in
90 * parse_tree_fold_bindings(). The goal is to reduce the big mess of a parse tree
91 * created by strings such as:
93 * result.color.secondary
95 * and roll them up into one token and fill out some information in a symbol table.
96 * In this case, the token at the root of the derivation becomes BINDING_TOKEN,
97 * and the token attribute is an index into the binding table where this state
100 * The next two passes go about associating variables with BINDING_TOKENs. This
101 * takes care of the cases like:
103 * OUTPUT foo = result.color.secondary;
105 * by inserting the index in the binding table for result.color.secondary into
106 * the attr field in the identifier table where the 'foo' variable sits.
107 * The second such pass deals with setting up arrays of program parameters,
108 * while the first only deals with scalars.
110 * We then examine all the information on variables and state that we have
111 * gathered, and layout which 'register' each variable or bit-of-state should use.
114 * Finally, we make a recursive pass of the parse tree and generate opcodes
115 * for Mesa to interpret while executing the program.
117 * It should be noted that each input/stack token has two parts, an 'identifier'
118 * and an 'attribute'. The identifier tells what class the token is, e.g. INTEGER_TOKEN,
119 * or NT_PROGRAM_SINGLE_ITEM_TOKEN. For some tokens, e.g. INTEGER_TOKEN, ID_TOKEN,
120 * FLOAT_TOKEN, or BINDING_TOKEN, the attribute for the token is an index into a table
121 * giving various properties about the token.
126 * Here are all of the structs used to hold parse state and symbol
129 * All strings which are not reserved words, floats, ints, or misc
130 * puncuation (ie .) are considered to be [potential] identifiers.
131 * When we encounter such a string while lex'ing, insert it into
132 * the id symbol table, shown below.
134 * Sometime later, we'll initialize the variable types for identifiers
135 * which really are variables. This gets shoved into the 'type' field.
137 * For variables, we'll need additional info (e.g. state it is bound to,
138 * variable we're aliased to, etc). This is stored in the 'attr' field.
139 * - For alias variables, the attr is the idx in the id table of
140 * the variable we are bound to.
141 * - For other variables, we need a whole mess of info. This can be
142 * found in the binding symbol table, below. In this case, the
143 * attr field is the idx into the binding table that describes us.
144 * - For uninitialized ids, attr is -1.
146 * The data field holds the string of the id.
148 * len is the number of identifiers in the table.
150 typedef struct st_id_table
160 * For PARAM arrays, we need to record the contents for use when
161 * laying out registers and loading state.
163 * len is the number of arrays in the table.
165 * num_elements[i] is the number of items in array i. In other words, this
166 * is the number of registers it would require when allocating.
168 * data[i][n] is the state bound to element n in array i. It is an idx into
171 typedef struct st_array_table
180 * For holding all of the data used to describe an identifier, we have the catch
181 * all binding symbol table.
183 * len is the number of bound items;
185 * type[i] tells what we are binding too, e.g. ATTRIB_POSITION, FOG_COLOR, or CONSTANT
187 * offset[i] gives the matrix number for matrix bindings, e.g. MATRIXROWS_MODELVIEW.
188 * Alternativly, it gives the number of the first parameter for PROGRAM_ENV_* and
191 * num_rows[i] gives the number of rows for multiple matrix rows, or the number
192 * of parameters in a env/local array.
194 * consts gives the 4-GLfloat constant value for bindings of type CONSTANT
196 * reg_num gives the register number which this binding is held in.
198 typedef struct st_binding_table
211 * Integers and floats are stored here.
213 typedef struct st_int_table
220 typedef struct st_float_table
228 * To avoid writing tons of mindless parser code, the parsing is driven by
229 * a few big tables of rules, plus a few special cases. However, this means
230 * that we have to do all of our analysis outside of the parsing step.
232 * So, the parser will contruct a parse tree describing the program string
233 * which we can then operate on to do things like code generation.
235 * This struct represents a node in the parse tree.
237 * If tok is a non-terminal token, tok_attr is not relevant.
238 * If tok is BINDING_TOKEN, tok_attr is the index into the binding table.
239 * if tok is INTEGER_TOKEN or FLOAT_TOKEN, tok_attr is the index in the integer/GLfloat table
241 * prod_applied is the production number applied to this token in the derivation of
242 * the program string. See arbvp_grammar.txt for a listing of the productions, and
245 typedef struct st_parse_tree_node
247 GLint tok
, tok_attr
, is_terminal
;
249 struct st_parse_tree_node
*children
[4];
253 /** This stores tokens that we lex out
255 typedef struct st_token_list
260 struct st_token_list
*next
;
265 * This holds all of the productions in the grammar.
267 * lhs is a non-terminal token, e.g. NT_PROGRAM_TOKEN.
268 * rhs is either NULL_TOKEN, another non-terminal token, or a terminal token.
269 * In some cases, we need the RHS to be a certain value, e.g. for the dst reg write masks.
270 * For this, key is used to specify the string. If we don't care about the key, just
272 * Int/floats are slightly different, "-1" specifies 'we don't care'.
274 * lhs is not very useful here, but is is convient for sanity sake when specifing productions.
276 typedef struct st_prod_table
285 * This holds the look ahead table to drive the parser. We examine the token on
286 * the top of the stack, as well as the next token in the input stream (the look ahead).
287 * We then match this against the table, and apply the approprate production. If nothing
288 * matches, we have a parse error.
290 * Here, LHS is the (non-terminal) token to match against the top of the stack.
292 * la is the token to match against the look ahead.
294 * If la is ID_TOKEN, we have to match a given keyword (e.g. 'ambient'). This is specified in
297 * prod_idx is the idx into the prod_table of the production that we are to apply if this
300 typedef struct st_look_ahead_table
310 * This is the general catch-all for the parse state
312 typedef struct st_parse_state
317 /* lex stuff ------ */
318 GLint start_pos
, curr_pos
;
320 /* ---------------- */
328 token_list
*stack_head
, *stack_free_list
;
330 parse_tree_node
*pt_head
;
334 /* local prototypes */
335 static GLint
float_table_add(float_table
* tab
, const char *str
, GLint start
,
337 static GLint
int_table_add(int_table
* tab
, const char *str
, GLint start
,
339 static GLint
id_table_add(id_table
* tab
, const char *str
, GLint start
,
341 static void parse_tree_free_children(parse_tree_node
* ptn
);
344 * Here we have a ton of defined terms that we use to identify productions,
345 * terminals, and nonterminals.
355 #define ADDRESS_TOKEN 4
356 #define ALIAS_TOKEN 5
358 #define ATTRIB_TOKEN 7
382 #define OPTION_TOKEN 25
383 #define OUTPUT_TOKEN 26
385 #define PARAM_TOKEN 27
396 #define TEMP_TOKEN 35
400 #define SEMICOLON_TOKEN 37
401 #define COMMA_TOKEN 38
402 #define PLUS_TOKEN 39
403 #define MINUS_TOKEN 40
404 #define PERIOD_TOKEN 41
405 #define DOTDOT_TOKEN 42
406 #define LBRACKET_TOKEN 43
407 #define RBRACKET_TOKEN 44
408 #define LBRACE_TOKEN 45
409 #define RBRACE_TOKEN 46
410 #define EQUAL_TOKEN 47
412 #define INTEGER_TOKEN 48
413 #define FLOAT_TOKEN 49
415 #define PROGRAM_TOKEN 50
416 #define RESULT_TOKEN 51
417 #define STATE_TOKEN 52
418 #define VERTEX_TOKEN 53
420 #define NULL_TOKEN 54
422 #define BINDING_TOKEN 55
425 * Non-terminal tokens
427 #define NT_PROGRAM_TOKEN 100
428 #define NT_OPTION_SEQUENCE_TOKEN 101
429 #define NT_OPTION_SEQUENCE2_TOKEN 102
430 #define NT_OPTION_TOKEN 103
431 #define NT_STATEMENT_SEQUENCE_TOKEN 104
432 #define NT_STATEMENT_SEQUENCE2_TOKEN 105
433 #define NT_STATEMENT_TOKEN 106
435 #define NT_INSTRUCTION_TOKEN 107
436 #define NT_ARL_INSTRUCTION_TOKEN 108
437 #define NT_VECTOROP_INSTRUCTION_TOKEN 109
438 #define NT_VECTOROP_TOKEN 110
439 #define NT_SCALAROP_INSTRUCTION_TOKEN 111
440 #define NT_SCALAROP_TOKEN 112
441 #define NT_BINSCOP_INSTRUCTION_TOKEN 113
442 #define NT_BINSCOP_INSTRUCTION2_TOKEN 114
443 #define NT_BINSCOP_TOKEN 115
444 #define NT_BINOP_INSTRUCTION_TOKEN 116
445 #define NT_BINOP_INSTRUCTION2_TOKEN 117
446 #define NT_BINOP_TOKEN 118
447 #define NT_TRIOP_INSTRUCTION_TOKEN 119
448 #define NT_TRIOP_INSTRUCTION2_TOKEN 120
449 #define NT_TRIOP_INSTRUCTION3_TOKEN 121
450 #define NT_TRIOP_TOKEN 122
451 #define NT_SWZ_INSTRUCTION_TOKEN 123
452 #define NT_SWZ_INSTRUCTION2_TOKEN 124
454 #define NT_SCALAR_SRC_REG_TOKEN 130
455 #define NT_SWIZZLE_SRC_REG_TOKEN 131
456 #define NT_MASKED_DST_REG_TOKEN 132
457 #define NT_MASKED_ADDR_REG_TOKEN 133
458 #define NT_EXTENDED_SWIZZLE_TOKEN 134
459 #define NT_EXTENDED_SWIZZLE2_TOKEN 135
460 #define NT_EXT_SWIZ_COMP_TOKEN 136
461 #define NT_EXT_SWIZ_SEL_TOKEN 137
462 #define NT_SRC_REG_TOKEN 138
463 #define NT_DST_REG_TOKEN 139
464 #define NT_VERTEX_ATTRIB_REG_TOKEN 140
466 #define NT_TEMPORARY_REG_TOKEN 150
467 #define NT_PROG_PARAM_REG_TOKEN 151
468 #define NT_PROG_PARAM_SINGLE_TOKEN 152
469 #define NT_PROG_PARAM_ARRAY_TOKEN 153
470 #define NT_PROG_PARAM_ARRAY_MEM_TOKEN 154
471 #define NT_PROG_PARAM_ARRAY_ABS_TOKEN 155
472 #define NT_PROG_PARAM_ARRAY_REL_TOKEN 156
474 #define NT_ADDR_REG_REL_OFFSET_TOKEN 157
475 #define NT_ADDR_REG_POS_OFFSET_TOKEN 158
476 #define NT_ADDR_REG_NEG_OFFSET_TOKEN 159
478 #define NT_VERTEX_RESULT_REG_TOKEN 160
479 #define NT_ADDR_REG_TOKEN 161
480 #define NT_ADDR_COMPONENT_TOKEN 162
481 #define NT_ADDR_WRITE_MASK_TOKEN 163
482 #define NT_SCALAR_SUFFIX_TOKEN 164
483 #define NT_SWIZZLE_SUFFIX_TOKEN 165
485 #define NT_COMPONENT_TOKEN 166
486 #define NT_OPTIONAL_MASK_TOKEN 167
487 #define NT_OPTIONAL_MASK2_TOKEN 168
488 #define NT_NAMING_STATEMENT_TOKEN 169
490 #define NT_ATTRIB_STATEMENT_TOKEN 170
491 #define NT_VTX_ATTRIB_BINDING_TOKEN 171
492 #define NT_VTX_ATTRIB_ITEM_TOKEN 172
493 #define NT_VTX_ATTRIB_NUM_TOKEN 173
494 #define NT_VTX_OPT_WEIGHT_NUM_TOKEN 174
495 #define NT_VTX_WEIGHT_NUM_TOKEN 175
496 #define NT_PARAM_STATEMENT_TOKEN 176
497 #define NT_PARAM_STATEMENT2_TOKEN 177
498 #define NT_OPT_ARRAY_SIZE_TOKEN 178
499 #define NT_PARAM_SINGLE_INIT_TOKEN 179
500 #define NT_PARAM_MULTIPLE_INIT_TOKEN 180
501 #define NT_PARAM_MULT_INIT_LIST_TOKEN 181
502 #define NT_PARAM_MULT_INIT_LIST2_TOKEN 182
503 #define NT_PARAM_SINGLE_ITEM_DECL_TOKEN 183
504 #define NT_PARAM_SINGLE_ITEM_USE_TOKEN 184
505 #define NT_PARAM_MULTIPLE_ITEM_TOKEN 185
506 #define NT_STATE_MULTIPLE_ITEM_TOKEN 186
507 #define NT_STATE_MULTIPLE_ITEM2_TOKEN 187
508 #define NT_FOO_TOKEN 188
509 #define NT_FOO2_TOKEN 189
510 #define NT_FOO3_TOKEN 190
511 #define NT_FOO35_TOKEN 191
512 #define NT_FOO4_TOKEN 192
513 #define NT_STATE_SINGLE_ITEM_TOKEN 193
514 #define NT_STATE_SINGLE_ITEM2_TOKEN 194
515 #define NT_STATE_MATERIAL_ITEM_TOKEN 195
516 #define NT_STATE_MATERIAL_ITEM2_TOKEN 196
517 #define NT_STATE_MAT_PROPERTY_TOKEN 197
518 #define NT_STATE_LIGHT_ITEM_TOKEN 198
519 #define NT_STATE_LIGHT_ITEM2_TOKEN 199
520 #define NT_STATE_LIGHT_PROPERTY_TOKEN 200
521 #define NT_STATE_SPOT_PROPERTY_TOKEN 201
522 #define NT_STATE_LIGHT_MODEL_ITEM_TOKEN 202
523 #define NT_STATE_LMOD_PROPERTY_TOKEN 203
524 #define NT_STATE_LMOD_PROPERTY2_TOKEN 204
526 #define NT_STATE_LIGHT_PROD_ITEM_TOKEN 207
527 #define NT_STATE_LIGHT_PROD_ITEM15_TOKEN 208
528 #define NT_STATE_LIGHT_PROD_ITEM2_TOKEN 209
529 #define NT_STATE_LPROD_PROPERTY_TOKEN 210
530 #define NT_STATE_LIGHT_NUMBER_TOKEN 211
531 #define NT_STATE_TEX_GEN_ITEM_TOKEN 212
532 #define NT_STATE_TEX_GEN_ITEM2_TOKEN 213
533 #define NT_STATE_TEX_GEN_TYPE_TOKEN 214
534 #define NT_STATE_TEX_GEN_COORD_TOKEN 215
535 #define NT_STATE_FOG_ITEM_TOKEN 216
536 #define NT_STATE_FOG_PROPERTY_TOKEN 217
538 #define NT_STATE_CLIP_PLANE_ITEM_TOKEN 218
539 #define NT_STATE_CLIP_PLANE_ITEM2_TOKEN 219
540 #define NT_STATE_CLIP_PLANE_NUM_TOKEN 220
541 #define NT_STATE_POINT_ITEM_TOKEN 221
542 #define NT_STATE_POINT_PROPERTY_TOKEN 222
543 #define NT_STATE_MATRIX_ROW_TOKEN 223
544 #define NT_STATE_MATRIX_ROW15_TOKEN 224
545 #define NT_STATE_MATRIX_ROW2_TOKEN 225
546 #define NT_STATE_MATRIX_ROW3_TOKEN 226
547 #define NT_STATE_MAT_MODIFIER_TOKEN 227
548 #define NT_STATE_MATRIX_ROW_NUM_TOKEN 228
549 #define NT_STATE_MATRIX_NAME_TOKEN 229
550 #define NT_STATE_OPT_MOD_MAT_NUM_TOKEN 230
551 #define NT_STATE_MOD_MAT_NUM_TOKEN 231
552 #define NT_STATE_PALETTE_MAT_NUM_TOKEN 232
553 #define NT_STATE_PROGRAM_MAT_NUM_TOKEN 233
555 #define NT_PROGRAM_SINGLE_ITEM_TOKEN 234
556 #define NT_PROGRAM_SINGLE_ITEM2_TOKEN 235
557 #define NT_PROGRAM_MULTIPLE_ITEM_TOKEN 236
558 #define NT_PROGRAM_MULTIPLE_ITEM2_TOKEN 237
559 #define NT_PROG_ENV_PARAMS_TOKEN 238
560 #define NT_PROG_ENV_PARAM_NUMS_TOKEN 239
561 #define NT_PROG_ENV_PARAM_NUMS2_TOKEN 240
562 #define NT_PROG_ENV_PARAM_TOKEN 250
563 #define NT_PROG_LOCAL_PARAMS_TOKEN 251
564 #define NT_PROG_LOCAL_PARAM_NUMS_TOKEN 252
565 #define NT_PROG_LOCAL_PARAM_NUMS2_TOKEN 253
566 #define NT_PROG_LOCAL_PARAM_TOKEN 254
567 #define NT_PROG_ENV_PARAM_NUM_TOKEN 255
568 #define NT_PROG_LOCAL_PARAM_NUM_TOKEN 256
570 #define NT_PARAM_CONST_DECL_TOKEN 257
571 #define NT_PARAM_CONST_USE_TOKEN 258
572 #define NT_PARAM_CONST_SCALAR_DECL_TOKEN 259
573 #define NT_PARAM_CONST_SCALAR_USE_TOKEN 260
574 #define NT_PARAM_CONST_VECTOR_TOKEN 261
575 #define NT_PARAM_CONST_VECTOR2_TOKEN 262
576 #define NT_PARAM_CONST_VECTOR3_TOKEN 263
577 #define NT_PARAM_CONST_VECTOR4_TOKEN 264
579 #define NT_SIGNED_FLOAT_CONSTANT_TOKEN 265
580 #define NT_FLOAT_CONSTANT_TOKEN 266
581 #define NT_OPTIONAL_SIGN_TOKEN 267
583 #define NT_TEMP_STATEMENT_TOKEN 268
584 #define NT_ADDRESS_STATEMENT_TOKEN 269
585 #define NT_VAR_NAME_LIST_TOKEN 270
586 #define NT_OUTPUT_STATEMENT_TOKEN 271
587 #define NT_RESULT_BINDING_TOKEN 272
588 #define NT_RESULT_BINDING2_TOKEN 273
589 #define NT_RESULT_COL_BINDING_TOKEN 274
590 #define NT_RESULT_COL_BINDING2_TOKEN 275
591 #define NT_RESULT_COL_BINDING3_TOKEN 276
592 #define NT_RESULT_COL_BINDING4_TOKEN 277
593 #define NT_RESULT_COL_BINDING5_TOKEN 278
595 #define NT_OPT_FACE_TYPE2_TOKEN 279
596 #define NT_OPT_COLOR_TYPE_TOKEN 280
597 #define NT_OPT_COLOR_TYPE2_TOKEN 281
598 #define NT_OPT_TEX_COORD_NUM_TOKEN 282
599 #define NT_TEX_COORD_NUM_TOKEN 283
601 #define NT_ALIAS_STATEMENT_TOKEN 284
602 #define NT_ESTABLISH_NAME_TOKEN 285
603 #define NT_ESTABLISHED_NAME_TOKEN 286
605 #define NT_SWIZZLE_SUFFIX2_TOKEN 287
606 #define NT_COMPONENT4_TOKEN 288
611 * XXX: These can be turned into enums
614 #define STATE_IDENT 1
622 #define STATE_ADDRE 8
623 #define STATE_ADDRES 9
624 #define STATE_ADDRESS 10
627 #define STATE_ALIA 13
628 #define STATE_ALIAS 14
633 #define STATE_ATTR 19
634 #define STATE_ATTRI 20
635 #define STATE_ATTRIB 21
680 #define STATE_OPTI 60
681 #define STATE_OPTIO 61
682 #define STATE_OPTION 62
685 #define STATE_OUTP 65
686 #define STATE_OUTPU 66
687 #define STATE_OUTPUT 67
692 #define STATE_PARA 71
693 #define STATE_PARAM 72
716 #define STATE_TEMP 92
730 #define STATE_COMMENT 103
732 /* LC == lower case, as in 'program' */
733 #define STATE_LC_P 104
734 #define STATE_LC_PR 105
735 #define STATE_LC_PRO 106
736 #define STATE_LC_PROG 107
737 #define STATE_LC_PROGR 108
738 #define STATE_LC_PROGRA 109
740 #define STATE_LC_R 110
741 #define STATE_LC_RE 111
742 #define STATE_LC_RES 112
743 #define STATE_LC_RESU 113
744 #define STATE_LC_RESUL 114
745 #define STATE_LC_RESULT 115
747 #define STATE_LC_S 116
748 #define STATE_LC_ST 117
749 #define STATE_LC_STA 118
750 #define STATE_LC_STAT 119
751 #define STATE_LC_STATE 120
753 #define STATE_LC_V 121
754 #define STATE_LC_VE 122
755 #define STATE_LC_VER 123
756 #define STATE_LC_VERT 124
757 #define STATE_LC_VERTE 125
758 #define STATE_LC_VERTEX 126
759 #define STATE_LC_PROGRAM 127
764 #define ARB_VP_ERROR -1
765 #define ARB_VP_SUCESS 0
771 #define TYPE_ATTRIB 1
773 #define TYPE_PARAM_SINGLE 3
774 #define TYPE_PARAM_ARRAY 4
776 #define TYPE_ADDRESS 6
777 #define TYPE_OUTPUT 7
781 * Vertex Attrib Bindings
783 #define ATTRIB_POSITION 1
784 #define ATTRIB_WEIGHT 2
785 #define ATTRIB_NORMAL 3
786 #define ATTRIB_COLOR_PRIMARY 4
787 #define ATTRIB_COLOR_SECONDARY 5
788 #define ATTRIB_FOGCOORD 6
789 #define ATTRIB_TEXCOORD 7
790 #define ATTRIB_MATRIXINDEX 8
791 #define ATTRIB_ATTRIB 9
796 #define RESULT_POSITION 10
797 #define RESULT_FOGCOORD 11
798 #define RESULT_POINTSIZE 12
799 #define RESULT_COLOR_FRONT_PRIMARY 13
800 #define RESULT_COLOR_FRONT_SECONDARY 14
801 #define RESULT_COLOR_BACK_PRIMARY 15
802 #define RESULT_COLOR_BACK_SECONDARY 16
803 #define RESULT_TEXCOORD 17
806 * Material Property Bindings
808 #define MATERIAL_FRONT_AMBIENT 18
809 #define MATERIAL_FRONT_DIFFUSE 19
810 #define MATERIAL_FRONT_SPECULAR 20
811 #define MATERIAL_FRONT_EMISSION 21
812 #define MATERIAL_FRONT_SHININESS 22
813 #define MATERIAL_BACK_AMBIENT 23
814 #define MATERIAL_BACK_DIFFUSE 24
815 #define MATERIAL_BACK_SPECULAR 25
816 #define MATERIAL_BACK_EMISSION 26
817 #define MATERIAL_BACK_SHININESS 27
820 * Light Property Bindings
822 #define LIGHT_AMBIENT 28
823 #define LIGHT_DIFFUSE 29
824 #define LIGHT_SPECULAR 30
825 #define LIGHT_POSITION 31
826 #define LIGHT_ATTENUATION 32
827 #define LIGHT_SPOT_DIRECTION 33
828 #define LIGHT_HALF 34
829 #define LIGHTMODEL_AMBIENT 35
830 #define LIGHTMODEL_FRONT_SCENECOLOR 36
831 #define LIGHTMODEL_BACK_SCENECOLOR 37
832 #define LIGHTPROD_FRONT_AMBIENT 38
833 #define LIGHTPROD_FRONT_DIFFUSE 39
834 #define LIGHTPROD_FRONT_SPECULAR 40
835 #define LIGHTPROD_BACK_AMBIENT 41
836 #define LIGHTPROD_BACK_DIFFUSE 42
837 #define LIGHTPROD_BACK_SPECULAR 43
840 * Texgen Property Bindings
842 #define TEXGEN_EYE_S 44
843 #define TEXGEN_EYE_T 45
844 #define TEXGEN_EYE_R 46
845 #define TEXGEN_EYE_Q 47
846 #define TEXGEN_OBJECT_S 48
847 #define TEXGEN_OBJECT_T 49
848 #define TEXGEN_OBJECT_R 50
849 #define TEXGEN_OBJECT_Q 51
852 * Fog Property Bindings
855 #define FOG_PARAMS 53
858 * Clip Property Bindings
860 #define CLIP_PLANE 54
863 * Point Property Bindings
865 #define POINT_SIZE 55
866 #define POINT_ATTENUATION 56
869 * Matrix Row Property Bindings
871 #define MATRIXROW_MODELVIEW 57
872 #define MATRIXROW_MODELVIEW_INVERSE 58
873 #define MATRIXROW_MODELVIEW_INVTRANS 59
874 #define MATRIXROW_MODELVIEW_TRANSPOSE 60
875 #define MATRIXROW_PROJECTION 61
876 #define MATRIXROW_PROJECTION_INVERSE 62
877 #define MATRIXROW_PROJECTION_INVTRANS 63
878 #define MATRIXROW_PROJECTION_TRANSPOSE 64
879 #define MATRIXROW_MVP 65
880 #define MATRIXROW_MVP_INVERSE 66
881 #define MATRIXROW_MVP_INVTRANS 67
882 #define MATRIXROW_MVP_TRANSPOSE 68
883 #define MATRIXROW_TEXTURE 69
884 #define MATRIXROW_TEXTURE_INVERSE 70
885 #define MATRIXROW_TEXTURE_INVTRANS 71
886 #define MATRIXROW_TEXTURE_TRANSPOSE 72
887 #define MATRIXROW_PALETTE 73
888 #define MATRIXROW_PALETTE_INVERSE 74
889 #define MATRIXROW_PALETTE_INVTRANS 75
890 #define MATRIXROW_PALETTE_TRANSPOSE 76
891 #define MATRIXROW_PROGRAM 77
892 #define MATRIXROW_PROGRAM_INVERSE 78
893 #define MATRIXROW_PROGRAM_INVTRANS 79
894 #define MATRIXROW_PROGRAM_TRANSPOSE 80
896 #define MATRIXROWS_MODELVIEW 81
897 #define MATRIXROWS_MODELVIEW_INVERSE 82
898 #define MATRIXROWS_MODELVIEW_INVTRANS 83
899 #define MATRIXROWS_MODELVIEW_TRANSPOSE 84
900 #define MATRIXROWS_PROJECTION 85
901 #define MATRIXROWS_PROJECTION_INVERSE 86
902 #define MATRIXROWS_PROJECTION_INVTRANS 87
903 #define MATRIXROWS_PROJECTION_TRANSPOSE 88
904 #define MATRIXROWS_MVP 89
905 #define MATRIXROWS_MVP_INVERSE 90
906 #define MATRIXROWS_MVP_INVTRANS 91
907 #define MATRIXROWS_MVP_TRANSPOSE 92
908 #define MATRIXROWS_TEXTURE 93
909 #define MATRIXROWS_TEXTURE_INVERSE 94
910 #define MATRIXROWS_TEXTURE_INVTRANS 95
911 #define MATRIXROWS_TEXTURE_TRANSPOSE 96
912 #define MATRIXROWS_PALETTE 97
913 #define MATRIXROWS_PALETTE_INVERSE 98
914 #define MATRIXROWS_PALETTE_INVTRANS 99
915 #define MATRIXROWS_PALETTE_TRANSPOSE 100
916 #define MATRIXROWS_PROGRAM 101
917 #define MATRIXROWS_PROGRAM_INVERSE 102
918 #define MATRIXROWS_PROGRAM_INVTRANS 103
919 #define MATRIXROWS_PROGRAM_TRANSPOSE 104
921 #define PROGRAM_ENV_SINGLE 105
922 #define PROGRAM_LOCAL_SINGLE 106
923 #define PROGRAM_ENV_MULTI 107
924 #define PROGRAM_LOCAL_MULTI 108
931 #define IS_WHITESPACE(c) (c == ' ') || (c == '\t') || (c == '\n')
932 #define IS_IDCHAR(c) ((c >= 'A') && (c <= 'Z')) || \
933 ((c >= 'a') && (c <= 'z')) || \
934 (c == '_') || (c == '$')
935 #define IS_DIGIT(c) (c >= '0') && (c <= '9')
936 #define IS_CD(c) (IS_DIGIT(c)) || (IS_IDCHAR(c))
938 #define ADV_TO_STATE(state) s->curr_state = state; s->curr_pos++;
940 #define ADV_OR_FALLBACK(c, state) if (curr == c) { \
941 ADV_TO_STATE(state); \
944 ADV_TO_STATE(STATE_IDENT); \
949 #define FINISH(tok) *token = tok; s->start_pos = s->curr_pos; s->curr_state = STATE_BASE; return ARB_VP_SUCESS;
950 #define ADV_AND_FINISH(tok) *token = tok; s->start_pos = s->curr_pos+1; s->curr_pos++; \
951 s->curr_state = STATE_BASE; return ARB_VP_SUCESS;
953 #define FINISH_OR_FALLBACK(tok) if (IS_CD(curr)) {\
954 ADV_TO_STATE(STATE_IDENT); \
959 #define NO_KW {"", "", "", ""}
960 #define NULL2 NULL_TOKEN, NULL_TOKEN
961 #define NULL3 NULL_TOKEN, NULL2
962 #define NULL4 NULL2, NULL2
964 /* This uglyness is the production table. See the prod_table struct definition for a description */
965 prod_table ptab
[] = {
967 {NT_OPTION_SEQUENCE_TOKEN
, NT_STATEMENT_SEQUENCE_TOKEN
, END_TOKEN
, NULL_TOKEN
}, NO_KW
},
968 {NT_OPTION_SEQUENCE_TOKEN
, {NT_OPTION_SEQUENCE2_TOKEN
, NULL3
}, NO_KW
},
969 {NT_OPTION_SEQUENCE2_TOKEN
, {NT_OPTION_TOKEN
, NT_OPTION_SEQUENCE2_TOKEN
, NULL2
}, NO_KW
},
970 {NT_OPTION_SEQUENCE2_TOKEN
, {NULL4
}, NO_KW
},
971 {NT_OPTION_TOKEN
, {OPTION_TOKEN
, ID_TOKEN
, SEMICOLON_TOKEN
, NULL_TOKEN
}, NO_KW
},
975 {NT_STATEMENT_SEQUENCE_TOKEN
, {NT_STATEMENT_SEQUENCE2_TOKEN
, NULL3
}, NO_KW
},
976 {NT_STATEMENT_SEQUENCE2_TOKEN
, {NT_STATEMENT_TOKEN
, NT_STATEMENT_SEQUENCE2_TOKEN
, NULL2
}, NO_KW
},
977 {NT_STATEMENT_SEQUENCE2_TOKEN
, {NULL4
}, NO_KW
},
978 {NT_STATEMENT_TOKEN
, {NT_INSTRUCTION_TOKEN
, SEMICOLON_TOKEN
, NULL2
}, NO_KW
},
979 {NT_STATEMENT_TOKEN
, {NT_NAMING_STATEMENT_TOKEN
, SEMICOLON_TOKEN
, NULL2
}, NO_KW
},
982 {NT_INSTRUCTION_TOKEN
, {NT_ARL_INSTRUCTION_TOKEN
, NULL3
}, NO_KW
},
983 {NT_INSTRUCTION_TOKEN
, {NT_VECTOROP_INSTRUCTION_TOKEN
, NULL3
}, NO_KW
},
984 {NT_INSTRUCTION_TOKEN
, {NT_SCALAROP_INSTRUCTION_TOKEN
, NULL3
}, NO_KW
},
985 {NT_INSTRUCTION_TOKEN
, {NT_BINSCOP_INSTRUCTION_TOKEN
, NULL3
}, NO_KW
},
986 {NT_INSTRUCTION_TOKEN
, {NT_BINOP_INSTRUCTION_TOKEN
, NULL3
}, NO_KW
},
989 {NT_INSTRUCTION_TOKEN
, {NT_TRIOP_INSTRUCTION_TOKEN
, NULL3
}, NO_KW
},
990 {NT_INSTRUCTION_TOKEN
, {NT_SWZ_INSTRUCTION_TOKEN
, NULL3
}, NO_KW
},
991 {NT_ARL_INSTRUCTION_TOKEN
, {ARL_TOKEN
, NT_MASKED_ADDR_REG_TOKEN
,
992 COMMA_TOKEN
, NT_SCALAR_SRC_REG_TOKEN
}, NO_KW
},
993 {NT_VECTOROP_INSTRUCTION_TOKEN
, {NT_VECTOROP_TOKEN
, NT_MASKED_DST_REG_TOKEN
, COMMA_TOKEN
,
994 NT_SWIZZLE_SRC_REG_TOKEN
}, NO_KW
},
995 {NT_VECTOROP_TOKEN
, {ABS_TOKEN
, NULL3
}, NO_KW
},
998 {NT_VECTOROP_TOKEN
, {FLR_TOKEN
, NULL3
}, NO_KW
},
999 {NT_VECTOROP_TOKEN
, {FRC_TOKEN
, NULL3
}, NO_KW
},
1000 {NT_VECTOROP_TOKEN
, {LIT_TOKEN
, NULL3
}, NO_KW
},
1001 {NT_VECTOROP_TOKEN
, {MOV_TOKEN
, NULL3
}, NO_KW
},
1002 {NT_SCALAROP_INSTRUCTION_TOKEN
, {NT_SCALAROP_TOKEN
, NT_MASKED_DST_REG_TOKEN
, COMMA_TOKEN
,
1003 NT_SCALAR_SRC_REG_TOKEN
}, NO_KW
},
1006 {NT_SCALAROP_TOKEN
, {EX2_TOKEN
, NULL3
}, NO_KW
},
1007 {NT_SCALAROP_TOKEN
, {EXP_TOKEN
, NULL3
}, NO_KW
},
1008 {NT_SCALAROP_TOKEN
, {LG2_TOKEN
, NULL3
}, NO_KW
},
1009 {NT_SCALAROP_TOKEN
, {LOG_TOKEN
, NULL3
}, NO_KW
},
1010 {NT_SCALAROP_TOKEN
, {RCP_TOKEN
, NULL3
}, NO_KW
},
1013 {NT_SCALAROP_TOKEN
, {RSQ_TOKEN
, NULL3
}, NO_KW
},
1014 {NT_BINSCOP_INSTRUCTION_TOKEN
,
1015 {NT_BINSCOP_TOKEN
, NT_MASKED_DST_REG_TOKEN
, NT_BINSCOP_INSTRUCTION2_TOKEN
,
1016 NULL_TOKEN
}, NO_KW
},
1017 {NT_BINSCOP_INSTRUCTION2_TOKEN
,
1018 {COMMA_TOKEN
, NT_SCALAR_SRC_REG_TOKEN
, COMMA_TOKEN
,
1019 NT_SCALAR_SRC_REG_TOKEN
}, NO_KW
},
1020 {NT_BINSCOP_TOKEN
, {POW_TOKEN
, NULL3
}, NO_KW
},
1021 {NT_BINOP_INSTRUCTION_TOKEN
,
1022 {NT_BINOP_TOKEN
, NT_MASKED_DST_REG_TOKEN
, NT_BINOP_INSTRUCTION2_TOKEN
,
1023 NULL_TOKEN
}, NO_KW
},
1026 {NT_BINOP_INSTRUCTION2_TOKEN
,
1027 {COMMA_TOKEN
, NT_SWIZZLE_SRC_REG_TOKEN
, COMMA_TOKEN
,
1028 NT_SWIZZLE_SRC_REG_TOKEN
}, NO_KW
},
1029 {NT_BINOP_TOKEN
, {ADD_TOKEN
, NULL3
}, NO_KW
},
1030 {NT_BINOP_TOKEN
, {DP3_TOKEN
, NULL3
}, NO_KW
},
1031 {NT_BINOP_TOKEN
, {DP4_TOKEN
, NULL3
}, NO_KW
},
1032 {NT_BINOP_TOKEN
, {DPH_TOKEN
, NULL3
}, NO_KW
},
1035 {NT_BINOP_TOKEN
, {DST_TOKEN
, NULL3
}, NO_KW
},
1036 {NT_BINOP_TOKEN
, {MAX_TOKEN
, NULL3
}, NO_KW
},
1037 {NT_BINOP_TOKEN
, {MIN_TOKEN
, NULL3
}, NO_KW
},
1038 {NT_BINOP_TOKEN
, {MUL_TOKEN
, NULL3
}, NO_KW
},
1039 {NT_BINOP_TOKEN
, {SGE_TOKEN
, NULL3
}, NO_KW
},
1042 {NT_BINOP_TOKEN
, {SLT_TOKEN
, NULL3
}, NO_KW
},
1043 {NT_BINOP_TOKEN
, {SUB_TOKEN
, NULL3
}, NO_KW
},
1044 {NT_BINOP_TOKEN
, {XPD_TOKEN
, NULL3
}, NO_KW
},
1045 {NT_TRIOP_INSTRUCTION_TOKEN
,
1046 {NT_TRIOP_TOKEN
, NT_MASKED_DST_REG_TOKEN
, NT_TRIOP_INSTRUCTION2_TOKEN
,
1047 NULL_TOKEN
}, NO_KW
},
1048 {NT_TRIOP_INSTRUCTION2_TOKEN
,
1049 {COMMA_TOKEN
, NT_SWIZZLE_SRC_REG_TOKEN
, NT_TRIOP_INSTRUCTION3_TOKEN
,
1050 NULL_TOKEN
}, NO_KW
},
1053 {NT_TRIOP_INSTRUCTION3_TOKEN
,
1054 {COMMA_TOKEN
, NT_SWIZZLE_SRC_REG_TOKEN
, COMMA_TOKEN
,
1055 NT_SWIZZLE_SRC_REG_TOKEN
}, NO_KW
},
1056 {NT_TRIOP_TOKEN
, {MAD_TOKEN
, NULL3
}, NO_KW
},
1057 {NT_SWZ_INSTRUCTION_TOKEN
,
1058 {SWZ_TOKEN
, NT_MASKED_DST_REG_TOKEN
, NT_SWZ_INSTRUCTION2_TOKEN
,
1059 NULL_TOKEN
}, NO_KW
},
1060 {NT_SWZ_INSTRUCTION2_TOKEN
,
1061 {COMMA_TOKEN
, NT_SRC_REG_TOKEN
, COMMA_TOKEN
, NT_EXTENDED_SWIZZLE_TOKEN
},
1063 {NT_SCALAR_SRC_REG_TOKEN
,
1064 {NT_OPTIONAL_SIGN_TOKEN
, NT_SRC_REG_TOKEN
, NT_SCALAR_SUFFIX_TOKEN
,
1065 NULL_TOKEN
}, NO_KW
},
1068 {NT_SWIZZLE_SRC_REG_TOKEN
,
1069 {NT_OPTIONAL_SIGN_TOKEN
, NT_SRC_REG_TOKEN
, NT_SWIZZLE_SUFFIX_TOKEN
,
1070 NULL_TOKEN
}, NO_KW
},
1071 {NT_MASKED_DST_REG_TOKEN
,
1072 {NT_DST_REG_TOKEN
, NT_OPTIONAL_MASK_TOKEN
, NULL2
}, NO_KW
},
1073 {NT_MASKED_ADDR_REG_TOKEN
,
1074 {NT_ADDR_REG_TOKEN
, NT_ADDR_WRITE_MASK_TOKEN
, NULL2
}, NO_KW
},
1075 {NT_EXTENDED_SWIZZLE_TOKEN
,
1076 {NT_EXT_SWIZ_COMP_TOKEN
, COMMA_TOKEN
, NT_EXT_SWIZ_COMP_TOKEN
,
1077 NT_EXTENDED_SWIZZLE2_TOKEN
}, NO_KW
},
1078 {NT_EXTENDED_SWIZZLE2_TOKEN
,
1079 {COMMA_TOKEN
, NT_EXT_SWIZ_COMP_TOKEN
, COMMA_TOKEN
,
1080 NT_EXT_SWIZ_COMP_TOKEN
}, NO_KW
},
1083 {NT_EXT_SWIZ_COMP_TOKEN
,{NT_OPTIONAL_SIGN_TOKEN
, NT_EXT_SWIZ_SEL_TOKEN
, NULL2
},
1085 {NT_EXT_SWIZ_SEL_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"0", "", "", ""}},
1086 {NT_EXT_SWIZ_SEL_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"1", "", "", ""}},
1087 {NT_EXT_SWIZ_SEL_TOKEN
, {NT_COMPONENT_TOKEN
, NULL3
}, NO_KW
},
1088 {NT_SRC_REG_TOKEN
, {NT_VERTEX_ATTRIB_REG_TOKEN
, NULL3
}, NO_KW
},
1091 {NT_SRC_REG_TOKEN
, {NT_TEMPORARY_REG_TOKEN
, NULL3
}, NO_KW
},
1092 {NT_SRC_REG_TOKEN
, {NT_PROG_PARAM_REG_TOKEN
, NULL3
}, NO_KW
},
1093 {NT_DST_REG_TOKEN
, {NT_TEMPORARY_REG_TOKEN
, NULL3
}, NO_KW
},
1094 {NT_DST_REG_TOKEN
, {NT_VERTEX_RESULT_REG_TOKEN
, NULL3
}, NO_KW
},
1095 {NT_VERTEX_ATTRIB_REG_TOKEN
, {NT_ESTABLISHED_NAME_TOKEN
, NULL3
}, NO_KW
},
1098 {NT_VERTEX_ATTRIB_REG_TOKEN
, {NT_VTX_ATTRIB_BINDING_TOKEN
, NULL3
}, NO_KW
},
1099 {NT_TEMPORARY_REG_TOKEN
, {NT_ESTABLISHED_NAME_TOKEN
, NULL3
}, NO_KW
},
1100 {NT_PROG_PARAM_REG_TOKEN
, {NT_PROG_PARAM_SINGLE_TOKEN
, NULL3
}, NO_KW
},
1101 {NT_PROG_PARAM_REG_TOKEN
,
1102 {NT_PROG_PARAM_ARRAY_TOKEN
, LBRACKET_TOKEN
, NT_PROG_PARAM_ARRAY_MEM_TOKEN
,
1103 RBRACKET_TOKEN
}, NO_KW
},
1104 {NT_PROG_PARAM_REG_TOKEN
, {NT_PARAM_SINGLE_ITEM_USE_TOKEN
, NULL3
}, NO_KW
},
1107 {NT_PROG_PARAM_SINGLE_TOKEN
, {NT_ESTABLISHED_NAME_TOKEN
, NULL3
}, NO_KW
},
1108 {NT_PROG_PARAM_ARRAY_TOKEN
, {NT_ESTABLISHED_NAME_TOKEN
, NULL3
}, NO_KW
},
1109 {NT_PROG_PARAM_ARRAY_MEM_TOKEN
, {NT_PROG_PARAM_ARRAY_ABS_TOKEN
, NULL3
}, NO_KW
},
1110 {NT_PROG_PARAM_ARRAY_MEM_TOKEN
, {NT_PROG_PARAM_ARRAY_REL_TOKEN
, NULL3
}, NO_KW
},
1111 /* -1 matches all */
1112 {NT_PROG_PARAM_ARRAY_ABS_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1116 {NT_PROG_PARAM_ARRAY_REL_TOKEN
,
1117 {NT_ADDR_REG_TOKEN
, NT_ADDR_COMPONENT_TOKEN
, NT_ADDR_REG_REL_OFFSET_TOKEN
,
1118 NULL_TOKEN
}, NO_KW
},
1119 {NT_ADDR_REG_REL_OFFSET_TOKEN
, {NULL4
}, NO_KW
},
1120 {NT_ADDR_REG_REL_OFFSET_TOKEN
,
1121 {PLUS_TOKEN
, NT_ADDR_REG_POS_OFFSET_TOKEN
, NULL2
}, NO_KW
},
1122 {NT_ADDR_REG_REL_OFFSET_TOKEN
,
1123 {MINUS_TOKEN
, NT_ADDR_REG_NEG_OFFSET_TOKEN
, NULL2
}, NO_KW
},
1124 {NT_ADDR_REG_POS_OFFSET_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1127 {NT_ADDR_REG_NEG_OFFSET_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1128 {NT_VERTEX_RESULT_REG_TOKEN
, {NT_ESTABLISHED_NAME_TOKEN
, NULL3
}, NO_KW
},
1129 {NT_VERTEX_RESULT_REG_TOKEN
, {NT_RESULT_BINDING_TOKEN
, NULL3
}, NO_KW
},
1130 {NT_ADDR_REG_TOKEN
, {NT_ESTABLISHED_NAME_TOKEN
, NULL3
}, NO_KW
},
1131 {NT_ADDR_COMPONENT_TOKEN
, {PERIOD_TOKEN
, ID_TOKEN
, NULL2
}, {"", "x", "", ""}},
1134 {NT_ADDR_WRITE_MASK_TOKEN
, {PERIOD_TOKEN
, ID_TOKEN
, NULL2
}, {"", "x", "", ""}},
1135 {NT_SCALAR_SUFFIX_TOKEN
, {PERIOD_TOKEN
, NT_COMPONENT_TOKEN
, NULL2
}, {"", "x", "", ""}},
1136 {NT_SWIZZLE_SUFFIX_TOKEN
, {NULL4
}, NO_KW
},
1137 {NT_COMPONENT_TOKEN
, {ID_TOKEN
, NULL3
}, {"x", "", "", ""}},
1138 {NT_COMPONENT_TOKEN
, {ID_TOKEN
, NULL3
}, {"y", "", "", ""}},
1141 {NT_COMPONENT_TOKEN
, {ID_TOKEN
, NULL3
}, {"z", "", "", ""}},
1142 {NT_COMPONENT_TOKEN
, {ID_TOKEN
, NULL3
}, {"w", "", "", ""}},
1143 {NT_OPTIONAL_MASK_TOKEN
, {PERIOD_TOKEN
, NT_OPTIONAL_MASK2_TOKEN
, NULL2
}, NO_KW
},
1144 {NT_OPTIONAL_MASK_TOKEN
, {NULL4
}, NO_KW
},
1145 {NT_OPTIONAL_MASK2_TOKEN
, {ID_TOKEN
, NULL3
}, {"x", "", "", ""}},
1148 {NT_OPTIONAL_MASK2_TOKEN
, {ID_TOKEN
, NULL3
}, {"y", "", "", ""}},
1149 {NT_OPTIONAL_MASK2_TOKEN
, {ID_TOKEN
, NULL3
}, {"xy", "", "", ""}},
1150 {NT_OPTIONAL_MASK2_TOKEN
, {ID_TOKEN
, NULL3
}, {"z", "", "", ""}},
1151 {NT_OPTIONAL_MASK2_TOKEN
, {ID_TOKEN
, NULL3
}, {"xz", "", "", ""}},
1152 {NT_OPTIONAL_MASK2_TOKEN
, {ID_TOKEN
, NULL3
}, {"yz", "", "", ""}},
1155 {NT_OPTIONAL_MASK2_TOKEN
, {ID_TOKEN
, NULL3
}, {"xyz", "", "", ""}},
1156 {NT_OPTIONAL_MASK2_TOKEN
, {ID_TOKEN
, NULL3
}, {"w", "", "", ""}},
1157 {NT_OPTIONAL_MASK2_TOKEN
, {ID_TOKEN
, NULL3
}, {"xw", "", "", ""}},
1158 {NT_OPTIONAL_MASK2_TOKEN
, {ID_TOKEN
, NULL3
}, {"yw", "", "", ""}},
1159 {NT_OPTIONAL_MASK2_TOKEN
, {ID_TOKEN
, NULL3
}, {"xyw", "", "", ""}},
1162 {NT_OPTIONAL_MASK2_TOKEN
, {ID_TOKEN
, NULL3
}, {"zw", "", "", ""}},
1163 {NT_OPTIONAL_MASK2_TOKEN
, {ID_TOKEN
, NULL3
}, {"xzw", "", "", ""}},
1164 {NT_OPTIONAL_MASK2_TOKEN
, {ID_TOKEN
, NULL3
}, {"yzw", "", "", ""}},
1165 {NT_OPTIONAL_MASK2_TOKEN
, {ID_TOKEN
, NULL3
}, {"xyzw", "", "", ""}},
1166 {NT_NAMING_STATEMENT_TOKEN
, {NT_ATTRIB_STATEMENT_TOKEN
, NULL3
}, NO_KW
},
1169 {NT_NAMING_STATEMENT_TOKEN
, {NT_PARAM_STATEMENT_TOKEN
, NULL3
}, NO_KW
},
1170 {NT_NAMING_STATEMENT_TOKEN
, {NT_TEMP_STATEMENT_TOKEN
, NULL3
}, NO_KW
},
1171 {NT_NAMING_STATEMENT_TOKEN
, {NT_ADDRESS_STATEMENT_TOKEN
, NULL3
}, NO_KW
},
1172 {NT_NAMING_STATEMENT_TOKEN
, {NT_OUTPUT_STATEMENT_TOKEN
, NULL3
}, NO_KW
},
1173 {NT_NAMING_STATEMENT_TOKEN
, {NT_ALIAS_STATEMENT_TOKEN
, NULL3
}, NO_KW
},
1176 {NT_ATTRIB_STATEMENT_TOKEN
,
1177 {ATTRIB_TOKEN
, NT_ESTABLISH_NAME_TOKEN
, EQUAL_TOKEN
, NT_VTX_ATTRIB_BINDING_TOKEN
}, NO_KW
},
1178 {NT_VTX_ATTRIB_BINDING_TOKEN
,
1179 {VERTEX_TOKEN
, PERIOD_TOKEN
, NT_VTX_ATTRIB_ITEM_TOKEN
, NULL_TOKEN
}, NO_KW
},
1180 {NT_VTX_ATTRIB_ITEM_TOKEN
, {ID_TOKEN
, NULL3
}, {"position", "", "", ""}},
1181 {NT_VTX_ATTRIB_ITEM_TOKEN
, {ID_TOKEN
, NT_VTX_OPT_WEIGHT_NUM_TOKEN
, NULL2
},{"weight", "", "", ""}},
1182 {NT_VTX_ATTRIB_ITEM_TOKEN
, {ID_TOKEN
, NULL3
}, {"normal", "", "", ""}},
1185 {NT_VTX_ATTRIB_ITEM_TOKEN
, {ID_TOKEN
, NT_OPT_COLOR_TYPE_TOKEN
, NULL2
},
1186 {"color", "", "", ""}},
1187 {NT_VTX_ATTRIB_ITEM_TOKEN
, {ID_TOKEN
, NULL3
}, {"fogcoord", "", "", ""}},
1188 {NT_VTX_ATTRIB_ITEM_TOKEN
, {ID_TOKEN
, NT_OPT_TEX_COORD_NUM_TOKEN
, NULL2
},
1189 {"texcoord", "", "", ""}},
1190 {NT_VTX_ATTRIB_ITEM_TOKEN
,
1191 {ID_TOKEN
, LBRACKET_TOKEN
, NT_VTX_WEIGHT_NUM_TOKEN
, RBRACKET_TOKEN
},
1192 {"matrixindex", "", "", ""}},
1193 {NT_VTX_ATTRIB_ITEM_TOKEN
,
1194 {ID_TOKEN
, LBRACKET_TOKEN
, NT_VTX_ATTRIB_NUM_TOKEN
, RBRACKET_TOKEN
},
1195 {"attrib", "", "", ""}},
1198 {NT_VTX_ATTRIB_NUM_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1199 {NT_VTX_OPT_WEIGHT_NUM_TOKEN
, {NULL4
}, NO_KW
},
1200 {NT_VTX_OPT_WEIGHT_NUM_TOKEN
, {LBRACKET_TOKEN
, NT_VTX_WEIGHT_NUM_TOKEN
, RBRACKET_TOKEN
, NULL_TOKEN
},
1202 {NT_VTX_WEIGHT_NUM_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1203 {NT_PARAM_STATEMENT_TOKEN
,
1204 {PARAM_TOKEN
, NT_ESTABLISH_NAME_TOKEN
, NT_PARAM_STATEMENT2_TOKEN
,
1205 NULL_TOKEN
}, NO_KW
},
1208 {NT_PARAM_STATEMENT2_TOKEN
, {NT_PARAM_SINGLE_INIT_TOKEN
, NULL3
}, NO_KW
},
1209 {NT_PARAM_STATEMENT2_TOKEN
, {LBRACKET_TOKEN
, NT_OPT_ARRAY_SIZE_TOKEN
, RBRACKET_TOKEN
,
1210 NT_PARAM_MULTIPLE_INIT_TOKEN
}, NO_KW
},
1211 {NT_OPT_ARRAY_SIZE_TOKEN
, {NULL4
}, NO_KW
},
1212 {NT_OPT_ARRAY_SIZE_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1213 {NT_PARAM_SINGLE_INIT_TOKEN
, {EQUAL_TOKEN
, NT_PARAM_SINGLE_ITEM_DECL_TOKEN
, NULL2
},
1218 {NT_PARAM_MULTIPLE_INIT_TOKEN
,
1219 {EQUAL_TOKEN
, LBRACE_TOKEN
, NT_PARAM_MULT_INIT_LIST_TOKEN
, RBRACE_TOKEN
},
1221 {NT_PARAM_MULT_INIT_LIST_TOKEN
,
1222 {NT_PARAM_MULTIPLE_ITEM_TOKEN
, NT_PARAM_MULT_INIT_LIST2_TOKEN
, NULL2
},
1224 {NT_PARAM_MULT_INIT_LIST2_TOKEN
,
1225 {COMMA_TOKEN
, NT_PARAM_MULT_INIT_LIST_TOKEN
, NULL2
},
1227 {NT_PARAM_MULT_INIT_LIST2_TOKEN
, {NULL4
}, NO_KW
},
1228 {NT_PARAM_SINGLE_ITEM_DECL_TOKEN
, {NT_STATE_SINGLE_ITEM_TOKEN
, NULL3
},
1232 {NT_PARAM_SINGLE_ITEM_DECL_TOKEN
, {NT_PROGRAM_SINGLE_ITEM_TOKEN
, NULL3
}, NO_KW
},
1233 {NT_PARAM_SINGLE_ITEM_DECL_TOKEN
, {NT_PARAM_CONST_DECL_TOKEN
, NULL3
}, NO_KW
},
1234 {NT_PARAM_SINGLE_ITEM_USE_TOKEN
, {NT_STATE_SINGLE_ITEM_TOKEN
, NULL3
}, NO_KW
},
1235 {NT_PARAM_SINGLE_ITEM_USE_TOKEN
, {NT_PROGRAM_SINGLE_ITEM_TOKEN
, NULL3
}, NO_KW
},
1236 {NT_PARAM_SINGLE_ITEM_USE_TOKEN
, {NT_PARAM_CONST_USE_TOKEN
, NULL3
}, NO_KW
},
1239 {NT_PARAM_MULTIPLE_ITEM_TOKEN
, {NT_STATE_MULTIPLE_ITEM_TOKEN
, NULL3
}, NO_KW
},
1240 {NT_PARAM_MULTIPLE_ITEM_TOKEN
, {NT_PROGRAM_MULTIPLE_ITEM_TOKEN
, NULL3
}, NO_KW
},
1241 {NT_PARAM_MULTIPLE_ITEM_TOKEN
, {NT_PARAM_CONST_DECL_TOKEN
, NULL3
}, NO_KW
},
1242 {NT_STATE_MULTIPLE_ITEM_TOKEN
,
1243 {STATE_TOKEN
, PERIOD_TOKEN
, NT_STATE_MULTIPLE_ITEM2_TOKEN
, NULL_TOKEN
},
1245 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, {NT_STATE_MATERIAL_ITEM_TOKEN
, NULL3
}, NO_KW
},
1248 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, {NT_STATE_LIGHT_ITEM_TOKEN
, NULL3
}, NO_KW
},
1249 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, {NT_STATE_LIGHT_MODEL_ITEM_TOKEN
, NULL3
}, NO_KW
},
1250 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, {NT_STATE_LIGHT_PROD_ITEM_TOKEN
, NULL3
}, NO_KW
},
1251 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, {NT_STATE_TEX_GEN_ITEM_TOKEN
, NULL3
}, NO_KW
},
1252 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, {NT_STATE_FOG_ITEM_TOKEN
, NULL3
}, NO_KW
},
1255 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, {NT_STATE_CLIP_PLANE_ITEM_TOKEN
, NULL3
}, NO_KW
},
1256 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, {NT_STATE_POINT_ITEM_TOKEN
, NULL3
}, NO_KW
},
1257 {NT_STATE_MULTIPLE_ITEM2_TOKEN
,
1258 {ID_TOKEN
, PERIOD_TOKEN
, NT_STATE_MATRIX_NAME_TOKEN
, NT_FOO_TOKEN
},
1259 {"matrix", "", "", ""}},
1260 {NT_FOO_TOKEN
, {PERIOD_TOKEN
, NT_FOO2_TOKEN
, NULL2
}, NO_KW
},
1261 {NT_FOO2_TOKEN
, {NT_STATE_MAT_MODIFIER_TOKEN
, NT_FOO3_TOKEN
, NULL2
}, NO_KW
},
1264 {NT_FOO2_TOKEN
, {ID_TOKEN
, LBRACKET_TOKEN
, NT_STATE_MATRIX_ROW_NUM_TOKEN
, NT_FOO4_TOKEN
},
1265 {"row", "", "", ""}},
1266 {NT_FOO3_TOKEN
, {NULL4
}, NO_KW
},
1267 {NT_FOO3_TOKEN
, {PERIOD_TOKEN
, ID_TOKEN
, LBRACKET_TOKEN
, NT_FOO35_TOKEN
},
1268 {"", "row", "", ""}},
1269 {NT_FOO35_TOKEN
, {NT_STATE_MATRIX_ROW_NUM_TOKEN
, NT_FOO4_TOKEN
, NULL2
},
1271 {NT_FOO4_TOKEN
, {RBRACKET_TOKEN
, NULL3
}, NO_KW
},
1274 {NT_FOO4_TOKEN
, {DOTDOT_TOKEN
, NT_STATE_MATRIX_ROW_NUM_TOKEN
, RBRACKET_TOKEN
, NULL_TOKEN
},
1276 {NT_STATE_SINGLE_ITEM_TOKEN
,
1277 {STATE_TOKEN
, PERIOD_TOKEN
, NT_STATE_SINGLE_ITEM2_TOKEN
, NULL_TOKEN
},
1279 {NT_STATE_SINGLE_ITEM2_TOKEN
, {NT_STATE_MATERIAL_ITEM_TOKEN
, NULL3
},
1281 {NT_STATE_SINGLE_ITEM2_TOKEN
, {NT_STATE_LIGHT_ITEM_TOKEN
, NULL3
},
1283 {NT_STATE_SINGLE_ITEM2_TOKEN
, {NT_STATE_LIGHT_MODEL_ITEM_TOKEN
, NULL3
},
1287 {NT_STATE_SINGLE_ITEM2_TOKEN
, {NT_STATE_LIGHT_PROD_ITEM_TOKEN
, NULL3
}, NO_KW
},
1288 {NT_STATE_SINGLE_ITEM2_TOKEN
, {NT_STATE_TEX_GEN_ITEM_TOKEN
, NULL3
}, NO_KW
},
1289 {NT_STATE_SINGLE_ITEM2_TOKEN
, {NT_STATE_FOG_ITEM_TOKEN
, NULL3
}, NO_KW
},
1290 {NT_STATE_SINGLE_ITEM2_TOKEN
, {NT_STATE_CLIP_PLANE_ITEM_TOKEN
, NULL3
}, NO_KW
},
1291 {NT_STATE_SINGLE_ITEM2_TOKEN
, {NT_STATE_POINT_ITEM_TOKEN
, NULL3
}, NO_KW
},
1294 {NT_STATE_SINGLE_ITEM2_TOKEN
, {NT_STATE_MATRIX_ROW_TOKEN
, NULL3
}, NO_KW
},
1295 {NT_STATE_MATERIAL_ITEM_TOKEN
,
1296 {ID_TOKEN
, PERIOD_TOKEN
, NT_STATE_MATERIAL_ITEM2_TOKEN
, NULL_TOKEN
},
1297 {"material", "", "", ""}},
1298 {NT_STATE_MATERIAL_ITEM2_TOKEN
, {NT_STATE_MAT_PROPERTY_TOKEN
, NULL3
},
1300 {NT_STATE_MATERIAL_ITEM2_TOKEN
,
1301 {PERIOD_TOKEN
, NT_OPT_FACE_TYPE2_TOKEN
, PERIOD_TOKEN
,
1302 NT_STATE_MAT_PROPERTY_TOKEN
}, NO_KW
},
1303 {NT_STATE_MAT_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"ambient", "", "", ""}},
1306 {NT_STATE_MAT_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"diffuse", "", "", ""}},
1307 {NT_STATE_MAT_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"specular", "", "", ""}},
1308 {NT_STATE_MAT_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"emission", "", "", ""}},
1309 {NT_STATE_MAT_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"shininess", "", "", ""}},
1310 {NT_STATE_LIGHT_ITEM_TOKEN
,
1311 {ID_TOKEN
, LBRACKET_TOKEN
, NT_STATE_LIGHT_NUMBER_TOKEN
,
1312 NT_STATE_LIGHT_ITEM2_TOKEN
}, {"light", "", "", ""}},
1315 {NT_STATE_LIGHT_ITEM2_TOKEN
, {RBRACKET_TOKEN
, PERIOD_TOKEN
, NT_STATE_LIGHT_PROPERTY_TOKEN
, NULL_TOKEN
},
1317 {NT_STATE_LIGHT_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"ambient", "", "", ""}},
1318 {NT_STATE_LIGHT_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"diffuse", "", "", ""}},
1319 {NT_STATE_LIGHT_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"specular", "", "", ""}},
1320 {NT_STATE_LIGHT_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"position", "", "", ""}},
1323 {NT_STATE_LIGHT_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"attenuation", "", "", ""}},
1324 {NT_STATE_LIGHT_PROPERTY_TOKEN
,
1325 {ID_TOKEN
, PERIOD_TOKEN
, NT_STATE_SPOT_PROPERTY_TOKEN
, NULL_TOKEN
},
1326 {"spot", "", "", ""}},
1327 {NT_STATE_LIGHT_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"half", "", "", ""}},
1328 {NT_STATE_SPOT_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"direction", "", "", ""}},
1329 {NT_STATE_LIGHT_MODEL_ITEM_TOKEN
,
1330 {ID_TOKEN
, NT_STATE_LMOD_PROPERTY_TOKEN
, NULL2
}, {"lightmodel", "", "", ""}},
1333 {NT_STATE_LMOD_PROPERTY_TOKEN
, {PERIOD_TOKEN
, NT_STATE_LMOD_PROPERTY2_TOKEN
, NULL2
}, NO_KW
},
1334 {NT_STATE_LMOD_PROPERTY2_TOKEN
, {ID_TOKEN
, NULL3
}, {"ambient", "", "", ""}},
1335 {NT_STATE_LMOD_PROPERTY2_TOKEN
, {ID_TOKEN
, NULL3
}, {"scenecolor", "", "", ""}},
1336 {NT_STATE_LMOD_PROPERTY2_TOKEN
,
1337 {NT_OPT_FACE_TYPE2_TOKEN
, PERIOD_TOKEN
, ID_TOKEN
, NULL_TOKEN
},
1338 {"scenecolor", "", "", ""}},
1339 {NT_STATE_LIGHT_PROD_ITEM_TOKEN
,
1340 {ID_TOKEN
, LBRACKET_TOKEN
, NT_STATE_LIGHT_NUMBER_TOKEN
,
1341 NT_STATE_LIGHT_PROD_ITEM15_TOKEN
}, {"lightprod", "", "", ""}},
1344 {NT_STATE_LIGHT_PROD_ITEM15_TOKEN
,
1345 {RBRACKET_TOKEN
, PERIOD_TOKEN
, NT_STATE_LIGHT_PROD_ITEM2_TOKEN
, NULL_TOKEN
}, NO_KW
},
1346 {NT_STATE_LIGHT_PROD_ITEM2_TOKEN
, {NT_STATE_LPROD_PROPERTY_TOKEN
, NULL3
}, NO_KW
},
1347 {NT_STATE_LIGHT_PROD_ITEM2_TOKEN
,
1348 {NT_OPT_FACE_TYPE2_TOKEN
, PERIOD_TOKEN
, NT_STATE_LPROD_PROPERTY_TOKEN
, NULL_TOKEN
}, NO_KW
},
1349 {NT_STATE_LPROD_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"diffuse", "", "", ""}},
1350 {NT_STATE_LPROD_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"ambient", "", "", ""}},
1353 {NT_STATE_LPROD_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"specular", "", "", ""}},
1354 {NT_STATE_LIGHT_NUMBER_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1355 {NT_STATE_TEX_GEN_ITEM_TOKEN
, {ID_TOKEN
, NT_OPT_TEX_COORD_NUM_TOKEN
,
1356 NT_STATE_TEX_GEN_ITEM2_TOKEN
, NULL_TOKEN
}, {"texgen", "", "", ""}},
1357 {NT_STATE_TEX_GEN_ITEM2_TOKEN
,{PERIOD_TOKEN
, NT_STATE_TEX_GEN_TYPE_TOKEN
, PERIOD_TOKEN
,
1358 NT_STATE_TEX_GEN_COORD_TOKEN
}, NO_KW
},
1359 {NT_STATE_TEX_GEN_TYPE_TOKEN
, {ID_TOKEN
, NULL3
}, {"eye", "", "", ""}},
1362 {NT_STATE_TEX_GEN_TYPE_TOKEN
, {ID_TOKEN
, NULL3
}, {"object", "", "", ""}},
1363 {NT_STATE_TEX_GEN_COORD_TOKEN
, {ID_TOKEN
, NULL3
}, {"s", "", "", ""}},
1364 {NT_STATE_TEX_GEN_COORD_TOKEN
, {ID_TOKEN
, NULL3
}, {"t", "", "", ""}},
1365 {NT_STATE_TEX_GEN_COORD_TOKEN
, {ID_TOKEN
, NULL3
}, {"r", "", "", ""}},
1366 {NT_STATE_TEX_GEN_COORD_TOKEN
, {ID_TOKEN
, NULL3
}, {"q", "", "", ""}},
1369 {NT_STATE_FOG_ITEM_TOKEN
, {ID_TOKEN
, PERIOD_TOKEN
, NT_STATE_FOG_PROPERTY_TOKEN
, NULL_TOKEN
},
1371 {NT_STATE_FOG_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"color", "", "", ""}},
1372 {NT_STATE_FOG_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"params", "", "", ""}},
1373 {NT_STATE_CLIP_PLANE_ITEM_TOKEN
,
1374 {ID_TOKEN
, LBRACKET_TOKEN
, NT_STATE_CLIP_PLANE_NUM_TOKEN
,
1375 NT_STATE_CLIP_PLANE_ITEM2_TOKEN
}, {"clip", "", "", ""}},
1376 {NT_STATE_CLIP_PLANE_ITEM2_TOKEN
,
1377 {RBRACKET_TOKEN
, PERIOD_TOKEN
, ID_TOKEN
, NULL_TOKEN
},
1378 {"", "", "plane", ""}},
1381 {NT_STATE_CLIP_PLANE_NUM_TOKEN
,{INTEGER_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1382 {NT_STATE_POINT_ITEM_TOKEN
, {ID_TOKEN
, PERIOD_TOKEN
, NT_STATE_POINT_PROPERTY_TOKEN
, NULL_TOKEN
},
1383 {"point", "", "", ""}},
1384 {NT_STATE_POINT_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"size", "", "", ""}},
1385 {NT_STATE_POINT_PROPERTY_TOKEN
, {ID_TOKEN
, NULL3
}, {"attenuation", "", "", ""}},
1386 {NT_STATE_MATRIX_ROW_TOKEN
, {ID_TOKEN
, PERIOD_TOKEN
, NT_STATE_MATRIX_NAME_TOKEN
,
1387 NT_STATE_MATRIX_ROW15_TOKEN
}, {"matrix", "", "", ""}},
1390 {NT_STATE_MATRIX_ROW15_TOKEN
, {PERIOD_TOKEN
, NT_STATE_MATRIX_ROW2_TOKEN
, NULL2
}, NO_KW
},
1391 {NT_STATE_MATRIX_ROW2_TOKEN
, {ID_TOKEN
, LBRACKET_TOKEN
,
1392 NT_STATE_MATRIX_ROW_NUM_TOKEN
, RBRACKET_TOKEN
},
1393 {"row", "", "", ""}},
1394 {NT_STATE_MATRIX_ROW2_TOKEN
, {NT_STATE_MAT_MODIFIER_TOKEN
, PERIOD_TOKEN
, ID_TOKEN
,
1395 NT_STATE_MATRIX_ROW3_TOKEN
},
1396 {"", "", "row", ""}},
1397 {NT_STATE_MATRIX_ROW3_TOKEN
, {LBRACKET_TOKEN
, NT_STATE_MATRIX_ROW_NUM_TOKEN
, RBRACKET_TOKEN
,
1398 NULL_TOKEN
}, NO_KW
},
1399 {NT_STATE_MAT_MODIFIER_TOKEN
, {ID_TOKEN
, NULL3
}, {"inverse", "", "", ""}},
1402 {NT_STATE_MAT_MODIFIER_TOKEN
, {ID_TOKEN
, NULL3
}, {"transpose", "", "", ""}},
1403 {NT_STATE_MAT_MODIFIER_TOKEN
, {ID_TOKEN
, NULL3
}, {"invtrans", "", "", ""}},
1404 {NT_STATE_MATRIX_ROW_NUM_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1405 {NT_STATE_MATRIX_NAME_TOKEN
, {ID_TOKEN
, NT_STATE_OPT_MOD_MAT_NUM_TOKEN
, NULL2
},
1406 {"modelview", "", "", ""}},
1407 {NT_STATE_MATRIX_NAME_TOKEN
, {ID_TOKEN
, NULL3
}, {"projection", "", "", ""}},
1410 {NT_STATE_MATRIX_NAME_TOKEN
, {ID_TOKEN
, NULL3
}, {"mvp", "", "", ""}},
1411 {NT_STATE_MATRIX_NAME_TOKEN
, {ID_TOKEN
, NT_OPT_TEX_COORD_NUM_TOKEN
, NULL2
},
1412 {"texture", "", "", ""}},
1413 {NT_STATE_MATRIX_NAME_TOKEN
, {ID_TOKEN
, LBRACKET_TOKEN
, NT_STATE_PALETTE_MAT_NUM_TOKEN
,
1414 RBRACKET_TOKEN
}, {"palette", "", "", ""}},
1415 {NT_STATE_MATRIX_NAME_TOKEN
, {PROGRAM_TOKEN
, LBRACKET_TOKEN
, NT_STATE_PROGRAM_MAT_NUM_TOKEN
,
1416 RBRACKET_TOKEN
}, NO_KW
},
1417 {NT_STATE_OPT_MOD_MAT_NUM_TOKEN
, {NULL4
}, NO_KW
},
1420 {NT_STATE_OPT_MOD_MAT_NUM_TOKEN
,
1421 {LBRACKET_TOKEN
, NT_STATE_MOD_MAT_NUM_TOKEN
, RBRACKET_TOKEN
, NULL_TOKEN
}, NO_KW
},
1422 {NT_STATE_MOD_MAT_NUM_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1423 {NT_STATE_PALETTE_MAT_NUM_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1424 {NT_STATE_PROGRAM_MAT_NUM_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1425 {NT_PROGRAM_SINGLE_ITEM_TOKEN
,
1426 {PROGRAM_TOKEN
, PERIOD_TOKEN
, NT_PROGRAM_SINGLE_ITEM2_TOKEN
, NULL_TOKEN
}, NO_KW
},
1429 {NT_PROGRAM_SINGLE_ITEM2_TOKEN
, {NT_PROG_ENV_PARAM_TOKEN
, NULL3
}, NO_KW
},
1430 {NT_PROGRAM_SINGLE_ITEM2_TOKEN
, {NT_PROG_LOCAL_PARAM_TOKEN
, NULL3
}, NO_KW
},
1431 {NT_PROGRAM_MULTIPLE_ITEM_TOKEN
,
1432 {PROGRAM_TOKEN
, PERIOD_TOKEN
, NT_PROGRAM_MULTIPLE_ITEM2_TOKEN
, NULL_TOKEN
}, NO_KW
},
1433 {NT_PROGRAM_MULTIPLE_ITEM2_TOKEN
, {NT_PROG_ENV_PARAMS_TOKEN
, NULL3
}, NO_KW
},
1434 {NT_PROGRAM_MULTIPLE_ITEM2_TOKEN
, {NT_PROG_LOCAL_PARAMS_TOKEN
, NULL3
}, NO_KW
},
1437 {NT_PROG_ENV_PARAMS_TOKEN
, {ID_TOKEN
, LBRACKET_TOKEN
, NT_PROG_ENV_PARAM_NUMS_TOKEN
, RBRACKET_TOKEN
},
1438 {"env", "", "", ""}},
1439 {NT_PROG_ENV_PARAM_NUMS_TOKEN
, {NT_PROG_ENV_PARAM_NUM_TOKEN
, NT_PROG_ENV_PARAM_NUMS2_TOKEN
, NULL2
},
1441 {NT_PROG_ENV_PARAM_NUMS2_TOKEN
, {DOTDOT_TOKEN
, NT_PROG_ENV_PARAM_NUM_TOKEN
, NULL2
}, NO_KW
},
1442 {NT_PROG_ENV_PARAM_NUMS2_TOKEN
, {NULL4
}, NO_KW
},
1443 {NT_PROG_ENV_PARAM_TOKEN
,
1444 {ID_TOKEN
, LBRACKET_TOKEN
, NT_PROG_ENV_PARAM_NUM_TOKEN
, RBRACKET_TOKEN
},
1445 {"env", "", "", ""}},
1448 {NT_PROG_LOCAL_PARAMS_TOKEN
, {ID_TOKEN
, LBRACKET_TOKEN
, NT_PROG_LOCAL_PARAM_NUMS_TOKEN
,
1449 RBRACKET_TOKEN
}, {"local", "", "", ""}},
1450 {NT_PROG_LOCAL_PARAM_NUMS_TOKEN
,
1451 {NT_PROG_LOCAL_PARAM_NUM_TOKEN
, NT_PROG_LOCAL_PARAM_NUMS2_TOKEN
, NULL2
},
1453 {NT_PROG_LOCAL_PARAM_NUMS2_TOKEN
, {DOTDOT_TOKEN
, NT_PROG_LOCAL_PARAM_NUM_TOKEN
, NULL2
}, NO_KW
},
1454 {NT_PROG_LOCAL_PARAM_NUMS2_TOKEN
, {NULL4
}, NO_KW
},
1455 {NT_PROG_LOCAL_PARAM_TOKEN
, {ID_TOKEN
, LBRACKET_TOKEN
, NT_PROG_LOCAL_PARAM_NUM_TOKEN
, RBRACKET_TOKEN
},
1456 {"local", "", "", ""}},
1459 {NT_PROG_ENV_PARAM_NUM_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1460 {NT_PROG_LOCAL_PARAM_NUM_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1461 {NT_PARAM_CONST_DECL_TOKEN
, {NT_PARAM_CONST_SCALAR_DECL_TOKEN
, NULL3
}, NO_KW
},
1462 {NT_PARAM_CONST_DECL_TOKEN
, {NT_PARAM_CONST_VECTOR_TOKEN
, NULL3
}, NO_KW
},
1463 {NT_PARAM_CONST_USE_TOKEN
, {NT_PARAM_CONST_SCALAR_USE_TOKEN
, NULL3
}, NO_KW
},
1466 {NT_PARAM_CONST_USE_TOKEN
, {NT_PARAM_CONST_VECTOR_TOKEN
, NULL3
}, NO_KW
},
1467 {NT_PARAM_CONST_SCALAR_DECL_TOKEN
, {NT_SIGNED_FLOAT_CONSTANT_TOKEN
, NULL3
}, NO_KW
},
1468 {NT_PARAM_CONST_SCALAR_USE_TOKEN
, {FLOAT_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1469 {NT_PARAM_CONST_VECTOR_TOKEN
, {LBRACE_TOKEN
, NT_SIGNED_FLOAT_CONSTANT_TOKEN
,
1470 NT_PARAM_CONST_VECTOR2_TOKEN
, NULL_TOKEN
}, NO_KW
},
1471 {NT_PARAM_CONST_VECTOR2_TOKEN
,{RBRACE_TOKEN
, NULL3
}, NO_KW
},
1474 {NT_PARAM_CONST_VECTOR2_TOKEN
, {COMMA_TOKEN
, NT_SIGNED_FLOAT_CONSTANT_TOKEN
,
1475 NT_PARAM_CONST_VECTOR3_TOKEN
, NULL_TOKEN
}, NO_KW
},
1476 {NT_PARAM_CONST_VECTOR3_TOKEN
, {RBRACE_TOKEN
, NULL3
}, NO_KW
},
1477 {NT_PARAM_CONST_VECTOR3_TOKEN
, {COMMA_TOKEN
, NT_SIGNED_FLOAT_CONSTANT_TOKEN
,
1478 NT_PARAM_CONST_VECTOR4_TOKEN
, NULL_TOKEN
}, NO_KW
},
1479 {NT_PARAM_CONST_VECTOR4_TOKEN
, {RBRACE_TOKEN
, NULL3
}, NO_KW
},
1480 {NT_PARAM_CONST_VECTOR4_TOKEN
, {COMMA_TOKEN
, NT_SIGNED_FLOAT_CONSTANT_TOKEN
,
1481 RBRACE_TOKEN
, NULL_TOKEN
}, NO_KW
},
1484 {NT_SIGNED_FLOAT_CONSTANT_TOKEN
, {NT_OPTIONAL_SIGN_TOKEN
, FLOAT_TOKEN
, NULL2
},
1485 {"", "-1", "", ""}},
1486 {NT_OPTIONAL_SIGN_TOKEN
, {NULL4
}, NO_KW
},
1487 {NT_OPTIONAL_SIGN_TOKEN
, {MINUS_TOKEN
, NULL3
}, NO_KW
},
1488 {NT_OPTIONAL_SIGN_TOKEN
, {PLUS_TOKEN
, NULL3
}, NO_KW
},
1489 {NT_TEMP_STATEMENT_TOKEN
, {TEMP_TOKEN
, NT_VAR_NAME_LIST_TOKEN
, NULL2
},
1493 {NT_ADDRESS_STATEMENT_TOKEN
, {ADDRESS_TOKEN
, NT_VAR_NAME_LIST_TOKEN
, NULL2
}, NO_KW
},
1494 {NT_VAR_NAME_LIST_TOKEN
, {NT_ESTABLISH_NAME_TOKEN
, NULL3
}, NO_KW
},
1495 {NT_VAR_NAME_LIST_TOKEN
, {NT_ESTABLISH_NAME_TOKEN
, COMMA_TOKEN
, NT_VAR_NAME_LIST_TOKEN
,
1496 NULL_TOKEN
}, NO_KW
},
1497 {NT_OUTPUT_STATEMENT_TOKEN
, {OUTPUT_TOKEN
, NT_ESTABLISH_NAME_TOKEN
, EQUAL_TOKEN
,
1498 NT_RESULT_BINDING_TOKEN
}, NO_KW
},
1499 {NT_RESULT_BINDING_TOKEN
, {RESULT_TOKEN
, PERIOD_TOKEN
, NT_RESULT_BINDING2_TOKEN
, NULL_TOKEN
},
1503 {NT_RESULT_BINDING2_TOKEN
, {ID_TOKEN
, NULL3
}, {"position", "", "", ""}},
1504 {NT_RESULT_BINDING2_TOKEN
, {ID_TOKEN
, NULL3
}, {"fogcoord", "", "", ""}},
1505 {NT_RESULT_BINDING2_TOKEN
, {ID_TOKEN
, NULL3
}, {"pointsize", "", "", ""}},
1506 {NT_RESULT_BINDING2_TOKEN
, {NT_RESULT_COL_BINDING_TOKEN
, NULL3
}, NO_KW
},
1507 {NT_RESULT_BINDING2_TOKEN
, {ID_TOKEN
, NT_OPT_TEX_COORD_NUM_TOKEN
, NULL2
},
1508 {"texcoord", "", "", ""}},
1511 {NT_RESULT_COL_BINDING_TOKEN
, {ID_TOKEN
, NT_RESULT_COL_BINDING2_TOKEN
, NULL2
}, {"color", "", "", ""}},
1512 {NT_RESULT_COL_BINDING2_TOKEN
, {NULL4
}, NO_KW
},
1513 {NT_RESULT_COL_BINDING2_TOKEN
, {PERIOD_TOKEN
, NT_RESULT_COL_BINDING3_TOKEN
, NULL2
}, NO_KW
},
1514 {NT_RESULT_COL_BINDING3_TOKEN
, {ID_TOKEN
, NT_RESULT_COL_BINDING4_TOKEN
, NULL2
}, {"front", "", "", ""}},
1515 {NT_RESULT_COL_BINDING3_TOKEN
, {ID_TOKEN
, NT_RESULT_COL_BINDING4_TOKEN
, NULL2
}, {"back", "", "", ""}},
1518 {NT_RESULT_COL_BINDING4_TOKEN
, {NULL4
}, NO_KW
},
1519 {NT_RESULT_COL_BINDING4_TOKEN
, {PERIOD_TOKEN
, NT_RESULT_COL_BINDING5_TOKEN
, NULL2
}, NO_KW
},
1520 {NT_RESULT_COL_BINDING5_TOKEN
, {ID_TOKEN
, NULL3
}, {"primary", "", "", ""}},
1521 {NT_RESULT_COL_BINDING5_TOKEN
, {ID_TOKEN
, NULL3
}, {"secondary", "", "", ""}},
1522 {NT_OPT_FACE_TYPE2_TOKEN
, {ID_TOKEN
, NULL3
}, {"front", "", "", ""}},
1525 {NT_OPT_FACE_TYPE2_TOKEN
, {ID_TOKEN
, NULL3
}, {"back", "", "", ""}},
1526 {NT_OPT_COLOR_TYPE_TOKEN
, {PERIOD_TOKEN
, NT_OPT_COLOR_TYPE2_TOKEN
, NULL2
}, NO_KW
},
1527 {NT_OPT_COLOR_TYPE_TOKEN
, {NULL4
}, NO_KW
},
1528 {NT_OPT_COLOR_TYPE2_TOKEN
, {ID_TOKEN
, NULL3
}, {"primary", "", "", ""}},
1529 {NT_OPT_COLOR_TYPE2_TOKEN
, {ID_TOKEN
, NULL3
}, {"secondary", "", "", ""}},
1532 {NT_OPT_TEX_COORD_NUM_TOKEN
, {NULL4
}, NO_KW
},
1533 {NT_OPT_TEX_COORD_NUM_TOKEN
,
1534 {LBRACKET_TOKEN
, NT_TEX_COORD_NUM_TOKEN
, RBRACKET_TOKEN
, NULL_TOKEN
}, NO_KW
},
1535 {NT_TEX_COORD_NUM_TOKEN
, {INTEGER_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1536 {NT_ALIAS_STATEMENT_TOKEN
, {ALIAS_TOKEN
, NT_ESTABLISH_NAME_TOKEN
, EQUAL_TOKEN
,
1537 NT_ESTABLISHED_NAME_TOKEN
}, NO_KW
},
1538 {NT_ESTABLISH_NAME_TOKEN
, {ID_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1541 {NT_ESTABLISHED_NAME_TOKEN
, {ID_TOKEN
, NULL3
}, {"-1", "", "", ""}},
1542 {NT_FOO_TOKEN
, {NULL4
}, NO_KW
},
1543 {NT_SWIZZLE_SUFFIX_TOKEN
, {PERIOD_TOKEN
, NT_SWIZZLE_SUFFIX2_TOKEN
, NULL2
},
1545 {NT_SWIZZLE_SUFFIX2_TOKEN
, {NT_COMPONENT_TOKEN
, NULL3
}, NO_KW
},
1546 {NT_SWIZZLE_SUFFIX2_TOKEN
, {NT_COMPONENT4_TOKEN
, NULL3
}, NO_KW
},
1549 /* This is the look ahead table. See the look_ahead_table struct def for a description */
1550 look_ahead_table latab
[] = {
1551 {NT_PROGRAM_TOKEN
, ABS_TOKEN
, "", 0},
1552 {NT_PROGRAM_TOKEN
, ADD_TOKEN
, "", 0},
1553 {NT_PROGRAM_TOKEN
, ADDRESS_TOKEN
, "", 0},
1554 {NT_PROGRAM_TOKEN
, ALIAS_TOKEN
, "", 0},
1555 {NT_PROGRAM_TOKEN
, ARL_TOKEN
, "", 0},
1556 {NT_PROGRAM_TOKEN
, ATTRIB_TOKEN
, "", 0},
1557 {NT_PROGRAM_TOKEN
, DP3_TOKEN
, "", 0},
1558 {NT_PROGRAM_TOKEN
, DP4_TOKEN
, "", 0},
1559 {NT_PROGRAM_TOKEN
, DPH_TOKEN
, "", 0},
1560 {NT_PROGRAM_TOKEN
, DST_TOKEN
, "", 0},
1561 {NT_PROGRAM_TOKEN
, END_TOKEN
, "", 0},
1562 {NT_PROGRAM_TOKEN
, EOF_TOKEN
, "", 0},
1563 {NT_PROGRAM_TOKEN
, EX2_TOKEN
, "", 0},
1564 {NT_PROGRAM_TOKEN
, EXP_TOKEN
, "", 0},
1565 {NT_PROGRAM_TOKEN
, FLR_TOKEN
, "", 0},
1566 {NT_PROGRAM_TOKEN
, FRC_TOKEN
, "", 0},
1567 {NT_PROGRAM_TOKEN
, LIT_TOKEN
, "", 0},
1568 {NT_PROGRAM_TOKEN
, LG2_TOKEN
, "", 0},
1569 {NT_PROGRAM_TOKEN
, LOG_TOKEN
, "", 0},
1570 {NT_PROGRAM_TOKEN
, MAD_TOKEN
, "", 0},
1571 {NT_PROGRAM_TOKEN
, MAX_TOKEN
, "", 0},
1572 {NT_PROGRAM_TOKEN
, MIN_TOKEN
, "", 0},
1573 {NT_PROGRAM_TOKEN
, MOV_TOKEN
, "", 0},
1574 {NT_PROGRAM_TOKEN
, MUL_TOKEN
, "", 0},
1575 {NT_PROGRAM_TOKEN
, OPTION_TOKEN
, "", 0},
1576 {NT_PROGRAM_TOKEN
, OUTPUT_TOKEN
, "", 0},
1577 {NT_PROGRAM_TOKEN
, PARAM_TOKEN
, "", 0},
1578 {NT_PROGRAM_TOKEN
, POW_TOKEN
, "", 0},
1579 {NT_PROGRAM_TOKEN
, RCP_TOKEN
, "", 0},
1580 {NT_PROGRAM_TOKEN
, RSQ_TOKEN
, "", 0},
1581 {NT_PROGRAM_TOKEN
, SGE_TOKEN
, "", 0},
1582 {NT_PROGRAM_TOKEN
, SLT_TOKEN
, "", 0},
1583 {NT_PROGRAM_TOKEN
, SUB_TOKEN
, "", 0},
1584 {NT_PROGRAM_TOKEN
, SWZ_TOKEN
, "", 0},
1585 {NT_PROGRAM_TOKEN
, XPD_TOKEN
, "", 0},
1586 {NT_PROGRAM_TOKEN
, TEMP_TOKEN
, "", 0},
1588 {NT_OPTION_SEQUENCE_TOKEN
, ABS_TOKEN
, "", 1},
1589 {NT_OPTION_SEQUENCE_TOKEN
, ADD_TOKEN
, "", 1},
1590 {NT_OPTION_SEQUENCE_TOKEN
, ADDRESS_TOKEN
, "", 1},
1591 {NT_OPTION_SEQUENCE_TOKEN
, ALIAS_TOKEN
, "", 1},
1592 {NT_OPTION_SEQUENCE_TOKEN
, ARL_TOKEN
, "", 1},
1593 {NT_OPTION_SEQUENCE_TOKEN
, ATTRIB_TOKEN
, "", 1},
1594 {NT_OPTION_SEQUENCE_TOKEN
, DP3_TOKEN
, "", 1},
1595 {NT_OPTION_SEQUENCE_TOKEN
, DP4_TOKEN
, "", 1},
1596 {NT_OPTION_SEQUENCE_TOKEN
, DPH_TOKEN
, "", 1},
1597 {NT_OPTION_SEQUENCE_TOKEN
, DST_TOKEN
, "", 1},
1598 {NT_OPTION_SEQUENCE_TOKEN
, END_TOKEN
, "", 1},
1599 {NT_OPTION_SEQUENCE_TOKEN
, EX2_TOKEN
, "", 1},
1600 {NT_OPTION_SEQUENCE_TOKEN
, EXP_TOKEN
, "", 1},
1601 {NT_OPTION_SEQUENCE_TOKEN
, FLR_TOKEN
, "", 1},
1602 {NT_OPTION_SEQUENCE_TOKEN
, FRC_TOKEN
, "", 1},
1603 {NT_OPTION_SEQUENCE_TOKEN
, LIT_TOKEN
, "", 1},
1604 {NT_OPTION_SEQUENCE_TOKEN
, LG2_TOKEN
, "", 1},
1605 {NT_OPTION_SEQUENCE_TOKEN
, LOG_TOKEN
, "", 1},
1606 {NT_OPTION_SEQUENCE_TOKEN
, MAD_TOKEN
, "", 1},
1607 {NT_OPTION_SEQUENCE_TOKEN
, MAX_TOKEN
, "", 1},
1608 {NT_OPTION_SEQUENCE_TOKEN
, MIN_TOKEN
, "", 1},
1609 {NT_OPTION_SEQUENCE_TOKEN
, MOV_TOKEN
, "", 1},
1610 {NT_OPTION_SEQUENCE_TOKEN
, MUL_TOKEN
, "", 1},
1611 {NT_OPTION_SEQUENCE_TOKEN
, OPTION_TOKEN
, "", 1},
1612 {NT_OPTION_SEQUENCE_TOKEN
, OUTPUT_TOKEN
, "", 1},
1613 {NT_OPTION_SEQUENCE_TOKEN
, PARAM_TOKEN
, "", 1},
1614 {NT_OPTION_SEQUENCE_TOKEN
, POW_TOKEN
, "", 1},
1615 {NT_OPTION_SEQUENCE_TOKEN
, RCP_TOKEN
, "", 1},
1616 {NT_OPTION_SEQUENCE_TOKEN
, RSQ_TOKEN
, "", 1},
1617 {NT_OPTION_SEQUENCE_TOKEN
, SGE_TOKEN
, "", 1},
1618 {NT_OPTION_SEQUENCE_TOKEN
, SLT_TOKEN
, "", 1},
1619 {NT_OPTION_SEQUENCE_TOKEN
, SUB_TOKEN
, "", 1},
1620 {NT_OPTION_SEQUENCE_TOKEN
, SWZ_TOKEN
, "", 1},
1621 {NT_OPTION_SEQUENCE_TOKEN
, XPD_TOKEN
, "", 1},
1622 {NT_OPTION_SEQUENCE_TOKEN
, TEMP_TOKEN
, "", 1},
1624 {NT_OPTION_SEQUENCE2_TOKEN
, OPTION_TOKEN
, "", 2},
1626 {NT_OPTION_SEQUENCE2_TOKEN
, ABS_TOKEN
, "", 3},
1627 {NT_OPTION_SEQUENCE2_TOKEN
, ADD_TOKEN
, "", 3},
1628 {NT_OPTION_SEQUENCE2_TOKEN
, ADDRESS_TOKEN
, "", 3},
1629 {NT_OPTION_SEQUENCE2_TOKEN
, ALIAS_TOKEN
, "", 3},
1630 {NT_OPTION_SEQUENCE2_TOKEN
, ARL_TOKEN
, "", 3},
1631 {NT_OPTION_SEQUENCE2_TOKEN
, ATTRIB_TOKEN
, "", 3},
1632 {NT_OPTION_SEQUENCE2_TOKEN
, DP3_TOKEN
, "", 3},
1633 {NT_OPTION_SEQUENCE2_TOKEN
, DP4_TOKEN
, "", 3},
1634 {NT_OPTION_SEQUENCE2_TOKEN
, DPH_TOKEN
, "", 3},
1635 {NT_OPTION_SEQUENCE2_TOKEN
, DST_TOKEN
, "", 3},
1636 {NT_OPTION_SEQUENCE2_TOKEN
, END_TOKEN
, "", 3},
1637 {NT_OPTION_SEQUENCE2_TOKEN
, EX2_TOKEN
, "", 3},
1638 {NT_OPTION_SEQUENCE2_TOKEN
, EXP_TOKEN
, "", 3},
1639 {NT_OPTION_SEQUENCE2_TOKEN
, FLR_TOKEN
, "", 3},
1640 {NT_OPTION_SEQUENCE2_TOKEN
, FRC_TOKEN
, "", 3},
1641 {NT_OPTION_SEQUENCE2_TOKEN
, LIT_TOKEN
, "", 3},
1642 {NT_OPTION_SEQUENCE2_TOKEN
, LG2_TOKEN
, "", 3},
1643 {NT_OPTION_SEQUENCE2_TOKEN
, LOG_TOKEN
, "", 3},
1644 {NT_OPTION_SEQUENCE2_TOKEN
, MAD_TOKEN
, "", 3},
1645 {NT_OPTION_SEQUENCE2_TOKEN
, MAX_TOKEN
, "", 3},
1646 {NT_OPTION_SEQUENCE2_TOKEN
, MIN_TOKEN
, "", 3},
1647 {NT_OPTION_SEQUENCE2_TOKEN
, MOV_TOKEN
, "", 3},
1648 {NT_OPTION_SEQUENCE2_TOKEN
, MUL_TOKEN
, "", 3},
1649 {NT_OPTION_SEQUENCE2_TOKEN
, OUTPUT_TOKEN
, "", 3},
1650 {NT_OPTION_SEQUENCE2_TOKEN
, PARAM_TOKEN
, "", 3},
1651 {NT_OPTION_SEQUENCE2_TOKEN
, POW_TOKEN
, "", 3},
1652 {NT_OPTION_SEQUENCE2_TOKEN
, RCP_TOKEN
, "", 3},
1653 {NT_OPTION_SEQUENCE2_TOKEN
, RSQ_TOKEN
, "", 3},
1654 {NT_OPTION_SEQUENCE2_TOKEN
, SGE_TOKEN
, "", 3},
1655 {NT_OPTION_SEQUENCE2_TOKEN
, SLT_TOKEN
, "", 3},
1656 {NT_OPTION_SEQUENCE2_TOKEN
, SUB_TOKEN
, "", 3},
1657 {NT_OPTION_SEQUENCE2_TOKEN
, SWZ_TOKEN
, "", 3},
1658 {NT_OPTION_SEQUENCE2_TOKEN
, XPD_TOKEN
, "", 3},
1659 {NT_OPTION_SEQUENCE2_TOKEN
, TEMP_TOKEN
, "", 3},
1661 {NT_OPTION_TOKEN
, OPTION_TOKEN
, "", 4},
1663 {NT_STATEMENT_SEQUENCE_TOKEN
, ABS_TOKEN
, "", 5},
1664 {NT_STATEMENT_SEQUENCE_TOKEN
, ADD_TOKEN
, "", 5},
1665 {NT_STATEMENT_SEQUENCE_TOKEN
, ADDRESS_TOKEN
, "", 5},
1666 {NT_STATEMENT_SEQUENCE_TOKEN
, ALIAS_TOKEN
, "", 5},
1667 {NT_STATEMENT_SEQUENCE_TOKEN
, ARL_TOKEN
, "", 5},
1668 {NT_STATEMENT_SEQUENCE_TOKEN
, ATTRIB_TOKEN
, "", 5},
1669 {NT_STATEMENT_SEQUENCE_TOKEN
, DP3_TOKEN
, "", 5},
1670 {NT_STATEMENT_SEQUENCE_TOKEN
, DP4_TOKEN
, "", 5},
1671 {NT_STATEMENT_SEQUENCE_TOKEN
, DPH_TOKEN
, "", 5},
1672 {NT_STATEMENT_SEQUENCE_TOKEN
, DST_TOKEN
, "", 5},
1673 {NT_STATEMENT_SEQUENCE_TOKEN
, END_TOKEN
, "", 5},
1674 {NT_STATEMENT_SEQUENCE_TOKEN
, EX2_TOKEN
, "", 5},
1675 {NT_STATEMENT_SEQUENCE_TOKEN
, EXP_TOKEN
, "", 5},
1676 {NT_STATEMENT_SEQUENCE_TOKEN
, FLR_TOKEN
, "", 5},
1677 {NT_STATEMENT_SEQUENCE_TOKEN
, FRC_TOKEN
, "", 5},
1678 {NT_STATEMENT_SEQUENCE_TOKEN
, LIT_TOKEN
, "", 5},
1679 {NT_STATEMENT_SEQUENCE_TOKEN
, LG2_TOKEN
, "", 5},
1680 {NT_STATEMENT_SEQUENCE_TOKEN
, LOG_TOKEN
, "", 5},
1681 {NT_STATEMENT_SEQUENCE_TOKEN
, MAD_TOKEN
, "", 5},
1682 {NT_STATEMENT_SEQUENCE_TOKEN
, MAX_TOKEN
, "", 5},
1683 {NT_STATEMENT_SEQUENCE_TOKEN
, MIN_TOKEN
, "", 5},
1684 {NT_STATEMENT_SEQUENCE_TOKEN
, MOV_TOKEN
, "", 5},
1685 {NT_STATEMENT_SEQUENCE_TOKEN
, MUL_TOKEN
, "", 5},
1686 {NT_STATEMENT_SEQUENCE_TOKEN
, OUTPUT_TOKEN
, "", 5},
1687 {NT_STATEMENT_SEQUENCE_TOKEN
, PARAM_TOKEN
, "", 5},
1688 {NT_STATEMENT_SEQUENCE_TOKEN
, POW_TOKEN
, "", 5},
1689 {NT_STATEMENT_SEQUENCE_TOKEN
, RCP_TOKEN
, "", 5},
1690 {NT_STATEMENT_SEQUENCE_TOKEN
, RSQ_TOKEN
, "", 5},
1691 {NT_STATEMENT_SEQUENCE_TOKEN
, SGE_TOKEN
, "", 5},
1692 {NT_STATEMENT_SEQUENCE_TOKEN
, SLT_TOKEN
, "", 5},
1693 {NT_STATEMENT_SEQUENCE_TOKEN
, SUB_TOKEN
, "", 5},
1694 {NT_STATEMENT_SEQUENCE_TOKEN
, SWZ_TOKEN
, "", 5},
1695 {NT_STATEMENT_SEQUENCE_TOKEN
, XPD_TOKEN
, "", 5},
1696 {NT_STATEMENT_SEQUENCE_TOKEN
, TEMP_TOKEN
, "", 5},
1698 {NT_STATEMENT_SEQUENCE2_TOKEN
, ABS_TOKEN
, "", 6},
1699 {NT_STATEMENT_SEQUENCE2_TOKEN
, ADD_TOKEN
, "", 6},
1700 {NT_STATEMENT_SEQUENCE2_TOKEN
, ADDRESS_TOKEN
, "", 6},
1701 {NT_STATEMENT_SEQUENCE2_TOKEN
, ALIAS_TOKEN
, "", 6},
1702 {NT_STATEMENT_SEQUENCE2_TOKEN
, ARL_TOKEN
, "", 6},
1703 {NT_STATEMENT_SEQUENCE2_TOKEN
, ATTRIB_TOKEN
, "", 6},
1704 {NT_STATEMENT_SEQUENCE2_TOKEN
, DP3_TOKEN
, "", 6},
1705 {NT_STATEMENT_SEQUENCE2_TOKEN
, DP4_TOKEN
, "", 6},
1706 {NT_STATEMENT_SEQUENCE2_TOKEN
, DPH_TOKEN
, "", 6},
1707 {NT_STATEMENT_SEQUENCE2_TOKEN
, DST_TOKEN
, "", 6},
1708 {NT_STATEMENT_SEQUENCE2_TOKEN
, EX2_TOKEN
, "", 6},
1709 {NT_STATEMENT_SEQUENCE2_TOKEN
, EXP_TOKEN
, "", 6},
1710 {NT_STATEMENT_SEQUENCE2_TOKEN
, FLR_TOKEN
, "", 6},
1711 {NT_STATEMENT_SEQUENCE2_TOKEN
, FRC_TOKEN
, "", 6},
1712 {NT_STATEMENT_SEQUENCE2_TOKEN
, LIT_TOKEN
, "", 6},
1713 {NT_STATEMENT_SEQUENCE2_TOKEN
, LG2_TOKEN
, "", 6},
1714 {NT_STATEMENT_SEQUENCE2_TOKEN
, LOG_TOKEN
, "", 6},
1715 {NT_STATEMENT_SEQUENCE2_TOKEN
, MAD_TOKEN
, "", 6},
1716 {NT_STATEMENT_SEQUENCE2_TOKEN
, MAX_TOKEN
, "", 6},
1717 {NT_STATEMENT_SEQUENCE2_TOKEN
, MIN_TOKEN
, "", 6},
1718 {NT_STATEMENT_SEQUENCE2_TOKEN
, MOV_TOKEN
, "", 6},
1719 {NT_STATEMENT_SEQUENCE2_TOKEN
, MUL_TOKEN
, "", 6},
1720 {NT_STATEMENT_SEQUENCE2_TOKEN
, OUTPUT_TOKEN
, "", 6},
1721 {NT_STATEMENT_SEQUENCE2_TOKEN
, PARAM_TOKEN
, "", 6},
1722 {NT_STATEMENT_SEQUENCE2_TOKEN
, POW_TOKEN
, "", 6},
1723 {NT_STATEMENT_SEQUENCE2_TOKEN
, RCP_TOKEN
, "", 6},
1724 {NT_STATEMENT_SEQUENCE2_TOKEN
, RSQ_TOKEN
, "", 6},
1725 {NT_STATEMENT_SEQUENCE2_TOKEN
, SGE_TOKEN
, "", 6},
1726 {NT_STATEMENT_SEQUENCE2_TOKEN
, SLT_TOKEN
, "", 6},
1727 {NT_STATEMENT_SEQUENCE2_TOKEN
, SUB_TOKEN
, "", 6},
1728 {NT_STATEMENT_SEQUENCE2_TOKEN
, SWZ_TOKEN
, "", 6},
1729 {NT_STATEMENT_SEQUENCE2_TOKEN
, XPD_TOKEN
, "", 6},
1730 {NT_STATEMENT_SEQUENCE2_TOKEN
, TEMP_TOKEN
, "", 6},
1732 {NT_STATEMENT_SEQUENCE2_TOKEN
, END_TOKEN
, "", 7},
1735 {NT_STATEMENT_TOKEN
, ABS_TOKEN
, "", 8},
1736 {NT_STATEMENT_TOKEN
, ADD_TOKEN
, "", 8},
1737 {NT_STATEMENT_TOKEN
, ARL_TOKEN
, "", 8},
1738 {NT_STATEMENT_TOKEN
, DP3_TOKEN
, "", 8},
1739 {NT_STATEMENT_TOKEN
, DP4_TOKEN
, "", 8},
1740 {NT_STATEMENT_TOKEN
, DPH_TOKEN
, "", 8},
1741 {NT_STATEMENT_TOKEN
, DST_TOKEN
, "", 8},
1742 {NT_STATEMENT_TOKEN
, EX2_TOKEN
, "", 8},
1743 {NT_STATEMENT_TOKEN
, EXP_TOKEN
, "", 8},
1744 {NT_STATEMENT_TOKEN
, FLR_TOKEN
, "", 8},
1745 {NT_STATEMENT_TOKEN
, FRC_TOKEN
, "", 8},
1746 {NT_STATEMENT_TOKEN
, LIT_TOKEN
, "", 8},
1747 {NT_STATEMENT_TOKEN
, LG2_TOKEN
, "", 8},
1748 {NT_STATEMENT_TOKEN
, LOG_TOKEN
, "", 8},
1749 {NT_STATEMENT_TOKEN
, MAD_TOKEN
, "", 8},
1750 {NT_STATEMENT_TOKEN
, MAX_TOKEN
, "", 8},
1751 {NT_STATEMENT_TOKEN
, MIN_TOKEN
, "", 8},
1752 {NT_STATEMENT_TOKEN
, MOV_TOKEN
, "", 8},
1753 {NT_STATEMENT_TOKEN
, MUL_TOKEN
, "", 8},
1754 {NT_STATEMENT_TOKEN
, POW_TOKEN
, "", 8},
1755 {NT_STATEMENT_TOKEN
, RCP_TOKEN
, "", 8},
1756 {NT_STATEMENT_TOKEN
, RSQ_TOKEN
, "", 8},
1757 {NT_STATEMENT_TOKEN
, SGE_TOKEN
, "", 8},
1758 {NT_STATEMENT_TOKEN
, SLT_TOKEN
, "", 8},
1759 {NT_STATEMENT_TOKEN
, SUB_TOKEN
, "", 8},
1760 {NT_STATEMENT_TOKEN
, SWZ_TOKEN
, "", 8},
1761 {NT_STATEMENT_TOKEN
, XPD_TOKEN
, "", 8},
1763 {NT_STATEMENT_TOKEN
, ADDRESS_TOKEN
, "", 9},
1764 {NT_STATEMENT_TOKEN
, ALIAS_TOKEN
, "", 9},
1765 {NT_STATEMENT_TOKEN
, ATTRIB_TOKEN
, "", 9},
1766 {NT_STATEMENT_TOKEN
, OUTPUT_TOKEN
, "", 9},
1767 {NT_STATEMENT_TOKEN
, PARAM_TOKEN
, "", 9},
1768 {NT_STATEMENT_TOKEN
, TEMP_TOKEN
, "", 9},
1770 {NT_INSTRUCTION_TOKEN
, ARL_TOKEN
, "", 10},
1772 {NT_INSTRUCTION_TOKEN
, ABS_TOKEN
, "", 11},
1773 {NT_INSTRUCTION_TOKEN
, FLR_TOKEN
, "", 11},
1774 {NT_INSTRUCTION_TOKEN
, FRC_TOKEN
, "", 11},
1775 {NT_INSTRUCTION_TOKEN
, LIT_TOKEN
, "", 11},
1776 {NT_INSTRUCTION_TOKEN
, MOV_TOKEN
, "", 11},
1778 {NT_INSTRUCTION_TOKEN
, EX2_TOKEN
, "", 12},
1779 {NT_INSTRUCTION_TOKEN
, EXP_TOKEN
, "", 12},
1780 {NT_INSTRUCTION_TOKEN
, LG2_TOKEN
, "", 12},
1781 {NT_INSTRUCTION_TOKEN
, LOG_TOKEN
, "", 12},
1782 {NT_INSTRUCTION_TOKEN
, RCP_TOKEN
, "", 12},
1783 {NT_INSTRUCTION_TOKEN
, RSQ_TOKEN
, "", 12},
1785 {NT_INSTRUCTION_TOKEN
, POW_TOKEN
, "", 13},
1787 {NT_INSTRUCTION_TOKEN
, ADD_TOKEN
, "", 14},
1788 {NT_INSTRUCTION_TOKEN
, DP3_TOKEN
, "", 14},
1789 {NT_INSTRUCTION_TOKEN
, DP4_TOKEN
, "", 14},
1790 {NT_INSTRUCTION_TOKEN
, DPH_TOKEN
, "", 14},
1791 {NT_INSTRUCTION_TOKEN
, DST_TOKEN
, "", 14},
1792 {NT_INSTRUCTION_TOKEN
, MAX_TOKEN
, "", 14},
1793 {NT_INSTRUCTION_TOKEN
, MIN_TOKEN
, "", 14},
1794 {NT_INSTRUCTION_TOKEN
, MUL_TOKEN
, "", 14},
1795 {NT_INSTRUCTION_TOKEN
, SGE_TOKEN
, "", 14},
1796 {NT_INSTRUCTION_TOKEN
, SLT_TOKEN
, "", 14},
1797 {NT_INSTRUCTION_TOKEN
, SUB_TOKEN
, "", 14},
1798 {NT_INSTRUCTION_TOKEN
, XPD_TOKEN
, "", 14},
1800 {NT_INSTRUCTION_TOKEN
, MAD_TOKEN
, "", 15},
1802 {NT_INSTRUCTION_TOKEN
, SWZ_TOKEN
, "", 16},
1804 {NT_ARL_INSTRUCTION_TOKEN
, ARL_TOKEN
, "", 17},
1806 {NT_VECTOROP_INSTRUCTION_TOKEN
, ABS_TOKEN
, "", 18},
1807 {NT_VECTOROP_INSTRUCTION_TOKEN
, FLR_TOKEN
, "", 18},
1808 {NT_VECTOROP_INSTRUCTION_TOKEN
, FRC_TOKEN
, "", 18},
1809 {NT_VECTOROP_INSTRUCTION_TOKEN
, LIT_TOKEN
, "", 18},
1810 {NT_VECTOROP_INSTRUCTION_TOKEN
, MOV_TOKEN
, "", 18},
1812 {NT_VECTOROP_TOKEN
, ABS_TOKEN
, "", 19},
1814 {NT_VECTOROP_TOKEN
, FLR_TOKEN
, "", 20},
1816 {NT_VECTOROP_TOKEN
, FRC_TOKEN
, "", 21},
1818 {NT_VECTOROP_TOKEN
, LIT_TOKEN
, "", 22},
1820 {NT_VECTOROP_TOKEN
, MOV_TOKEN
, "", 23},
1822 {NT_SCALAROP_INSTRUCTION_TOKEN
, EX2_TOKEN
, "", 24},
1823 {NT_SCALAROP_INSTRUCTION_TOKEN
, EXP_TOKEN
, "", 24},
1824 {NT_SCALAROP_INSTRUCTION_TOKEN
, LG2_TOKEN
, "", 24},
1825 {NT_SCALAROP_INSTRUCTION_TOKEN
, LOG_TOKEN
, "", 24},
1826 {NT_SCALAROP_INSTRUCTION_TOKEN
, RCP_TOKEN
, "", 24},
1827 {NT_SCALAROP_INSTRUCTION_TOKEN
, RSQ_TOKEN
, "", 24},
1829 {NT_SCALAROP_TOKEN
, EX2_TOKEN
, "", 25},
1831 {NT_SCALAROP_TOKEN
, EXP_TOKEN
, "", 26},
1833 {NT_SCALAROP_TOKEN
, LG2_TOKEN
, "", 27},
1835 {NT_SCALAROP_TOKEN
, LOG_TOKEN
, "", 28},
1837 {NT_SCALAROP_TOKEN
, RCP_TOKEN
, "", 29},
1839 {NT_SCALAROP_TOKEN
, RSQ_TOKEN
, "", 30},
1841 {NT_BINSCOP_INSTRUCTION_TOKEN
, POW_TOKEN
, "", 31},
1843 {NT_BINSCOP_INSTRUCTION2_TOKEN
, COMMA_TOKEN
, "", 32},
1845 {NT_BINSCOP_TOKEN
, POW_TOKEN
, "", 33},
1847 {NT_BINOP_INSTRUCTION_TOKEN
, ADD_TOKEN
, "", 34},
1848 {NT_BINOP_INSTRUCTION_TOKEN
, DP3_TOKEN
, "", 34},
1849 {NT_BINOP_INSTRUCTION_TOKEN
, DP4_TOKEN
, "", 34},
1850 {NT_BINOP_INSTRUCTION_TOKEN
, DPH_TOKEN
, "", 34},
1851 {NT_BINOP_INSTRUCTION_TOKEN
, DST_TOKEN
, "", 34},
1852 {NT_BINOP_INSTRUCTION_TOKEN
, MAX_TOKEN
, "", 34},
1853 {NT_BINOP_INSTRUCTION_TOKEN
, MIN_TOKEN
, "", 34},
1854 {NT_BINOP_INSTRUCTION_TOKEN
, MUL_TOKEN
, "", 34},
1855 {NT_BINOP_INSTRUCTION_TOKEN
, SGE_TOKEN
, "", 34},
1856 {NT_BINOP_INSTRUCTION_TOKEN
, SLT_TOKEN
, "", 34},
1857 {NT_BINOP_INSTRUCTION_TOKEN
, SUB_TOKEN
, "", 34},
1858 {NT_BINOP_INSTRUCTION_TOKEN
, XPD_TOKEN
, "", 34},
1860 {NT_BINOP_INSTRUCTION2_TOKEN
, COMMA_TOKEN
, "", 35},
1862 {NT_BINOP_TOKEN
, ADD_TOKEN
, "", 36},
1863 {NT_BINOP_TOKEN
, DP3_TOKEN
, "", 37},
1864 {NT_BINOP_TOKEN
, DP4_TOKEN
, "", 38},
1865 {NT_BINOP_TOKEN
, DPH_TOKEN
, "", 39},
1866 {NT_BINOP_TOKEN
, DST_TOKEN
, "", 40},
1867 {NT_BINOP_TOKEN
, MAX_TOKEN
, "", 41},
1868 {NT_BINOP_TOKEN
, MIN_TOKEN
, "", 42},
1869 {NT_BINOP_TOKEN
, MUL_TOKEN
, "", 43},
1870 {NT_BINOP_TOKEN
, SGE_TOKEN
, "", 44},
1871 {NT_BINOP_TOKEN
, SLT_TOKEN
, "", 45},
1872 {NT_BINOP_TOKEN
, SUB_TOKEN
, "", 46},
1873 {NT_BINOP_TOKEN
, XPD_TOKEN
, "", 47},
1875 {NT_TRIOP_INSTRUCTION_TOKEN
, MAD_TOKEN
, "", 48},
1876 {NT_TRIOP_INSTRUCTION2_TOKEN
, COMMA_TOKEN
, "", 49},
1877 {NT_TRIOP_INSTRUCTION3_TOKEN
, COMMA_TOKEN
, "", 50},
1879 {NT_TRIOP_TOKEN
, MAD_TOKEN
, "", 51},
1880 {NT_SWZ_INSTRUCTION_TOKEN
, SWZ_TOKEN
, "", 52},
1881 {NT_SWZ_INSTRUCTION2_TOKEN
, COMMA_TOKEN
, "", 53},
1883 {NT_SCALAR_SRC_REG_TOKEN
, PLUS_TOKEN
, "", 54},
1884 {NT_SCALAR_SRC_REG_TOKEN
, MINUS_TOKEN
, "", 54},
1885 {NT_SCALAR_SRC_REG_TOKEN
, VERTEX_TOKEN
, "", 54},
1886 {NT_SCALAR_SRC_REG_TOKEN
, STATE_TOKEN
, "", 54},
1887 {NT_SCALAR_SRC_REG_TOKEN
, PROGRAM_TOKEN
, "", 54},
1888 {NT_SCALAR_SRC_REG_TOKEN
, LBRACE_TOKEN
, "", 54},
1889 {NT_SCALAR_SRC_REG_TOKEN
, FLOAT_TOKEN
, "-1", 54},
1890 {NT_SCALAR_SRC_REG_TOKEN
, INTEGER_TOKEN
, "-1", 54},
1891 {NT_SCALAR_SRC_REG_TOKEN
, ID_TOKEN
, "-1", 54},
1893 {NT_SWIZZLE_SRC_REG_TOKEN
, PLUS_TOKEN
, "", 55},
1894 {NT_SWIZZLE_SRC_REG_TOKEN
, MINUS_TOKEN
, "", 55},
1895 {NT_SWIZZLE_SRC_REG_TOKEN
, VERTEX_TOKEN
, "", 55},
1896 {NT_SWIZZLE_SRC_REG_TOKEN
, STATE_TOKEN
, "", 55},
1897 {NT_SWIZZLE_SRC_REG_TOKEN
, PROGRAM_TOKEN
, "", 55},
1898 {NT_SWIZZLE_SRC_REG_TOKEN
, LBRACE_TOKEN
, "", 55},
1899 {NT_SWIZZLE_SRC_REG_TOKEN
, FLOAT_TOKEN
, "-1", 55},
1900 {NT_SWIZZLE_SRC_REG_TOKEN
, INTEGER_TOKEN
, "-1", 55},
1901 {NT_SWIZZLE_SRC_REG_TOKEN
, ID_TOKEN
, "-1", 55},
1903 {NT_MASKED_DST_REG_TOKEN
, ID_TOKEN
, "-1", 56},
1904 {NT_MASKED_DST_REG_TOKEN
, RESULT_TOKEN
, "", 56},
1905 {NT_MASKED_ADDR_REG_TOKEN
, ID_TOKEN
, "-1", 57},
1907 {NT_EXTENDED_SWIZZLE_TOKEN
, PLUS_TOKEN
, "", 58},
1908 {NT_EXTENDED_SWIZZLE_TOKEN
, MINUS_TOKEN
, "", 58},
1909 {NT_EXTENDED_SWIZZLE_TOKEN
, INTEGER_TOKEN
, "0", 58},
1910 {NT_EXTENDED_SWIZZLE_TOKEN
, INTEGER_TOKEN
, "1", 58},
1911 {NT_EXTENDED_SWIZZLE_TOKEN
, ID_TOKEN
, "x", 58},
1912 {NT_EXTENDED_SWIZZLE_TOKEN
, ID_TOKEN
, "y", 58},
1913 {NT_EXTENDED_SWIZZLE_TOKEN
, ID_TOKEN
, "z", 58},
1914 {NT_EXTENDED_SWIZZLE_TOKEN
, ID_TOKEN
, "w", 58},
1916 {NT_EXTENDED_SWIZZLE2_TOKEN
, COMMA_TOKEN
, "", 59},
1918 {NT_EXT_SWIZ_COMP_TOKEN
, PLUS_TOKEN
, "", 60},
1919 {NT_EXT_SWIZ_COMP_TOKEN
, MINUS_TOKEN
, "", 60},
1920 {NT_EXT_SWIZ_COMP_TOKEN
, INTEGER_TOKEN
, "0", 60},
1921 {NT_EXT_SWIZ_COMP_TOKEN
, INTEGER_TOKEN
, "1", 60},
1922 {NT_EXT_SWIZ_COMP_TOKEN
, ID_TOKEN
, "x", 60},
1923 {NT_EXT_SWIZ_COMP_TOKEN
, ID_TOKEN
, "y", 60},
1924 {NT_EXT_SWIZ_COMP_TOKEN
, ID_TOKEN
, "z", 60},
1925 {NT_EXT_SWIZ_COMP_TOKEN
, ID_TOKEN
, "w", 60},
1927 {NT_EXT_SWIZ_SEL_TOKEN
, INTEGER_TOKEN
, "0", 61},
1928 {NT_EXT_SWIZ_SEL_TOKEN
, INTEGER_TOKEN
, "1", 62},
1929 {NT_EXT_SWIZ_SEL_TOKEN
, ID_TOKEN
, "x", 63},
1930 {NT_EXT_SWIZ_SEL_TOKEN
, ID_TOKEN
, "y", 63},
1931 {NT_EXT_SWIZ_SEL_TOKEN
, ID_TOKEN
, "z", 63},
1932 {NT_EXT_SWIZ_SEL_TOKEN
, ID_TOKEN
, "w", 63},
1934 /* Special case for 64 - 68 */
1936 {NT_DST_REG_TOKEN
, RESULT_TOKEN
, "", 68},
1937 {NT_VERTEX_ATTRIB_REG_TOKEN
, ID_TOKEN
, "-1", 69},
1938 {NT_VERTEX_ATTRIB_REG_TOKEN
, VERTEX_TOKEN
, "", 70},
1939 {NT_TEMPORARY_REG_TOKEN
, ID_TOKEN
, "-1", 71},
1941 /* Special case for 72 - 73 */
1943 {NT_PROG_PARAM_REG_TOKEN
, STATE_TOKEN
, "", 74},
1944 {NT_PROG_PARAM_REG_TOKEN
, PROGRAM_TOKEN
, "", 74},
1945 {NT_PROG_PARAM_REG_TOKEN
, LBRACE_TOKEN
, "", 74},
1946 {NT_PROG_PARAM_REG_TOKEN
, FLOAT_TOKEN
, "-1", 74},
1948 {NT_PROG_PARAM_SINGLE_TOKEN
, ID_TOKEN
, "-1", 75},
1949 {NT_PROG_PARAM_ARRAY_TOKEN
, ID_TOKEN
, "-1", 76},
1950 {NT_PROG_PARAM_ARRAY_MEM_TOKEN
, INTEGER_TOKEN
, "-1", 77},
1951 {NT_PROG_PARAM_ARRAY_MEM_TOKEN
, ID_TOKEN
, "-1", 78},
1952 {NT_PROG_PARAM_ARRAY_ABS_TOKEN
, INTEGER_TOKEN
, "-1", 79},
1953 {NT_PROG_PARAM_ARRAY_REL_TOKEN
, ID_TOKEN
, "-1", 80},
1955 {NT_ADDR_REG_REL_OFFSET_TOKEN
, RBRACKET_TOKEN
, "", 81},
1956 {NT_ADDR_REG_REL_OFFSET_TOKEN
, PLUS_TOKEN
, "", 82},
1957 {NT_ADDR_REG_REL_OFFSET_TOKEN
, MINUS_TOKEN
, "", 83},
1958 {NT_ADDR_REG_POS_OFFSET_TOKEN
, INTEGER_TOKEN
, "-1", 84},
1959 {NT_ADDR_REG_NEG_OFFSET_TOKEN
, INTEGER_TOKEN
, "-1", 85},
1962 {NT_VERTEX_RESULT_REG_TOKEN
, ID_TOKEN
, "-1", 86},
1963 {NT_VERTEX_RESULT_REG_TOKEN
, RESULT_TOKEN
, "", 87},
1964 {NT_ADDR_REG_TOKEN
, ID_TOKEN
, "-1", 88},
1965 {NT_ADDR_COMPONENT_TOKEN
, PERIOD_TOKEN
, "", 89},
1966 {NT_ADDR_WRITE_MASK_TOKEN
, PERIOD_TOKEN
, "", 90},
1968 {NT_SCALAR_SUFFIX_TOKEN
, PERIOD_TOKEN
, "", 91},
1970 {NT_SWIZZLE_SUFFIX_TOKEN
, COMMA_TOKEN
, "", 92},
1971 {NT_SWIZZLE_SUFFIX_TOKEN
, SEMICOLON_TOKEN
, "", 92},
1972 {NT_SWIZZLE_SUFFIX_TOKEN
, PERIOD_TOKEN
, "", 317},
1974 {NT_COMPONENT_TOKEN
, ID_TOKEN
, "x", 93},
1975 {NT_COMPONENT_TOKEN
, ID_TOKEN
, "y", 94},
1976 {NT_COMPONENT_TOKEN
, ID_TOKEN
, "z", 95},
1977 {NT_COMPONENT_TOKEN
, ID_TOKEN
, "w", 96},
1979 {NT_OPTIONAL_MASK_TOKEN
, PERIOD_TOKEN
, "", 97},
1980 {NT_OPTIONAL_MASK_TOKEN
, COMMA_TOKEN
, "", 98},
1982 {NT_OPTIONAL_MASK2_TOKEN
, ID_TOKEN
, "x", 99},
1983 {NT_OPTIONAL_MASK2_TOKEN
, ID_TOKEN
, "y", 100},
1984 {NT_OPTIONAL_MASK2_TOKEN
, ID_TOKEN
, "xy", 101},
1985 {NT_OPTIONAL_MASK2_TOKEN
, ID_TOKEN
, "z", 102},
1986 {NT_OPTIONAL_MASK2_TOKEN
, ID_TOKEN
, "xz", 103},
1987 {NT_OPTIONAL_MASK2_TOKEN
, ID_TOKEN
, "yz", 104},
1988 {NT_OPTIONAL_MASK2_TOKEN
, ID_TOKEN
, "xyz", 105},
1989 {NT_OPTIONAL_MASK2_TOKEN
, ID_TOKEN
, "w", 106},
1990 {NT_OPTIONAL_MASK2_TOKEN
, ID_TOKEN
, "xw", 107},
1991 {NT_OPTIONAL_MASK2_TOKEN
, ID_TOKEN
, "yw", 108},
1992 {NT_OPTIONAL_MASK2_TOKEN
, ID_TOKEN
, "xyw", 109},
1993 {NT_OPTIONAL_MASK2_TOKEN
, ID_TOKEN
, "zw", 110},
1994 {NT_OPTIONAL_MASK2_TOKEN
, ID_TOKEN
, "xzw", 111},
1995 {NT_OPTIONAL_MASK2_TOKEN
, ID_TOKEN
, "yzw", 112},
1996 {NT_OPTIONAL_MASK2_TOKEN
, ID_TOKEN
, "xyzw", 113},
1999 {NT_NAMING_STATEMENT_TOKEN
, ATTRIB_TOKEN
, "", 114},
2000 {NT_NAMING_STATEMENT_TOKEN
, PARAM_TOKEN
, "", 115},
2001 {NT_NAMING_STATEMENT_TOKEN
, TEMP_TOKEN
, "", 116},
2002 {NT_NAMING_STATEMENT_TOKEN
, ADDRESS_TOKEN
, "", 117},
2003 {NT_NAMING_STATEMENT_TOKEN
, OUTPUT_TOKEN
, "", 118},
2004 {NT_NAMING_STATEMENT_TOKEN
, ALIAS_TOKEN
, "", 119},
2006 {NT_ATTRIB_STATEMENT_TOKEN
, ATTRIB_TOKEN
, "", 120},
2007 {NT_VTX_ATTRIB_BINDING_TOKEN
, VERTEX_TOKEN
, "", 121},
2009 {NT_VTX_ATTRIB_ITEM_TOKEN
, ID_TOKEN
, "position", 122},
2010 {NT_VTX_ATTRIB_ITEM_TOKEN
, ID_TOKEN
, "weight", 123},
2011 {NT_VTX_ATTRIB_ITEM_TOKEN
, ID_TOKEN
, "normal", 124},
2012 {NT_VTX_ATTRIB_ITEM_TOKEN
, ID_TOKEN
, "color", 125},
2013 {NT_VTX_ATTRIB_ITEM_TOKEN
, ID_TOKEN
, "fogcoord", 126},
2014 {NT_VTX_ATTRIB_ITEM_TOKEN
, ID_TOKEN
, "texcoord", 127},
2015 {NT_VTX_ATTRIB_ITEM_TOKEN
, ID_TOKEN
, "matrixindex", 128},
2016 {NT_VTX_ATTRIB_ITEM_TOKEN
, ID_TOKEN
, "attrib", 129},
2018 {NT_VTX_ATTRIB_NUM_TOKEN
, INTEGER_TOKEN
, "-1", 130},
2019 {NT_VTX_OPT_WEIGHT_NUM_TOKEN
, SEMICOLON_TOKEN
, "", 131},
2020 {NT_VTX_OPT_WEIGHT_NUM_TOKEN
, COMMA_TOKEN
, "", 131},
2021 {NT_VTX_OPT_WEIGHT_NUM_TOKEN
, PERIOD_TOKEN
, "", 131},
2022 {NT_VTX_OPT_WEIGHT_NUM_TOKEN
, LBRACKET_TOKEN
, "", 132},
2024 {NT_VTX_WEIGHT_NUM_TOKEN
, INTEGER_TOKEN
, "-1", 133},
2025 {NT_PARAM_STATEMENT_TOKEN
, PARAM_TOKEN
, "", 134},
2026 {NT_PARAM_STATEMENT2_TOKEN
, EQUAL_TOKEN
, "", 135},
2027 {NT_PARAM_STATEMENT2_TOKEN
, LBRACKET_TOKEN
, "", 136},
2029 {NT_OPT_ARRAY_SIZE_TOKEN
, RBRACKET_TOKEN
, "", 137},
2030 {NT_OPT_ARRAY_SIZE_TOKEN
, INTEGER_TOKEN
, "-1", 138},
2032 {NT_PARAM_SINGLE_INIT_TOKEN
, EQUAL_TOKEN
, "", 139},
2033 {NT_PARAM_MULTIPLE_INIT_TOKEN
, EQUAL_TOKEN
, "", 140},
2035 {NT_PARAM_MULT_INIT_LIST_TOKEN
, STATE_TOKEN
, "", 141},
2036 {NT_PARAM_MULT_INIT_LIST_TOKEN
, PROGRAM_TOKEN
, "", 141},
2037 {NT_PARAM_MULT_INIT_LIST_TOKEN
, PLUS_TOKEN
, "", 141},
2038 {NT_PARAM_MULT_INIT_LIST_TOKEN
, MINUS_TOKEN
, "", 141},
2039 {NT_PARAM_MULT_INIT_LIST_TOKEN
, FLOAT_TOKEN
, "-1", 141},
2040 {NT_PARAM_MULT_INIT_LIST_TOKEN
, INTEGER_TOKEN
, "-1", 141},
2041 {NT_PARAM_MULT_INIT_LIST_TOKEN
, LBRACE_TOKEN
, "", 141},
2044 {NT_PARAM_MULT_INIT_LIST2_TOKEN
, COMMA_TOKEN
, "", 142},
2045 {NT_PARAM_MULT_INIT_LIST2_TOKEN
, RBRACE_TOKEN
, "", 143},
2048 {NT_PARAM_SINGLE_ITEM_DECL_TOKEN
, STATE_TOKEN
, "", 144},
2049 {NT_PARAM_SINGLE_ITEM_DECL_TOKEN
, PROGRAM_TOKEN
, "", 145},
2050 {NT_PARAM_SINGLE_ITEM_DECL_TOKEN
, PLUS_TOKEN
, "", 146},
2051 {NT_PARAM_SINGLE_ITEM_DECL_TOKEN
, MINUS_TOKEN
, "", 146},
2052 {NT_PARAM_SINGLE_ITEM_DECL_TOKEN
, FLOAT_TOKEN
, "-1", 146},
2053 {NT_PARAM_SINGLE_ITEM_DECL_TOKEN
, INTEGER_TOKEN
, "-1", 146},
2054 {NT_PARAM_SINGLE_ITEM_DECL_TOKEN
, LBRACE_TOKEN
, "", 146},
2057 {NT_PARAM_SINGLE_ITEM_USE_TOKEN
, STATE_TOKEN
, "", 147},
2058 {NT_PARAM_SINGLE_ITEM_USE_TOKEN
, PROGRAM_TOKEN
, "", 148},
2059 {NT_PARAM_SINGLE_ITEM_USE_TOKEN
, LBRACE_TOKEN
, "", 149},
2060 {NT_PARAM_SINGLE_ITEM_USE_TOKEN
, FLOAT_TOKEN
, "-1", 149},
2061 {NT_PARAM_SINGLE_ITEM_USE_TOKEN
, INTEGER_TOKEN
, "-1", 149},
2063 {NT_PARAM_MULTIPLE_ITEM_TOKEN
, STATE_TOKEN
, "", 150},
2064 {NT_PARAM_MULTIPLE_ITEM_TOKEN
, PROGRAM_TOKEN
, "", 151},
2065 {NT_PARAM_MULTIPLE_ITEM_TOKEN
, PLUS_TOKEN
, "", 152},
2066 {NT_PARAM_MULTIPLE_ITEM_TOKEN
, MINUS_TOKEN
, "", 152},
2067 {NT_PARAM_MULTIPLE_ITEM_TOKEN
, FLOAT_TOKEN
, "-1", 152},
2068 {NT_PARAM_MULTIPLE_ITEM_TOKEN
, INTEGER_TOKEN
, "-1", 152},
2069 {NT_PARAM_MULTIPLE_ITEM_TOKEN
, LBRACE_TOKEN
, "", 152},
2071 {NT_STATE_MULTIPLE_ITEM_TOKEN
, STATE_TOKEN
, "", 153},
2072 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, ID_TOKEN
, "material", 154},
2073 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, ID_TOKEN
, "light", 155},
2074 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, ID_TOKEN
, "lightmodel", 156},
2075 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, ID_TOKEN
, "lightprod", 157},
2076 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, ID_TOKEN
, "texgen", 158},
2077 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, ID_TOKEN
, "fog", 159},
2078 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, ID_TOKEN
, "clip", 160},
2079 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, ID_TOKEN
, "point", 161},
2080 {NT_STATE_MULTIPLE_ITEM2_TOKEN
, ID_TOKEN
, "matrix", 162},
2082 {NT_FOO_TOKEN
, PERIOD_TOKEN
, "", 163},
2083 {NT_FOO_TOKEN
, COMMA_TOKEN
, "", 316},
2084 {NT_FOO_TOKEN
, RBRACE_TOKEN
, "", 316},
2085 {NT_FOO2_TOKEN
, ID_TOKEN
, "inverse", 164},
2086 {NT_FOO2_TOKEN
, ID_TOKEN
, "transpose", 164},
2087 {NT_FOO2_TOKEN
, ID_TOKEN
, "invtrans", 164},
2088 {NT_FOO2_TOKEN
, ID_TOKEN
, "row", 165},
2089 {NT_FOO3_TOKEN
, COMMA_TOKEN
, "", 166},
2090 {NT_FOO3_TOKEN
, RBRACE_TOKEN
, "", 166},
2091 {NT_FOO3_TOKEN
, PERIOD_TOKEN
, "", 167},
2093 {NT_FOO35_TOKEN
, INTEGER_TOKEN
, "-1", 168},
2094 {NT_FOO4_TOKEN
, RBRACKET_TOKEN
, "", 169},
2095 {NT_FOO4_TOKEN
, DOTDOT_TOKEN
, "", 170},
2097 {NT_STATE_SINGLE_ITEM_TOKEN
, STATE_TOKEN
, "", 171},
2098 {NT_STATE_SINGLE_ITEM2_TOKEN
, ID_TOKEN
, "material", 172},
2099 {NT_STATE_SINGLE_ITEM2_TOKEN
, ID_TOKEN
, "light", 173},
2100 {NT_STATE_SINGLE_ITEM2_TOKEN
, ID_TOKEN
, "lightmodel", 174},
2101 {NT_STATE_SINGLE_ITEM2_TOKEN
, ID_TOKEN
, "lightprod", 175},
2102 {NT_STATE_SINGLE_ITEM2_TOKEN
, ID_TOKEN
, "texgen", 176},
2103 {NT_STATE_SINGLE_ITEM2_TOKEN
, ID_TOKEN
, "fog", 177},
2104 {NT_STATE_SINGLE_ITEM2_TOKEN
, ID_TOKEN
, "clip", 178},
2105 {NT_STATE_SINGLE_ITEM2_TOKEN
, ID_TOKEN
, "point", 179},
2106 {NT_STATE_SINGLE_ITEM2_TOKEN
, ID_TOKEN
, "matrix", 180},
2109 {NT_STATE_MATERIAL_ITEM_TOKEN
, ID_TOKEN
, "material", 181},
2110 {NT_STATE_MATERIAL_ITEM2_TOKEN
, ID_TOKEN
, "ambient", 182},
2111 {NT_STATE_MATERIAL_ITEM2_TOKEN
, ID_TOKEN
, "diffuse", 182},
2112 {NT_STATE_MATERIAL_ITEM2_TOKEN
, ID_TOKEN
, "specular", 182},
2113 {NT_STATE_MATERIAL_ITEM2_TOKEN
, ID_TOKEN
, "emission", 182},
2114 {NT_STATE_MATERIAL_ITEM2_TOKEN
, ID_TOKEN
, "shininess", 182},
2116 {NT_STATE_MATERIAL_ITEM2_TOKEN
, PERIOD_TOKEN
, "", 183},
2117 {NT_STATE_MAT_PROPERTY_TOKEN
, ID_TOKEN
, "ambient", 184},
2118 {NT_STATE_MAT_PROPERTY_TOKEN
, ID_TOKEN
, "diffuse", 185},
2119 {NT_STATE_MAT_PROPERTY_TOKEN
, ID_TOKEN
, "specular", 186},
2120 {NT_STATE_MAT_PROPERTY_TOKEN
, ID_TOKEN
, "emission", 187},
2121 {NT_STATE_MAT_PROPERTY_TOKEN
, ID_TOKEN
, "shininess", 188},
2124 {NT_STATE_LIGHT_ITEM_TOKEN
, ID_TOKEN
, "light", 189},
2125 {NT_STATE_LIGHT_ITEM2_TOKEN
, RBRACKET_TOKEN
, "", 190},
2128 {NT_STATE_LIGHT_PROPERTY_TOKEN
, ID_TOKEN
, "ambient", 191},
2129 {NT_STATE_LIGHT_PROPERTY_TOKEN
, ID_TOKEN
, "diffuse", 192},
2130 {NT_STATE_LIGHT_PROPERTY_TOKEN
, ID_TOKEN
, "specular", 193},
2131 {NT_STATE_LIGHT_PROPERTY_TOKEN
, ID_TOKEN
, "position", 194},
2132 {NT_STATE_LIGHT_PROPERTY_TOKEN
, ID_TOKEN
, "attenuation", 195},
2133 {NT_STATE_LIGHT_PROPERTY_TOKEN
, ID_TOKEN
, "spot", 196},
2134 {NT_STATE_LIGHT_PROPERTY_TOKEN
, ID_TOKEN
, "half", 197},
2136 {NT_STATE_SPOT_PROPERTY_TOKEN
, ID_TOKEN
, "direction", 198},
2137 {NT_STATE_LIGHT_MODEL_ITEM_TOKEN
, ID_TOKEN
, "lightmodel", 199},
2140 {NT_STATE_LMOD_PROPERTY_TOKEN
, PERIOD_TOKEN
, "", 200},
2141 {NT_STATE_LMOD_PROPERTY2_TOKEN
, ID_TOKEN
, "ambient", 201},
2142 {NT_STATE_LMOD_PROPERTY2_TOKEN
, ID_TOKEN
, "scenecolor", 202},
2143 {NT_STATE_LMOD_PROPERTY2_TOKEN
, ID_TOKEN
, "front", 203},
2144 {NT_STATE_LMOD_PROPERTY2_TOKEN
, ID_TOKEN
, "back", 203},
2147 {NT_STATE_LIGHT_PROD_ITEM_TOKEN
, ID_TOKEN
, "lightprod", 204},
2148 {NT_STATE_LIGHT_PROD_ITEM15_TOKEN
, RBRACKET_TOKEN
, "", 205},
2149 {NT_STATE_LIGHT_PROD_ITEM2_TOKEN
, ID_TOKEN
, "ambient", 206},
2150 {NT_STATE_LIGHT_PROD_ITEM2_TOKEN
, ID_TOKEN
, "diffuse", 206},
2151 {NT_STATE_LIGHT_PROD_ITEM2_TOKEN
, ID_TOKEN
, "specular", 206},
2152 {NT_STATE_LIGHT_PROD_ITEM2_TOKEN
, ID_TOKEN
, "front", 207},
2153 {NT_STATE_LIGHT_PROD_ITEM2_TOKEN
, ID_TOKEN
, "back", 207},
2155 {NT_STATE_LPROD_PROPERTY_TOKEN
, ID_TOKEN
, "ambient", 208},
2156 {NT_STATE_LPROD_PROPERTY_TOKEN
, ID_TOKEN
, "diffuse", 209},
2157 {NT_STATE_LPROD_PROPERTY_TOKEN
, ID_TOKEN
, "specular", 210},
2159 {NT_STATE_LIGHT_NUMBER_TOKEN
, INTEGER_TOKEN
, "-1", 211},
2160 {NT_STATE_TEX_GEN_ITEM_TOKEN
, ID_TOKEN
, "texgen", 212},
2161 {NT_STATE_TEX_GEN_ITEM2_TOKEN
, PERIOD_TOKEN
, "", 213},
2162 {NT_STATE_TEX_GEN_TYPE_TOKEN
, ID_TOKEN
, "eye", 214},
2163 {NT_STATE_TEX_GEN_TYPE_TOKEN
, ID_TOKEN
, "object", 215},
2166 {NT_STATE_TEX_GEN_COORD_TOKEN
, ID_TOKEN
, "s", 216},
2167 {NT_STATE_TEX_GEN_COORD_TOKEN
, ID_TOKEN
, "t", 217},
2168 {NT_STATE_TEX_GEN_COORD_TOKEN
, ID_TOKEN
, "r", 218},
2169 {NT_STATE_TEX_GEN_COORD_TOKEN
, ID_TOKEN
, "q", 219},
2171 {NT_STATE_FOG_ITEM_TOKEN
, ID_TOKEN
, "fog", 220},
2173 {NT_STATE_FOG_PROPERTY_TOKEN
, ID_TOKEN
, "color", 221},
2174 {NT_STATE_FOG_PROPERTY_TOKEN
, ID_TOKEN
, "params", 222},
2176 {NT_STATE_CLIP_PLANE_ITEM_TOKEN
, ID_TOKEN
, "clip", 223},
2177 {NT_STATE_CLIP_PLANE_ITEM2_TOKEN
, RBRACKET_TOKEN
, "", 224},
2178 {NT_STATE_CLIP_PLANE_NUM_TOKEN
, INTEGER_TOKEN
, "-1", 225},
2179 {NT_STATE_POINT_ITEM_TOKEN
, ID_TOKEN
, "point", 226},
2180 {NT_STATE_POINT_PROPERTY_TOKEN
, ID_TOKEN
, "size", 227},
2181 {NT_STATE_POINT_PROPERTY_TOKEN
, ID_TOKEN
, "attenuation", 228},
2184 {NT_STATE_MATRIX_ROW_TOKEN
, ID_TOKEN
, "matrix", 229},
2185 {NT_STATE_MATRIX_ROW15_TOKEN
, PERIOD_TOKEN
, "", 230},
2186 {NT_STATE_MATRIX_ROW2_TOKEN
, ID_TOKEN
, "row", 231},
2187 {NT_STATE_MATRIX_ROW2_TOKEN
, ID_TOKEN
, "inverse", 232},
2188 {NT_STATE_MATRIX_ROW2_TOKEN
, ID_TOKEN
, "transpose", 232},
2189 {NT_STATE_MATRIX_ROW2_TOKEN
, ID_TOKEN
, "invtrans", 232},
2190 {NT_STATE_MATRIX_ROW3_TOKEN
, LBRACKET_TOKEN
, "", 233},
2192 {NT_STATE_MAT_MODIFIER_TOKEN
, ID_TOKEN
, "inverse", 234},
2193 {NT_STATE_MAT_MODIFIER_TOKEN
, ID_TOKEN
, "transpose", 235},
2194 {NT_STATE_MAT_MODIFIER_TOKEN
, ID_TOKEN
, "invtrans", 236},
2195 {NT_STATE_MATRIX_ROW_NUM_TOKEN
, INTEGER_TOKEN
, "-1", 237},
2198 {NT_STATE_MATRIX_NAME_TOKEN
, ID_TOKEN
, "modelview", 238},
2199 {NT_STATE_MATRIX_NAME_TOKEN
, ID_TOKEN
, "projection", 239},
2200 {NT_STATE_MATRIX_NAME_TOKEN
, ID_TOKEN
, "mvp", 240},
2201 {NT_STATE_MATRIX_NAME_TOKEN
, ID_TOKEN
, "texture", 241},
2202 {NT_STATE_MATRIX_NAME_TOKEN
, ID_TOKEN
, "palette", 242},
2203 {NT_STATE_MATRIX_NAME_TOKEN
, PROGRAM_TOKEN
, "", 243},
2205 {NT_STATE_OPT_MOD_MAT_NUM_TOKEN
, PERIOD_TOKEN
, "", 244},
2206 {NT_STATE_OPT_MOD_MAT_NUM_TOKEN
, COMMA_TOKEN
, "", 244},
2207 {NT_STATE_OPT_MOD_MAT_NUM_TOKEN
, RBRACE_TOKEN
, "", 244},
2208 {NT_STATE_OPT_MOD_MAT_NUM_TOKEN
, LBRACKET_TOKEN
, "", 245},
2210 {NT_STATE_MOD_MAT_NUM_TOKEN
, INTEGER_TOKEN
, "-1", 246},
2211 {NT_STATE_PALETTE_MAT_NUM_TOKEN
, INTEGER_TOKEN
, "-1", 247},
2212 {NT_STATE_PROGRAM_MAT_NUM_TOKEN
, INTEGER_TOKEN
, "-1", 248},
2214 {NT_PROGRAM_SINGLE_ITEM_TOKEN
, PROGRAM_TOKEN
, "", 249},
2215 {NT_PROGRAM_SINGLE_ITEM2_TOKEN
, ID_TOKEN
, "env", 250},
2216 {NT_PROGRAM_SINGLE_ITEM2_TOKEN
, ID_TOKEN
, "local", 251},
2219 {NT_PROGRAM_MULTIPLE_ITEM_TOKEN
, PROGRAM_TOKEN
, "", 252},
2220 {NT_PROGRAM_MULTIPLE_ITEM2_TOKEN
, ID_TOKEN
, "env", 253},
2221 {NT_PROGRAM_MULTIPLE_ITEM2_TOKEN
, ID_TOKEN
, "local", 254},
2222 {NT_PROG_ENV_PARAMS_TOKEN
, ID_TOKEN
, "env", 255},
2223 {NT_PROG_ENV_PARAM_NUMS_TOKEN
, INTEGER_TOKEN
, "-1", 256},
2224 {NT_PROG_ENV_PARAM_NUMS2_TOKEN
, DOTDOT_TOKEN
, "", 257},
2225 {NT_PROG_ENV_PARAM_NUMS2_TOKEN
, RBRACKET_TOKEN
, "", 258},
2226 {NT_PROG_ENV_PARAM_TOKEN
, ID_TOKEN
, "env", 259},
2228 {NT_PROG_LOCAL_PARAMS_TOKEN
, ID_TOKEN
, "local", 260},
2229 {NT_PROG_LOCAL_PARAM_NUMS_TOKEN
, INTEGER_TOKEN
, "-1", 261},
2230 {NT_PROG_LOCAL_PARAM_NUMS2_TOKEN
, DOTDOT_TOKEN
, "", 262},
2231 {NT_PROG_LOCAL_PARAM_NUMS2_TOKEN
, RBRACKET_TOKEN
, "", 263},
2232 {NT_PROG_LOCAL_PARAM_TOKEN
, ID_TOKEN
, "local", 264},
2233 {NT_PROG_ENV_PARAM_NUM_TOKEN
, INTEGER_TOKEN
, "-1", 265},
2234 {NT_PROG_LOCAL_PARAM_NUM_TOKEN
, INTEGER_TOKEN
, "-1", 266},
2235 {NT_PARAM_CONST_DECL_TOKEN
, PLUS_TOKEN
, "", 267},
2236 {NT_PARAM_CONST_DECL_TOKEN
, MINUS_TOKEN
, "", 267},
2237 {NT_PARAM_CONST_DECL_TOKEN
, FLOAT_TOKEN
, "-1", 267},
2238 {NT_PARAM_CONST_DECL_TOKEN
, INTEGER_TOKEN
, "-1", 267},
2239 {NT_PARAM_CONST_DECL_TOKEN
, LBRACE_TOKEN
, "", 268},
2241 {NT_PARAM_CONST_USE_TOKEN
, FLOAT_TOKEN
, "-1", 269},
2242 {NT_PARAM_CONST_USE_TOKEN
, INTEGER_TOKEN
, "-1", 269},
2243 {NT_PARAM_CONST_USE_TOKEN
, LBRACE_TOKEN
, "", 270},
2246 {NT_PARAM_CONST_SCALAR_DECL_TOKEN
, PLUS_TOKEN
, "", 271},
2247 {NT_PARAM_CONST_SCALAR_DECL_TOKEN
, MINUS_TOKEN
, "", 271},
2248 {NT_PARAM_CONST_SCALAR_DECL_TOKEN
, FLOAT_TOKEN
, "-1", 271},
2249 {NT_PARAM_CONST_SCALAR_DECL_TOKEN
, INTEGER_TOKEN
, "-1", 271},
2251 {NT_PARAM_CONST_SCALAR_USE_TOKEN
, FLOAT_TOKEN
, "-1", 272},
2252 {NT_PARAM_CONST_SCALAR_USE_TOKEN
, INTEGER_TOKEN
, "-1", 272},
2253 {NT_PARAM_CONST_VECTOR_TOKEN
, LBRACE_TOKEN
, "", 273},
2254 {NT_PARAM_CONST_VECTOR2_TOKEN
, RBRACE_TOKEN
, "", 274},
2255 {NT_PARAM_CONST_VECTOR2_TOKEN
, COMMA_TOKEN
, "", 275},
2256 {NT_PARAM_CONST_VECTOR3_TOKEN
, RBRACE_TOKEN
, "", 276},
2257 {NT_PARAM_CONST_VECTOR3_TOKEN
, COMMA_TOKEN
, "", 277},
2258 {NT_PARAM_CONST_VECTOR4_TOKEN
, RBRACE_TOKEN
, "", 278},
2259 {NT_PARAM_CONST_VECTOR4_TOKEN
, COMMA_TOKEN
, "", 279},
2261 {NT_SIGNED_FLOAT_CONSTANT_TOKEN
, PLUS_TOKEN
, "", 280},
2262 {NT_SIGNED_FLOAT_CONSTANT_TOKEN
, MINUS_TOKEN
, "", 280},
2263 {NT_SIGNED_FLOAT_CONSTANT_TOKEN
, FLOAT_TOKEN
, "-1", 280},
2264 {NT_SIGNED_FLOAT_CONSTANT_TOKEN
, INTEGER_TOKEN
, "-1", 280},
2266 {NT_OPTIONAL_SIGN_TOKEN
, FLOAT_TOKEN
, "-1", 281},
2267 {NT_OPTIONAL_SIGN_TOKEN
, INTEGER_TOKEN
, "0", 281},
2268 {NT_OPTIONAL_SIGN_TOKEN
, INTEGER_TOKEN
, "1", 281},
2269 {NT_OPTIONAL_SIGN_TOKEN
, INTEGER_TOKEN
, "-1", 281},
2270 {NT_OPTIONAL_SIGN_TOKEN
, ID_TOKEN
, "-1", 281},
2271 {NT_OPTIONAL_SIGN_TOKEN
, STATE_TOKEN
, "", 281},
2272 {NT_OPTIONAL_SIGN_TOKEN
, PROGRAM_TOKEN
, "", 281},
2273 {NT_OPTIONAL_SIGN_TOKEN
, VERTEX_TOKEN
, "", 281},
2274 {NT_OPTIONAL_SIGN_TOKEN
, LBRACE_TOKEN
, "", 281},
2277 {NT_OPTIONAL_SIGN_TOKEN
, MINUS_TOKEN
, "", 282},
2278 {NT_OPTIONAL_SIGN_TOKEN
, PLUS_TOKEN
, "", 283},
2280 {NT_TEMP_STATEMENT_TOKEN
, TEMP_TOKEN
, "", 284},
2281 {NT_ADDRESS_STATEMENT_TOKEN
, ADDRESS_TOKEN
, "", 285},
2283 /* Special case 286-7 */
2285 {NT_OUTPUT_STATEMENT_TOKEN
, OUTPUT_TOKEN
, "", 288},
2286 {NT_RESULT_BINDING_TOKEN
, RESULT_TOKEN
, "", 289},
2287 {NT_RESULT_BINDING2_TOKEN
, ID_TOKEN
, "position", 290},
2288 {NT_RESULT_BINDING2_TOKEN
, ID_TOKEN
, "fogcoord", 291},
2289 {NT_RESULT_BINDING2_TOKEN
, ID_TOKEN
, "pointsize", 292},
2290 {NT_RESULT_BINDING2_TOKEN
, ID_TOKEN
, "color", 293},
2291 {NT_RESULT_BINDING2_TOKEN
, ID_TOKEN
, "texcoord", 294},
2293 {NT_RESULT_COL_BINDING_TOKEN
, ID_TOKEN
, "color", 295},
2295 /* Special case 296-7 */
2297 {NT_RESULT_COL_BINDING3_TOKEN
, ID_TOKEN
, "front", 298},
2298 {NT_RESULT_COL_BINDING3_TOKEN
, ID_TOKEN
, "back", 299},
2300 /* Special case 300-301 */
2302 {NT_RESULT_COL_BINDING5_TOKEN
, ID_TOKEN
, "primary", 302},
2303 {NT_RESULT_COL_BINDING5_TOKEN
, ID_TOKEN
, "secondary", 303},
2304 {NT_OPT_FACE_TYPE2_TOKEN
, ID_TOKEN
, "front", 304},
2305 {NT_OPT_FACE_TYPE2_TOKEN
, ID_TOKEN
, "back", 305},
2307 /* Special case 306-7 */
2309 {NT_OPT_COLOR_TYPE2_TOKEN
, ID_TOKEN
, "primary", 308},
2310 {NT_OPT_COLOR_TYPE2_TOKEN
, ID_TOKEN
, "secondary", 309},
2312 {NT_OPT_TEX_COORD_NUM_TOKEN
, PERIOD_TOKEN
, "", 310},
2313 {NT_OPT_TEX_COORD_NUM_TOKEN
, SEMICOLON_TOKEN
, "", 310},
2314 {NT_OPT_TEX_COORD_NUM_TOKEN
, COMMA_TOKEN
, "", 310},
2315 {NT_OPT_TEX_COORD_NUM_TOKEN
, RBRACE_TOKEN
, "", 310},
2316 {NT_OPT_TEX_COORD_NUM_TOKEN
, LBRACKET_TOKEN
, "", 311},
2318 {NT_TEX_COORD_NUM_TOKEN
, INTEGER_TOKEN
, "-1", 312},
2320 /* Special case for 313 to get aliasing correct */
2322 {NT_ESTABLISH_NAME_TOKEN
, ID_TOKEN
, "-1", 314},
2323 {NT_ESTABLISHED_NAME_TOKEN
, ID_TOKEN
, "-1", 315},
2325 /* Special case for 318-9 */
2328 static GLint nprods
= sizeof(ptab
) / sizeof(prod_table
);
2329 static GLint nlas
= sizeof(latab
) / sizeof(look_ahead_table
);
2332 * This is a gigantic FSA to recognize the keywords put forth in the
2333 * GL_ARB_vertex_program spec.
2335 * All other tokens are deemed 'identifiers', and shoved into the
2336 * identifier symbol table (as opposed to the GLint and GLfloat symbol tables)
2338 * \param s The parse state
2339 * \param token The next token seen is returned in this value
2340 * \param token_attr The token attribute for the next token is returned here. This
2341 * is the index into the approprate symbol table if token is INTEGER_TOKEN,
2342 * FLOAT_TOKEN, or ID_TOKEN
2344 * \return ARB_VP_ERROR on lex error, ARB_VP_SUCESS on sucess
2347 get_next_token(parse_state
* s
, GLint
* token
, GLint
* token_attr
)
2351 while (s
->start_pos
< s
->len
) {
2352 curr
= s
->str
[s
->curr_pos
];
2354 switch (s
->curr_state
) {
2357 if (IS_WHITESPACE(curr
)) {
2362 if (IS_IDCHAR(curr
)) {
2365 ADV_TO_STATE(STATE_A
);
2369 ADV_TO_STATE(STATE_D
);
2373 ADV_TO_STATE(STATE_E
);
2377 ADV_TO_STATE(STATE_F
);
2381 ADV_TO_STATE(STATE_L
);
2385 ADV_TO_STATE(STATE_M
);
2389 ADV_TO_STATE(STATE_O
);
2393 ADV_TO_STATE(STATE_P
);
2397 ADV_TO_STATE(STATE_R
);
2401 ADV_TO_STATE(STATE_S
);
2405 ADV_TO_STATE(STATE_T
);
2409 ADV_TO_STATE(STATE_X
);
2413 ADV_TO_STATE(STATE_LC_P
);
2417 ADV_TO_STATE(STATE_LC_R
);
2421 ADV_TO_STATE(STATE_LC_S
);
2425 ADV_TO_STATE(STATE_LC_V
);
2430 s
->start_pos
= s
->curr_pos
;
2434 else if (IS_DIGIT(curr
)) {
2435 ADV_TO_STATE(STATE_N4
);
2440 ADV_TO_STATE(STATE_COMMENT
);
2443 ADV_AND_FINISH(SEMICOLON_TOKEN
);
2446 ADV_AND_FINISH(COMMA_TOKEN
);
2449 ADV_AND_FINISH(PLUS_TOKEN
);
2452 ADV_AND_FINISH(MINUS_TOKEN
);
2455 ADV_AND_FINISH(LBRACKET_TOKEN
);
2458 ADV_AND_FINISH(RBRACKET_TOKEN
);
2461 ADV_AND_FINISH(LBRACE_TOKEN
);
2464 ADV_AND_FINISH(RBRACE_TOKEN
);
2467 ADV_AND_FINISH(EQUAL_TOKEN
);
2471 ADV_TO_STATE(STATE_N1
);
2475 return ARB_VP_ERROR
;
2483 /* Main identifier state */
2491 id_table_add(&s
->idents
, s
->str
, s
->start_pos
, s
->curr_pos
);
2494 s
->start_pos
= s
->curr_pos
;
2495 return ARB_VP_SUCESS
;
2499 /* -----------------------------------------------------
2500 * Beginning of the A* keywords
2506 ADV_TO_STATE(STATE_AB
);
2509 ADV_TO_STATE(STATE_AD
);
2512 ADV_TO_STATE(STATE_AL
);
2515 ADV_TO_STATE(STATE_AR
);
2518 ADV_TO_STATE(STATE_AT
);
2521 ADV_TO_STATE(STATE_IDENT
);
2531 ADV_OR_FALLBACK('S', STATE_ABS
);
2535 FINISH_OR_FALLBACK(ABS_TOKEN
);
2539 ADV_OR_FALLBACK('D', STATE_ADD
);
2544 ADV_TO_STATE(STATE_ADDR
);
2546 else if (IS_CD(curr
)) {
2547 ADV_TO_STATE(STATE_IDENT
);
2555 ADV_OR_FALLBACK('E', STATE_ADDRE
);
2559 ADV_OR_FALLBACK('S', STATE_ADDRES
);
2563 ADV_OR_FALLBACK('S', STATE_ADDRESS
);
2567 FINISH_OR_FALLBACK(ADDRESS_TOKEN
);
2571 ADV_OR_FALLBACK('I', STATE_ALI
);
2575 ADV_OR_FALLBACK('A', STATE_ALIA
);
2579 ADV_OR_FALLBACK('S', STATE_ALIAS
);
2583 FINISH_OR_FALLBACK(ALIAS_TOKEN
);
2587 ADV_OR_FALLBACK('L', STATE_ARL
);
2591 FINISH_OR_FALLBACK(ARL_TOKEN
);
2595 ADV_OR_FALLBACK('T', STATE_ATT
);
2599 ADV_OR_FALLBACK('R', STATE_ATTR
);
2603 ADV_OR_FALLBACK('I', STATE_ATTRI
);
2607 ADV_OR_FALLBACK('B', STATE_ATTRIB
);
2611 FINISH_OR_FALLBACK(ATTRIB_TOKEN
);
2614 /* -----------------------------------------------------
2615 * Beginning of the D* keywords
2621 ADV_TO_STATE(STATE_DP
);
2624 ADV_TO_STATE(STATE_DS
);
2627 ADV_TO_STATE(STATE_IDENT
);
2640 ADV_TO_STATE(STATE_DP3
);
2643 ADV_TO_STATE(STATE_DP4
);
2646 ADV_TO_STATE(STATE_DPH
);
2649 ADV_TO_STATE(STATE_IDENT
);
2659 FINISH_OR_FALLBACK(DP3_TOKEN
);
2663 FINISH_OR_FALLBACK(DP4_TOKEN
);
2667 FINISH_OR_FALLBACK(DPH_TOKEN
);
2671 ADV_OR_FALLBACK('T', STATE_DST
);
2675 FINISH_OR_FALLBACK(DST_TOKEN
);
2678 /* -----------------------------------------------------
2679 * Beginning of the E* keywords
2685 ADV_TO_STATE(STATE_EN
);
2688 ADV_TO_STATE(STATE_EX
);
2691 ADV_TO_STATE(STATE_IDENT
);
2701 ADV_OR_FALLBACK('D', STATE_END
);
2705 FINISH_OR_FALLBACK(END_TOKEN
);
2712 ADV_TO_STATE(STATE_EX2
);
2715 ADV_TO_STATE(STATE_EXP
);
2718 ADV_TO_STATE(STATE_IDENT
);
2728 FINISH_OR_FALLBACK(EX2_TOKEN
);
2732 FINISH_OR_FALLBACK(EXP_TOKEN
);
2735 /* -----------------------------------------------------
2736 * Beginning of the F* keywords
2742 ADV_TO_STATE(STATE_FL
);
2745 ADV_TO_STATE(STATE_FR
);
2748 ADV_TO_STATE(STATE_IDENT
);
2758 ADV_OR_FALLBACK('R', STATE_FLR
);
2762 FINISH_OR_FALLBACK(FLR_TOKEN
);
2766 ADV_OR_FALLBACK('C', STATE_FRC
);
2770 FINISH_OR_FALLBACK(FRC_TOKEN
);
2773 /* -----------------------------------------------------
2774 * Beginning of the L* keywords
2780 ADV_TO_STATE(STATE_LG
);
2783 ADV_TO_STATE(STATE_LI
);
2786 ADV_TO_STATE(STATE_LO
);
2789 ADV_TO_STATE(STATE_IDENT
);
2799 ADV_OR_FALLBACK('2', STATE_LG2
);
2803 FINISH_OR_FALLBACK(LG2_TOKEN
);
2807 ADV_OR_FALLBACK('T', STATE_LIT
);
2811 FINISH_OR_FALLBACK(LIT_TOKEN
);
2815 ADV_OR_FALLBACK('G', STATE_LOG
);
2819 FINISH_OR_FALLBACK(LOG_TOKEN
);
2822 /* -----------------------------------------------------
2823 * Beginning of the M* keywords
2829 ADV_TO_STATE(STATE_MA
);
2832 ADV_TO_STATE(STATE_MI
);
2835 ADV_TO_STATE(STATE_MO
);
2838 ADV_TO_STATE(STATE_MU
);
2841 ADV_TO_STATE(STATE_IDENT
);
2854 ADV_TO_STATE(STATE_MAD
);
2857 ADV_TO_STATE(STATE_MAX
);
2860 ADV_TO_STATE(STATE_IDENT
);
2870 FINISH_OR_FALLBACK(MAD_TOKEN
);
2874 FINISH_OR_FALLBACK(MAX_TOKEN
);
2878 ADV_OR_FALLBACK('N', STATE_MIN
);
2882 FINISH_OR_FALLBACK(MIN_TOKEN
);
2886 ADV_OR_FALLBACK('V', STATE_MOV
);
2890 FINISH_OR_FALLBACK(MOV_TOKEN
);
2894 ADV_OR_FALLBACK('L', STATE_MUL
);
2898 FINISH_OR_FALLBACK(MUL_TOKEN
);
2901 /* -----------------------------------------------------
2902 * Beginning of the O* keywords
2908 ADV_TO_STATE(STATE_OP
);
2911 ADV_TO_STATE(STATE_OU
);
2914 ADV_TO_STATE(STATE_IDENT
);
2924 ADV_OR_FALLBACK('T', STATE_OPT
);
2928 ADV_OR_FALLBACK('I', STATE_OPTI
);
2932 ADV_OR_FALLBACK('O', STATE_OPTIO
);
2936 ADV_OR_FALLBACK('N', STATE_OPTION
);
2940 FINISH_OR_FALLBACK(OPTION_TOKEN
);
2944 ADV_OR_FALLBACK('T', STATE_OUT
);
2948 ADV_OR_FALLBACK('P', STATE_OUTP
);
2952 ADV_OR_FALLBACK('U', STATE_OUTPU
);
2956 ADV_OR_FALLBACK('T', STATE_OUTPUT
);
2960 FINISH_OR_FALLBACK(OUTPUT_TOKEN
);
2963 /* -----------------------------------------------------
2964 * Beginning of the P* keywords
2970 ADV_TO_STATE(STATE_PA
);
2973 ADV_TO_STATE(STATE_PO
);
2976 ADV_TO_STATE(STATE_IDENT
);
2986 ADV_OR_FALLBACK('R', STATE_PAR
);
2990 ADV_OR_FALLBACK('A', STATE_PARA
);
2994 ADV_OR_FALLBACK('M', STATE_PARAM
);
2998 FINISH_OR_FALLBACK(PARAM_TOKEN
);
3002 ADV_OR_FALLBACK('W', STATE_POW
);
3006 FINISH_OR_FALLBACK(POW_TOKEN
);
3009 /* -----------------------------------------------------
3010 * Beginning of the R* keywords
3016 ADV_TO_STATE(STATE_RC
);
3019 ADV_TO_STATE(STATE_RS
);
3022 ADV_TO_STATE(STATE_IDENT
);
3032 ADV_OR_FALLBACK('P', STATE_RCP
);
3036 FINISH_OR_FALLBACK(RCP_TOKEN
);
3040 ADV_OR_FALLBACK('Q', STATE_RSQ
);
3044 FINISH_OR_FALLBACK(RSQ_TOKEN
);
3047 /* -----------------------------------------------------
3048 * Beginning of the S* keywords
3054 ADV_TO_STATE(STATE_SG
);
3057 ADV_TO_STATE(STATE_SL
);
3060 ADV_TO_STATE(STATE_SU
);
3063 ADV_TO_STATE(STATE_SW
);
3066 ADV_TO_STATE(STATE_IDENT
);
3076 ADV_OR_FALLBACK('E', STATE_SGE
);
3080 FINISH_OR_FALLBACK(SGE_TOKEN
);
3084 ADV_OR_FALLBACK('T', STATE_SLT
);
3088 FINISH_OR_FALLBACK(SLT_TOKEN
);
3092 ADV_OR_FALLBACK('B', STATE_SUB
);
3096 FINISH_OR_FALLBACK(SUB_TOKEN
);
3100 ADV_OR_FALLBACK('Z', STATE_SWZ
);
3104 FINISH_OR_FALLBACK(SWZ_TOKEN
);
3107 /* -----------------------------------------------------
3108 * Beginning of the T* keywords
3111 ADV_OR_FALLBACK('E', STATE_TE
);
3115 ADV_OR_FALLBACK('M', STATE_TEM
);
3119 ADV_OR_FALLBACK('P', STATE_TEMP
);
3123 FINISH_OR_FALLBACK(TEMP_TOKEN
);
3126 /* -----------------------------------------------------
3127 * Beginning of the X* keywords
3130 ADV_OR_FALLBACK('P', STATE_XP
);
3134 ADV_OR_FALLBACK('D', STATE_XPD
);
3138 FINISH_OR_FALLBACK(XPD_TOKEN
);
3141 /* -----------------------------------------------------
3142 * Beginning of the p* keywords
3145 ADV_OR_FALLBACK('r', STATE_LC_PR
);
3149 ADV_OR_FALLBACK('o', STATE_LC_PRO
);
3153 ADV_OR_FALLBACK('g', STATE_LC_PROG
);
3157 ADV_OR_FALLBACK('r', STATE_LC_PROGR
);
3160 case STATE_LC_PROGR
:
3161 ADV_OR_FALLBACK('a', STATE_LC_PROGRA
);
3164 case STATE_LC_PROGRA
:
3165 ADV_OR_FALLBACK('m', STATE_LC_PROGRAM
);
3168 case STATE_LC_PROGRAM
:
3169 FINISH_OR_FALLBACK(PROGRAM_TOKEN
);
3172 /* -----------------------------------------------------
3173 * Beginning of the r* keywords
3176 ADV_OR_FALLBACK('e', STATE_LC_RE
);
3180 ADV_OR_FALLBACK('s', STATE_LC_RES
);
3184 ADV_OR_FALLBACK('u', STATE_LC_RESU
);
3188 ADV_OR_FALLBACK('l', STATE_LC_RESUL
);
3191 case STATE_LC_RESUL
:
3192 ADV_OR_FALLBACK('t', STATE_LC_RESULT
);
3195 case STATE_LC_RESULT
:
3196 FINISH_OR_FALLBACK(RESULT_TOKEN
);
3199 /* -----------------------------------------------------
3200 * Beginning of the s* keywords
3203 ADV_OR_FALLBACK('t', STATE_LC_ST
);
3207 ADV_OR_FALLBACK('a', STATE_LC_STA
);
3211 ADV_OR_FALLBACK('t', STATE_LC_STAT
);
3215 ADV_OR_FALLBACK('e', STATE_LC_STATE
);
3218 case STATE_LC_STATE
:
3219 FINISH_OR_FALLBACK(STATE_TOKEN
);
3222 /* -----------------------------------------------------
3223 * Beginning of the v* keywords
3226 ADV_OR_FALLBACK('e', STATE_LC_VE
);
3230 ADV_OR_FALLBACK('r', STATE_LC_VER
);
3234 ADV_OR_FALLBACK('t', STATE_LC_VERT
);
3238 ADV_OR_FALLBACK('e', STATE_LC_VERTE
);
3241 case STATE_LC_VERTE
:
3242 ADV_OR_FALLBACK('x', STATE_LC_VERTEX
);
3245 case STATE_LC_VERTEX
:
3246 FINISH_OR_FALLBACK(VERTEX_TOKEN
);
3249 /* -----------------------------------------------------
3250 * Beginning of the number & comment FSAs
3254 ADV_TO_STATE(STATE_N2
);
3256 else if (IS_DIGIT(curr
)) {
3257 ADV_TO_STATE(STATE_N3
);
3260 /*ADV_AND_FINISH(PERIOD_TOKEN); */
3261 FINISH(PERIOD_TOKEN
);
3267 /*ADV_AND_FINISH(DOTDOT_TOKEN);*/
3268 FINISH(DOTDOT_TOKEN
);
3270 FINISH(PERIOD_TOKEN
);
3275 if (IS_DIGIT(curr
)) {
3276 ADV_TO_STATE(STATE_N3
);
3278 else if ((curr
== 'E') || (curr
== 'e')) {
3279 ADV_TO_STATE(STATE_N5
);
3281 else if (curr
== '.') {
3282 /* Blech! we have something like 1.. -> have to backup */
3285 int_table_add(&s
->ints
, s
->str
, s
->start_pos
, s
->curr_pos
);
3286 FINISH(INTEGER_TOKEN
);
3290 float_table_add(&s
->floats
, s
->str
, s
->start_pos
, s
->curr_pos
);
3291 /*ADV_AND_FINISH(FLOAT_TOKEN);*/
3292 FINISH(FLOAT_TOKEN
);
3297 if (IS_DIGIT(curr
)) {
3298 ADV_TO_STATE(STATE_N4
);
3300 else if ((curr
== 'E') || (curr
== 'e')) {
3301 ADV_TO_STATE(STATE_N5
);
3303 else if (curr
== '.') {
3304 ADV_TO_STATE(STATE_N3
);
3308 int_table_add(&s
->ints
, s
->str
, s
->start_pos
, s
->curr_pos
);
3309 /*ADV_AND_FINISH(INTEGER_TOKEN);*/
3310 FINISH(INTEGER_TOKEN
);
3315 if (IS_DIGIT(curr
)) {
3316 ADV_TO_STATE(STATE_N6
);
3318 else if ((curr
== '+') || (curr
== '-')) {
3319 ADV_TO_STATE(STATE_N7
)
3322 return ARB_VP_ERROR
;
3327 if (IS_DIGIT(curr
)) {
3328 ADV_TO_STATE(STATE_N6
);
3332 float_table_add(&s
->floats
, s
->str
, s
->start_pos
, s
->curr_pos
);
3333 /*ADV_AND_FINISH(FLOAT_TOKEN);*/
3334 FINISH(FLOAT_TOKEN
);
3339 if (IS_DIGIT(curr
)) {
3340 ADV_TO_STATE(STATE_N6
);
3343 return ARB_VP_ERROR
;
3349 if ((curr
== '\n') || (curr
== '\r')) {
3350 s
->start_pos
= s
->curr_pos
+ 1;
3355 ADV_TO_STATE(STATE_COMMENT
);
3361 return ARB_VP_SUCESS
;
3365 * This does the same as get_next_token(), but it does not advance the
3366 * position pointers (Err, rather it does, but then it resets them)
3368 * \param s The parse state
3369 * \param token The next token seen is returned in this value
3370 * \param token_attr The token attribute for the next token is returned here. This
3371 * is the index into the approprate symbol table if token is INTEGER_TOKEN,
3372 * FLOAT_TOKEN, or ID_TOKEN
3373 * \param how_many How many tokens to peek ahead
3375 * \return ARB_VP_ERROR on lex error, ARB_VP_SUCESS on sucess
3378 peek_next_token(parse_state
* s
, GLint
* token
, GLint
* token_attr
,
3381 GLint tmp_state
= s
->curr_state
;
3382 GLint tmp_sp
= s
->start_pos
;
3383 GLint tmp_cp
= s
->curr_pos
;
3386 for (a
= 0; a
< how_many
; a
++) {
3387 retval
= get_next_token(s
, token
, token_attr
);
3389 if (retval
== ARB_VP_ERROR
)
3393 s
->curr_state
= tmp_state
;
3394 s
->start_pos
= tmp_sp
;
3395 s
->curr_pos
= tmp_cp
;
3401 * Print out the value of a token
3404 debug_token(parse_state
* state
, GLint t
, GLint ta
)
3411 printf("|%s| ", state
->idents
.data
[ta
]);
3414 printf("|%d| ", state
->ints
.data
[ta
]);
3417 printf("|%f| ", state
->floats
.data
[ta
]);
3537 case SEMICOLON_TOKEN
:
3555 case LBRACKET_TOKEN
:
3558 case RBRACKET_TOKEN
:
3584 printf("Unknown token type %d\n", t
);
3589 * Setup the state used by the parser / lex
3591 * \param str The program string, with the !!ARBvp1.0 token stripped off
3592 * \param len The lenght of the given string
3594 * \return A parse_state struct to keep track of all the things we need while parsing
3596 static parse_state
*
3597 parse_state_init(GLubyte
* str
, GLint len
)
3599 parse_state
*s
= (parse_state
*) _mesa_malloc(sizeof(parse_state
));
3601 s
->str
= _mesa_strdup((char *) str
);
3609 s
->idents
.data
= NULL
;
3612 s
->ints
.data
= NULL
;
3615 s
->floats
.data
= NULL
;
3616 printf("%s\n", s
->str
);
3619 s
->binds
.type
= NULL
;
3620 s
->binds
.offset
= NULL
;
3621 s
->binds
.row
= NULL
;
3622 s
->binds
.consts
= NULL
;
3625 s
->arrays
.num_elements
= NULL
;
3626 s
->arrays
.data
= NULL
;
3628 s
->stack_head
= NULL
;
3629 s
->stack_free_list
= NULL
;
3637 * This frees all the things we hold while parsing.
3639 * \param s The struct created by parse_state_init()
3642 parse_state_cleanup(parse_state
* s
)
3645 token_list
*tl
, *next
;
3647 /* Free our copy of the string [Mesa has its own] */
3650 /* Free all the tables ident, int, float, bind, mat */
3651 _mesa_free(s
->idents
.type
);
3652 _mesa_free(s
->idents
.attr
);
3653 for (a
= 0; a
< s
->idents
.len
; a
++)
3654 _mesa_free(s
->idents
.data
[a
]);
3656 _mesa_free(s
->ints
.data
);
3657 _mesa_free(s
->floats
.data
);
3659 _mesa_free(s
->arrays
.num_elements
);
3660 for (a
= 0; a
< s
->arrays
.len
; a
++)
3661 _mesa_free(s
->arrays
.data
[a
]);
3663 _mesa_free(s
->binds
.type
);
3664 _mesa_free(s
->binds
.offset
);
3665 _mesa_free(s
->binds
.row
);
3666 _mesa_free(s
->binds
.num_rows
);
3667 _mesa_free(s
->binds
.reg_num
);
3669 for (a
= 0; a
< s
->binds
.len
; a
++) {
3670 printf("6: %d/%d\n", a
, s
->binds
.len
- 1);
3671 _mesa_free(s
->binds
.consts
[a
]);
3675 /* Free the stack */
3682 tl
= s
->stack_free_list
;
3688 printf("freed stack free list\n");
3691 /* Free the parse tree */
3692 parse_tree_free_children(s
->pt_head
);
3693 printf("freed parse_tree\n");
3696 printf("freed state\n");
3700 * Alloc a new node for a parse tree.
3702 * \return An empty node to fill and stick into the parse tree
3704 static parse_tree_node
*
3705 parse_tree_node_init(void)
3708 parse_tree_node
*pt
;
3710 pt
= (parse_tree_node
*) _mesa_malloc(sizeof(parse_tree_node
));
3713 pt
->is_terminal
= 0;
3714 pt
->prod_applied
= -1;
3716 for (a
= 0; a
< 4; a
++)
3717 pt
->children
[a
] = NULL
;
3723 * We maintain a stack of nonterminals used for predictive parsing. To keep
3724 * from thrashing malloc/free, we keep a free list of token_list structs
3725 * to be used for this stack. This function is called to refill the free
3726 * list, when we try to grab a new token_list struct, and find that there are none
3729 * \param s The parse state
3732 _fill_free_list(parse_state
* s
)
3737 if (s
->stack_free_list
)
3740 for (a
= 0; a
< 20; a
++) {
3741 tl
= (token_list
*) _mesa_malloc(sizeof(token_list
));
3743 tl
->next
= s
->stack_free_list
;
3744 s
->stack_free_list
= tl
;
3749 * Peek at the head of the nonterminal stack,
3751 * \param s The parse state
3752 * \param token Return for the nonterminal token on the top of the stack
3753 * \param token_attr Return for the the token attribute on the top of the stack
3755 * \return ARB_VP_ERROR on an empty stack [not necessarily a bad thing], else ARB_VP_SUCESS
3758 _stack_peek(parse_state
* s
, GLint
* token
, GLint
* token_attr
)
3760 if (!s
->stack_head
) {
3761 fprintf(stderr
, "ACK! Empty stack on peek!\n");
3762 return ARB_VP_ERROR
;
3765 *token
= s
->stack_head
->tok
;
3766 *token_attr
= s
->stack_head
->tok_attr
;
3768 return ARB_VP_SUCESS
;
3772 * Remove the token at the head of the nonterminal stack
3773 * \param s The parse state
3774 * \param token Return for the nonterminal token on the top of the stack
3775 * \param token_attr Return for the the token attribute on the top of the stack
3776 * \param ptn Return for a pointer to the place in the parse tree where
3779 * \return ARB_VP_ERROR on an empty stack [not necessarily a bad thing], else ARB_VP_SUCESS
3782 _stack_pop(parse_state
* s
, GLint
* token
, GLint
* token_attr
,
3783 parse_tree_node
** ptn
)
3787 if (!s
->stack_head
) {
3788 fprintf(stderr
, "ACK! Empty stack!\n");
3789 return ARB_VP_ERROR
;
3792 *token
= s
->stack_head
->tok
;
3793 *token_attr
= s
->stack_head
->tok_attr
;
3795 *ptn
= s
->stack_head
->pt
;
3798 s
->stack_head
= tl
->next
;
3799 tl
->next
= s
->stack_free_list
;
3800 s
->stack_free_list
= tl
;
3802 return ARB_VP_SUCESS
;
3806 * Put a token, its attribute, and the the parse tree node where the token is stored, onto
3809 * \param s The parse state
3810 * \param token Return for the nonterminal token on the top of the stack
3811 * \param token_attr Return for the the token attribute on the top of the stack
3812 * \param ptn Return for a pointer to the place in the parse tree where
3815 * \return ARB_VP_ERROR on out of memory while allocing more storage for the stack,
3816 * else ARB_VP_SUCESS
3819 _stack_push(parse_state
* s
, GLint token
, GLint token_attr
,
3820 parse_tree_node
* ptn
)
3824 if (!s
->stack_free_list
) {
3826 if (!s
->stack_free_list
) {
3827 fprintf(stderr
, "ACK! Error filling stack free list\n");
3828 return ARB_VP_ERROR
;
3832 tl
= s
->stack_free_list
;
3834 s
->stack_free_list
= tl
->next
;
3837 tl
->tok_attr
= token_attr
;
3839 tl
->next
= s
->stack_head
;
3843 return ARB_VP_SUCESS
;
3847 * Allocate a new entry in the array table
3849 * \param tab The array table to add a new element too
3851 * \return The index into the array table where the new element is.
3854 array_table_new(array_table
* tab
)
3857 if (tab
->len
== 0) {
3858 tab
->num_elements
= (GLint
*) _mesa_malloc(sizeof(GLint
));
3859 tab
->data
= (GLint
**) _mesa_malloc(sizeof(GLint
*));
3864 (GLint
*) _mesa_realloc(tab
->num_elements
, tab
->len
* sizeof(GLint
),
3865 (tab
->len
+ 1) * sizeof(GLint
));
3867 (GLint
**) _mesa_realloc(tab
->data
, tab
->len
* sizeof(GLint
*),
3868 (tab
->len
+ 1) * sizeof(GLint
*));
3873 tab
->num_elements
[idx
] = 0;
3874 tab
->data
[idx
] = NULL
;
3880 * Add a new element to a array in a array table
3882 * \param tab The array table
3883 * \param idx The index into the array table of the array we want to append an item onto
3884 * \param data The program parameter that goes into the idx-th array
3887 array_table_add_data(array_table
* tab
, GLint idx
, GLint data
)
3889 if ((idx
< 0) || (idx
>= tab
->len
)) {
3890 printf("Bad matrix index %d!\n", idx
);
3894 if (tab
->data
[idx
] == NULL
) {
3895 tab
->data
[idx
] = (GLint
*) _mesa_malloc(sizeof(GLint
));
3899 (GLint
*) _mesa_realloc(tab
->data
[idx
],
3900 tab
->num_elements
[idx
] * sizeof(GLint
),
3901 (tab
->num_elements
[idx
] +
3902 1) * sizeof(GLint
));
3905 tab
->data
[idx
][tab
->num_elements
[idx
]] = data
;
3906 tab
->num_elements
[idx
]++;
3911 * This adds a new entry into the binding table.
3913 * \param tab The binding table
3914 * \param type The type of the state
3915 * \param offset For matrix bindings, e.g. MATRIXROWS_MODELVIEW, this gives the matrix number.
3916 * For PROGRAM_ENV_* and PROGRAM_LOCAL_* bindings, this gives the number of the first parameter
3918 * \param row For MATRIXROWS bindings, this is the first row in the matrix we're bound to
3919 * \param nrows For MATRIXROWS bindings, this is the number of rows of the matrix we have.
3920 * For PROGRAM_ENV/LOCAL bindings, this is the number of parameters in the array we're bound to
3921 * \param values For CONSTANT bindings, these are the constant values we're bound to
3922 * \return The index into the binding table where this state is bound
3925 binding_table_add(binding_table
* tab
, GLint type
, GLint offset
, GLint row
,
3926 GLint nrows
, GLfloat
* values
)
3932 /* test for existance */
3933 for (a
= 0; a
< tab
->len
; a
++) {
3934 if ((tab
->type
[a
] == type
) && (tab
->offset
[a
] == offset
)
3935 && (tab
->row
[a
] == row
) && (tab
->num_rows
[a
] == nrows
) &&
3936 (fabs(tab
->consts
[a
][0] - values
[0]) < .0001) &&
3937 (fabs(tab
->consts
[a
][1] - values
[1]) < .0001) &&
3938 (fabs(tab
->consts
[a
][2] - values
[2]) < .0001) &&
3939 (fabs(tab
->consts
[a
][3] - values
[3]) < .0001))
3943 if (tab
->len
== 0) {
3944 tab
->type
= (GLint
*) _mesa_malloc(sizeof(GLint
));
3945 tab
->offset
= (GLint
*) _mesa_malloc(sizeof(GLint
));
3946 tab
->row
= (GLint
*) _mesa_malloc(sizeof(GLint
));
3947 tab
->num_rows
= (GLint
*) _mesa_malloc(sizeof(GLint
));
3948 tab
->consts
= (GLfloat
**) _mesa_malloc(sizeof(GLfloat
*));
3949 tab
->consts
[0] = (GLfloat
*) _mesa_malloc(4 * sizeof(GLfloat
));
3950 tab
->reg_num
= (GLint
*) _mesa_malloc(sizeof(GLint
));
3954 (GLint
*) _mesa_realloc(tab
->type
, tab
->len
* sizeof(GLint
),
3955 (tab
->len
+ 1) * sizeof(GLint
));
3957 (GLint
*) _mesa_realloc(tab
->offset
, tab
->len
* sizeof(GLint
),
3958 (tab
->len
+ 1) * sizeof(GLint
));
3960 (GLint
*) _mesa_realloc(tab
->row
, tab
->len
* sizeof(GLint
),
3961 (tab
->len
+ 1) * sizeof(GLint
));
3963 (GLint
*) _mesa_realloc(tab
->num_rows
, tab
->len
* sizeof(GLint
),
3964 (tab
->len
+ 1) * sizeof(GLint
));
3966 (GLfloat
**) _mesa_realloc(tab
->consts
, tab
->len
* sizeof(GLfloat
),
3967 (tab
->len
+ 1) * sizeof(GLfloat
*));
3968 tab
->consts
[tab
->len
] = (GLfloat
*) _mesa_malloc(4 * sizeof(GLfloat
));
3970 (GLint
*) _mesa_realloc(tab
->reg_num
, tab
->len
* sizeof(GLint
),
3971 (tab
->len
+ 1) * sizeof(GLint
));
3974 tab
->type
[key
] = type
;
3975 tab
->offset
[key
] = offset
;
3976 tab
->row
[key
] = row
; /*key;*/
3977 tab
->num_rows
[key
] = nrows
;
3978 tab
->reg_num
[key
] = 0;
3979 _mesa_memcpy(tab
->consts
[key
], values
, 4 * sizeof(GLfloat
));
3986 * Given a string and a start/end point, add a string into the float
3987 * symbol table (and convert it into a float)
3989 * If we already have this GLfloat in the table, don't bother
3990 * adding another, just return the key to the existing one
3992 * \param tab The float table
3993 * \param str The string containing the float
3994 * \param start The starting position of the float in str
3995 * \param end The ending position of the float in str
3997 * \return The index of the float, after we insert it, in the float table
4000 float_table_add(float_table
*tab
, const char *str
, GLint start
, GLint end
)
4007 newstr
= (GLubyte
*) _mesa_malloc(end
- start
+ 2);
4008 _mesa_memset(newstr
, 0, end
- start
+ 2);
4009 _mesa_memcpy(newstr
, str
+ start
, end
- start
);
4011 /* test for existance */
4012 for (a
= 0; a
< tab
->len
; a
++) {
4013 if (tab
->data
[a
] == atof((char *) newstr
)) {
4019 if (tab
->len
== 0) {
4020 tab
->data
= (GLdouble
*) _mesa_malloc(sizeof(GLdouble
));
4024 (GLdouble
*) _mesa_realloc(tab
->data
, tab
->len
* sizeof(GLdouble
),
4025 (tab
->len
+ 1) * sizeof(GLdouble
));
4028 tab
->data
[key
] = atof((char *) newstr
);
4036 * Given a string and a start/end point, add a string into the int
4037 * symbol table (and convert it into a int)
4039 * If we already have this int in the table, don't bother
4040 * adding another, just return the key to the existing one
4042 * \param tab The int table
4043 * \param str The string containing the int
4044 * \param start The starting position of the int in str
4045 * \param end The ending position of the int in str
4047 * \return The index of the int, after we insert it, in the int table
4050 int_table_add(int_table
* tab
, const char *str
, GLint start
, GLint end
)
4057 newstr
= (char *) _mesa_malloc(end
- start
+ 2);
4058 _mesa_memset(newstr
, 0, end
- start
+ 2);
4059 _mesa_memcpy(newstr
, str
+ start
, end
- start
);
4061 for (a
= 0; a
< tab
->len
; a
++) {
4062 if (tab
->data
[a
] == _mesa_atoi(newstr
)) {
4068 if (tab
->len
== 0) {
4069 tab
->data
= (GLint
*) _mesa_malloc(sizeof(GLint
));
4073 (GLint
*) _mesa_realloc(tab
->data
, tab
->len
* sizeof(GLint
),
4074 (tab
->len
+ 1) * sizeof(GLint
));
4077 tab
->data
[key
] = _mesa_atoi(newstr
);
4085 * Insert an identifier into the identifier symbol table
4087 * If we already have this id in the table, don't bother
4088 * adding another, just return the key to the existing one
4090 * If we already have this id in the table, and it has been
4091 * initialized to an ALIAS, return what the alias points
4092 * to, not the alias var
4094 * \param tab The ID table
4095 * \param str The string containing the id
4096 * \param start The position in str where the id begins
4097 * \param end The position in str where the id ends
4100 * 1) The index into the id table where the id is
4101 * 2) The index into the id table where the alias of id, if we already have id
4102 * in the table, and it has been initialized to type ALIAS
4105 id_table_add(id_table
* tab
, const char * str
, GLint start
, GLint end
)
4112 if (tab
->len
== 0) {
4113 tab
->data
= (GLubyte
**) _mesa_malloc(sizeof(GLubyte
*));
4114 tab
->type
= (GLint
*) _mesa_malloc(sizeof(GLint
));
4115 tab
->attr
= (GLint
*) _mesa_malloc(sizeof(GLint
));
4119 (GLubyte
**) _mesa_realloc(tab
->data
, tab
->len
* sizeof(GLubyte
*),
4120 (tab
->len
+ 1) * sizeof(GLubyte
*));
4122 (GLint
*) _mesa_realloc(tab
->type
, tab
->len
* sizeof(GLint
),
4123 (tab
->len
+ 1) * sizeof(GLint
));
4125 (GLint
*) _mesa_realloc(tab
->attr
, tab
->len
* sizeof(GLint
),
4126 (tab
->len
+ 1) * sizeof(GLint
));
4129 /*tab->type[key] = TYPE_NONE;*/
4131 newstr
= (GLubyte
*) _mesa_malloc((end
- start
+ 2) * sizeof(GLubyte
));
4132 _mesa_memset(newstr
, 0, end
- start
+ 2);
4133 _mesa_memcpy(newstr
, str
+ start
, end
- start
);
4135 for (a
= 0; a
< tab
->len
; a
++) {
4136 /* aha! we found it in the table */
4137 if (!_mesa_strcmp((char *) tab
->data
[a
], (char *) newstr
)) {
4141 while ((tab
->type
[key
] == TYPE_ALIAS
) && (tab
->attr
[key
] != -1)) {
4142 printf("----------- %s is an alias, renaming to %s\n",
4143 tab
->data
[key
], tab
->data
[tab
->attr
[key
]]);
4144 key
= tab
->attr
[key
];
4151 /* oh, we really have a new id */
4152 tab
->data
[key
] = newstr
;
4153 tab
->type
[key
] = TYPE_NONE
;
4154 tab
->attr
[key
] = -1;
4160 /*#define SHOW_STEPS 1*/
4164 * Apply the specified production number to the parse state. This handles
4165 * looking at the production table and sticking new tokens onto the
4168 * It also handles the construction of the parse tree
4170 * \param s The parse state
4171 * \param num The production number to apply [the idx in the production table]
4175 apply_production(parse_state
* s
, int num
)
4177 GLint a
, str_key
, stack_tok
, stack_tok_attr
;
4178 GLint tok
, nnptr
= 0;
4179 parse_tree_node
*ptn
;
4180 parse_tree_node
*pt_ptr_new
[4];
4182 (void) _stack_pop(s
, &stack_tok
, &stack_tok_attr
, &ptn
);
4183 /*printf("apply prod %d\n", num); */
4185 ptn
->prod_applied
= num
;
4186 for (a
= 3; a
>= 0; a
--) {
4188 tok
= ptab
[num
].rhs
[a
];
4190 if (tok
== NULL_TOKEN
)
4193 /* If we are pushing an identifier or a number, we need to translate the string literal
4194 * in the production table into an entry in the approprate symbol table
4196 if (tok
== ID_TOKEN
) {
4197 str_key
= id_table_add(&s
->idents
, ptab
[num
].key
[a
], 0,
4198 _mesa_strlen(ptab
[num
].key
[a
]));
4200 else if (tok
== INTEGER_TOKEN
) {
4201 str_key
= int_table_add(&s
->ints
, ptab
[num
].key
[a
], 0,
4202 _mesa_strlen(ptab
[num
].key
[a
]));
4204 else if (tok
== FLOAT_TOKEN
) {
4205 str_key
= float_table_add(&s
->floats
, ptab
[num
].key
[a
], 0,
4206 _mesa_strlen(ptab
[num
].key
[a
]));
4209 /* "-1" is a wildcard flag, accept any id/float/int */
4210 if ((!_mesa_strcmp(ptab
[num
].key
[a
], "-1")) &&
4211 ((tok
== FLOAT_TOKEN
) || (tok
== INTEGER_TOKEN
)
4212 || (tok
== ID_TOKEN
))) {
4213 pt_ptr_new
[nnptr
] = parse_tree_node_init();
4214 pt_ptr_new
[nnptr
]->is_terminal
= 0;
4215 pt_ptr_new
[nnptr
]->tok
= tok
;
4216 pt_ptr_new
[nnptr
]->tok_attr
= str_key
;
4218 _stack_push(s
, ptab
[num
].rhs
[a
], str_key
, pt_ptr_new
[nnptr
- 1]);
4220 else if (tok
>= NT_PROGRAM_TOKEN
) {
4221 pt_ptr_new
[nnptr
] = parse_tree_node_init();
4222 pt_ptr_new
[nnptr
]->is_terminal
= 0;
4223 pt_ptr_new
[nnptr
]->tok
= tok
;
4225 _stack_push(s
, ptab
[num
].rhs
[a
], str_key
, pt_ptr_new
[nnptr
- 1]);
4228 _stack_push(s
, ptab
[num
].rhs
[a
], str_key
, NULL
);
4233 /*printf("%x %d:[%x %x %x %x]\n", ptn, nnptr, pt_ptr_new[0], pt_ptr_new[1], pt_ptr_new[2], pt_ptr_new[3]); */
4235 for (a
= nnptr
- 1; a
>= 0; a
--) {
4236 ptn
->children
[tok
] = pt_ptr_new
[a
];
4237 /*printf("%x->children[%d] = %x\n", ptn, tok, pt_ptr_new[a]); */
4244 * Here we initialize a bunch of variables to a given type (e.g. TEMP).
4246 * We stick the variable type into the 0-th element in the var_queue array, followed by var_queue_size
4247 * indicies into the identifier table which designate the variables we are to init.
4249 * \param s The parse state
4250 * \param var_queue The queue of variables to initialize. The first element in the array is variable
4251 * type. It is followed by var_queue_size indicies into the identifier table
4252 * who we are supposed to init to type var_queue[0].
4253 * \param var_queue_size The number of variables listed in var_queue[].
4255 * \return ARB_VP_ERROR if we have already initilized a variable in var_queue, otherwise
4259 init_vars(parse_state
* s
, GLint
* var_queue
, GLint var_queue_size
)
4264 while (a
< var_queue_size
) {
4265 /* Make sure we haven't already init'd this var. This will
4266 * catch multiple definations of the same symbol
4268 if (s
->idents
.type
[var_queue
[a
]] != TYPE_NONE
) {
4269 printf("%s already init'd! (%d)\n", s
->idents
.data
[var_queue
[a
]],
4270 s
->idents
.type
[var_queue
[a
]]);
4271 return ARB_VP_ERROR
;
4274 s
->idents
.type
[var_queue
[a
]] = var_queue
[0];
4275 s
->idents
.attr
[var_queue
[a
]] = -1;
4279 return ARB_VP_SUCESS
;
4283 * The main parsing loop. This applies productions and builds the parse tree.
4285 * \param s The parse state
4287 * \return ARB_VP_ERROR on a parse error, else ARB_VP_SUCESS
4290 parse(parse_state
* s
)
4292 GLint input_tok
, input_tok_attr
;
4293 GLint stack_tok
, stack_tok_attr
;
4294 GLint peek_tok
, peek_tok_attr
, ret
;
4296 GLint var_queue_size
= 0;
4298 parse_tree_node
*ptn
, *ptn2
;
4300 /* This should be MAX_VAR + 1 */
4301 var_queue
= (GLint
*) _mesa_malloc(1000 * sizeof(int));
4303 s
->stack_head
= NULL
;
4305 /* init the system by pushing the start symbol onto the stack */
4306 ptn
= parse_tree_node_init();
4307 ptn
->is_terminal
= 0;
4308 ptn
->tok
= NT_PROGRAM_TOKEN
;
4310 _stack_push(s
, NT_PROGRAM_TOKEN
, 0, ptn
);
4312 /* and get the first token */
4313 if (get_next_token(s
, &input_tok
, &input_tok_attr
) == ARB_VP_ERROR
) {
4314 fprintf(stderr
, "LEX ERROR!!\n");
4315 return ARB_VP_ERROR
;
4319 GLint la
, is_nonterm
;
4321 /* If the stack is empty, and we've eaten all the input, we're done */
4322 if ((_stack_peek(s
, &stack_tok
, &stack_tok_attr
) == ARB_VP_ERROR
) &&
4323 (input_tok
== EOF_TOKEN
))
4327 printf("stack: %d input: ", stack_tok
);
4328 debug_token(s
, input_tok
, input_tok_attr
);
4332 /* We [may] have a non-terminal on top of the stack, apply
4335 switch (stack_tok
) {
4336 /* Special case non-terminals */
4338 /* productions 64-66 */
4339 case NT_SRC_REG_TOKEN
:
4340 if ((input_tok
== VERTEX_TOKEN
) ||
4341 ((input_tok
== ID_TOKEN
)
4342 && (s
->idents
.type
[input_tok_attr
] == TYPE_ATTRIB
))) {
4343 apply_production(s
, 64);
4346 if ((input_tok
== ID_TOKEN
)
4347 && (s
->idents
.type
[input_tok_attr
] == TYPE_TEMP
)) {
4348 apply_production(s
, 65);
4351 if ((input_tok
== STATE_TOKEN
) ||
4352 (input_tok
== PROGRAM_TOKEN
) ||
4353 (input_tok
== LBRACE_TOKEN
) ||
4354 (input_tok
== FLOAT_TOKEN
) ||
4355 (input_tok
== INTEGER_TOKEN
) ||
4356 ((input_tok
== ID_TOKEN
)
4357 && (s
->idents
.type
[input_tok_attr
] == TYPE_PARAM_SINGLE
))
4358 || ((input_tok
== ID_TOKEN
)
4359 && (s
->idents
.type
[input_tok_attr
] ==
4360 TYPE_PARAM_ARRAY
))) {
4361 apply_production(s
, 66);
4364 return ARB_VP_ERROR
;
4368 /* productions 67-68 */
4369 case NT_DST_REG_TOKEN
:
4370 /* We can only write to result.*, TEMP vars, or OUTPUT vars */
4371 if (input_tok
== RESULT_TOKEN
) {
4372 apply_production(s
, 68);
4374 else if (input_tok
== ID_TOKEN
) {
4375 if (s
->idents
.type
[input_tok_attr
] == TYPE_TEMP
) {
4376 apply_production(s
, 67);
4378 else if (s
->idents
.type
[input_tok_attr
] == TYPE_OUTPUT
) {
4379 apply_production(s
, 68);
4382 return ARB_VP_ERROR
;
4386 return ARB_VP_ERROR
;
4390 /* productions 72-4 */
4391 case NT_PROG_PARAM_REG_TOKEN
:
4392 if ((input_tok
== ID_TOKEN
)
4393 && (s
->idents
.type
[input_tok_attr
] == TYPE_PARAM_SINGLE
)) {
4394 apply_production(s
, 72);
4397 if ((input_tok
== ID_TOKEN
)
4398 && (s
->idents
.type
[input_tok_attr
] == TYPE_PARAM_ARRAY
)) {
4399 apply_production(s
, 73);
4402 if ((input_tok
== STATE_TOKEN
) ||
4403 (input_tok
== PROGRAM_TOKEN
) ||
4404 (input_tok
== FLOAT_TOKEN
) ||
4405 (input_tok
== INTEGER_TOKEN
) || (input_tok
== LBRACE_TOKEN
)) {
4406 apply_production(s
, 74);
4409 return ARB_VP_ERROR
;
4413 /* productions 286-7 */
4414 case NT_VAR_NAME_LIST_TOKEN
:
4415 ret
= peek_next_token(s
, &peek_tok
, &peek_tok_attr
, 1);
4417 var_queue
[var_queue_size
] = input_tok_attr
;
4420 if ((ret
== ARB_VP_ERROR
) || (peek_tok
!= COMMA_TOKEN
)) {
4421 apply_production(s
, 286);
4423 /* Dump the var_queue & assign types */
4424 if (init_vars(s
, var_queue
, var_queue_size
) == ARB_VP_ERROR
)
4425 return ARB_VP_ERROR
;
4428 apply_production(s
, 287);
4432 /* productions 296-7 */
4433 case NT_RESULT_COL_BINDING2_TOKEN
:
4434 if ((input_tok
== SEMICOLON_TOKEN
) || (input_tok
== COMMA_TOKEN
)) {
4435 apply_production(s
, 296);
4437 else if (input_tok
== PERIOD_TOKEN
) {
4438 ret
= peek_next_token(s
, &peek_tok
, &peek_tok_attr
, 1);
4439 if ((peek_tok
== ID_TOKEN
) &&
4440 ((!_mesa_strcmp((char *) s
->idents
.data
[peek_tok_attr
], "back")) ||
4441 (!_mesa_strcmp((char *) s
->idents
.data
[peek_tok_attr
], "front")))) {
4442 apply_production(s
, 297);
4445 apply_production(s
, 296);
4449 return ARB_VP_ERROR
;
4453 /* productions 300-1 */
4454 case NT_RESULT_COL_BINDING4_TOKEN
:
4455 if ((input_tok
== SEMICOLON_TOKEN
) || (input_tok
== COMMA_TOKEN
)) {
4456 apply_production(s
, 300);
4458 else if (input_tok
== PERIOD_TOKEN
) {
4459 ret
= peek_next_token(s
, &peek_tok
, &peek_tok_attr
, 1);
4460 if ((ret
== ARB_VP_SUCESS
) && (peek_tok
== ID_TOKEN
) &&
4461 ((!_mesa_strcmp((char *) s
->idents
.data
[peek_tok_attr
], "primary")) ||
4462 (!_mesa_strcmp((char *) s
->idents
.data
[peek_tok_attr
], "secondary"))))
4464 apply_production(s
, 301);
4467 apply_production(s
, 300);
4471 return ARB_VP_ERROR
;
4475 /* productions 306-7 */
4476 case NT_OPT_COLOR_TYPE_TOKEN
:
4477 if ((input_tok
== SEMICOLON_TOKEN
) || (input_tok
== COMMA_TOKEN
)) {
4478 apply_production(s
, 307);
4480 else if (input_tok
== PERIOD_TOKEN
) {
4481 ret
= peek_next_token(s
, &peek_tok
, &peek_tok_attr
, 1);
4482 if ((ret
== ARB_VP_SUCESS
) && (peek_tok
== ID_TOKEN
) &&
4483 ((!_mesa_strcmp((char *) s
->idents
.data
[peek_tok_attr
], "primary")) ||
4484 (!_mesa_strcmp((char *) s
->idents
.data
[peek_tok_attr
], "secondary"))))
4486 apply_production(s
, 306);
4489 apply_production(s
, 307);
4493 return ARB_VP_ERROR
;
4497 /* production 313 -- Do this so we can mangle IDs as they are
4498 * added into the ID table for the lex
4500 case NT_ALIAS_STATEMENT_TOKEN
:
4501 if (input_tok
== ALIAS_TOKEN
) {
4504 apply_production(s
, 313);
4508 var_queue
[0] = TYPE_ALIAS
;
4509 ret
= peek_next_token(s
, &peek_tok
, &peek_tok_attr
, 1);
4510 var_queue
[var_queue_size
] = peek_tok_attr
;
4513 if (init_vars(s
, var_queue
, var_queue_size
) == ARB_VP_ERROR
)
4514 return ARB_VP_ERROR
;
4516 /* Now, peek ahead and see what we are aliasing _to_ */
4517 alias_to
= peek_tok_attr
;
4518 ret
= peek_next_token(s
, &peek_tok
, &peek_tok_attr
, 3);
4519 if (ret
== ARB_VP_SUCESS
) {
4520 s
->idents
.attr
[alias_to
] = peek_tok_attr
;
4523 return ARB_VP_ERROR
;
4526 return ARB_VP_ERROR
;
4530 /* productions 314 (ESTABLISH_NAME) duplicates are caught by the ID symbol table */
4532 /* productions 315 */
4533 case NT_ESTABLISHED_NAME_TOKEN
:
4534 if (input_tok
== ID_TOKEN
) {
4535 if (s
->idents
.type
[input_tok_attr
] == TYPE_NONE
) {
4536 printf("Trying to use variable %s before initializing!\n",
4537 s
->idents
.data
[input_tok_attr
]);
4538 return ARB_VP_ERROR
;
4541 apply_production(s
, 315);
4545 return ARB_VP_ERROR
;
4550 /* productions 318-9 */
4551 case NT_SWIZZLE_SUFFIX2_TOKEN
:
4552 if (_mesa_strlen((char *) s
->idents
.data
[input_tok_attr
]) == 1) {
4553 apply_production(s
, 318);
4555 else if (_mesa_strlen((char *) s
->idents
.data
[input_tok_attr
]) == 4) {
4556 apply_production(s
, 319);
4559 return ARB_VP_ERROR
;
4563 /* 4-component swizzle mask -- this is a total hack */
4564 #define IS_SWZ_CMP(foo) ((foo == 'x') || (foo == 'y') || (foo == 'z') || (foo == 'w'))
4565 case NT_COMPONENT4_TOKEN
:
4567 GLubyte
*str
= s
->idents
.data
[input_tok_attr
];
4569 if (IS_SWZ_CMP(str
[0]) && IS_SWZ_CMP(str
[1]) && IS_SWZ_CMP(str
[2])
4570 && IS_SWZ_CMP(str
[3])) {
4571 _stack_pop(s
, &stack_tok
, &stack_tok_attr
, &ptn
);
4572 /* _stack_push(s, input_tok, input_tok_attr, NULL);*/
4574 ptn2
= parse_tree_node_init();
4575 ptn2
->tok
= input_tok
;
4576 ptn2
->tok_attr
= input_tok_attr
;
4577 ptn2
->is_terminal
= 1;
4578 ptn
->children
[0] = ptn2
;
4579 _stack_push(s
, input_tok
, input_tok_attr
, ptn2
);
4582 return ARB_VP_ERROR
;
4587 /* Handle general non-terminals using tables, and terminals */
4590 for (la
= 0; la
< nlas
; la
++) {
4591 if (latab
[la
].lhs
!= stack_tok
)
4594 if (latab
[la
].la
!= input_tok
)
4597 if (input_tok
== ID_TOKEN
) {
4599 id_table_add(&s
->idents
, latab
[la
].la_kw
, 0,
4600 _mesa_strlen(latab
[la
].la_kw
));
4601 if ((str_key
!= input_tok_attr
)
4602 && (_mesa_strcmp(latab
[la
].la_kw
, "-1")))
4605 else if (input_tok
== INTEGER_TOKEN
) {
4606 if ((s
->ints
.data
[input_tok_attr
] !=
4607 _mesa_atoi(latab
[la
].la_kw
))
4608 && (_mesa_atoi(latab
[la
].la_kw
) != -1)) {
4612 else if (input_tok
== FLOAT_TOKEN
) {
4613 if ((s
->floats
.data
[input_tok_attr
] != atof(latab
[la
].la_kw
))
4614 && (atof(latab
[la
].la_kw
) != -1))
4617 idx
= latab
[la
].prod_idx
;
4619 /* Here we stack identifiers onto the var_queue */
4624 var_queue
[0] = TYPE_ATTRIB
;
4625 ret
= peek_next_token(s
, &peek_tok
, &peek_tok_attr
, 1);
4626 var_queue
[var_queue_size
] = peek_tok_attr
;
4629 if (init_vars(s
, var_queue
, var_queue_size
) == ARB_VP_ERROR
)
4630 return ARB_VP_ERROR
;
4636 var_queue
[0] = TYPE_PARAM
;
4638 ret
= peek_next_token(s
, &peek_tok
, &peek_tok_attr
, 1);
4639 var_queue
[var_queue_size
] = peek_tok_attr
;
4645 var_queue
[0] = TYPE_PARAM_SINGLE
;
4647 if (init_vars(s
, var_queue
, var_queue_size
) == ARB_VP_ERROR
)
4648 return ARB_VP_ERROR
;
4652 var_queue
[0] = TYPE_PARAM_ARRAY
;
4654 if (init_vars(s
, var_queue
, var_queue_size
) == ARB_VP_ERROR
)
4655 return ARB_VP_ERROR
;
4661 var_queue
[0] = TYPE_TEMP
;
4667 var_queue
[0] = TYPE_ADDRESS
;
4673 var_queue
[0] = TYPE_OUTPUT
;
4674 ret
= peek_next_token(s
, &peek_tok
, &peek_tok_attr
, 1);
4675 var_queue
[var_queue_size
] = peek_tok_attr
;
4678 if (init_vars(s
, var_queue
, var_queue_size
) == ARB_VP_ERROR
)
4679 return ARB_VP_ERROR
;
4683 /* stack opts for varNameList -- see above */
4687 /* finally.. we match! apply the production */
4688 if ((idx
< 0) || (idx
>= nprods
)) {
4690 "Prod IDX of %d in look ahead table [%d] is horked!\n",
4695 apply_production(s
, idx
);
4701 if ((stack_tok
== EOF_TOKEN
) && (s
->stack_head
== NULL
))
4702 return ARB_VP_SUCESS
;
4704 if ((input_tok
== stack_tok
) ||
4705 ((stack_tok
== FLOAT_TOKEN
)
4706 && (input_tok
== INTEGER_TOKEN
))) {
4707 /* XXX: Need to check values for int/id/GLfloat tokens here -- yes! */
4709 _stack_pop(s
, &stack_tok
, &stack_tok_attr
, &ptn
);
4711 && ((stack_tok
== FLOAT_TOKEN
)
4712 || (stack_tok
== INTEGER_TOKEN
)
4713 || (stack_tok
== ID_TOKEN
))) {
4714 ptn
->is_terminal
= 1;
4715 ptn
->tok
= input_tok
;
4716 ptn
->tok_attr
= input_tok_attr
;
4719 if (get_next_token(s
, &input_tok
, &input_tok_attr
) ==
4721 fprintf(stderr
, "PARSE ERROR!!\n");
4722 return ARB_VP_ERROR
;
4726 fprintf(stderr
, "PARSE ERROR!\n");
4727 return ARB_VP_ERROR
;
4734 return ARB_VP_SUCESS
;
4740 * Print out the parse tree from a given point. Just for debugging.
4742 * \param s The parse state
4743 * \param ptn The root to start printing from
4746 print_parse_tree(parse_state
* s
, parse_tree_node
* ptn
)
4750 /* If we're terminal, prGLint and exit */
4751 if (ptn
->is_terminal
) {
4752 debug_token(s
, ptn
->tok
, ptn
->tok_attr
);
4757 /* Else, recurse on all our children */
4758 for (a
= 0; a
< 4; a
++) {
4759 if (!ptn
->children
[a
])
4762 print_parse_tree(s
, ptn
->children
[a
]);
4767 * Free all of the children of a given parse tree node.
4769 * \param ptn The root node whose children we recursively free
4772 parse_tree_free_children(parse_tree_node
* ptn
)
4778 if (!ptn
->children
[0])
4781 for (a
= 0; a
< 4; a
++) {
4782 if (ptn
->children
[a
]) {
4783 parse_tree_free_children(ptn
->children
[a
]);
4784 _mesa_free(ptn
->children
[a
]);
4785 ptn
->children
[a
] = NULL
;
4791 * Given the name of a matrix, and a modifier, expand into a binding type.
4793 * names: 0 -- modelview
4805 * \param name The number of the matrix type
4806 * \param mod The number of the matrix modifier
4808 * \return The binding state corresponding to name & mod
4811 name_and_mod_to_matrixrows(GLint name
, GLint mod
)
4814 case 0: /* modelview */
4817 return MATRIXROWS_MODELVIEW
;
4819 return MATRIXROWS_MODELVIEW_INVERSE
;
4821 return MATRIXROWS_MODELVIEW_INVTRANS
;
4823 return MATRIXROWS_MODELVIEW_TRANSPOSE
;
4826 case 1: /* projection */
4829 return MATRIXROWS_PROJECTION
;
4831 return MATRIXROWS_PROJECTION_INVERSE
;
4833 return MATRIXROWS_PROJECTION_INVTRANS
;
4835 return MATRIXROWS_PROJECTION_TRANSPOSE
;
4842 return MATRIXROWS_MVP
;
4844 return MATRIXROWS_MVP_INVERSE
;
4846 return MATRIXROWS_MVP_INVTRANS
;
4848 return MATRIXROWS_MVP_TRANSPOSE
;
4852 case 3: /* texture */
4855 return MATRIXROWS_TEXTURE
;
4857 return MATRIXROWS_TEXTURE_INVERSE
;
4859 return MATRIXROWS_TEXTURE_INVTRANS
;
4861 return MATRIXROWS_TEXTURE_TRANSPOSE
;
4864 case 4: /* palette */
4867 return MATRIXROWS_PALETTE
;
4869 return MATRIXROWS_PALETTE_INVERSE
;
4871 return MATRIXROWS_PALETTE_INVTRANS
;
4873 return MATRIXROWS_PALETTE_TRANSPOSE
;
4876 case 5: /* program */
4879 return MATRIXROWS_PROGRAM
;
4881 return MATRIXROWS_PROGRAM_INVERSE
;
4883 return MATRIXROWS_PROGRAM_INVTRANS
;
4885 return MATRIXROWS_PROGRAM_TRANSPOSE
;
4894 * This takes a node in the parse tree for an OPTIONAL_MASK token
4895 * being derived into a write mask for a register.
4897 * This will expand the production number into a 4-component
4900 * \param mask_node The parse tree node for the optional_mask non-termina
4901 * \param mask 4-component write mask
4904 get_optional_mask(parse_tree_node
* mask_node
, GLint
* mask
)
4906 if (mask_node
->prod_applied
== 97) {
4907 switch (mask_node
->children
[0]->prod_applied
) {
5006 case 113: /* xyzw */
5017 * Given a MASKED_DST_REG token in a parse tree node, figure out what
5018 * register number and write mask the production results in.
5020 * \param s The parse state
5021 * \param mdr The parse tree node
5022 * \param dest The destination register number
5023 * \param dest_mask The 4-component write mask
5026 get_masked_dst_reg(parse_state
* s
, parse_tree_node
* mdr
, GLint
* dest
,
5031 /* dest is a TEMP variable */
5032 if (mdr
->children
[0]->prod_applied
== 67) {
5033 a
= mdr
->children
[0]->children
[0]->children
[0]->children
[0]->tok_attr
;
5034 *dest
= s
->binds
.reg_num
[s
->idents
.attr
[a
]];
5035 printf("dst reg: %d (%s)\n", *dest
, s
->idents
.data
[a
]);
5038 /* dest is a result variable */
5039 if (mdr
->children
[0]->children
[0]->prod_applied
== 86) {
5040 a
= mdr
->children
[0]->children
[0]->children
[0]->children
[0]->
5042 *dest
= s
->binds
.reg_num
[s
->idents
.attr
[a
]];
5043 printf("dest reg: %d (%s)\n", *dest
, s
->idents
.data
[a
]);
5045 /* dest is an implicit binding to result/output state */
5047 a
= mdr
->children
[0]->children
[0]->children
[0]->tok_attr
;
5048 *dest
= s
->binds
.reg_num
[a
];
5049 printf("dst: %d\n", *dest
);
5053 /* mdr->children[1] is the write mask */
5054 get_optional_mask(mdr
->children
[1], dest_mask
);
5059 * Given a parse tree node with a swizzled src token, figure out the swizzle
5062 * \param s The parse state
5063 * \param ssr The parse tree node
5064 * \param swz The 4-component swizzle, 0 - x, 1 - y, 2 - z, 3 - w
5067 get_src_swizzle(parse_state
* s
, parse_tree_node
* ssr
, GLint
* swz
)
5072 if (ssr
->prod_applied
== 317) {
5073 if (ssr
->children
[0]->prod_applied
== 318) { /* single component */
5074 switch (ssr
->children
[0]->children
[0]->prod_applied
) {
5076 for (a
= 0; a
< 4; a
++)
5081 for (a
= 0; a
< 4; a
++)
5086 for (a
= 0; a
< 4; a
++)
5091 for (a
= 0; a
< 4; a
++)
5096 else { /* 4-component */
5098 c
= s
->idents
.data
[ssr
->children
[0]->children
[0]->children
[0]->
5100 for (a
= 0; a
< 4; a
++) {
5122 * Given a parse tree node for a src register with an optional sign, figure out
5123 * what register the src maps to, and what the sign is
5125 * \param s The parse state
5126 * \param ssr The parse tree node to work from
5127 * \param sign The sign (1 or -1)
5128 * \param ssrc The src register number
5131 get_optional_sign_and_src_reg(parse_state
* s
, parse_tree_node
* ssr
,
5132 int *sign
, int *ssrc
)
5136 /* ssr->children[0] is the optionalSign */
5137 if (ssr
->children
[0]->prod_applied
== 282) { /* - */
5141 /* ssr->children[1] is the srcReg */
5143 /* The src is a vertex attrib */
5144 if (ssr
->children
[1]->prod_applied
== 64) {
5145 if (ssr
->children
[1]->children
[0]->prod_applied
== 69) { /* variable */
5146 a
= ssr
->children
[1]->children
[0]->children
[0]->children
[0]->
5148 *ssrc
= s
->binds
.reg_num
[s
->idents
.attr
[a
]];
5149 printf("src reg: %d (%s)\n", *ssrc
, s
->idents
.data
[a
]);
5151 else { /* implicit binding */
5153 a
= ssr
->children
[1]->children
[0]->children
[0]->tok_attr
;
5154 *ssrc
= s
->binds
.reg_num
[a
];
5155 printf("src reg: %d %d (implicit binding)\n",
5156 *ssrc
, s
->binds
.type
[a
]);
5160 /* The src is a temp variable */
5161 if (ssr
->children
[1]->prod_applied
== 65) {
5162 a
= ssr
->children
[1]->children
[0]->children
[0]->children
[0]->tok_attr
;
5163 *ssrc
= s
->binds
.reg_num
[s
->idents
.attr
[a
]];
5164 printf("src reg: %d (%s)\n", *ssrc
, s
->idents
.data
[a
]);
5166 /* The src is a param */
5168 /* We have a single item */
5169 if (ssr
->children
[1]->children
[0]->prod_applied
== 72) {
5170 a
= ssr
->children
[1]->children
[0]->children
[0]->children
[0]->
5171 children
[0]->tok_attr
;
5172 *ssrc
= s
->binds
.reg_num
[s
->idents
.attr
[a
]];
5173 printf("src reg: %d (%s)\n", *ssrc
, s
->idents
.data
[a
]);
5176 /* We have an array of items */
5177 if (ssr
->children
[1]->children
[0]->prod_applied
== 73) {
5178 a
= ssr
->children
[1]->children
[0]->children
[0]->children
[0]->
5179 children
[0]->tok_attr
;
5180 *ssrc
= s
->binds
.reg_num
[s
->idents
.attr
[a
]];
5182 /* We have an absolute offset into the array */
5183 if (ssr
->children
[1]->children
[0]->children
[1]->prod_applied
== 77) {
5184 /* Ok, are array will be layed out fully in registers, so we can compute the reg */
5185 printf("array base: %s\n", s
->idents
.data
[a
]);
5186 a
= ssr
->children
[1]->children
[0]->children
[1]->children
[0]->
5187 children
[0]->tok_attr
;
5188 printf("array absolute offset: %d\n", s
->ints
.data
[a
]);
5189 *ssrc
+= s
->ints
.data
[a
];
5191 /* Otherwise, we have to grab the offset register */
5192 else { /* progParamArrayRel */
5194 /* XXX: We don't know the offset, so we have to grab the offset register # */
5197 /* Otherwise, we have an implicit binding */
5198 else { /* paramSingleItemUse */
5200 if (ssr
->children
[1]->children
[0]->children
[0]->prod_applied
== 148) { /* programSingleItem */
5201 a
= ssr
->children
[1]->children
[0]->children
[0]->children
[0]->
5205 a
= ssr
->children
[1]->children
[0]->children
[0]->children
[0]->
5206 children
[0]->tok_attr
;
5208 *ssrc
= s
->binds
.reg_num
[a
];
5209 printf("src reg: %d %d (implicit binding)\n", *ssrc
,
5217 * Figure out what register a src reg is in, as well as the swizzle mask and the
5220 * \param s The parse state
5221 * \param ssr The swizzeled src reg parse tree node
5222 * \param sign The return value for the sign {1, -1}
5223 * \param ssrc The return value for the register number
5224 * \param swz The 4-component swizzle mask
5227 get_swizzle_src_reg(parse_state
* s
, parse_tree_node
* ssr
, GLint
* sign
,
5228 GLint
* ssrc
, GLint
* swz
)
5230 get_optional_sign_and_src_reg(s
, ssr
, sign
, ssrc
);
5232 /* ssr->children[2] is the swizzleSuffix */
5233 get_src_swizzle(s
, ssr
->children
[2], swz
);
5237 * Just like get_swizzle_src_reg, but find the scalar value to use from the register instead
5238 * of the swizzle mask
5240 * \param s The parse state
5241 * \param ssr The swizzeled src reg parse tree node
5242 * \param sign The return value for the sign {1, -1}
5243 * \param ssrc The return value for the register number
5244 * \param scalar The 1-component scalar number
5247 get_scalar_src_reg(parse_state
* s
, parse_tree_node
* ssr
, GLint
* sign
,
5248 GLint
* ssrc
, GLint
* scalar
)
5250 get_optional_sign_and_src_reg(s
, ssr
, sign
, ssrc
);
5252 /* sn->children[2] is a scalarSuffix */
5253 switch (ssr
->children
[2]->children
[0]->prod_applied
) {
5270 * Recursivly traverse the parse tree and generate Mesa opcodes
5272 * \param s The parse state
5273 * \param ptn The parse tree node to process
5276 parse_tree_generate_opcodes(parse_state
* s
, parse_tree_node
* ptn
)
5279 GLint opcode
, dst
, src
[3];
5280 GLint dst_mask
[4], src_swz
[3][4], src_scalar
[3], src_sign
[3];
5281 parse_tree_node
*dn
, *sn
[3];
5283 src_sign
[0] = src_sign
[1] = src_sign
[2] = 1;
5284 for (a
= 0; a
< 4; a
++) {
5289 src_scalar
[0] = src_scalar
[1] = src_scalar
[2] = 0;
5290 dst_mask
[0] = dst_mask
[1] = dst_mask
[2] = dst_mask
[3] = 1;
5292 switch (ptn
->prod_applied
) {
5294 opcode
= VP_OPCODE_ARL
;
5296 dn
= ptn
->children
[0];
5297 sn
[0] = ptn
->children
[1];
5299 /* dn is a maskedAddrReg */
5300 /* dn->children[0] is an addrReg */
5301 /* dn->children[1] is an addrWriteMask */
5302 /* XXX: do this.. */
5305 case 18: /* VECTORop */
5306 switch (ptn
->children
[0]->prod_applied
) {
5308 opcode
= VP_OPCODE_ABS
;
5311 opcode
= VP_OPCODE_FLR
;
5314 opcode
= VP_OPCODE_FRC
;
5317 opcode
= VP_OPCODE_LIT
;
5320 opcode
= VP_OPCODE_MOV
;
5323 printf("opcode: %d\n", opcode
);
5325 /* dn is a maskedDstReg */
5326 dn
= ptn
->children
[1];
5328 /* sn is a swizzleSrcReg */
5329 sn
[0] = ptn
->children
[2];
5331 get_masked_dst_reg(s
, dn
, &dst
, dst_mask
);
5332 printf("dst: %d mask: %d %d %d %d\n", dst
, dst_mask
[0], dst_mask
[1],
5333 dst_mask
[2], dst_mask
[3]);
5335 get_swizzle_src_reg(s
, sn
[0], &src_sign
[0], &src
[0], src_swz
[0]);
5337 printf("src sign: %d reg: %d swz: %d %d %d %d\n",
5338 src_sign
[0], src
[0], src_swz
[0][0], src_swz
[0][1], src_swz
[0][2],
5342 case 24: /* SCALARop */
5343 switch (ptn
->children
[0]->prod_applied
) {
5345 opcode
= VP_OPCODE_EX2
;
5348 opcode
= VP_OPCODE_EXP
;
5351 opcode
= VP_OPCODE_LG2
;
5354 opcode
= VP_OPCODE_LOG
;
5357 opcode
= VP_OPCODE_RCP
;
5360 opcode
= VP_OPCODE_RSQ
;
5364 printf("opcode: %d\n", opcode
);
5365 /* dn is a maskedDstReg */
5366 dn
= ptn
->children
[1];
5368 get_masked_dst_reg(s
, dn
, &dst
, dst_mask
);
5369 printf("dst: %d mask: %d %d %d %d\n", dst
, dst_mask
[0], dst_mask
[1],
5370 dst_mask
[2], dst_mask
[3]);
5372 /* sn is a scalarSrcReg */
5373 sn
[0] = ptn
->children
[2];
5375 get_scalar_src_reg(s
, sn
[0], &src_sign
[0], &src
[0], &src_scalar
[0]);
5376 printf("src sign: %d reg: %d scalar: %d\n", src_sign
[0], src
[0],
5380 case 31: /* BINSC */
5381 opcode
= VP_OPCODE_POW
;
5383 printf("opcode: %d\n", opcode
);
5385 dn
= ptn
->children
[1];
5386 get_masked_dst_reg(s
, dn
, &dst
, dst_mask
);
5387 printf("dst: %d mask: %d %d %d %d\n", dst
, dst_mask
[0], dst_mask
[1],
5388 dst_mask
[2], dst_mask
[3]);
5390 /* sn are scalarSrcReg's */
5391 sn
[0] = ptn
->children
[2]->children
[0];
5392 sn
[1] = ptn
->children
[2]->children
[1];
5394 get_scalar_src_reg(s
, sn
[0], &src_sign
[0], &src
[0], &src_scalar
[0]);
5395 get_scalar_src_reg(s
, sn
[1], &src_sign
[1], &src
[1], &src_scalar
[1]);
5397 printf("src0 sign: %d reg: %d scalar: %d\n", src_sign
[0], src
[0],
5399 printf("src1 sign: %d reg: %d scalar: %d\n", src_sign
[1], src
[1],
5405 switch (ptn
->children
[0]->prod_applied
) {
5407 opcode
= VP_OPCODE_ADD
;
5410 opcode
= VP_OPCODE_DP3
;
5413 opcode
= VP_OPCODE_DP4
;
5416 opcode
= VP_OPCODE_DPH
;
5419 opcode
= VP_OPCODE_DST
;
5422 opcode
= VP_OPCODE_MAX
;
5425 opcode
= VP_OPCODE_MIN
;
5428 opcode
= VP_OPCODE_MUL
;
5431 opcode
= VP_OPCODE_SGE
;
5434 opcode
= VP_OPCODE_SLT
;
5437 opcode
= VP_OPCODE_SUB
;
5440 opcode
= VP_OPCODE_XPD
;
5444 printf("opcode: %d\n", opcode
);
5447 dn
= ptn
->children
[1];
5448 get_masked_dst_reg(s
, dn
, &dst
, dst_mask
);
5449 printf("dst: %d mask: %d %d %d %d\n", dst
, dst_mask
[0], dst_mask
[1],
5450 dst_mask
[2], dst_mask
[3]);
5452 /* sn are scalarSrcReg's */
5453 sn
[0] = ptn
->children
[2]->children
[0];
5454 sn
[1] = ptn
->children
[2]->children
[1];
5456 get_swizzle_src_reg(s
, sn
[0], &src_sign
[0], &src
[0], src_swz
[0]);
5457 get_swizzle_src_reg(s
, sn
[1], &src_sign
[1], &src
[1], src_swz
[1]);
5459 printf("src0 sign: %d reg: %d swz: %d %d %d %d\n",
5460 src_sign
[0], src
[0], src_swz
[0][0], src_swz
[0][1], src_swz
[0][2],
5462 printf("src1 sign: %d reg: %d swz: %d %d %d %d\n", src_sign
[1], src
[1],
5463 src_swz
[1][0], src_swz
[1][1], src_swz
[1][2], src_swz
[1][3]);
5467 opcode
= VP_OPCODE_MAD
;
5469 printf("opcode: %d\n", opcode
);
5472 dn
= ptn
->children
[1];
5473 get_masked_dst_reg(s
, dn
, &dst
, dst_mask
);
5474 printf("dst: %d mask: %d %d %d %d\n", dst
, dst_mask
[0], dst_mask
[1],
5475 dst_mask
[2], dst_mask
[3]);
5477 /* sn are scalarSrcReg's */
5478 sn
[0] = ptn
->children
[2]->children
[0];
5479 sn
[1] = ptn
->children
[2]->children
[1]->children
[0];
5480 sn
[2] = ptn
->children
[2]->children
[1]->children
[1];
5482 get_swizzle_src_reg(s
, sn
[0], &src_sign
[0], &src
[0], src_swz
[0]);
5483 get_swizzle_src_reg(s
, sn
[1], &src_sign
[1], &src
[1], src_swz
[1]);
5484 get_swizzle_src_reg(s
, sn
[2], &src_sign
[2], &src
[2], src_swz
[2]);
5486 printf("src0 sign: %d reg: %d swz: %d %d %d %d\n",
5487 src_sign
[0], src
[0], src_swz
[0][0], src_swz
[0][1], src_swz
[0][2],
5489 printf("src1 sign: %d reg: %d swz: %d %d %d %d\n", src_sign
[1], src
[1],
5490 src_swz
[1][0], src_swz
[1][1], src_swz
[1][2], src_swz
[1][3]);
5491 printf("src2 sign: %d reg: %d swz: %d %d %d %d\n", src_sign
[2], src
[2],
5492 src_swz
[2][0], src_swz
[2][1], src_swz
[2][2], src_swz
[2][3]);
5496 for (a
= 0; a
< 4; a
++) {
5497 if (!ptn
->children
[a
])
5499 parse_tree_generate_opcodes(s
, ptn
->children
[a
]);
5504 * When we go to examine the parse tree to generate opcodes, things are not exactly pretty to deal with.
5505 * Parameters, constants, matricies, attribute bindings, and the like are represented by large numbers
5508 * In order to keep the code generation code cleaner, we make a recursive pass over the parse tree and 'roll up' these deep
5509 * derivations of the attribs, and replace them with a single token, BINDING_TOKEN. The token attribute for
5510 * BINDING_TOKEN is a index in the 'binding table' where all the relavant info on the chunk of state is stored,
5513 * For example, the string 'vertex.color.secondary' is represented by 4 productions, and 4 nodes in the parse
5514 * tree. The token at the root of this derivation is NT_VTX_ATTRIB_BINDING_TOKEN. After this folding,
5515 * the token at the root is BINDING_TOKEN, and s->binds[token_attr_at_the_root].type = ATTRIB_COLOR_SECONDARY.
5517 * \param s The parse state
5518 * \param ptn The root parse tree node to start folding bindings
5521 parse_tree_fold_bindings(parse_state
* s
, parse_tree_node
* ptn
)
5524 GLint eat_children
, bind_type
, bind_idx
, bind_row
, bind_nrows
;
5525 GLfloat bind_vals
[4];
5526 parse_tree_node
*ptmp
;
5531 bind_vals
[0] = bind_vals
[1] = bind_vals
[2] = bind_vals
[3] = 0.0f
;
5532 switch (ptn
->prod_applied
) {
5537 switch (ptn
->children
[0]->prod_applied
) {
5538 case 122: /* position */
5539 bind_type
= ATTRIB_POSITION
;
5541 case 123: /* weight */
5542 bind_type
= ATTRIB_WEIGHT
;
5543 if (ptn
->children
[0]->children
[0]->prod_applied
== 132) {
5545 s
->ints
.data
[ptn
->children
[0]->children
[0]->children
[0]->
5546 children
[0]->tok_attr
];
5549 case 124: /* normal */
5550 bind_type
= ATTRIB_NORMAL
;
5552 case 125: /* color */
5553 bind_type
= ATTRIB_COLOR_PRIMARY
;
5554 if (ptn
->children
[0]->children
[0]->prod_applied
== 306) {
5555 if (ptn
->children
[0]->children
[0]->children
[0]->prod_applied
==
5557 bind_type
= ATTRIB_COLOR_SECONDARY
;
5560 case 126: /* fogcoord */
5561 bind_type
= ATTRIB_FOGCOORD
;
5563 case 127: /* texcoord */
5564 bind_type
= ATTRIB_TEXCOORD
;
5565 if (ptn
->children
[0]->children
[0]->prod_applied
== 311) {
5567 s
->ints
.data
[ptn
->children
[0]->children
[0]->children
[0]->
5568 children
[0]->tok_attr
];
5571 case 128: /* matrixindex */
5572 bind_type
= ATTRIB_MATRIXINDEX
;
5574 s
->ints
.data
[ptn
->children
[0]->children
[0]->children
[0]->
5577 case 129: /* attrib */
5578 bind_type
= ATTRIB_ATTRIB
;
5580 s
->ints
.data
[ptn
->children
[0]->children
[0]->children
[0]->
5588 case 172: /* material */
5591 ptmp
= ptn
->children
[0]->children
[0];
5594 if (ptmp
->prod_applied
== 182) {
5599 if ((ptmp
->prod_applied
== 183)
5600 && (ptmp
->children
[0]->prod_applied
== 305)) {
5605 /* no explicit face, or explicit front */
5607 switch (ptmp
->children
[b
]->prod_applied
) {
5608 case 184: /* ambient */
5609 bind_type
= MATERIAL_FRONT_AMBIENT
;
5611 case 185: /* diffuse */
5612 bind_type
= MATERIAL_FRONT_DIFFUSE
;
5614 case 186: /* specular */
5615 bind_type
= MATERIAL_FRONT_SPECULAR
;
5617 case 187: /* emission */
5618 bind_type
= MATERIAL_FRONT_EMISSION
;
5620 case 188: /* shininess */
5621 bind_type
= MATERIAL_FRONT_SHININESS
;
5625 /* has explicit back face */
5627 switch (ptmp
->children
[1]->prod_applied
) {
5628 case 184: /* ambient */
5629 bind_type
= MATERIAL_BACK_AMBIENT
;
5631 case 185: /* diffuse */
5632 bind_type
= MATERIAL_BACK_DIFFUSE
;
5634 case 186: /* specular */
5635 bind_type
= MATERIAL_BACK_SPECULAR
;
5637 case 187: /* emission */
5638 bind_type
= MATERIAL_BACK_EMISSION
;
5640 case 188: /* shininess */
5641 bind_type
= MATERIAL_BACK_SHININESS
;
5647 case 173: /* light */
5650 printf("FOLDING LIGHT!\n");
5651 ptmp
= ptn
->children
[0];
5652 bind_idx
= s
->ints
.data
[ptmp
->children
[0]->children
[0]->tok_attr
];
5653 switch (ptmp
->children
[1]->children
[0]->prod_applied
) {
5654 case 191: /* ambient */
5655 bind_type
= LIGHT_AMBIENT
;
5657 case 192: /* diffuse */
5658 bind_type
= LIGHT_DIFFUSE
;
5660 case 193: /* specular */
5661 bind_type
= LIGHT_SPECULAR
;
5663 case 194: /* position */
5664 bind_type
= LIGHT_POSITION
;
5666 case 195: /* attenuation */
5667 bind_type
= LIGHT_ATTENUATION
;
5669 case 196: /* spot */
5670 bind_type
= LIGHT_SPOT_DIRECTION
;
5672 case 197: /* half */
5673 bind_type
= LIGHT_HALF
;
5679 case 174: /* lightmodel */
5683 ptmp
= ptn
->children
[0];
5684 switch (ptmp
->prod_applied
) {
5685 case 201: /* ambient */
5686 bind_type
= LIGHTMODEL_AMBIENT
;
5688 case 202: /* scenecolor */
5689 bind_type
= LIGHTMODEL_FRONT_SCENECOLOR
;
5691 case 203: /* foo.scenecolor */
5692 if (ptmp
->children
[0]->prod_applied
== 304)
5693 bind_type
= LIGHTMODEL_FRONT_SCENECOLOR
;
5695 bind_type
= LIGHTMODEL_BACK_SCENECOLOR
;
5699 case 175: /* lightprod */
5703 ptmp
= ptn
->children
[0];
5704 bind_idx
= s
->ints
.data
[ptmp
->children
[0]->children
[0]->tok_attr
];
5705 /* No explicit face */
5706 if (ptmp
->children
[1]->children
[0]->prod_applied
== 206) {
5708 b
= 0; /* 0-th child */
5711 if ((ptmp
->children
[1]->children
[0]->prod_applied
== 207) &&
5712 (ptmp
->children
[1]->children
[0]->children
[0]->prod_applied
==
5715 b
= 1; /* 1-th child */
5722 switch (ptmp
->children
[1]->children
[0]->children
[b
]->prod_applied
) {
5723 case 208: /* ambient */
5724 bind_type
= LIGHTPROD_FRONT_AMBIENT
;
5726 case 209: /* diffuse */
5727 bind_type
= LIGHTPROD_FRONT_DIFFUSE
;
5729 case 210: /* specular */
5730 bind_type
= LIGHTPROD_FRONT_SPECULAR
;
5735 switch (ptmp
->children
[1]->children
[0]->children
[b
]->prod_applied
) {
5736 case 208: /* ambient */
5737 bind_type
= LIGHTPROD_BACK_AMBIENT
;
5739 case 209: /* diffuse */
5740 bind_type
= LIGHTPROD_BACK_DIFFUSE
;
5742 case 210: /* specular */
5743 bind_type
= LIGHTPROD_BACK_SPECULAR
;
5749 case 176: /* texgen */
5753 ptmp
= ptn
->children
[0];
5754 if (ptmp
->children
[0]->prod_applied
== 311)
5756 s
->ints
.data
[ptmp
->children
[0]->children
[0]->children
[0]->
5758 ptmp
= ptn
->children
[0]->children
[1];
5759 if (ptmp
->children
[0]->prod_applied
== 214)
5763 b
= ptmp
->children
[1]->prod_applied
- 216;
5767 bind_type
= TEXGEN_EYE_S
;
5770 bind_type
= TEXGEN_EYE_T
;
5773 bind_type
= TEXGEN_EYE_R
;
5776 bind_type
= TEXGEN_EYE_Q
;
5783 bind_type
= TEXGEN_OBJECT_S
;
5786 bind_type
= TEXGEN_OBJECT_T
;
5789 bind_type
= TEXGEN_OBJECT_R
;
5792 bind_type
= TEXGEN_OBJECT_Q
;
5802 ptmp
= ptn
->children
[0];
5803 if (ptmp
->children
[0]->prod_applied
== 221)
5804 bind_type
= FOG_COLOR
;
5806 bind_type
= FOG_PARAMS
;
5809 case 178: /* clip */
5813 ptmp
= ptn
->children
[0];
5814 bind_idx
= s
->ints
.data
[ptmp
->children
[0]->children
[0]->tok_attr
];
5815 bind_type
= CLIP_PLANE
;
5818 case 179: /* point */
5822 ptmp
= ptn
->children
[0];
5823 if (ptmp
->children
[0]->prod_applied
== 227)
5824 bind_type
= POINT_SIZE
;
5826 bind_type
= POINT_ATTENUATION
;
5829 case 162: /* matrix rows/whole matrix */
5833 parse_tree_node
*mname
;
5837 mname
= ptn
->children
[0];
5838 switch (mname
->prod_applied
) {
5839 case 238: /* modelview */
5841 if (mname
->children
[0]->prod_applied
== 245)
5843 s
->ints
.data
[mname
->children
[0]->children
[0]->children
[0]->
5846 case 239: /* projection */
5852 case 241: /* texture */
5853 if (mname
->children
[0]->prod_applied
== 311)
5855 s
->ints
.data
[mname
->children
[0]->children
[0]->children
[0]->
5859 case 242: /* palette */
5861 s
->ints
.data
[mname
->children
[0]->children
[0]->tok_attr
];
5864 case 243: /* program */
5866 s
->ints
.data
[mname
->children
[0]->children
[0]->tok_attr
];
5871 ptmp
= ptn
->children
[1];
5872 if (ptmp
->prod_applied
== 316) {
5873 bind_type
= name_and_mod_to_matrixrows(name
, mod
);
5878 if (ptmp
->children
[0]->prod_applied
== 164) {
5879 switch (ptmp
->children
[0]->children
[0]->prod_applied
) {
5880 case 234: /* inverse */
5883 case 235: /* transpose */
5886 case 236: /* invtrans */
5890 if (ptmp
->children
[0]->children
[1]->prod_applied
== 166) {
5891 bind_type
= name_and_mod_to_matrixrows(name
, mod
);
5895 else { /* prod 167 */
5897 bind_type
= name_and_mod_to_matrixrows(name
, mod
);
5899 s
->ints
.data
[ptmp
->children
[0]->children
[1]->
5900 children
[0]->children
[0]->children
[0]->
5902 if (ptmp
->children
[0]->children
[1]->children
[0]->
5903 children
[1]->prod_applied
== 169)
5907 s
->ints
.data
[ptmp
->children
[0]->children
[1]->
5908 children
[0]->children
[1]->children
[0]->
5909 children
[0]->tok_attr
] - bind_row
+ 1;
5913 else { /* prod 165 */
5915 bind_type
= name_and_mod_to_matrixrows(name
, mod
);
5918 s
->ints
.data
[ptmp
->children
[0]->children
[0]->children
[0]->
5920 if (ptmp
->children
[0]->children
[1]->prod_applied
== 169)
5924 s
->ints
.data
[ptmp
->children
[0]->children
[1]->
5925 children
[0]->children
[0]->tok_attr
] -
5931 printf("folding matrixrows: %d %d %d %d\n", bind_type
, bind_idx
,
5932 bind_row
, bind_nrows
);
5935 case 180: /* matrix row */
5941 parse_tree_node
*mname
, *mrow
;
5943 ptmp
= ptn
->children
[0];
5944 mname
= ptmp
->children
[0];
5946 if (ptmp
->children
[1]->children
[0]->prod_applied
== 232) {
5948 ptmp
->children
[1]->children
[0]->children
[1]->children
[0]->
5950 switch (ptmp
->children
[1]->children
[0]->children
[0]->prod_applied
) {
5952 mod
= 1; /* inverse */
5955 mod
= 2; /* transpose */
5958 mod
= 3; /* invtrans */
5963 mrow
= ptmp
->children
[1]->children
[0]->children
[0]->children
[0];
5965 bind_row
= s
->ints
.data
[mrow
->tok_attr
];
5967 switch (mname
->prod_applied
) {
5968 case 238: /* modelview */
5969 if (mname
->children
[0]->prod_applied
== 245) {
5971 s
->ints
.data
[mname
->children
[0]->children
[0]->children
[0]->
5976 bind_type
= MATRIXROW_MODELVIEW
;
5979 bind_type
= MATRIXROW_MODELVIEW_INVERSE
;
5982 bind_type
= MATRIXROW_MODELVIEW_TRANSPOSE
;
5985 bind_type
= MATRIXROW_MODELVIEW_INVTRANS
;
5989 case 239: /* projection */
5992 bind_type
= MATRIXROW_PROJECTION
;
5995 bind_type
= MATRIXROW_PROJECTION_INVERSE
;
5998 bind_type
= MATRIXROW_PROJECTION_TRANSPOSE
;
6001 bind_type
= MATRIXROW_PROJECTION_INVTRANS
;
6008 bind_type
= MATRIXROW_MVP
;
6011 bind_type
= MATRIXROW_MVP_INVERSE
;
6014 bind_type
= MATRIXROW_MVP_TRANSPOSE
;
6017 bind_type
= MATRIXROW_MVP_INVTRANS
;
6021 case 241: /* texture */
6022 if (mname
->children
[0]->prod_applied
== 311) {
6024 s
->ints
.data
[mname
->children
[0]->children
[0]->children
[0]->
6029 bind_type
= MATRIXROW_TEXTURE
;
6032 bind_type
= MATRIXROW_TEXTURE_INVERSE
;
6035 bind_type
= MATRIXROW_TEXTURE_TRANSPOSE
;
6038 bind_type
= MATRIXROW_TEXTURE_INVTRANS
;
6042 case 242: /* palette */
6044 s
->ints
.data
[mname
->children
[0]->children
[0]->tok_attr
];
6047 bind_type
= MATRIXROW_PALETTE
;
6050 bind_type
= MATRIXROW_PALETTE_INVERSE
;
6053 bind_type
= MATRIXROW_PALETTE_TRANSPOSE
;
6056 bind_type
= MATRIXROW_PALETTE_INVTRANS
;
6060 case 243: /* program */
6062 s
->ints
.data
[mname
->children
[0]->children
[0]->tok_attr
];
6065 bind_type
= MATRIXROW_PROGRAM
;
6068 bind_type
= MATRIXROW_PROGRAM_INVERSE
;
6071 bind_type
= MATRIXROW_PROGRAM_TRANSPOSE
;
6074 bind_type
= MATRIXROW_PROGRAM_INVTRANS
;
6081 /* program (single) */
6085 switch (ptn
->children
[0]->prod_applied
) {
6087 bind_type
= PROGRAM_ENV_SINGLE
;
6089 case 251: /* local */
6090 bind_type
= PROGRAM_LOCAL_SINGLE
;
6094 s
->ints
.data
[ptn
->children
[0]->children
[0]->children
[0]->
6095 children
[0]->tok_attr
];
6098 /* program (multi) */
6102 switch (ptn
->children
[0]->prod_applied
) {
6104 case 254: /* local */
6105 if (ptn
->children
[0]->prod_applied
== 253)
6106 bind_type
= PROGRAM_ENV_MULTI
;
6108 bind_type
= PROGRAM_LOCAL_MULTI
;
6110 ptmp
= ptn
->children
[0]->children
[0]->children
[0];
6111 bind_idx
= bind_row
=
6112 s
->ints
.data
[ptmp
->children
[0]->children
[0]->tok_attr
];
6115 ptmp
= ptn
->children
[0]->children
[0]->children
[0]->children
[1];
6116 if ((ptmp
->prod_applied
== 257) || (ptmp
->prod_applied
== 262))
6118 s
->ints
.data
[ptmp
->children
[0]->children
[0]->tok_attr
] -
6124 #define FOLD_FLOAT_CONSTANT(float_ptr, bind_vals_idx, sign) \
6125 if (float_ptr->tok == 49) /* GLfloat */ {\
6126 bind_vals[bind_vals_idx] = sign * (GLfloat) s->floats.data[float_ptr->tok_attr];\
6129 bind_vals[bind_vals_idx] = sign * s->ints.data[float_ptr->tok_attr];\
6132 #define FOLD_SIGNED_FLOAT_CONSTANT(sf_ptr, bind_vals_idx) \
6134 GLfloat __mul = 1.0F;\
6135 if (sf_ptr->children[0]->prod_applied == 282) \
6137 FOLD_FLOAT_CONSTANT(sf_ptr->children[1], bind_vals_idx, __mul);\
6140 /* const scalar decl */
6144 bind_type
= CONSTANT
;
6146 FOLD_SIGNED_FLOAT_CONSTANT(ptn
->children
[0], 0);
6150 if (ptn
->children
[0]->children
[0]->prod_applied
== 282) {
6154 FOLD_FLOAT_CONSTANT(ptn
->children
[0]->children
[1], 0, mul
);
6163 bind_type
= CONSTANT
;
6165 FOLD_SIGNED_FLOAT_CONSTANT(ptn
->children
[0], 0);
6166 if (ptn
->children
[1]->prod_applied
== 275) {
6167 FOLD_SIGNED_FLOAT_CONSTANT(ptn
->children
[1]->children
[0], 1);
6168 if (ptn
->children
[1]->children
[1]->prod_applied
== 277) {
6169 FOLD_SIGNED_FLOAT_CONSTANT(ptn
->children
[1]->children
[1]->
6171 if (ptn
->children
[1]->children
[1]->children
[1]->prod_applied
==
6173 FOLD_SIGNED_FLOAT_CONSTANT(ptn
->children
[1]->children
[1]->
6174 children
[1]->children
[0], 3);
6184 switch (ptn
->children
[0]->prod_applied
) {
6185 case 290: /* position */
6186 bind_type
= RESULT_POSITION
;
6188 case 291: /* fogcoord */
6189 bind_type
= RESULT_FOGCOORD
;
6191 case 292: /* pointsize */
6192 bind_type
= RESULT_POINTSIZE
;
6194 case 293: /* color */
6195 bind_type
= RESULT_COLOR_FRONT_PRIMARY
;
6196 ptmp
= ptn
->children
[0]->children
[0]->children
[0];
6197 if (ptmp
->prod_applied
== 297) {
6198 if (ptmp
->children
[0]->prod_applied
== 298) { /* front */
6199 if (ptmp
->children
[0]->children
[0]->prod_applied
== 301) {
6200 if (ptmp
->children
[0]->children
[0]->children
[0]->prod_applied
== 303) /* secondary */
6201 bind_type
= RESULT_COLOR_FRONT_SECONDARY
;
6206 bind_type
= RESULT_COLOR_BACK_PRIMARY
;
6207 if (ptmp
->children
[0]->children
[0]->prod_applied
== 301) {
6208 if (ptmp
->children
[0]->children
[0]->children
[0]->prod_applied
== 303) /* secondary */
6209 bind_type
= RESULT_COLOR_BACK_SECONDARY
;
6215 case 294: /* texcoord */
6216 bind_type
= RESULT_TEXCOORD
;
6217 if (ptn
->children
[0]->children
[0]->prod_applied
== 311) {
6219 s
->ints
.data
[ptn
->children
[0]->children
[0]->children
[0]->
6220 children
[0]->tok_attr
];
6227 /* Mmmmm... baaaaby */
6229 if (eat_children
== 2)
6230 parse_tree_free_children(ptn
->children
[0]);
6232 parse_tree_free_children(ptn
);
6234 /* Insert the binding into the binding table */
6235 ptn
->tok
= BINDING_TOKEN
;
6237 binding_table_add(&s
->binds
, bind_type
, bind_idx
, bind_row
,
6238 bind_nrows
, bind_vals
);
6240 printf("Got binding %d %d %d %d at pos %d in bind tab [%f %f %f %f]\n",
6241 bind_type
, bind_idx
, bind_row
, bind_nrows
, ptn
->tok_attr
,
6242 bind_vals
[0], bind_vals
[1], bind_vals
[2], bind_vals
[3]);
6246 for (a
= 0; a
< 4; a
++) {
6247 if (!ptn
->children
[a
])
6250 parse_tree_fold_bindings(s
, ptn
->children
[a
]);
6255 * After we have figured out what mess of parse tree actually represents GL state (or constants, or
6256 * whatnot), we have to line up variables with the state. For example, a line something like
6258 * OUTPUT foo = result.position;
6260 * We would have 'foo' in the identifier table at some position foo_idx, and 'result.position' in the
6261 * binding table at some position res_pos_idx. To set things up such that 'foo' is associated with
6262 * the result position state, we need to set ident[foo_idx].attr = res_pos_idx so we can generate
6263 * opcodes without going bonkers.
6265 * This function works on OUTPUT, ATTRIB, and PARAM single bindings. PARAM array bindings are handled in
6266 * parse_tree_assign_param_arrays().
6268 * \param s The parse state
6269 * \param ptn The root of the parse tree from which to start lining up state and variables
6272 parse_tree_assign_bindings(parse_state
* s
, parse_tree_node
* ptn
)
6275 parse_tree_node
*var_name
, *attr_item
;
6277 /* OUTPUT, ATTRIB */
6278 if ((ptn
->prod_applied
== 288) || (ptn
->prod_applied
== 120)) {
6279 var_name
= ptn
->children
[0]->children
[0];
6280 attr_item
= ptn
->children
[1];
6282 if (attr_item
->tok
!= BINDING_TOKEN
) {
6284 "sanity check: trying to bind an output variable to something funky!\n");
6288 s
->idents
.attr
[var_name
->tok_attr
] = attr_item
->tok_attr
;
6289 printf("result: %s bound to %d\n", s
->idents
.data
[var_name
->tok_attr
],
6290 s
->binds
.type
[s
->idents
.attr
[var_name
->tok_attr
]]);
6294 /* stateSingleItemDecl */
6295 if (ptn
->prod_applied
== 134) {
6296 var_name
= ptn
->children
[0]->children
[0];
6297 if (ptn
->children
[1]->prod_applied
== 135) {
6298 if (ptn
->children
[1]->children
[0]->prod_applied
== 139) {
6299 if (ptn
->children
[1]->children
[0]->children
[0]->prod_applied
==
6302 ptn
->children
[1]->children
[0]->children
[0]->children
[0]->
6304 else if (ptn
->children
[1]->children
[0]->children
[0]->
6305 prod_applied
== 145)
6307 ptn
->children
[1]->children
[0]->children
[0]->children
[0];
6310 ptn
->children
[1]->children
[0]->children
[0]->children
[0]->
6313 if (attr_item
->tok
!= BINDING_TOKEN
) {
6315 "sanity check: trying to bind an param variable (%s) to something funky! [%d]\n",
6316 s
->idents
.data
[var_name
->tok_attr
], attr_item
->tok
);
6320 s
->idents
.attr
[var_name
->tok_attr
] = attr_item
->tok_attr
;
6321 printf("result: %s bound to %d\n",
6322 s
->idents
.data
[var_name
->tok_attr
],
6323 s
->binds
.type
[s
->idents
.attr
[var_name
->tok_attr
]]);
6330 /* else, recurse on all our children */
6331 for (a
= 0; a
< 4; a
++) {
6332 if (!ptn
->children
[a
])
6335 parse_tree_assign_bindings(s
, ptn
->children
[a
]);
6341 * This handles lining up PARAM arrays with variables, much like parse_tree_assign_bindings().
6343 * In parse_tree_assign_bindings, we set the identifier attr to the index into the binding table of
6346 * Here, instead, we allocate a slot in the 'array table' to stick the bound state into. Instead
6347 * of an index into the binding table, the identifier attr now holds the index into the array table.
6349 * \param s The parse state
6350 * \param pnt The root parse tree node to handle arrays from
6354 parse_tree_assign_param_arrays(parse_state
* s
, parse_tree_node
* ptn
)
6356 GLint a
, is_mult
, array_len
;
6357 parse_tree_node
*var_name
, *binding
, *arraysize
, *ptmp
;
6359 /* If we're a param */
6360 if (ptn
->prod_applied
== 134) {
6361 /* establish name */
6362 var_name
= ptn
->children
[0];
6364 /* param_statement2 */
6365 binding
= ptn
->children
[1];
6366 if (binding
->prod_applied
== 136) {
6368 arraysize
= binding
->children
[0];
6373 if (arraysize
->prod_applied
== 138) {
6374 debug_token(s
, var_name
->children
[0]->tok
,
6375 var_name
->children
[0]->tok_attr
);
6376 debug_token(s
, arraysize
->children
[0]->tok
,
6377 arraysize
->children
[0]->tok_attr
);
6383 if (arraysize
->prod_applied
== 137) {
6385 printf("How do I init a PARAM array like foo[]?? \n");
6392 s
->idents
.attr
[var_name
->tok_attr
] = array_table_new(&s
->arrays
);
6394 binding
= binding
->children
[1]->children
[0];
6395 ptmp
= binding
->children
[0];
6398 if (ptmp
->prod_applied
== 150) { /* state */
6399 printf("matrix 0 [state]:\n");
6400 printf("%d %d\n", ptmp
->children
[0]->children
[0]->tok
,
6401 ptmp
->children
[0]->children
[0]->tok_attr
);
6402 array_table_add_data(&s
->arrays
,
6403 s
->idents
.attr
[var_name
->tok_attr
],
6404 ptmp
->children
[0]->children
[0]->tok_attr
);
6406 s
->binds
.num_rows
[ptmp
->children
[0]->children
[0]->tok_attr
];
6408 else if (ptmp
->prod_applied
== 151) { /* program */
6409 printf("matrix 0 [program]:\n");
6410 printf("%d %d\n", ptmp
->children
[0]->tok
,
6411 ptmp
->children
[0]->tok_attr
);
6412 array_table_add_data(&s
->arrays
,
6413 s
->idents
.attr
[var_name
->tok_attr
],
6414 ptmp
->children
[0]->tok_attr
);
6415 array_len
+= s
->binds
.num_rows
[ptmp
->children
[0]->tok_attr
];
6417 else { /* constant */
6419 printf("matrix 0 [constant]:\n");
6420 printf("%d %d\n", ptmp
->children
[0]->children
[0]->tok
,
6421 ptmp
->children
[0]->children
[0]->tok_attr
);
6422 array_table_add_data(&s
->arrays
,
6423 s
->idents
.attr
[var_name
->tok_attr
],
6424 ptmp
->children
[0]->children
[0]->tok_attr
);
6426 s
->binds
.num_rows
[ptmp
->children
[0]->children
[0]->tok_attr
];
6428 binding
= binding
->children
[1];
6430 while (binding
->prod_applied
!= 143) {
6431 ptmp
= binding
->children
[0]->children
[0];
6432 printf("mat: %d\n", ptmp
->prod_applied
);
6433 if (ptmp
->prod_applied
== 150) { /* state */
6434 printf("matrix %d:\n", array_len
);
6435 printf("%d %d\n", ptmp
->children
[0]->children
[0]->tok
,
6436 ptmp
->children
[0]->children
[0]->tok_attr
);
6437 array_table_add_data(&s
->arrays
,
6438 s
->idents
.attr
[var_name
->tok_attr
],
6439 ptmp
->children
[0]->children
[0]->tok_attr
);
6441 s
->binds
.num_rows
[ptmp
->children
[0]->children
[0]->tok_attr
];
6443 else if (ptmp
->prod_applied
== 151) { /* program */
6444 printf("matrix %d [program]:\n", array_len
);
6445 printf("%d %d\n", ptmp
->children
[0]->tok
,
6446 ptmp
->children
[0]->tok_attr
);
6447 array_table_add_data(&s
->arrays
,
6448 s
->idents
.attr
[var_name
->tok_attr
],
6449 ptmp
->children
[0]->tok_attr
);
6450 array_len
+= s
->binds
.num_rows
[ptmp
->children
[0]->tok_attr
];
6452 else { /* constant */
6454 printf("matrix %d [constant]:\n", array_len
);
6455 printf("%d %d\n", ptmp
->children
[0]->children
[0]->tok
,
6456 ptmp
->children
[0]->children
[0]->tok_attr
);
6457 array_table_add_data(&s
->arrays
,
6458 s
->idents
.attr
[var_name
->tok_attr
],
6459 ptmp
->children
[0]->children
[0]->tok_attr
);
6461 s
->binds
.num_rows
[ptmp
->children
[0]->children
[0]->tok_attr
];
6463 binding
= binding
->children
[0]->children
[1];
6466 /* XXX: have to compare the requested size, and the actual
6467 * size, and fix up any inconsistancies
6470 printf("matrix wants to get %d rows\n",
6471 s
->ints
.data
[arraysize
->children
[0]->tok_attr
]);
6473 printf("matrix num rows: %d\n", array_len
);
6479 /* Else, recurse on all our children */
6480 for (a
= 0; a
< 4; a
++) {
6481 if (!ptn
->children
[a
])
6484 parse_tree_assign_param_arrays(s
, ptn
->children
[a
]);
6489 /* XXX: This needs to be written properly. */
6491 * Here we allocate 'registers' for all of the various variables and bound state.
6493 * The 'register' number is given by the reg_num field in the binding table. Note that this field
6494 * is not stored in the identifier table. If it were, we would need a different mechanism for handling
6495 * implicit bindings.
6497 * However, after some discussion with Brian, implicit bindings may be handled by grabbing state
6498 * directly from Mesa's state structs. This might be a little hairy here, maybe not.. Implicit
6499 * bindings are those in the binding table that are not pointed to by any ident.attr or array.data
6501 * This should also do various error checking, like the multiple vertex attrib error, or 'too many bindings'
6504 * \param s The parse state
6507 assign_regs(parse_state
* s
)
6512 for (a
= 0; a
< s
->idents
.len
; a
++) {
6513 if (s
->idents
.type
[a
] == TYPE_TEMP
) {
6515 binding_table_add(&s
->binds
, TYPE_TEMP
, 0, 0, 0, foo
);
6521 * Parse/compile the 'str' returning the compiled 'program'.
6522 * ctx->Program.ErrorPos will be -1 if successful. Otherwise, ErrorPos
6523 * indicates the position of the error in 'str'.
6526 _mesa_parse_arb_vertex_program(GLcontext
* ctx
, GLenum target
,
6527 const GLubyte
* string
, GLsizei len
,
6528 struct vertex_program
*program
)
6530 GLubyte
*our_string
;
6533 /* XXX: How do I handle these errors? */
6534 if (len
< 10 || _mesa_strncmp((const char *) string
, "!!ARBvp1.0", 10)) {
6535 ctx
->Program
.ErrorPos
= 0;
6536 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glProgramStringARB(bad header)");
6540 /* Make a null-terminated copy of the program string */
6541 our_string
= (GLubyte
*) MALLOC(len
+ 1);
6543 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
6546 MEMCPY(our_string
, string
, len
);
6547 our_string
[len
] = 0;
6549 state
= parse_state_init(our_string
+ 10, _mesa_strlen((char *) our_string
) - 10);
6551 if (parse(state
) == ARB_VP_SUCESS
) {
6552 printf("parse sucess!\n");
6555 printf("*** error\n");
6556 parse_state_cleanup(state
);
6560 /* First, we 'fold' bindings from a big mess of productions and
6561 * tokens into one BINDING_TOKEN, which points to an entry
6562 * in the binding sym table that holds all of the relevant
6563 * info for the binding destination.
6565 parse_tree_fold_bindings(state
, state
->pt_head
);
6567 /* Now, for each type of binding, walk the parse tree and stick
6568 * the index into the binding sym table
6570 parse_tree_assign_bindings(state
, state
->pt_head
);
6572 /* XXX: this still needs a' fixin to get folded bindings
6573 * -- it does? wtf do I mean? */
6574 parse_tree_assign_param_arrays(state
, state
->pt_head
);
6576 /* XXX: Now, assign registers. For this, we'll need to create
6577 * bindings for all temps (and what else?? )
6581 /* Ok, now generate code */
6582 parse_tree_generate_opcodes(state
, state
->pt_head
);
6584 /* Just for testing.. */
6585 program
->Base
.Target
= target
;
6586 if (program
->Base
.String
) {
6587 FREE(program
->Base
.String
);
6589 program
->Base
.String
= our_string
;
6590 program
->Base
.Format
= GL_PROGRAM_FORMAT_ASCII_ARB
;
6592 if (program
->Instructions
) {
6593 FREE(program
->Instructions
);
6596 program
->Instructions
=
6597 (struct vp_instruction
*) _mesa_malloc(sizeof(struct vp_instruction
));
6598 program
->Instructions
[0].Opcode
= VP_OPCODE_END
;
6599 program
->InputsRead
= 0;
6600 program
->OutputsWritten
= 0;
6601 program
->IsPositionInvariant
= 0;
6603 parse_state_cleanup(state
);
6606 * - handle implicit state grabbing & register allocation like discussed
6607 * - implicit param declarations -- see above
6609 * - variable bindings -- ADDRESS
6610 * - deal with explicit array sizes & size mismatches
6611 * - shuddup all my debugging crap
6613 * - multiple vtx attrib binding error
6614 * - What do I do on look ahead for prod 54 & 55? (see arbvp_grammar.txt)
6616 * - check integer ranges
6617 * - check array index ranges
6618 * - check variable counts
6619 * - param register allocation
6620 * - exercise swizzles and masks
6622 * - generate opcodes
6623 * + Get addres registers for relative offsets in PARAM arrays
6624 * + Properly encode implicit PARAMs and ATTRIBs.
6627 * + actually emit Mesa opcodes
6628 * - segfaults while freeing stuff