nv40: fix typo in one of the previous commits
[mesa.git] / src / mesa / shader / arbprogram.syn
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.2
4 *
5 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
6 *
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:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
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.
23 */
24
25 /**
26 * \file arbprogram.syn
27 * ARB_fragment/vertex_program syntax
28 * \author Michal Krol
29 */
30
31 .syntax program;
32
33 /*
34 This value must be incremented every time emit code values or structure of the production
35 array changes. This value is placed at the beginning of the production array. The loader
36 compares the value with its REVISION value. If they do not match, the loader is not up
37 to date.
38 */
39 .emtcode REVISION 0x0a
40
41 /* program type */
42 .emtcode FRAGMENT_PROGRAM 0x01
43 .emtcode VERTEX_PROGRAM 0x02
44
45 /* program section */
46 .emtcode OPTION 0x01
47 .emtcode INSTRUCTION 0x02
48 .emtcode DECLARATION 0x03
49 .emtcode END 0x04
50
51 /* GL_ARB_fragment_program option */
52 .emtcode ARB_PRECISION_HINT_FASTEST 0x00
53 .emtcode ARB_PRECISION_HINT_NICEST 0x01
54 .emtcode ARB_FOG_EXP 0x02
55 .emtcode ARB_FOG_EXP2 0x03
56 .emtcode ARB_FOG_LINEAR 0x04
57
58 /* GL_ARB_vertex_program option */
59 .emtcode ARB_POSITION_INVARIANT 0x05
60
61 /* GL_ARB_fragment_program_shadow option */
62 .emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x06
63
64 /* GL_ARB_draw_buffers option */
65 .emtcode ARB_DRAW_BUFFERS 0x07
66
67 /* GL_MESA_texture_array option */
68 .emtcode MESA_TEXTURE_ARRAY 0x08
69
70 /* GL_ARB_fragment_program instruction class */
71 .emtcode OP_ALU_INST 0x00
72 .emtcode OP_TEX_INST 0x01
73
74 /* GL_ARB_vertex_program instruction class */
75 /* OP_ALU_INST */
76
77 /* GL_ARB_fragment_program instruction type */
78 .emtcode OP_ALU_VECTOR 0x00
79 .emtcode OP_ALU_SCALAR 0x01
80 .emtcode OP_ALU_BINSC 0x02
81 .emtcode OP_ALU_BIN 0x03
82 .emtcode OP_ALU_TRI 0x04
83 .emtcode OP_ALU_SWZ 0x05
84 .emtcode OP_TEX_SAMPLE 0x06
85 .emtcode OP_TEX_KIL 0x07
86
87 /* GL_ARB_vertex_program instruction type */
88 .emtcode OP_ALU_ARL 0x08
89 /* OP_ALU_VECTOR */
90 /* OP_ALU_SCALAR */
91 /* OP_ALU_BINSC */
92 /* OP_ALU_BIN */
93 /* OP_ALU_TRI */
94 /* OP_ALU_SWZ */
95
96 /* GL_ARB_fragment_program instruction code */
97 .emtcode OP_ABS 0x00
98 .emtcode OP_ABS_SAT 0x1B
99 .emtcode OP_FLR 0x09
100 .emtcode OP_FLR_SAT 0x26
101 .emtcode OP_FRC 0x0A
102 .emtcode OP_FRC_SAT 0x27
103 .emtcode OP_LIT 0x0C
104 .emtcode OP_LIT_SAT 0x2A
105 .emtcode OP_MOV 0x11
106 .emtcode OP_MOV_SAT 0x30
107 .emtcode OP_COS 0x1F
108 .emtcode OP_COS_SAT 0x20
109 .emtcode OP_EX2 0x07
110 .emtcode OP_EX2_SAT 0x25
111 .emtcode OP_LG2 0x0B
112 .emtcode OP_LG2_SAT 0x29
113 .emtcode OP_RCP 0x14
114 .emtcode OP_RCP_SAT 0x33
115 .emtcode OP_RSQ 0x15
116 .emtcode OP_RSQ_SAT 0x34
117 .emtcode OP_SIN 0x38
118 .emtcode OP_SIN_SAT 0x39
119 .emtcode OP_SCS 0x35
120 .emtcode OP_SCS_SAT 0x36
121 .emtcode OP_POW 0x13
122 .emtcode OP_POW_SAT 0x32
123 .emtcode OP_ADD 0x01
124 .emtcode OP_ADD_SAT 0x1C
125 .emtcode OP_DP3 0x03
126 .emtcode OP_DP3_SAT 0x21
127 .emtcode OP_DP4 0x04
128 .emtcode OP_DP4_SAT 0x22
129 .emtcode OP_DPH 0x05
130 .emtcode OP_DPH_SAT 0x23
131 .emtcode OP_DST 0x06
132 .emtcode OP_DST_SAT 0x24
133 .emtcode OP_MAX 0x0F
134 .emtcode OP_MAX_SAT 0x2E
135 .emtcode OP_MIN 0x10
136 .emtcode OP_MIN_SAT 0x2F
137 .emtcode OP_MUL 0x12
138 .emtcode OP_MUL_SAT 0x31
139 .emtcode OP_SGE 0x16
140 .emtcode OP_SGE_SAT 0x37
141 .emtcode OP_SLT 0x17
142 .emtcode OP_SLT_SAT 0x3A
143 .emtcode OP_SUB 0x18
144 .emtcode OP_SUB_SAT 0x3B
145 .emtcode OP_XPD 0x1A
146 .emtcode OP_XPD_SAT 0x43
147 .emtcode OP_CMP 0x1D
148 .emtcode OP_CMP_SAT 0x1E
149 .emtcode OP_LRP 0x2B
150 .emtcode OP_LRP_SAT 0x2C
151 .emtcode OP_MAD 0x0E
152 .emtcode OP_MAD_SAT 0x2D
153 .emtcode OP_SWZ 0x19
154 .emtcode OP_SWZ_SAT 0x3C
155 .emtcode OP_TEX 0x3D
156 .emtcode OP_TEX_SAT 0x3E
157 .emtcode OP_TXB 0x3F
158 .emtcode OP_TXB_SAT 0x40
159 .emtcode OP_TXP 0x41
160 .emtcode OP_TXP_SAT 0x42
161 .emtcode OP_KIL 0x28
162
163 /* GL_ARB_vertex_program instruction code */
164 .emtcode OP_ARL 0x02
165 /* OP_ABS */
166 /* OP_FLR */
167 /* OP_FRC */
168 /* OP_LIT */
169 /* OP_MOV */
170 /* OP_EX2 */
171 .emtcode OP_EXP 0x08
172 /* OP_LG2 */
173 .emtcode OP_LOG 0x0D
174 /* OP_RCP */
175 /* OP_RSQ */
176 /* OP_POW */
177 /* OP_ADD */
178 /* OP_DP3 */
179 /* OP_DP4 */
180 /* OP_DPH */
181 /* OP_DST */
182 /* OP_MAX */
183 /* OP_MIN */
184 /* OP_MUL */
185 /* OP_SGE */
186 /* OP_SLT */
187 /* OP_SUB */
188 /* OP_XPD */
189 /* OP_MAD */
190 /* OP_SWZ */
191
192 /* fragment attribute binding */
193 .emtcode FRAGMENT_ATTRIB_COLOR 0x01
194 .emtcode FRAGMENT_ATTRIB_TEXCOORD 0x02
195 .emtcode FRAGMENT_ATTRIB_FOGCOORD 0x03
196 .emtcode FRAGMENT_ATTRIB_POSITION 0x04
197
198 /* vertex attribute binding */
199 .emtcode VERTEX_ATTRIB_POSITION 0x01
200 .emtcode VERTEX_ATTRIB_WEIGHT 0x02
201 .emtcode VERTEX_ATTRIB_NORMAL 0x03
202 .emtcode VERTEX_ATTRIB_COLOR 0x04
203 .emtcode VERTEX_ATTRIB_FOGCOORD 0x05
204 .emtcode VERTEX_ATTRIB_TEXCOORD 0x06
205 .emtcode VERTEX_ATTRIB_MATRIXINDEX 0x07
206 .emtcode VERTEX_ATTRIB_GENERIC 0x08
207
208 /* fragment result binding */
209 .emtcode FRAGMENT_RESULT_COLOR 0x01
210 .emtcode FRAGMENT_RESULT_DEPTH 0x02
211
212 /* vertex result binding */
213 .emtcode VERTEX_RESULT_POSITION 0x01
214 .emtcode VERTEX_RESULT_COLOR 0x02
215 .emtcode VERTEX_RESULT_FOGCOORD 0x03
216 .emtcode VERTEX_RESULT_POINTSIZE 0x04
217 .emtcode VERTEX_RESULT_TEXCOORD 0x05
218
219 /* texture target */
220 .emtcode TEXTARGET_1D 0x01
221 .emtcode TEXTARGET_2D 0x02
222 .emtcode TEXTARGET_3D 0x03
223 .emtcode TEXTARGET_RECT 0x04
224 .emtcode TEXTARGET_CUBE 0x05
225 /* GL_ARB_fragment_program_shadow */
226 .emtcode TEXTARGET_SHADOW1D 0x06
227 .emtcode TEXTARGET_SHADOW2D 0x07
228 .emtcode TEXTARGET_SHADOWRECT 0x08
229 /* GL_MESA_texture_array */
230 .emtcode TEXTARGET_1D_ARRAY 0x09
231 .emtcode TEXTARGET_2D_ARRAY 0x0a
232 .emtcode TEXTARGET_SHADOW1D_ARRAY 0x0b
233 .emtcode TEXTARGET_SHADOW2D_ARRAY 0x0c
234
235 /* face type */
236 .emtcode FACE_FRONT 0x00
237 .emtcode FACE_BACK 0x01
238
239 /* color type */
240 .emtcode COLOR_PRIMARY 0x00
241 .emtcode COLOR_SECONDARY 0x01
242
243 /* component */
244 .emtcode COMPONENT_X 0x00
245 .emtcode COMPONENT_Y 0x01
246 .emtcode COMPONENT_Z 0x02
247 .emtcode COMPONENT_W 0x03
248 .emtcode COMPONENT_0 0x04
249 .emtcode COMPONENT_1 0x05
250
251 /* array index type */
252 .emtcode ARRAY_INDEX_ABSOLUTE 0x00
253 .emtcode ARRAY_INDEX_RELATIVE 0x01
254
255 /* matrix name */
256 .emtcode MATRIX_MODELVIEW 0x01
257 .emtcode MATRIX_PROJECTION 0x02
258 .emtcode MATRIX_MVP 0x03
259 .emtcode MATRIX_TEXTURE 0x04
260 .emtcode MATRIX_PALETTE 0x05
261 .emtcode MATRIX_PROGRAM 0x06
262
263 /* matrix modifier */
264 .emtcode MATRIX_MODIFIER_IDENTITY 0x00
265 .emtcode MATRIX_MODIFIER_INVERSE 0x01
266 .emtcode MATRIX_MODIFIER_TRANSPOSE 0x02
267 .emtcode MATRIX_MODIFIER_INVTRANS 0x03
268
269 /* constant type */
270 .emtcode CONSTANT_SCALAR 0x01
271 .emtcode CONSTANT_VECTOR 0x02
272
273 /* program param type */
274 .emtcode PROGRAM_PARAM_ENV 0x01
275 .emtcode PROGRAM_PARAM_LOCAL 0x02
276
277 /* register type */
278 .emtcode REGISTER_ATTRIB 0x01
279 .emtcode REGISTER_PARAM 0x02
280 .emtcode REGISTER_RESULT 0x03
281 .emtcode REGISTER_ESTABLISHED_NAME 0x04
282
283 /* param binding */
284 .emtcode PARAM_NULL 0x00
285 .emtcode PARAM_ARRAY_ELEMENT 0x01
286 .emtcode PARAM_STATE_ELEMENT 0x02
287 .emtcode PARAM_PROGRAM_ELEMENT 0x03
288 .emtcode PARAM_PROGRAM_ELEMENTS 0x04
289 .emtcode PARAM_CONSTANT 0x05
290
291 /* param state property */
292 .emtcode STATE_MATERIAL 0x01
293 .emtcode STATE_LIGHT 0x02
294 .emtcode STATE_LIGHT_MODEL 0x03
295 .emtcode STATE_LIGHT_PROD 0x04
296 .emtcode STATE_FOG 0x05
297 .emtcode STATE_MATRIX_ROWS 0x06
298 /* GL_ARB_fragment_program */
299 .emtcode STATE_TEX_ENV 0x07
300 .emtcode STATE_DEPTH 0x08
301 /* GL_ARB_vertex_program */
302 .emtcode STATE_TEX_GEN 0x09
303 .emtcode STATE_CLIP_PLANE 0x0A
304 .emtcode STATE_POINT 0x0B
305
306 /* state material property */
307 .emtcode MATERIAL_AMBIENT 0x01
308 .emtcode MATERIAL_DIFFUSE 0x02
309 .emtcode MATERIAL_SPECULAR 0x03
310 .emtcode MATERIAL_EMISSION 0x04
311 .emtcode MATERIAL_SHININESS 0x05
312
313 /* state light property */
314 .emtcode LIGHT_AMBIENT 0x01
315 .emtcode LIGHT_DIFFUSE 0x02
316 .emtcode LIGHT_SPECULAR 0x03
317 .emtcode LIGHT_POSITION 0x04
318 .emtcode LIGHT_ATTENUATION 0x05
319 .emtcode LIGHT_HALF 0x06
320 .emtcode LIGHT_SPOT_DIRECTION 0x07
321
322 /* state light model property */
323 .emtcode LIGHT_MODEL_AMBIENT 0x01
324 .emtcode LIGHT_MODEL_SCENECOLOR 0x02
325
326 /* state light product property */
327 .emtcode LIGHT_PROD_AMBIENT 0x01
328 .emtcode LIGHT_PROD_DIFFUSE 0x02
329 .emtcode LIGHT_PROD_SPECULAR 0x03
330
331 /* state texture environment property */
332 .emtcode TEX_ENV_COLOR 0x01
333
334 /* state texture generation coord property */
335 .emtcode TEX_GEN_EYE 0x01
336 .emtcode TEX_GEN_OBJECT 0x02
337
338 /* state fog property */
339 .emtcode FOG_COLOR 0x01
340 .emtcode FOG_PARAMS 0x02
341
342 /* state depth property */
343 .emtcode DEPTH_RANGE 0x01
344
345 /* state point parameters property */
346 .emtcode POINT_SIZE 0x01
347 .emtcode POINT_ATTENUATION 0x02
348
349 /* declaration */
350 .emtcode ATTRIB 0x01
351 .emtcode PARAM 0x02
352 .emtcode TEMP 0x03
353 .emtcode OUTPUT 0x04
354 .emtcode ALIAS 0x05
355 /* GL_ARB_vertex_program */
356 .emtcode ADDRESS 0x06
357
358 /* error messages */
359 .errtext UNKNOWN_PROGRAM_SIGNATURE "1001: '$e_signature$': unknown program signature"
360 .errtext MISSING_END_OR_INVALID_STATEMENT "1002: '$e_statement$': invalid statement"
361 .errtext CODE_AFTER_END "1003: '$e_statement$': code after 'END' keyword"
362 .errtext INVALID_PROGRAM_OPTION "1004: '$e_identifier$': invalid program option"
363 .errtext EXT_SWIZ_COMP_EXPECTED "1005: extended swizzle component expected but '$e_token$' found"
364 .errtext TEX_TARGET_EXPECTED "1006: texture target expected but '$e_token$' found"
365 .errtext TEXTURE_EXPECTED "1007: 'texture' expected but '$e_identifier$' found"
366 .errtext SOURCE_REGISTER_EXPECTED "1008: source register expected but '$e_token$' found"
367 .errtext DESTINATION_REGISTER_EXPECTED "1009: destination register expected but '$e_token$' found"
368 .errtext INVALID_ADDRESS_COMPONENT "1010: '$e_identifier$': invalid address component"
369 .errtext INVALID_ADDRESS_WRITEMASK "1011: '$e_identifier$': invalid address writemask"
370 .errtext INVALID_COMPONENT "1012: '$e_charordigit$': invalid component"
371 .errtext INVALID_SUFFIX "1013: '$e_identifier$': invalid suffix"
372 .errtext INVALID_WRITEMASK "1014: '$e_identifier$': invalid writemask"
373 .errtext FRAGMENT_EXPECTED "1015: 'fragment' expected but '$e_identifier$' found"
374 .errtext VERTEX_EXPECTED "1016: 'vertex' expected but '$e_identifier$' found"
375 .errtext INVALID_FRAGMENT_PROPERTY "1017: '$e_identifier$': invalid fragment property"
376 .errtext INVALID_VERTEX_PROPERTY "1018: '$e_identifier$': invalid vertex property"
377 .errtext INVALID_STATE_PROPERTY "1019: '$e_identifier$': invalid state property"
378 .errtext INVALID_MATERIAL_PROPERTY "1020: '$e_identifier$': invalid material property"
379 .errtext INVALID_LIGHT_PROPERTY "1021: '$e_identifier$': invalid light property"
380 .errtext INVALID_SPOT_PROPERTY "1022: '$e_identifier$': invalid spot property"
381 .errtext INVALID_LIGHTMODEL_PROPERTY "1023: '$e_identifier$': invalid light model property"
382 .errtext INVALID_LIGHTPROD_PROPERTY "1024: '$e_identifier$': invalid light product property"
383 .errtext INVALID_TEXENV_PROPERTY "1025: '$e_identifier$': invalid texture environment property"
384 .errtext INVALID_TEXGEN_PROPERTY "1026: '$e_identifier$': invalid texture generating property"
385 .errtext INVALID_TEXGEN_COORD "1027: '$e_identifier$': invalid texture generating coord"
386 .errtext INVALID_FOG_PROPERTY "1028: '$e_identifier$': invalid fog property"
387 .errtext INVALID_DEPTH_PROPERTY "1029: '$e_identifier$': invalid depth property"
388 .errtext INVALID_CLIPPLANE_PROPERTY "1030: '$e_identifier$': invalid clip plane property"
389 .errtext INVALID_POINT_PROPERTY "1031: '$e_identifier$': invalid point property"
390 .errtext MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED "1032: matrix row selector or modifier expected but '$e_token$' found"
391 .errtext INVALID_MATRIX_NAME "1033: '$e_identifier$': invalid matrix name"
392 .errtext INVALID_PROGRAM_PROPERTY "1034: '$e_identifier$': invalid program property"
393 .errtext RESULT_EXPECTED "1035: 'result' expected but '$e_token$' found"
394 .errtext INVALID_RESULT_PROPERTY "1036: '$e_identifier$': invalid result property"
395 .errtext INVALID_FACE_PROPERTY "1037: '$e_identifier$': invalid face property"
396 .errtext INVALID_COLOR_PROPERTY "1038: '$e_identifier$': invalid color property"
397 .errtext IDENTIFIER_EXPECTED "1039: identifier expected but '$e_token$' found"
398 .errtext RESERVED_KEYWORD "1040: use of reserved keyword as an identifier"
399 .errtext INTEGER_EXPECTED "1041: integer value expected but '$e_token$' found"
400 .errtext MISSING_SEMICOLON "1042: ';' expected but '$e_token$' found"
401 .errtext MISSING_COMMA "1043: ',' expected but '$e_token$' found"
402 .errtext MISSING_LBRACKET "1044: '[' expected but '$e_token$' found"
403 .errtext MISSING_RBRACKET "1045: ']' expected but '$e_token$' found"
404 .errtext MISSING_DOT "1046: '.' expected but '$e_token$' found"
405 .errtext MISSING_EQUAL "1047: '=' expected but '$e_token$' found"
406 .errtext MISSING_LBRACE "1048: '{' expected but '$e_token$' found"
407 .errtext MISSING_RBRACE "1049: '}' expected but '$e_token$' found"
408 .errtext MISSING_DOTDOT "1050: '..' expected but '$e_token$' found"
409 .errtext MISSING_FRACTION_OR_EXPONENT "1051: missing fraction part or exponent"
410 .errtext MISSING_DOT_OR_EXPONENT "1052: missing '.' or exponent"
411 .errtext EXPONENT_VALUE_EXPECTED "1053: exponent value expected"
412 .errtext INTEGER_OUT_OF_RANGE "1054: integer value out of range"
413 .errtext OPERATION_NEEDS_DESTINATION_VARIABLE "1055: operation needs destination variable"
414 .errtext OPERATION_NEEDS_SOURCE_VARIABLE "1056: operation needs source variable"
415 .errtext ADDRESS_REGISTER_EXPECTED "1057: address register expected but '$e_token$' found"
416 .errtext ADDRESS_REGISTER_OR_INTEGER_EXPECTED "1058: address register or integer literal expected but '$e_token$' found"
417
418 /* extension presence condition registers */
419
420 /* GL_ARB_vertex_blend */
421 /* GL_EXT_vertex_weighting */
422 .regbyte vertex_blend 0x00
423
424 /* GL_ARB_matrix_palette */
425 .regbyte matrix_palette 0x00
426
427 /* GL_ARB_point_parameters */
428 /* GL_EXT_point_parameters */
429 .regbyte point_parameters 0x00
430
431 /* GL_EXT_secondary_color */
432 .regbyte secondary_color 0x00
433
434 /* GL_EXT_fog_coord */
435 .regbyte fog_coord 0x00
436
437 /* GL_EXT_texture_rectangle */
438 /* GL_NV_texture_rectangle */
439 .regbyte texture_rectangle 0x00
440
441 /* GL_ARB_fragment_program_shadow */
442 .regbyte fragment_program_shadow 0x00
443
444 /* GL_ARB_draw_buffers */
445 .regbyte draw_buffers 0x00
446
447 /* GL_MESA_texture_array */
448 .regbyte texture_array 0x00
449
450 /* option presence condition registers */
451 /* they are all initially set to zero - when a particular OPTION is encountered, the appropriate */
452 /* register is set to 1 to indicate that the OPTION was specified. */
453
454 /* GL_ARB_fragment_program */
455 .regbyte ARB_precision_hint_fastest 0x00
456 .regbyte ARB_precision_hint_nicest 0x00
457 .regbyte ARB_fog_exp 0x00
458 .regbyte ARB_fog_exp2 0x00
459 .regbyte ARB_fog_linear 0x00
460
461 /* GL_ARB_vertex_program */
462 .regbyte ARB_position_invariant 0x00
463
464 /* GL_ARB_fragment_program_shadow */
465 .regbyte ARB_fragment_program_shadow 0x00
466
467 /* GL_ARB_draw_buffers */
468 .regbyte ARB_draw_buffers 0x00
469
470 /* GL_MESA_texture_array */
471 .regbyte MESA_texture_array 0x00
472
473 /* program target condition register */
474 /* this syntax script deals with two program targets - VERTEX_PROGRAM and FRAGMENT_PROGRAM. */
475 /* to distinguish between them we need a register that will store for us the current target. */
476 /* the client will typically set the register to apropriate value before parsing a particular */
477 /* program. the mapping between program targets and their values is listed below. */
478 /* */
479 /* program target register value */
480 /* ---------------------------------------------- */
481 /* FRAGMENT_PROGRAM 0x10 */
482 /* VERTEX_PROGRAM 0x20 */
483 /* */
484 /* the initial value of the register is 0 to catch potential errors with not setting the register */
485 /* with the proper value. */
486 .regbyte program_target 0x00
487
488 /*
489 <program> ::= <optionSequence> <statementSequence> "END"
490 */
491 program
492 programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;
493 programs
494 .if (program_target == 0x10) frag_program_1_0 .emit FRAGMENT_PROGRAM .emit 0x01 .emit 0x00 .or
495 .if (program_target == 0x20) vert_program_1_0 .emit VERTEX_PROGRAM .emit 0x01 .emit 0x00;
496 frag_program_1_0
497 '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'f' .and 'p' .and '1' .and '.' .and '0' .and
498 optional_space .and fp_optionSequence .and fp_statementSequence .and
499 "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
500 '\0' .error CODE_AFTER_END;
501 vert_program_1_0
502 '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'v' .and 'p' .and '1' .and '.' .and '0' .and
503 optional_space .and vp_optionSequence .and vp_statementSequence .and
504 "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
505 '\0' .error CODE_AFTER_END;
506
507 /*
508 <optionSequence> ::= <optionSequence> <option>
509 | ""
510 */
511 fp_optionSequence
512 .loop fp_option;
513 vp_optionSequence
514 .loop vp_option;
515
516 /*
517 <option> ::= "OPTION" <identifier> ";"
518
519 NOTE: options ARB_precision_hint_nicest and ARB_precision_hint_fastest are exclusive. When one of
520 these options is encountered, the other one is automatically disabled.
521 the same applies to options ARB_fog_exp, ARB_fog_exp2 and ARB_fog_linear.
522 */
523 fp_option
524 "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
525 fp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
526 vp_option
527 "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
528 vp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
529 fp_optionString
530 .if (ARB_precision_hint_nicest == 0x00) "ARB_precision_hint_fastest"
531 .emit ARB_PRECISION_HINT_FASTEST .load ARB_precision_hint_fastest 0x01 .or
532 .if (ARB_precision_hint_fastest == 0x00) "ARB_precision_hint_nicest"
533 .emit ARB_PRECISION_HINT_NICEST .load ARB_precision_hint_nicest 0x01 .or
534 fp_ARB_fog_exp .emit ARB_FOG_EXP .load ARB_fog_exp 0x01 .or
535 fp_ARB_fog_exp2 .emit ARB_FOG_EXP2 .load ARB_fog_exp2 0x01 .or
536 fp_ARB_fog_linear .emit ARB_FOG_LINEAR .load ARB_fog_linear 0x01 .or
537 .if (fragment_program_shadow != 0x00) "ARB_fragment_program_shadow"
538 .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01 .or
539 .if (draw_buffers != 0x00) "ARB_draw_buffers" .emit ARB_DRAW_BUFFERS
540 .load ARB_draw_buffers 0x01 .or
541 .if (texture_array != 0x00) "MESA_texture_array" .emit MESA_TEXTURE_ARRAY
542 .load MESA_texture_array 0x01;
543 vp_optionString
544 "ARB_position_invariant" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;
545 fp_ARB_fog_exp
546 .if (ARB_fog_exp2 == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp";
547 fp_ARB_fog_exp2
548 .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp2";
549 fp_ARB_fog_linear
550 .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_exp2 == 0x00) "ARB_fog_linear";
551
552 /*
553 <statementSequence> ::= <statementSequence> <statement>
554 | ""
555 */
556 fp_statementSequence
557 .loop fp_statement;
558 vp_statementSequence
559 .loop vp_statement;
560
561 /*
562 <statement> ::= <instruction> ";"
563 | <namingStatement> ";"
564
565 NOTE: ".emit $" in the definitions below means that we output instruction position (offset of
566 the first character of instruction) for program debugging purposes.
567 */
568 fp_statement
569 fp_statement_1 .or fp_statement_2;
570 vp_statement
571 vp_statement_1 .or vp_statement_2;
572 fp_statement_1
573 fp_instruction .emit INSTRUCTION .emit $ .and semicolon;
574 fp_statement_2
575 fp_namingStatement .emit DECLARATION .and semicolon;
576 vp_statement_1
577 vp_instruction .emit INSTRUCTION .emit $ .and semicolon;
578 vp_statement_2
579 vp_namingStatement .emit DECLARATION .and semicolon;
580
581 /*
582 fragment program
583 <instruction> ::= <ALUInstruction>
584 | <TexInstruction>
585
586 vertex program
587 <instruction> ::= <ARL_instruction>
588 | <VECTORop_instruction>
589 | <SCALARop_instruction>
590 | <BINSCop_instruction>
591 | <BINop_instruction>
592 | <TRIop_instruction>
593 | <SWZ_instruction>
594 */
595 fp_instruction
596 ALUInstruction .emit OP_ALU_INST .or
597 TexInstruction .emit OP_TEX_INST;
598 vp_instruction
599 ARL_instruction .emit OP_ALU_ARL .or
600 vp_VECTORop_instruction .emit OP_ALU_VECTOR .or
601 vp_SCALARop_instruction .emit OP_ALU_SCALAR .or
602 vp_BINSCop_instruction .emit OP_ALU_BINSC .or
603 vp_BINop_instruction .emit OP_ALU_BIN .or
604 vp_TRIop_instruction .emit OP_ALU_TRI .or
605 vp_SWZ_instruction .emit OP_ALU_SWZ;
606
607 /*
608 fragment program
609 <ALUInstruction> ::= <VECTORop_instruction>
610 | <SCALARop_instruction>
611 | <BINSCop_instruction>
612 | <BINop_instruction>
613 | <TRIop_instruction>
614 | <SWZ_instruction>
615 */
616 ALUInstruction
617 fp_VECTORop_instruction .emit OP_ALU_VECTOR .or
618 fp_SCALARop_instruction .emit OP_ALU_SCALAR .or
619 fp_BINSCop_instruction .emit OP_ALU_BINSC .or
620 fp_BINop_instruction .emit OP_ALU_BIN .or
621 fp_TRIop_instruction .emit OP_ALU_TRI .or
622 fp_SWZ_instruction .emit OP_ALU_SWZ;
623
624 /*
625 fragment program
626 <TexInstruction> ::= <SAMPLE_instruction>
627 | <KIL_instruction>
628 */
629 TexInstruction
630 SAMPLE_instruction .emit OP_TEX_SAMPLE .or
631 KIL_instruction .emit OP_TEX_KIL;
632
633 /*
634 vertex program
635 <ARL_instruction> ::= "ARL" <maskedAddrReg> "," <scalarSrcReg>
636 */
637 ARL_instruction
638 "ARL" .emit OP_ARL .and space_dst .and maskedAddrReg .and comma .and vp_scalarSrcReg;
639
640 /*
641 fragment program
642 <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> ","
643 <vectorSrcReg>
644
645 vertex program
646 <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> "," <swizzleSrcReg>
647 */
648 fp_VECTORop_instruction
649 fp_VECTORop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg;
650 vp_VECTORop_instruction
651 vp_VECTORop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg;
652
653 /*
654 fragment program
655 <VECTORop> ::= "ABS" | "ABS_SAT"
656 | "FLR" | "FLR_SAT"
657 | "FRC" | "FRC_SAT"
658 | "LIT" | "LIT_SAT"
659 | "MOV" | "MOV_SAT"
660
661 vertex program
662 <VECTORop> ::= "ABS"
663 | "FLR"
664 | "FRC"
665 | "LIT"
666 | "MOV"
667 */
668 fp_VECTORop
669 "ABS" .emit OP_ABS .or "ABS_SAT" .emit OP_ABS_SAT .or
670 "FLR" .emit OP_FLR .or "FLR_SAT" .emit OP_FLR_SAT .or
671 "FRC" .emit OP_FRC .or "FRC_SAT" .emit OP_FRC_SAT .or
672 "LIT" .emit OP_LIT .or "LIT_SAT" .emit OP_LIT_SAT .or
673 "MOV" .emit OP_MOV .or "MOV_SAT" .emit OP_MOV_SAT;
674 vp_VECTORop
675 "ABS" .emit OP_ABS .or
676 "FLR" .emit OP_FLR .or
677 "FRC" .emit OP_FRC .or
678 "LIT" .emit OP_LIT .or
679 "MOV" .emit OP_MOV;
680
681 /*
682 <SCALARop_instruction> ::= <SCALARop> <maskedDstReg> "," <scalarSrcReg>
683 */
684 fp_SCALARop_instruction
685 fp_SCALARop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg;
686 vp_SCALARop_instruction
687 vp_SCALARop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg;
688
689 /*
690 fragment program
691 <SCALARop> ::= "COS" | "COS_SAT"
692 | "EX2" | "EX2_SAT"
693 | "LG2" | "LG2_SAT"
694 | "RCP" | "RCP_SAT"
695 | "RSQ" | "RSQ_SAT"
696 | "SIN" | "SIN_SAT"
697 | "SCS" | "SCS_SAT"
698
699 vertex program
700 <SCALARop> ::= "EX2"
701 | "EXP"
702 | "LG2"
703 | "LOG"
704 | "RCP"
705 | "RSQ"
706 */
707 fp_SCALARop
708 "COS" .emit OP_COS .or "COS_SAT" .emit OP_COS_SAT .or
709 "EX2" .emit OP_EX2 .or "EX2_SAT" .emit OP_EX2_SAT .or
710 "LG2" .emit OP_LG2 .or "LG2_SAT" .emit OP_LG2_SAT .or
711 "RCP" .emit OP_RCP .or "RCP_SAT" .emit OP_RCP_SAT .or
712 "RSQ" .emit OP_RSQ .or "RSQ_SAT" .emit OP_RSQ_SAT .or
713 "SIN" .emit OP_SIN .or "SIN_SAT" .emit OP_SIN_SAT .or
714 "SCS" .emit OP_SCS .or "SCS_SAT" .emit OP_SCS_SAT;
715 vp_SCALARop
716 "EX2" .emit OP_EX2 .or
717 "EXP" .emit OP_EXP .or
718 "LG2" .emit OP_LG2 .or
719 "LOG" .emit OP_LOG .or
720 "RCP" .emit OP_RCP .or
721 "RSQ" .emit OP_RSQ;
722
723 /*
724 <BINSCop_instruction> ::= <BINSCop> <maskedDstReg> "," <scalarSrcReg> ","
725 <scalarSrcReg>
726 */
727 fp_BINSCop_instruction
728 fp_BINSCop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg .and comma .and
729 fp_scalarSrcReg;
730 vp_BINSCop_instruction
731 vp_BINSCop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg .and comma .and
732 vp_scalarSrcReg;
733
734 /*
735 fragment program
736 <BINSCop> ::= "POW" | "POW_SAT"
737
738 vertex program
739 <BINSCop> ::= "POW"
740 */
741 fp_BINSCop
742 "POW" .emit OP_POW .or "POW_SAT" .emit OP_POW_SAT;
743 vp_BINSCop
744 "POW" .emit OP_POW;
745
746 /*
747 fragment program
748 <BINop_instruction> ::= <BINop> <maskedDstReg> ","
749 <vectorSrcReg> "," <vectorSrcReg>
750
751 vertex program
752 <BINop_instruction> ::= <BINop> <maskedDstReg> ","
753 <swizzleSrcReg> "," <swizzleSrcReg>
754 */
755 fp_BINop_instruction
756 fp_BINop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
757 vectorSrcReg;
758 vp_BINop_instruction
759 vp_BINop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
760 swizzleSrcReg;
761
762 /*
763 fragment program
764 <BINop> ::= "ADD" | "ADD_SAT"
765 | "DP3" | "DP3_SAT"
766 | "DP4" | "DP4_SAT"
767 | "DPH" | "DPH_SAT"
768 | "DST" | "DST_SAT"
769 | "MAX" | "MAX_SAT"
770 | "MIN" | "MIN_SAT"
771 | "MUL" | "MUL_SAT"
772 | "SGE" | "SGE_SAT"
773 | "SLT" | "SLT_SAT"
774 | "SUB" | "SUB_SAT"
775 | "XPD" | "XPD_SAT"
776
777 vertex program
778 <BINop> ::= "ADD"
779 | "DP3"
780 | "DP4"
781 | "DPH"
782 | "DST"
783 | "MAX"
784 | "MIN"
785 | "MUL"
786 | "SGE"
787 | "SLT"
788 | "SUB"
789 | "XPD"
790 */
791 fp_BINop
792 "ADD" .emit OP_ADD .or "ADD_SAT" .emit OP_ADD_SAT .or
793 "DP3" .emit OP_DP3 .or "DP3_SAT" .emit OP_DP3_SAT .or
794 "DP4" .emit OP_DP4 .or "DP4_SAT" .emit OP_DP4_SAT .or
795 "DPH" .emit OP_DPH .or "DPH_SAT" .emit OP_DPH_SAT .or
796 "DST" .emit OP_DST .or "DST_SAT" .emit OP_DST_SAT .or
797 "MAX" .emit OP_MAX .or "MAX_SAT" .emit OP_MAX_SAT .or
798 "MIN" .emit OP_MIN .or "MIN_SAT" .emit OP_MIN_SAT .or
799 "MUL" .emit OP_MUL .or "MUL_SAT" .emit OP_MUL_SAT .or
800 "SGE" .emit OP_SGE .or "SGE_SAT" .emit OP_SGE_SAT .or
801 "SLT" .emit OP_SLT .or "SLT_SAT" .emit OP_SLT_SAT .or
802 "SUB" .emit OP_SUB .or "SUB_SAT" .emit OP_SUB_SAT .or
803 "XPD" .emit OP_XPD .or "XPD_SAT" .emit OP_XPD_SAT;
804 vp_BINop
805 "ADD" .emit OP_ADD .or
806 "DP3" .emit OP_DP3 .or
807 "DP4" .emit OP_DP4 .or
808 "DPH" .emit OP_DPH .or
809 "DST" .emit OP_DST .or
810 "MAX" .emit OP_MAX .or
811 "MIN" .emit OP_MIN .or
812 "MUL" .emit OP_MUL .or
813 "SGE" .emit OP_SGE .or
814 "SLT" .emit OP_SLT .or
815 "SUB" .emit OP_SUB .or
816 "XPD" .emit OP_XPD;
817
818 /*
819 fragment program
820 <TRIop_instruction> ::= <TRIop> <maskedDstReg> ","
821 <vectorSrcReg> "," <vectorSrcReg> ","
822 <vectorSrcReg>
823
824 vertex program
825 <TRIop_instruction> ::= <TRIop> <maskedDstReg> ","
826 <swizzleSrcReg> "," <swizzleSrcReg> ","
827 <swizzleSrcReg>
828 */
829 fp_TRIop_instruction
830 fp_TRIop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
831 vectorSrcReg .and comma .and vectorSrcReg;
832 vp_TRIop_instruction
833 vp_TRIop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
834 swizzleSrcReg .and comma .and swizzleSrcReg;
835
836 /*
837 fragment program
838 <TRIop> ::= "CMP" | "CMP_SAT"
839 | "LRP" | "LRP_SAT"
840 | "MAD" | "MAD_SAT"
841
842 vertex program
843 <TRIop> ::= "MAD"
844 */
845 fp_TRIop
846 "CMP" .emit OP_CMP .or "CMP_SAT" .emit OP_CMP_SAT .or
847 "LRP" .emit OP_LRP .or "LRP_SAT" .emit OP_LRP_SAT .or
848 "MAD" .emit OP_MAD .or "MAD_SAT" .emit OP_MAD_SAT;
849 vp_TRIop
850 "MAD" .emit OP_MAD;
851
852 /*
853 fragment program
854 <SWZ_instruction> ::= <SWZop> <maskedDstReg> ","
855 <srcReg> "," <extendedSwizzle>
856
857 vertex program
858 <SWZ_instruction> ::= "SWZ" <maskedDstReg> "," <srcReg> ","
859 <extendedSwizzle>
860 */
861 fp_SWZ_instruction
862 SWZop .and space_dst .and fp_maskedDstReg .and comma .and fp_srcReg .and comma .and
863 fp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;
864 vp_SWZ_instruction
865 "SWZ" .emit OP_SWZ .and space_dst .and vp_maskedDstReg .and comma .and vp_srcReg .and comma .and
866 vp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;
867
868 /*
869 fragment program
870 <SWZop> ::= "SWZ" | "SWZ_SAT"
871 */
872 SWZop
873 "SWZ" .emit OP_SWZ .or "SWZ_SAT" .emit OP_SWZ_SAT;
874
875 /*
876 fragment program
877 <SAMPLE_instruction> ::= <SAMPLEop> <maskedDstReg> ","
878 <vectorSrcReg> "," <texImageUnit> ","
879 <texTarget>
880 */
881 SAMPLE_instruction
882 SAMPLEop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
883 texImageUnit .and comma .and texTarget .error TEX_TARGET_EXPECTED;
884
885 /*
886 fragment program
887 <SAMPLEop> ::= "TEX" | "TEX_SAT"
888 | "TXP" | "TXP_SAT"
889 | "TXB" | "TXB_SAT"
890 */
891 SAMPLEop
892 "TEX" .emit OP_TEX .or "TEX_SAT" .emit OP_TEX_SAT .or
893 "TXB" .emit OP_TXB .or "TXB_SAT" .emit OP_TXB_SAT .or
894 "TXP" .emit OP_TXP .or "TXP_SAT" .emit OP_TXP_SAT;
895
896 /*
897 fragment program
898 <KIL_instruction> ::= "KIL" <vectorSrcReg>
899 */
900 KIL_instruction
901 "KIL" .emit OP_KIL .and space_src .and vectorSrcReg;
902
903 /*
904 fragment program
905 <texImageUnit> ::= "texture" <optTexImageUnitNum>
906 */
907 texImageUnit
908 "texture" .error TEXTURE_EXPECTED .and optTexImageUnitNum;
909
910 /*
911 fragment program
912 <texTarget> ::= "1D"
913 | "2D"
914 | "3D"
915 | "CUBE"
916 | "RECT"
917 | <shadowTarget> (if option ARB_fragment_program_shadow present)
918 | <arrayTarget> (if option MESA_texture_array present)
919 */
920 texTarget
921 "1D" .emit TEXTARGET_1D .or
922 "2D" .emit TEXTARGET_2D .or
923 "3D" .emit TEXTARGET_3D .or
924 .if (texture_rectangle != 0x00) "RECT" .emit TEXTARGET_RECT .or
925 "CUBE" .emit TEXTARGET_CUBE .or
926 .if (ARB_fragment_program_shadow != 0x00) shadowTarget .or
927 .if (MESA_texture_array != 0x00) arrayTarget;
928
929 /*
930 GL_ARB_fragment_program_shadow
931 <shadowTarget> ::= "SHADOW1D"
932 | "SHADOW2D"
933 | "SHADOWRECT"
934 | <shadowArrayTarget> (if option MESA_texture_array present)
935 */
936 shadowTarget
937 "SHADOW1D" .emit TEXTARGET_SHADOW1D .or
938 "SHADOW2D" .emit TEXTARGET_SHADOW2D .or
939 .if (texture_rectangle != 0x00) "SHADOWRECT" .emit TEXTARGET_SHADOWRECT .or
940 .if (MESA_texture_array != 0x00) shadowArrayTarget;
941
942 /*
943 GL_MESA_texture_array
944
945 <arrayTarget> ::= "ARRAY1D"
946 | "ARRAY2D"
947
948 <shadowArrayTarget> ::= "SHADOWARRAY1D"
949 | "SHADOWARRAY2D"
950 */
951
952 arrayTarget
953 "ARRAY1D" .emit TEXTARGET_1D_ARRAY .or
954 "ARRAY2D" .emit TEXTARGET_2D_ARRAY;
955
956 shadowArrayTarget
957 "SHADOWARRAY1D" .emit TEXTARGET_SHADOW1D_ARRAY .or
958 "SHADOWARRAY2D" .emit TEXTARGET_SHADOW2D_ARRAY;
959
960 /*
961 fragment program
962 <optTexImageUnitNum> ::= ""
963 | "[" <texImageUnitNum> "]"
964 */
965 optTexImageUnitNum
966 optTexImageUnitNum_1 .or .true .emit 0x00;
967 optTexImageUnitNum_1
968 lbracket_ne .and texImageUnitNum .and rbracket;
969
970 /*
971 fragment program
972 <texImageUnitNum> ::= <integer> from 0 to
973 MAX_TEXTURE_IMAGE_UNITS_ARB-1
974 */
975 texImageUnitNum
976 integer;
977
978 /*
979 <scalarSrcReg> ::= <optionalSign> <srcReg> <scalarSuffix>
980 */
981 fp_scalarSrcReg
982 optionalSign .and fp_srcReg .and fp_scalarSuffix;
983 vp_scalarSrcReg
984 optionalSign .and vp_srcReg .and vp_scalarSuffix;
985
986 /*
987 vertex program
988 <swizzleSrcReg> ::= <optionalSign> <srcReg> <swizzleSuffix>
989 */
990 swizzleSrcReg
991 optionalSign .and vp_srcReg .and swizzleSuffix;
992
993 /*
994 fragment program
995 <vectorSrcReg> ::= <optionalSign> <srcReg> <optionalSuffix>
996 */
997 vectorSrcReg
998 optionalSign .and fp_srcReg .and optionalSuffix;
999
1000 /*
1001 <maskedDstReg> ::= <dstReg> <optionalMask>
1002 */
1003 fp_maskedDstReg
1004 fp_dstReg .and fp_optionalMask;
1005 vp_maskedDstReg
1006 vp_dstReg .and vp_optionalMask;
1007
1008 /*
1009 vertex program
1010 <maskedAddrReg> ::= <addrReg> <addrWriteMask>
1011 */
1012 maskedAddrReg
1013 addrReg .error ADDRESS_REGISTER_EXPECTED .and addrWriteMask;
1014
1015 /*
1016 fragment program
1017 <extendedSwizzle> ::= <xyzwExtendedSwizzle>
1018 | <rgbaExtendedSwizzle>
1019
1020 vertex program
1021 <extendedSwizzle> ::= <extSwizComp> "," <extSwizComp> ","
1022 <extSwizComp> "," <extSwizComp>
1023
1024 NOTE: do NOT change the order of <rgbaExtendedSwizzle> and <xyzwExtendedSwizzle> rulez
1025 */
1026 fp_extendedSwizzle
1027 rgbaExtendedSwizzle .or xyzwExtendedSwizzle;
1028 vp_extendedSwizzle
1029 extSwizComp .and comma .and
1030 extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
1031 extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
1032 extSwizComp .error EXT_SWIZ_COMP_EXPECTED;
1033
1034 /*
1035 fragment program
1036 <xyzwExtendedSwizzle> ::= <xyzwExtSwizComp> "," <xyzwExtSwizComp> ","
1037 <xyzwExtSwizComp> "," <xyzwExtSwizComp>
1038 */
1039 xyzwExtendedSwizzle
1040 xyzwExtSwizComp .and comma .and
1041 xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
1042 xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
1043 xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
1044
1045 /*
1046 fragment program
1047 <rgbaExtendedSwizzle> ::= <rgbaExtSwizComp> "," <rgbaExtSwizComp> ","
1048 <rgbaExtSwizComp> "," <rgbaExtSwizComp>
1049 */
1050 rgbaExtendedSwizzle
1051 rgbaExtendedSwizzle_1 .or rgbaExtendedSwizzle_2 .or rgbaExtendedSwizzle_3 .or
1052 rgbaExtendedSwizzle_4;
1053 rgbaExtendedSwizzle_1
1054 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and
1055 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp;
1056 rgbaExtendedSwizzle_2
1057 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and
1058 rgbaExtSwizComp_alpha .and comma .and rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
1059 rgbaExtendedSwizzle_3
1060 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_alpha .and comma .and
1061 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
1062 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
1063 rgbaExtendedSwizzle_4
1064 rgbaExtSwizComp_alpha .and comma .and
1065 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
1066 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
1067 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
1068
1069 /*
1070 fragment program
1071 <xyzwExtSwizComp> ::= <optionalSign> <xyzwExtSwizSel>
1072 */
1073 xyzwExtSwizComp
1074 optionalSign .and xyzwExtSwizSel;
1075
1076 /*
1077 fragment program
1078 <rgbaExtSwizComp> ::= <optionalSign> <rgbaExtSwizSel>
1079 */
1080 rgbaExtSwizComp
1081 optionalSign .and rgbaExtSwizSel;
1082 rgbaExtSwizComp_digit
1083 optionalSign .and rgbaExtSwizSel_digit;
1084 rgbaExtSwizComp_alpha
1085 optionalSign .and rgbaExtSwizSel_alpha;
1086
1087 /*
1088 vertex program
1089 <extSwizComp> ::= <optionalSign> <extSwizSel>
1090 */
1091 extSwizComp
1092 optionalSign .and extSwizSel;
1093
1094 /*
1095 fragment program
1096 <xyzwExtSwizSel> ::= "0"
1097 | "1"
1098 | <xyzwComponent>
1099 */
1100 xyzwExtSwizSel
1101 "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or xyzwComponent_single;
1102
1103 /*
1104 fragment program
1105 <rgbaExtSwizSel> ::= "0"
1106 | "1"
1107 | <rgbaComponent>
1108 */
1109 rgbaExtSwizSel
1110 rgbaExtSwizSel_digit .or rgbaExtSwizSel_alpha;
1111 rgbaExtSwizSel_digit
1112 "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1;
1113 rgbaExtSwizSel_alpha
1114 rgbaComponent_single;
1115
1116 /*
1117 vertex program
1118 <extSwizSel> ::= "0"
1119 | "1"
1120 | <component>
1121 */
1122 extSwizSel
1123 "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or vp_component_single;
1124
1125 /*
1126 fragment program
1127 <srcReg> ::= <fragmentAttribReg>
1128 | <temporaryReg>
1129 | <progParamReg>
1130
1131 vertex program
1132 <srcReg> ::= <vertexAttribReg>
1133 | <temporaryReg>
1134 | <progParamReg>
1135 */
1136 fp_srcReg
1137 fp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;
1138 vp_srcReg
1139 vp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;
1140 fp_srcReg_1
1141 fragmentAttribReg .emit REGISTER_ATTRIB .or
1142 fp_progParamReg .emit REGISTER_PARAM .or
1143 fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1144 vp_srcReg_1
1145 vertexAttribReg .emit REGISTER_ATTRIB .or
1146 vp_progParamReg .emit REGISTER_PARAM .or
1147 vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1148
1149 /*
1150 fragment program
1151 <dstReg> ::= <temporaryReg>
1152 | <fragmentResultReg>
1153
1154 vertex program
1155 <dstReg> ::= <temporaryReg>
1156 | <vertexResultReg>
1157 */
1158 fp_dstReg
1159 fp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;
1160 vp_dstReg
1161 vp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;
1162 fp_dstReg_1
1163 fragmentResultReg .emit REGISTER_RESULT .or
1164 fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1165 vp_dstReg_1
1166 vertexResultReg .emit REGISTER_RESULT .or
1167 vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1168
1169 /*
1170 fragment program
1171 <fragmentAttribReg> ::= <establishedName>
1172 | <fragAttribBinding>
1173
1174 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
1175 */
1176 fragmentAttribReg
1177 /*fp_establishedName .or */fragAttribBinding;
1178
1179 /*
1180 vertex program
1181 <vertexAttribReg> ::= <establishedName>
1182 | <vtxAttribBinding>
1183
1184 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
1185 */
1186 vertexAttribReg
1187 vtxAttribBinding;
1188
1189 /*
1190 <temporaryReg> ::= <establishedName>
1191 */
1192 fp_temporaryReg
1193 fp_establishedName_no_error_on_identifier;
1194 vp_temporaryReg
1195 vp_establishedName_no_error_on_identifier;
1196
1197 /*
1198 fragment program
1199 <progParamReg> ::= <progParamSingle>
1200 | <progParamArray> "[" <progParamArrayAbs> "]"
1201 | <paramSingleItemUse>
1202
1203 vertex program
1204 <progParamReg> ::= <progParamSingle>
1205 | <progParamArray> "[" <progParamArrayMem> "]"
1206 | <paramSingleItemUse>
1207 */
1208 fp_progParamReg
1209 fp_paramSingleItemUse .or fp_progParamReg_1 .or fp_progParamSingle;
1210 vp_progParamReg
1211 vp_paramSingleItemUse .or vp_progParamReg_1 .or vp_progParamSingle;
1212 fp_progParamReg_1
1213 fp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayAbs .and
1214 rbracket;
1215 vp_progParamReg_1
1216 vp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayMem .and
1217 rbracket;
1218
1219 /*
1220 <progParamSingle> ::= <establishedName>
1221
1222 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
1223 */
1224 fp_progParamSingle
1225 .false;
1226 vp_progParamSingle
1227 .false;
1228
1229 /*
1230 <progParamArray> ::= <establishedName>
1231 */
1232 fp_progParamArray
1233 fp_establishedName_no_error_on_identifier;
1234 vp_progParamArray
1235 vp_establishedName_no_error_on_identifier;
1236
1237 /*
1238 vertex program
1239 <progParamArrayMem> ::= <progParamArrayAbs>
1240 | <progParamArrayRel>
1241 */
1242 progParamArrayMem
1243 progParamArrayAbs .or progParamArrayRel;
1244
1245 /*
1246 <progParamArrayAbs> ::= <integer>
1247 */
1248 progParamArrayAbs
1249 integer_ne .emit ARRAY_INDEX_ABSOLUTE;
1250
1251 /*
1252 vertex program
1253 <progParamArrayRel> ::= <addrReg> <addrComponent> <addrRegRelOffset>
1254 */
1255 progParamArrayRel
1256 addrReg .error ADDRESS_REGISTER_OR_INTEGER_EXPECTED .emit ARRAY_INDEX_RELATIVE .and
1257 addrComponent .and addrRegRelOffset;
1258
1259 /*
1260 vertex program
1261 <addrRegRelOffset> ::= ""
1262 | "+" <addrRegPosOffset>
1263 | "-" <addrRegNegOffset>
1264 */
1265 addrRegRelOffset
1266 addrRegRelOffset_1 .or addrRegRelOffset_2 .or .true .emit 0x00;
1267 addrRegRelOffset_1
1268 plus_ne .and addrRegPosOffset;
1269 addrRegRelOffset_2
1270 minus_ne .and addrRegNegOffset;
1271
1272 /*
1273 vertex program
1274 <addrRegPosOffset> ::= <integer> from 0 to 63
1275 */
1276 addrRegPosOffset
1277 integer_0_63;
1278
1279 /*
1280 vertex program
1281 <addrRegNegOffset> ::= <integer> from 0 to 64
1282 */
1283 addrRegNegOffset
1284 integer_0_64;
1285
1286 /*
1287 fragment program
1288 <fragmentResultReg> ::= <establishedName>
1289 | <resultBinding>
1290
1291 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg>
1292 */
1293 fragmentResultReg
1294 fp_resultBinding;
1295
1296 /*
1297 vertex program
1298 <vertexResultReg> ::= <establishedName>
1299 | <resultBinding>
1300
1301 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg>
1302 */
1303 vertexResultReg
1304 vp_resultBinding;
1305
1306 /*
1307 vertex program
1308 <addrReg> ::= <establishedName>
1309 */
1310 addrReg
1311 vp_establishedName_no_error_on_identifier;
1312
1313 /*
1314 vertex program
1315 <addrComponent> ::= "." "x"
1316 */
1317 addrComponent
1318 dot .and "x" .error INVALID_ADDRESS_COMPONENT .emit COMPONENT_X .emit COMPONENT_X
1319 .emit COMPONENT_X .emit COMPONENT_X;
1320
1321 /*
1322 vertex program
1323 <addrWriteMask> ::= "." "x"
1324 */
1325 addrWriteMask
1326 dot .and "x" .error INVALID_ADDRESS_WRITEMASK .emit 0x08;
1327
1328 /*
1329 <scalarSuffix> ::= "." <component>
1330 */
1331 fp_scalarSuffix
1332 dot .and fp_component_single .error INVALID_COMPONENT;
1333 vp_scalarSuffix
1334 dot .and vp_component_single .error INVALID_COMPONENT;
1335
1336 /*
1337 vertex program
1338 <swizzleSuffix> ::= ""
1339 | "." <component>
1340 | "." <component> <component>
1341 <component> <component>
1342 */
1343 swizzleSuffix
1344 swizzleSuffix_1 .or
1345 .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;
1346 swizzleSuffix_1
1347 dot_ne .and swizzleSuffix_2 .error INVALID_SUFFIX;
1348 swizzleSuffix_2
1349 swizzleSuffix_3 .or swizzleSuffix_4;
1350 swizzleSuffix_3
1351 vp_component_multi .and vp_component_multi .and vp_component_multi .error INVALID_COMPONENT .and
1352 vp_component_multi .error INVALID_COMPONENT;
1353 swizzleSuffix_4
1354 "x" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
1355 "y" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
1356 "z" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
1357 "w" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;
1358
1359 /*
1360 fragment program
1361 <optionalSuffix> ::= ""
1362 | "." <component>
1363 | "." <xyzwComponent> <xyzwComponent>
1364 <xyzwComponent> <xyzwComponent>
1365 | "." <rgbaComponent> <rgbaComponent>
1366 <rgbaComponent> <rgbaComponent>
1367 */
1368 optionalSuffix
1369 optionalSuffix_1 .or
1370 .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;
1371 optionalSuffix_1
1372 dot_ne .and optionalSuffix_2 .error INVALID_SUFFIX;
1373 optionalSuffix_2
1374 optionalSuffix_3 .or optionalSuffix_4 .or optionalSuffix_5;
1375 optionalSuffix_3
1376 xyzwComponent_multi .and xyzwComponent_multi .and
1377 xyzwComponent_multi .error INVALID_COMPONENT .and xyzwComponent_multi .error INVALID_COMPONENT;
1378 optionalSuffix_4
1379 rgbaComponent_multi .and rgbaComponent_multi .and
1380 rgbaComponent_multi .error INVALID_COMPONENT .and rgbaComponent_multi .error INVALID_COMPONENT;
1381 optionalSuffix_5
1382 "x" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
1383 "y" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
1384 "z" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
1385 "w" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .or
1386 "r" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
1387 "g" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
1388 "b" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
1389 "a" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;
1390
1391 /*
1392 fragment program
1393 <component> ::= <xyzwComponent>
1394 | <rgbaComponent>
1395
1396 vertex program
1397 <component> ::= "x"
1398 | "y"
1399 | "z"
1400 | "w"
1401 */
1402 fp_component_single
1403 xyzwComponent_single .or rgbaComponent_single;
1404 vp_component_multi
1405 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or
1406 'w' .emit COMPONENT_W;
1407 vp_component_single
1408 "x" .emit COMPONENT_X .or "y" .emit COMPONENT_Y .or "z" .emit COMPONENT_Z .or
1409 "w" .emit COMPONENT_W;
1410
1411 /*
1412 fragment program
1413 <xyzwComponent> ::= "x" | "y" | "z" | "w"
1414 */
1415 xyzwComponent_multi
1416 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or
1417 'w' .emit COMPONENT_W;
1418 xyzwComponent_single
1419 "x" .emit COMPONENT_X .or "y" .emit COMPONENT_Y .or "z" .emit COMPONENT_Z .or
1420 "w" .emit COMPONENT_W;
1421
1422 /*
1423 fragment program
1424 <rgbaComponent> ::= "r" | "g" | "b" | "a"
1425 */
1426 rgbaComponent_multi
1427 'r' .emit COMPONENT_X .or 'g' .emit COMPONENT_Y .or 'b' .emit COMPONENT_Z .or
1428 'a' .emit COMPONENT_W;
1429 rgbaComponent_single
1430 "r" .emit COMPONENT_X .or "g" .emit COMPONENT_Y .or "b" .emit COMPONENT_Z .or
1431 "a" .emit COMPONENT_W;
1432
1433 /*
1434 fragment program
1435 <optionalMask> ::= ""
1436 | <xyzwMask>
1437 | <rgbaMask>
1438
1439 vertex program
1440 <optionalMask> ::= ""
1441 | "." "x"
1442 | "." "y"
1443 | "." "xy"
1444 | "." "z"
1445 | "." "xz"
1446 | "." "yz"
1447 | "." "xyz"
1448 | "." "w"
1449 | "." "xw"
1450 | "." "yw"
1451 | "." "xyw"
1452 | "." "zw"
1453 | "." "xzw"
1454 | "." "yzw"
1455 | "." "xyzw"
1456
1457 NOTE: do NOT change the order of <rgbaMask> and <xyzwMask> rulez
1458 */
1459 fp_optionalMask
1460 rgbaMask .or xyzwMask .or .true .emit 0x0F;
1461 vp_optionalMask
1462 xyzwMask .or .true .emit 0x0F;
1463
1464 /*
1465 fragment program
1466 <xyzwMask> ::= "." "x"
1467 | "." "y"
1468 | "." "xy"
1469 | "." "z"
1470 | "." "xz"
1471 | "." "yz"
1472 | "." "xyz"
1473 | "." "w"
1474 | "." "xw"
1475 | "." "yw"
1476 | "." "xyw"
1477 | "." "zw"
1478 | "." "xzw"
1479 | "." "yzw"
1480 | "." "xyzw"
1481
1482 NOTE: <xyzwMask> is also referenced by the vertex program symbol <optionalMask>.
1483 */
1484 xyzwMask
1485 dot_ne .and xyzwMask_1 .error INVALID_WRITEMASK;
1486 xyzwMask_1
1487 "xyzw" .emit 0x0F .or "xyz" .emit 0x0E .or "xyw" .emit 0x0D .or "xy" .emit 0x0C .or
1488 "xzw" .emit 0x0B .or "xz" .emit 0x0A .or "xw" .emit 0x09 .or "x" .emit 0x08 .or
1489 "yzw" .emit 0x07 .or "yz" .emit 0x06 .or "yw" .emit 0x05 .or "y" .emit 0x04 .or
1490 "zw" .emit 0x03 .or "z" .emit 0x02 .or "w" .emit 0x01;
1491
1492 /*
1493 fragment program
1494 <rgbaMask> ::= "." "r"
1495 | "." "g"
1496 | "." "rg"
1497 | "." "b"
1498 | "." "rb"
1499 | "." "gb"
1500 | "." "rgb"
1501 | "." "a"
1502 | "." "ra"
1503 | "." "ga"
1504 | "." "rga"
1505 | "." "ba"
1506 | "." "rba"
1507 | "." "gba"
1508 | "." "rgba"
1509 */
1510 rgbaMask
1511 dot_ne .and rgbaMask_1;
1512 rgbaMask_1
1513 "rgba" .emit 0x0F .or "rgb" .emit 0x0E .or "rga" .emit 0x0D .or "rg" .emit 0x0C .or
1514 "rba" .emit 0x0B .or "rb" .emit 0x0A .or "ra" .emit 0x09 .or "r" .emit 0x08 .or
1515 "gba" .emit 0x07 .or "gb" .emit 0x06 .or "ga" .emit 0x05 .or "g" .emit 0x04 .or
1516 "ba" .emit 0x03 .or "b" .emit 0x02 .or "a" .emit 0x01;
1517
1518 /*
1519 fragment program
1520 <namingStatement> ::= <ATTRIB_statement>
1521 | <PARAM_statement>
1522 | <TEMP_statement>
1523 | <OUTPUT_statement>
1524 | <ALIAS_statement>
1525
1526 vertex program
1527 <namingStatement> ::= <ATTRIB_statement>
1528 | <PARAM_statement>
1529 | <TEMP_statement>
1530 | <ADDRESS_statement>
1531 | <OUTPUT_statement>
1532 | <ALIAS_statement>
1533 */
1534 fp_namingStatement
1535 fp_ATTRIB_statement .emit ATTRIB .or
1536 fp_PARAM_statement .emit PARAM .or
1537 fp_TEMP_statement .emit TEMP .or
1538 fp_OUTPUT_statement .emit OUTPUT .or
1539 fp_ALIAS_statement .emit ALIAS;
1540 vp_namingStatement
1541 vp_ATTRIB_statement .emit ATTRIB .or
1542 vp_PARAM_statement .emit PARAM .or
1543 vp_TEMP_statement .emit TEMP .or
1544 ADDRESS_statement .emit ADDRESS .or
1545 vp_OUTPUT_statement .emit OUTPUT .or
1546 vp_ALIAS_statement .emit ALIAS;
1547
1548 /*
1549 fragment program
1550 <ATTRIB_statement> ::= "ATTRIB" <establishName> "="
1551 <fragAttribBinding>
1552
1553 vertex program
1554 <ATTRIB_statement> ::= "ATTRIB" <establishName> "="
1555 <vtxAttribBinding>
1556 */
1557 fp_ATTRIB_statement
1558 "ATTRIB" .and space .and fp_establishName .and equal .and
1559 fragAttribBinding .error FRAGMENT_EXPECTED;
1560 vp_ATTRIB_statement
1561 "ATTRIB" .and space .and vp_establishName .and equal .and
1562 vtxAttribBinding .error VERTEX_EXPECTED;
1563
1564 /*
1565 fragment program
1566 <fragAttribBinding> ::= "fragment" "." <fragAttribItem>
1567 */
1568 fragAttribBinding
1569 "fragment" .and dot .and fragAttribItem .error INVALID_FRAGMENT_PROPERTY;
1570
1571 /*
1572 vertex program
1573 <vtxAttribBinding> ::= "vertex" "." <vtxAttribItem>
1574 */
1575 vtxAttribBinding
1576 "vertex" .and dot .and vtxAttribItem .error INVALID_VERTEX_PROPERTY;
1577
1578 /*
1579 fragment program
1580 <fragAttribItem> ::= "color" <optColorType>
1581 | "texcoord" <optTexCoordNum>
1582 | "fogcoord"
1583 | "position"
1584 */
1585 fragAttribItem
1586 fragAttribItem_1 .emit FRAGMENT_ATTRIB_COLOR .or
1587 fragAttribItem_2 .emit FRAGMENT_ATTRIB_TEXCOORD .or
1588 .if (fog_coord != 0x00) "fogcoord" .emit FRAGMENT_ATTRIB_FOGCOORD .or
1589 "position" .emit FRAGMENT_ATTRIB_POSITION;
1590 fragAttribItem_1
1591 "color" .and optColorType;
1592 fragAttribItem_2
1593 "texcoord" .and optTexCoordNum;
1594
1595 /*
1596 vertex program
1597 <vtxAttribItem> ::= "position"
1598 | "weight" <vtxOptWeightNum>
1599 | "normal"
1600 | "color" <optColorType>
1601 | "fogcoord"
1602 | "texcoord" <optTexCoordNum>
1603 | "matrixindex" "[" <vtxWeightNum> "]"
1604 | "attrib" "[" <vtxAttribNum> "]"
1605 */
1606 vtxAttribItem
1607 "position" .emit VERTEX_ATTRIB_POSITION .or
1608 .if (vertex_blend != 0x00) vtxAttribItem_1 .emit VERTEX_ATTRIB_WEIGHT .or
1609 "normal" .emit VERTEX_ATTRIB_NORMAL .or
1610 vtxAttribItem_2 .emit VERTEX_ATTRIB_COLOR .or
1611 "fogcoord" .emit VERTEX_ATTRIB_FOGCOORD .or
1612 vtxAttribItem_3 .emit VERTEX_ATTRIB_TEXCOORD .or
1613 .if (matrix_palette != 0x00) vtxAttribItem_4 .emit VERTEX_ATTRIB_MATRIXINDEX .or
1614 vtxAttribItem_5 .emit VERTEX_ATTRIB_GENERIC;
1615 vtxAttribItem_1
1616 "weight" .and vtxOptWeightNum;
1617 vtxAttribItem_2
1618 "color" .and optColorType;
1619 vtxAttribItem_3
1620 "texcoord" .and optTexCoordNum;
1621 vtxAttribItem_4
1622 "matrixindex" .and lbracket .and vtxWeightNum .and rbracket;
1623 vtxAttribItem_5
1624 "attrib" .and lbracket .and vtxAttribNum .and rbracket;
1625
1626 /*
1627 vertex program
1628 <vtxAttribNum> ::= <integer> from 0 to MAX_VERTEX_ATTRIBS_ARB-1
1629 */
1630 vtxAttribNum
1631 integer;
1632
1633 /*
1634 vertex program
1635 <vtxOptWeightNum> ::= ""
1636 | "[" <vtxWeightNum> "]"
1637 */
1638 vtxOptWeightNum
1639 vtxOptWeightNum_1 .or .true .emit 0x00;
1640 vtxOptWeightNum_1
1641 lbracket_ne .and vtxWeightNum .and rbracket;
1642
1643 /*
1644 vertex program
1645 <vtxWeightNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1,
1646 must be divisible by four
1647 */
1648 vtxWeightNum
1649 integer;
1650
1651 /*
1652 <PARAM_statement> ::= <PARAM_singleStmt>
1653 | <PARAM_multipleStmt>
1654 */
1655 fp_PARAM_statement
1656 fp_PARAM_multipleStmt .or fp_PARAM_singleStmt;
1657 vp_PARAM_statement
1658 vp_PARAM_multipleStmt .or vp_PARAM_singleStmt;
1659
1660 /*
1661 <PARAM_singleStmt> ::= "PARAM" <establishName> <paramSingleInit>
1662 */
1663 fp_PARAM_singleStmt
1664 "PARAM" .and space .and fp_establishName .and .true .emit 0x00 .and fp_paramSingleInit .and
1665 .true .emit PARAM_NULL;
1666 vp_PARAM_singleStmt
1667 "PARAM" .and space .and vp_establishName .and .true .emit 0x00 .and vp_paramSingleInit .and
1668 .true .emit PARAM_NULL;
1669
1670 /*
1671 <PARAM_multipleStmt> ::= "PARAM" <establishName> "[" <optArraySize> "]"
1672 <paramMultipleInit>
1673 */
1674 fp_PARAM_multipleStmt
1675 "PARAM" .and space .and fp_establishName .and lbracket_ne .and optArraySize .and rbracket .and
1676 fp_paramMultipleInit .and .true .emit PARAM_NULL;
1677 vp_PARAM_multipleStmt
1678 "PARAM" .and space .and vp_establishName .and lbracket_ne .and optArraySize .and rbracket .and
1679 vp_paramMultipleInit .and .true .emit PARAM_NULL;
1680
1681 /*
1682 <optArraySize> ::= ""
1683 | <integer> from 1 to MAX_PROGRAM_PARAMETERS_ARB
1684 (maximum number of allowed program
1685 parameter bindings)
1686 */
1687 optArraySize
1688 optional_integer;
1689
1690 /*
1691 <paramSingleInit> ::= "=" <paramSingleItemDecl>
1692 */
1693 fp_paramSingleInit
1694 equal .and fp_paramSingleItemDecl;
1695 vp_paramSingleInit
1696 equal .and vp_paramSingleItemDecl;
1697
1698 /*
1699 <paramMultipleInit> ::= "=" "{" <paramMultInitList> "}"
1700 */
1701 fp_paramMultipleInit
1702 equal .and lbrace .and fp_paramMultInitList .and rbrace;
1703 vp_paramMultipleInit
1704 equal .and lbrace .and vp_paramMultInitList .and rbrace;
1705
1706 /*
1707 <paramMultInitList> ::= <paramMultipleItem>
1708 | <paramMultipleItem> "," <paramMultiInitList>
1709 */
1710 fp_paramMultInitList
1711 fp_paramMultInitList_1 .or fp_paramMultipleItem;
1712 vp_paramMultInitList
1713 vp_paramMultInitList_1 .or vp_paramMultipleItem;
1714 fp_paramMultInitList_1
1715 fp_paramMultipleItem .and comma_ne .and fp_paramMultInitList;
1716 vp_paramMultInitList_1
1717 vp_paramMultipleItem .and comma_ne .and vp_paramMultInitList;
1718
1719 /*
1720 <paramSingleItemDecl> ::= <stateSingleItem>
1721 | <programSingleItem>
1722 | <paramConstDecl>
1723 */
1724 fp_paramSingleItemDecl
1725 fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1726 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1727 paramConstDecl .emit PARAM_CONSTANT;
1728 vp_paramSingleItemDecl
1729 vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1730 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1731 paramConstDecl .emit PARAM_CONSTANT;
1732
1733 /*
1734 <paramSingleItemUse> ::= <stateSingleItem>
1735 | <programSingleItem>
1736 | <paramConstUse>
1737 */
1738 fp_paramSingleItemUse
1739 fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1740 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1741 paramConstUse .emit PARAM_CONSTANT;
1742 vp_paramSingleItemUse
1743 vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1744 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1745 paramConstUse .emit PARAM_CONSTANT;
1746
1747 /*
1748 <paramMultipleItem> ::= <stateMultipleItem>
1749 | <programMultipleItem>
1750 | <paramConstDecl>
1751 */
1752 fp_paramMultipleItem
1753 fp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or
1754 programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or
1755 paramConstDecl .emit PARAM_CONSTANT;
1756 vp_paramMultipleItem
1757 vp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or
1758 programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or
1759 paramConstDecl .emit PARAM_CONSTANT;
1760
1761 /*
1762 <stateMultipleItem> ::= <stateSingleItem>
1763 | "state" "." <stateMatrixRows>
1764 */
1765 fp_stateMultipleItem
1766 stateMultipleItem_1 .or fp_stateSingleItem;
1767 vp_stateMultipleItem
1768 stateMultipleItem_1 .or vp_stateSingleItem;
1769 stateMultipleItem_1
1770 "state" .and dot .and stateMatrixRows .emit STATE_MATRIX_ROWS;
1771
1772 /*
1773 fragment program
1774 <stateSingleItem> ::= "state" "." <stateMaterialItem>
1775 | "state" "." <stateLightItem>
1776 | "state" "." <stateLightModelItem>
1777 | "state" "." <stateLightProdItem>
1778 | "state" "." <stateTexEnvItem>
1779 | "state" "." <stateFogItem>
1780 | "state" "." <stateDepthItem>
1781 | "state" "." <stateMatrixRow>
1782
1783 vertex program
1784 <stateSingleItem> ::= "state" "." <stateMaterialItem>
1785 | "state" "." <stateLightItem>
1786 | "state" "." <stateLightModelItem>
1787 | "state" "." <stateLightProdItem>
1788 | "state" "." <stateTexGenItem>
1789 | "state" "." <stateFogItem>
1790 | "state" "." <stateClipPlaneItem>
1791 | "state" "." <statePointItem>
1792 | "state" "." <stateMatrixRow>
1793 */
1794 fp_stateSingleItem
1795 "state" .and dot .and fp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;
1796 vp_stateSingleItem
1797 "state" .and dot .and vp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;
1798 fp_stateSingleItem_1
1799 stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or
1800 stateSingleItem_5 .or stateSingleItem_7 .or stateSingleItem_8 .or stateSingleItem_11;
1801 vp_stateSingleItem_1
1802 stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or
1803 stateSingleItem_6 .or stateSingleItem_7 .or stateSingleItem_9 .or stateSingleItem_10 .or
1804 stateSingleItem_11;
1805 stateSingleItem_1
1806 stateMaterialItem .emit STATE_MATERIAL;
1807 stateSingleItem_2
1808 stateLightItem .emit STATE_LIGHT;
1809 stateSingleItem_3
1810 stateLightModelItem .emit STATE_LIGHT_MODEL;
1811 stateSingleItem_4
1812 stateLightProdItem .emit STATE_LIGHT_PROD;
1813 stateSingleItem_5
1814 stateTexEnvItem .emit STATE_TEX_ENV;
1815 stateSingleItem_6
1816 stateTexGenItem .emit STATE_TEX_GEN;
1817 stateSingleItem_7
1818 stateFogItem .emit STATE_FOG;
1819 stateSingleItem_8
1820 stateDepthItem .emit STATE_DEPTH;
1821 stateSingleItem_9
1822 stateClipPlaneItem .emit STATE_CLIP_PLANE;
1823 stateSingleItem_10
1824 statePointItem .emit STATE_POINT;
1825 stateSingleItem_11
1826 stateMatrixRow .emit STATE_MATRIX_ROWS;
1827
1828 /*
1829 <stateMaterialItem> ::= "material" <optFaceType> "." <stateMatProperty>
1830 */
1831 stateMaterialItem
1832 "material" .and optFaceType .and dot .and stateMatProperty .error INVALID_MATERIAL_PROPERTY;
1833
1834 /*
1835 <stateMatProperty> ::= "ambient"
1836 | "diffuse"
1837 | "specular"
1838 | "emission"
1839 | "shininess"
1840 */
1841 stateMatProperty
1842 "ambient" .emit MATERIAL_AMBIENT .or
1843 "diffuse" .emit MATERIAL_DIFFUSE .or
1844 "specular" .emit MATERIAL_SPECULAR .or
1845 "emission" .emit MATERIAL_EMISSION .or
1846 "shininess" .emit MATERIAL_SHININESS;
1847
1848 /*
1849 <stateLightItem> ::= "light" "[" <stateLightNumber> "]" "."
1850 <stateLightProperty>
1851 */
1852 stateLightItem
1853 "light" .and lbracket .and stateLightNumber .and rbracket .and dot .and
1854 stateLightProperty .error INVALID_LIGHT_PROPERTY;
1855
1856 /*
1857 <stateLightProperty> ::= "ambient"
1858 | "diffuse"
1859 | "specular"
1860 | "position"
1861 | "attenuation"
1862 | "spot" "." <stateSpotProperty>
1863 | "half"
1864 */
1865 stateLightProperty
1866 "ambient" .emit LIGHT_AMBIENT .or
1867 "diffuse" .emit LIGHT_DIFFUSE .or
1868 "specular" .emit LIGHT_SPECULAR .or
1869 "position" .emit LIGHT_POSITION .or
1870 "attenuation" .emit LIGHT_ATTENUATION .or
1871 stateLightProperty_1 .emit LIGHT_SPOT_DIRECTION .or
1872 "half" .emit LIGHT_HALF;
1873 stateLightProperty_1
1874 "spot" .and dot .and stateSpotProperty .error INVALID_SPOT_PROPERTY;
1875
1876 /*
1877 <stateSpotProperty> ::= "direction"
1878 */
1879 stateSpotProperty
1880 "direction";
1881
1882 /*
1883 <stateLightModelItem> ::= "lightmodel" <stateLModProperty>
1884 */
1885 stateLightModelItem
1886 "lightmodel" .and stateLModProperty .error INVALID_LIGHTMODEL_PROPERTY;
1887
1888 /*
1889 <stateLModProperty> ::= "." "ambient"
1890 | <optFaceType> "." "scenecolor"
1891 */
1892 stateLModProperty
1893 stateLModProperty_1 .or stateLModProperty_2;
1894 stateLModProperty_1
1895 dot .and "ambient" .emit LIGHT_MODEL_AMBIENT;
1896 stateLModProperty_2
1897 stateLModProperty_3 .emit LIGHT_MODEL_SCENECOLOR;
1898 stateLModProperty_3
1899 optFaceType .and dot .and "scenecolor";
1900
1901 /*
1902 <stateLightProdItem> ::= "lightprod" "[" <stateLightNumber> "]"
1903 <optFaceType> "." <stateLProdProperty>
1904 */
1905 stateLightProdItem
1906 "lightprod" .and lbracket .and stateLightNumber .and rbracket .and optFaceType .and dot .and
1907 stateLProdProperty .error INVALID_LIGHTPROD_PROPERTY;
1908
1909 /*
1910 <stateLProdProperty> ::= "ambient"
1911 | "diffuse"
1912 | "specular"
1913 */
1914 stateLProdProperty
1915 "ambient" .emit LIGHT_PROD_AMBIENT .or
1916 "diffuse" .emit LIGHT_PROD_DIFFUSE .or
1917 "specular" .emit LIGHT_PROD_SPECULAR;
1918
1919 /*
1920 <stateLightNumber> ::= <integer> from 0 to MAX_LIGHTS-1
1921 */
1922 stateLightNumber
1923 integer;
1924
1925 /*
1926 fragment program
1927 <stateTexEnvItem> ::= "texenv" <optLegacyTexUnitNum> "."
1928 <stateTexEnvProperty>
1929 */
1930 stateTexEnvItem
1931 "texenv" .and optLegacyTexUnitNum .and dot .and
1932 stateTexEnvProperty .error INVALID_TEXENV_PROPERTY;
1933
1934 /*
1935 fragment program
1936 <stateTexEnvProperty> ::= "color"
1937 */
1938 stateTexEnvProperty
1939 "color" .emit TEX_ENV_COLOR;
1940
1941 /*
1942 fragment program
1943 <optLegacyTexUnitNum> ::= ""
1944 | "[" <legacyTexUnitNum> "]"
1945
1946 NOTE: <optLegaceTexUnitNum> is not optional.
1947 */
1948 optLegacyTexUnitNum
1949 lbracket_ne .and legacyTexUnitNum .and rbracket;
1950
1951 /*
1952 fragment program
1953 <legacyTexUnitNum> ::= <integer> from 0 to MAX_TEXTURE_UNITS-1
1954 */
1955 legacyTexUnitNum
1956 integer;
1957
1958 /*
1959 vertex program
1960 <stateTexGenItem> ::= "texgen" <optTexCoordNum> "."
1961 <stateTexGenType> "." <stateTexGenCoord>
1962 */
1963 stateTexGenItem
1964 "texgen" .and optTexCoordNum .and dot .and stateTexGenType .error INVALID_TEXGEN_PROPERTY .and
1965 dot .and stateTexGenCoord .error INVALID_TEXGEN_COORD;
1966
1967 /*
1968 vertex program
1969 <stateTexGenType> ::= "eye"
1970 | "object"
1971 */
1972 stateTexGenType
1973 "eye" .emit TEX_GEN_EYE .or
1974 "object" .emit TEX_GEN_OBJECT;
1975
1976 /*
1977 vertex program
1978 <stateTexGenCoord> ::= "s"
1979 | "t"
1980 | "r"
1981 | "q"
1982 */
1983 stateTexGenCoord
1984 "s" .emit COMPONENT_X .or
1985 "t" .emit COMPONENT_Y .or
1986 "r" .emit COMPONENT_Z .or
1987 "q" .emit COMPONENT_W;
1988
1989 /*
1990 <stateFogItem> ::= "fog" "." <stateFogProperty>
1991 */
1992 stateFogItem
1993 "fog" .and dot .and stateFogProperty .error INVALID_FOG_PROPERTY;
1994
1995 /*
1996 <stateFogProperty> ::= "color"
1997 | "params"
1998 */
1999 stateFogProperty
2000 "color" .emit FOG_COLOR .or
2001 "params" .emit FOG_PARAMS;
2002
2003 /*
2004 fragment program
2005 <stateDepthItem> ::= "depth" "." <stateDepthProperty>
2006 */
2007 stateDepthItem
2008 "depth" .and dot .and stateDepthProperty .error INVALID_DEPTH_PROPERTY;
2009
2010 /*
2011 fragment program
2012 <stateDepthProperty> ::= "range"
2013 */
2014 stateDepthProperty
2015 "range" .emit DEPTH_RANGE;
2016
2017 /*
2018 vertex program
2019 <stateClipPlaneItem> ::= "clip" "[" <stateClipPlaneNum> "]" "." "plane"
2020 */
2021 stateClipPlaneItem
2022 "clip" .and lbracket .and stateClipPlaneNum .and rbracket .and dot .and
2023 "plane" .error INVALID_CLIPPLANE_PROPERTY;
2024
2025 /*
2026 vertex program
2027 <stateClipPlaneNum> ::= <integer> from 0 to MAX_CLIP_PLANES-1
2028 */
2029 stateClipPlaneNum
2030 integer;
2031
2032 /*
2033 vertex program
2034 <statePointItem> ::= "point" "." <statePointProperty>
2035 */
2036 statePointItem
2037 "point" .and dot .and statePointProperty .error INVALID_POINT_PROPERTY;
2038
2039 /*
2040 vertex program
2041 <statePointProperty> ::= "size"
2042 | "attenuation"
2043 */
2044 statePointProperty
2045 "size" .emit POINT_SIZE .or
2046 .if (point_parameters != 0x00) "attenuation" .emit POINT_ATTENUATION;
2047
2048 /*
2049 <stateMatrixRow> ::= <stateMatrixItem> "." "row" "["
2050 <stateMatrixRowNum> "]"
2051 */
2052 stateMatrixRow
2053 stateMatrixItem .and dot .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and
2054 lbracket .and stateMatrixRowNum .and rbracket .emit 0x0;
2055
2056 /*
2057 <stateMatrixRows> ::= <stateMatrixItem> <optMatrixRows>
2058 */
2059 stateMatrixRows
2060 stateMatrixItem .and optMatrixRows;
2061
2062 /*
2063 <optMatrixRows> ::= ""
2064 | "." "row" "[" <stateMatrixRowNum> ".."
2065 <stateMatrixRowNum> "]"
2066 */
2067 optMatrixRows
2068 optMatrixRows_1 .or .true .emit 0x0 .emit '3' .emit 0x0 .emit $;
2069 optMatrixRows_1
2070 dot_ne .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and lbracket .and
2071 stateMatrixRowNum .and dotdot .and stateMatrixRowNum .and rbracket;
2072
2073 /*
2074 <stateMatrixItem> ::= "matrix" "." <stateMatrixName>
2075 <stateOptMatModifier>
2076 */
2077 stateMatrixItem
2078 "matrix" .and dot .and stateMatrixName .error INVALID_MATRIX_NAME .and stateOptMatModifier;
2079
2080 /*
2081 <stateOptMatModifier> ::= ""
2082 | "." <stateMatModifier>
2083 */
2084 stateOptMatModifier
2085 stateOptMatModifier_1 .or .true .emit MATRIX_MODIFIER_IDENTITY;
2086 stateOptMatModifier_1
2087 dot_ne .and stateMatModifier;
2088
2089 /*
2090 <stateMatModifier> ::= "inverse"
2091 | "transpose"
2092 | "invtrans"
2093 */
2094 stateMatModifier
2095 "inverse" .emit MATRIX_MODIFIER_INVERSE .or
2096 "transpose" .emit MATRIX_MODIFIER_TRANSPOSE .or
2097 "invtrans" .emit MATRIX_MODIFIER_INVTRANS;
2098
2099 /*
2100 <stateMatrixRowNum> ::= <integer> from 0 to 3
2101 */
2102 stateMatrixRowNum
2103 integer_0_3;
2104
2105 /*
2106 <stateMatrixName> ::= "modelview" <stateOptModMatNum>
2107 | "projection"
2108 | "mvp"
2109 | "texture" <optTexCoordNum>
2110 | "palette" "[" <statePaletteMatNum> "]"
2111 | "program" "[" <stateProgramMatNum> "]"
2112 */
2113 stateMatrixName
2114 stateMatrixName_1_1 .emit MATRIX_MODELVIEW .or
2115 "projection" .emit MATRIX_PROJECTION .or
2116 "mvp" .emit MATRIX_MVP .or
2117 stateMatrixName_1_2 .emit MATRIX_TEXTURE .or
2118 .if (matrix_palette != 0x00) stateMatrixName_1_3 .emit MATRIX_PALETTE .or
2119 stateMatrixName_1_4 .emit MATRIX_PROGRAM;
2120 stateMatrixName_1_1
2121 "modelview" .and stateOptModMatNum;
2122 stateMatrixName_1_2
2123 "texture" .and optTexCoordNum;
2124 stateMatrixName_1_3
2125 "palette" .and lbracket .and statePaletteMatNum .and rbracket;
2126 stateMatrixName_1_4
2127 "program" .and lbracket .and stateProgramMatNum .and rbracket;
2128
2129 /*
2130 <stateOptModMatNum> ::= ""
2131 | "[" <stateModMatNum> "]"
2132 */
2133 stateOptModMatNum
2134 .if (vertex_blend != 0x00) stateOptModMatNum_1 .or
2135 .true .emit 0x00;
2136 stateOptModMatNum_1
2137 lbracket_ne .and stateModMatNum .and rbracket;
2138
2139 /*
2140 <stateModMatNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1
2141 */
2142 stateModMatNum
2143 integer;
2144
2145 /*
2146 <optTexCoordNum> ::= ""
2147 | "[" <texCoordNum> "]"
2148 */
2149 optTexCoordNum
2150 optTexCoordNum_1 .or .true .emit 0x00;
2151 optTexCoordNum_1
2152 lbracket_ne .and texCoordNum .and rbracket;
2153
2154 /*
2155 <texCoordNum> ::= <integer> from 0 to MAX_TEXTURE_COORDS_ARB-1
2156 */
2157 texCoordNum
2158 integer;
2159
2160 /*
2161 <statePaletteMatNum> ::= <integer> from 0 to MAX_PALETTE_MATRICES_ARB-1
2162 */
2163 statePaletteMatNum
2164 integer;
2165
2166 /*
2167 <stateProgramMatNum> ::= <integer> from 0 to MAX_PROGRAM_MATRICES_ARB-1
2168 */
2169 stateProgramMatNum
2170 integer;
2171
2172 /*
2173 <programSingleItem> ::= <progEnvParam>
2174 | <progLocalParam>
2175
2176 NOTE: <programSingleItem> has been modified for correct error handling. If program property
2177 is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated.
2178 */
2179 programSingleItem
2180 "program" .and dot .and programSingleItem_1 .error INVALID_PROGRAM_PROPERTY;
2181 programSingleItem_1
2182 progEnvParam .or progLocalParam;
2183
2184 /*
2185 <programMultipleItem> ::= <progEnvParams>
2186 | <progLocalParams>
2187
2188 NOTE: <programMultipleItem> has been modified for correct error handling. If program property
2189 is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated.
2190 */
2191 programMultipleItem
2192 "program" .and dot .and programMultipleItem_1 .error INVALID_PROGRAM_PROPERTY;
2193 programMultipleItem_1
2194 progEnvParams .or progLocalParams;
2195
2196 /*
2197 <progEnvParams> ::= "program" "." "env"
2198 "[" <progEnvParamNums> "]"
2199
2200 NOTE: "program" "." has been moved to <programMultipleItem>.
2201 */
2202 progEnvParams
2203 "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNums .and rbracket;
2204
2205 /*
2206 <progEnvParamNums> ::= <progEnvParamNum>
2207 | <progEnvParamNum> ".." <progEnvParamNum>
2208 */
2209 progEnvParamNums
2210 progEnvParamNums_1 .or progEnvParamNums_2;
2211 progEnvParamNums_1
2212 progEnvParamNum .and dotdot_ne .and progEnvParamNum;
2213 progEnvParamNums_2
2214 progEnvParamNum .and .true .emit 0x00;
2215
2216 /*
2217 <progEnvParam> ::= "program" "." "env"
2218 "[" <progEnvParamNum> "]"
2219
2220 NOTE: "program" "." has been moved to <programSingleItem>.
2221 */
2222 progEnvParam
2223 "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNum .and rbracket .emit 0x00;
2224
2225 /*
2226 <progLocalParams> ::= "program" "." "local"
2227 "[" <progLocalParamNums> "]"
2228
2229 NOTE: "program" "." has been moved to <programMultipleItem>.
2230 */
2231 progLocalParams
2232 "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNums .and rbracket;
2233
2234 /*
2235 <progLocalParamNums> ::= <progLocalParamNum>
2236 | <progLocalParamNum> ".." <progLocalParamNum>
2237 */
2238 progLocalParamNums
2239 progLocalParamNums_1 .or progLocalParamNums_2;
2240 progLocalParamNums_1
2241 progLocalParamNum .and dotdot_ne .and progLocalParamNum;
2242 progLocalParamNums_2
2243 progLocalParamNum .and .true .emit 0x00;
2244
2245 /*
2246 <progLocalParam> ::= "program" "." "local"
2247 "[" <progLocalParamNum> "]"
2248
2249 NOTE: "program" "." has been moved to <programSingleItem>.
2250 */
2251 progLocalParam
2252 "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNum .and rbracket .emit 0x00;
2253
2254 /*
2255 <progEnvParamNum> ::= <integer> from 0 to
2256 MAX_PROGRAM_ENV_PARAMETERS_ARB - 1
2257 */
2258 progEnvParamNum
2259 integer;
2260
2261 /*
2262 <progLocalParamNum> ::= <integer> from 0 to
2263 MAX_PROGRAM_LOCAL_PARAMETERS_ARB - 1
2264 */
2265 progLocalParamNum
2266 integer;
2267
2268 /*
2269 <paramConstDecl> ::= <paramConstScalarDecl>
2270 | <paramConstVector>
2271 */
2272 paramConstDecl
2273 paramConstScalarDecl .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;
2274
2275 /*
2276 <paramConstUse> ::= <paramConstScalarUse>
2277 | <paramConstVector>
2278 */
2279 paramConstUse
2280 paramConstScalarUse .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;
2281
2282 /*
2283 <paramConstScalarDecl> ::= <signedFloatConstant>
2284 */
2285 paramConstScalarDecl
2286 signedFloatConstant;
2287
2288 /*
2289 <paramConstScalarUse> ::= <floatConstant>
2290 */
2291 paramConstScalarUse
2292 floatConstant;
2293
2294 /*
2295 <paramConstVector> ::= "{" <signedFloatConstant> "}"
2296 | "{" <signedFloatConstant> ","
2297 <signedFloatConstant> "}"
2298 | "{" <signedFloatConstant> ","
2299 <signedFloatConstant> ","
2300 <signedFloatConstant> "}"
2301 | "{" <signedFloatConstant> ","
2302 <signedFloatConstant> ","
2303 <signedFloatConstant> ","
2304 <signedFloatConstant> "}"
2305 */
2306 paramConstVector
2307 paramConstVector_4 .emit 0x04 .or paramConstVector_3 .emit 0x03 .or
2308 paramConstVector_2 .emit 0x02 .or paramConstVector_1 .emit 0x01;
2309 paramConstVector_1
2310 lbrace_ne .and signedFloatConstant .and rbrace;
2311 paramConstVector_2
2312 lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;
2313 paramConstVector_3
2314 lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and
2315 signedFloatConstant .and rbrace;
2316 paramConstVector_4
2317 lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and
2318 signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;
2319
2320 /*
2321 <signedFloatConstant> ::= <optionalSign> <floatConstant>
2322 */
2323 signedFloatConstant
2324 optionalSign .and floatConstant;
2325
2326 /*
2327 <floatConstant> ::= see text
2328 The <floatConstant> rule matches a floating-point constant consisting
2329 of an integer part, a decimal point, a fraction part, an "e" or
2330 "E", and an optionally signed integer exponent. The integer and
2331 fraction parts both consist of a sequence of one or more digits ("0"
2332 through "9"). Either the integer part or the fraction parts (not
2333 both) may be missing; either the decimal point or the "e" (or "E")
2334 and the exponent (not both) may be missing.
2335 */
2336 floatConstant
2337 float;
2338
2339 /*
2340 <optionalSign> ::= ""
2341 | "-"
2342 | "+"
2343 */
2344 optionalSign
2345 optional_sign_ne;
2346
2347 /*
2348 <TEMP_statement> ::= "TEMP" <varNameList>
2349 */
2350 fp_TEMP_statement
2351 "TEMP" .and space .and fp_varNameList .and .true .emit 0x00;
2352 vp_TEMP_statement
2353 "TEMP" .and space .and vp_varNameList .and .true .emit 0x00;
2354
2355 /*
2356 vertex program
2357 <ADDRESS_statement> ::= "ADDRESS" <varNameList>
2358 */
2359 ADDRESS_statement
2360 "ADDRESS" .and space .and vp_varNameList .and .true .emit 0x00;
2361
2362 /*
2363 <varNameList> ::= <establishName>
2364 | <establishName> "," <varNameList>
2365 */
2366 fp_varNameList
2367 fp_varNameList_1 .or fp_establishName;
2368 vp_varNameList
2369 vp_varNameList_1 .or vp_establishName;
2370 fp_varNameList_1
2371 fp_establishName .and comma_ne .and fp_varNameList;
2372 vp_varNameList_1
2373 vp_establishName .and comma_ne .and vp_varNameList;
2374
2375 /*
2376 <OUTPUT_statement> ::= "OUTPUT" <establishName> "="
2377 <resultBinding>
2378 */
2379 fp_OUTPUT_statement
2380 "OUTPUT" .and space .and fp_establishName .and equal .and
2381 fp_resultBinding .error RESULT_EXPECTED;
2382 vp_OUTPUT_statement
2383 "OUTPUT" .and space .and vp_establishName .and equal .and
2384 vp_resultBinding .error RESULT_EXPECTED;
2385
2386 /*
2387 fragment program
2388 <resultBinding> ::= "result" "." "color"
2389 | "result" "." "color" <optOutputColorNum> (if option ARB_draw_buffers present)
2390 | "result" "." "depth"
2391
2392 vertex program
2393 <resultBinding> ::= "result" "." "position"
2394 | "result" "." <resultColBinding>
2395 | "result" "." "fogcoord"
2396 | "result" "." "pointsize"
2397 | "result" "." "texcoord" <optTexCoordNum>
2398 */
2399 fp_resultBinding
2400 "result" .and dot .and fp_resultBinding_1 .error INVALID_RESULT_PROPERTY;
2401 vp_resultBinding
2402 "result" .and dot .and vp_resultBinding_1 .error INVALID_RESULT_PROPERTY;
2403 fp_resultBinding_1
2404 fp_resultBinding_2 .emit FRAGMENT_RESULT_COLOR .or
2405 "depth" .emit FRAGMENT_RESULT_DEPTH;
2406 fp_resultBinding_2
2407 "color" .and optOutputColorNum;
2408 vp_resultBinding_1
2409 .if (ARB_position_invariant == 0x00) "position" .emit VERTEX_RESULT_POSITION .or
2410 resultColBinding .emit VERTEX_RESULT_COLOR .or
2411 "fogcoord" .emit VERTEX_RESULT_FOGCOORD .or
2412 "pointsize" .emit VERTEX_RESULT_POINTSIZE .or
2413 vp_resultBinding_2 .emit VERTEX_RESULT_TEXCOORD;
2414 vp_resultBinding_2
2415 "texcoord" .and optTexCoordNum;
2416
2417 /*
2418 GL_ARB_draw_buffers
2419 <optOutputColorNum> ::= ""
2420 | "[" <outputColorNum> "]"
2421 */
2422 optOutputColorNum
2423 .if (ARB_draw_buffers != 0x00) optOutputColorNum_1 .or .true .emit 0x00;
2424 optOutputColorNum_1
2425 lbracket_ne .and outputColorNum .and rbracket;
2426
2427 /*
2428 GL_ARB_draw_buffers
2429 <outputColorNum> ::= <integer> from 0 to MAX_DRAW_BUFFERS_ARB-1
2430 */
2431 outputColorNum
2432 integer;
2433
2434 /*
2435 vertex program
2436 <resultColBinding> ::= "color" <optFaceType> <optColorType>
2437 */
2438 resultColBinding
2439 "color" .and optFaceType .and optColorType;
2440
2441 /*
2442 <optFaceType> ::= ""
2443 | "." "front"
2444 | "." "back"
2445 */
2446 optFaceType
2447 FaceType .or .true .emit FACE_FRONT;
2448 FaceType
2449 dot_ne .and FaceProperty;
2450 FaceProperty
2451 "front" .emit FACE_FRONT .or "back" .emit FACE_BACK;
2452
2453 /*
2454 <optColorType> ::= ""
2455 | "." "primary"
2456 | "." "secondary"
2457 */
2458 optColorType
2459 ColorType .or .true .emit COLOR_PRIMARY;
2460 ColorType
2461 dot_ne .and ColorProperty;
2462 ColorProperty
2463 "primary" .emit COLOR_PRIMARY .or
2464 .if (secondary_color != 0x00) "secondary" .emit COLOR_SECONDARY;
2465
2466 /*
2467 <ALIAS_statement> ::= "ALIAS" <establishName> "="
2468 <establishedName>
2469 */
2470 fp_ALIAS_statement
2471 "ALIAS" .and fp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and fp_establishedName;
2472 vp_ALIAS_statement
2473 "ALIAS" .and vp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and vp_establishedName;
2474 fp_ALIAS_statement_1
2475 space .and fp_establishName;
2476 vp_ALIAS_statement_1
2477 space .and vp_establishName;
2478
2479 /*
2480 <establishName> ::= <identifier>
2481 */
2482 fp_establishName
2483 fp_identifier;
2484 vp_establishName
2485 vp_identifier;
2486
2487 /*
2488 <establishedName> ::= <identifier>
2489 */
2490 fp_establishedName
2491 fp_identifier;
2492 vp_establishedName
2493 vp_identifier;
2494 fp_establishedName_no_error_on_identifier
2495 fp_identifier_ne;
2496 vp_establishedName_no_error_on_identifier
2497 vp_identifier_ne;
2498
2499 /*
2500 fragment program
2501 <identifier> ::= see text
2502 The <identifier> rule matches a sequence of one or more letters ("A"
2503 through "Z", "a" through "z"), digits ("0" through "9), underscores
2504 ("_"), or dollar signs ("$"); the first character must not be a
2505 number. Upper and lower case letters are considered different
2506 (names are case-sensitive). The following strings are reserved
2507 keywords and may not be used as identifiers:
2508
2509 ABS, ABS_SAT, ADD, ADD_SAT, ALIAS, ATTRIB, CMP, CMP_SAT, COS,
2510 COS_SAT, DP3, DP3_SAT, DP4, DP4_SAT, DPH, DPH_SAT, DST, DST_SAT,
2511 END, EX2, EX2_SAT, FLR, FLR_SAT, FRC, FRC_SAT, KIL, LG2,
2512 LG2_SAT, LIT, LIT_SAT, LRP, LRP_SAT, MAD, MAD_SAT, MAX, MAX_SAT,
2513 MIN, MIN_SAT, MOV, MOV_SAT, MUL, MUL_SAT, OPTION, OUTPUT, PARAM,
2514 POW, POW_SAT, RCP, RCP_SAT, RSQ, RSQ_SAT, SIN, SIN_SAT, SCS,
2515 SCS_SAT, SGE, SGE_SAT, SLT, SLT_SAT, SUB, SUB_SAT, SWZ, SWZ_SAT,
2516 TEMP, TEX, TEX_SAT, TXB, TXB_SAT, TXP, TXP_SAT, XPD, XPD_SAT,
2517 fragment, program, result, state, and texture.
2518
2519 vertex program
2520 <identifier> ::= see text
2521 The <identifier> rule matches a sequence of one or more letters ("A"
2522 through "Z", "a" through "z"), digits ("0" through "9), underscores ("_"),
2523 or dollar signs ("$"); the first character must not be a number. Upper
2524 and lower case letters are considered different (names are
2525 case-sensitive). The following strings are reserved keywords and may not
2526 be used as identifiers:
2527
2528 ABS, ADD, ADDRESS, ALIAS, ARL, ATTRIB, DP3, DP4, DPH, DST, END, EX2,
2529 EXP, FLR, FRC, LG2, LIT, LOG, MAD, MAX, MIN, MOV, MUL, OPTION, OUTPUT,
2530 PARAM, POW, RCP, RSQ, SGE, SLT, SUB, SWZ, TEMP, XPD, program, result,
2531 state, and vertex.
2532 */
2533 fp_identifier
2534 fp_identifier_ne .error IDENTIFIER_EXPECTED;
2535 vp_identifier
2536 vp_identifier_ne .error IDENTIFIER_EXPECTED;
2537 fp_identifier_ne
2538 fp_not_reserved_identifier .and identifier_ne;
2539 vp_identifier_ne
2540 vp_not_reserved_identifier .and identifier_ne;
2541
2542 fp_not_reserved_identifier
2543 fp_not_reserved_identifier_1 .or .true;
2544 fp_not_reserved_identifier_1
2545 fp_reserved_identifier .and .false .error RESERVED_KEYWORD;
2546 vp_not_reserved_identifier
2547 vp_not_reserved_identifier_1 .or .true;
2548 vp_not_reserved_identifier_1
2549 vp_reserved_identifier .and .false .error RESERVED_KEYWORD;
2550
2551 fp_reserved_identifier
2552 "ABS" .or "ABS_SAT" .or "ADD" .or "ADD_SAT" .or "ALIAS" .or "ATTRIB" .or "CMP" .or "CMP_SAT" .or
2553 "COS" .or "COS_SAT" .or "DP3" .or "DP3_SAT" .or "DP4" .or "DP4_SAT" .or "DPH" .or "DPH_SAT" .or
2554 "DST" .or "DST_SAT" .or "END" .or "EX2" .or "EX2_SAT" .or "FLR" .or "FLR_SAT" .or "FRC" .or
2555 "FRC_SAT" .or "KIL" .or "LG2" .or "LG2_SAT" .or "LIT" .or "LIT_SAT" .or "LRP" .or "LRP_SAT" .or
2556 "MAD" .or "MAD_SAT" .or "MAX" .or "MAX_SAT" .or "MIN" .or "MIN_SAT" .or "MOV" .or "MOV_SAT" .or
2557 "MUL" .or "MUL_SAT" .or "OPTION" .or "OUTPUT" .or "PARAM" .or "POW" .or "POW_SAT" .or "RCP" .or
2558 "RCP_SAT" .or "RSQ" .or "RSQ_SAT" .or "SIN" .or "SIN_SAT" .or "SCS" .or "SCS_SAT" .or "SGE" .or
2559 "SGE_SAT" .or "SLT" .or "SLT_SAT" .or "SUB" .or "SUB_SAT" .or "SWZ" .or "SWZ_SAT" .or "TEMP" .or
2560 "TEX" .or "TEX_SAT" .or "TXB" .or "TXB_SAT" .or "TXP" .or "TXP_SAT" .or "XPD" .or "XPD_SAT" .or
2561 "fragment" .or "program" .or "result" .or "state" .or "texture";
2562 vp_reserved_identifier
2563 "ABS" .or "ADD" .or "ADDRESS" .or "ALIAS" .or "ARL" .or "ATTRIB" .or "DP3" .or "DP4" .or
2564 "DPH" .or "DST" .or "END" .or "EX2" .or "EXP" .or "FLR" .or "FRC" .or "LG2" .or "LIT" .or
2565 "LOG" .or "MAD" .or "MAX" .or "MIN" .or "MOV" .or "MUL" .or "OPTION" .or "OUTPUT" .or
2566 "PARAM" .or "POW" .or "RCP" .or "RSQ" .or "SGE" .or "SLT" .or "SUB" .or "SWZ" .or "TEMP" .or
2567 "XPD" .or "program" .or "result" .or "state" .or "vertex";
2568
2569 /*
2570 The <integer> rule matches an integer constant. The integer consists
2571 of a sequence of one or more digits ("0" through "9").
2572 */
2573 integer
2574 integer_ne .error INTEGER_EXPECTED;
2575
2576 zero
2577 '0';
2578
2579 leading_zeroes
2580 .loop zero;
2581
2582 no_digit
2583 no_digit_1 .or .true;
2584 no_digit_1
2585 digit10 .and .false .error INTEGER_OUT_OF_RANGE;
2586
2587 all_zeroes
2588 all_zeroes_1 .or no_digit_1;
2589 all_zeroes_1
2590 '0' .and .loop zero .and no_digit;
2591
2592 integer_0_3
2593 integer_0_3_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
2594 integer_0_3_1
2595 integer_0_3_2 .or all_zeroes .emit '0';
2596 integer_0_3_2 /* [1, 3] */
2597 leading_zeroes .and '1'-'3' .emit * .and no_digit;
2598
2599 integer_0_63
2600 integer_0_63_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
2601 integer_0_63_1
2602 integer_0_63_2 .or integer_0_63_3 .or integer_0_63_4 .or integer_0_63_5 .or
2603 all_zeroes .emit '0';
2604 integer_0_63_2 /* [7, 9] */
2605 leading_zeroes .and '7'-'9' .emit * .and no_digit;
2606 integer_0_63_3 /* [10, 59] */
2607 leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;
2608 integer_0_63_4 /* [60, 63] */
2609 leading_zeroes .and '6' .emit * .and '0'-'3' .emit * .and no_digit;
2610 integer_0_63_5 /* [1, 6] */
2611 leading_zeroes .and '1'-'6' .emit * .and no_digit;
2612
2613 integer_0_64
2614 integer_0_64_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
2615 integer_0_64_1
2616 integer_0_64_2 .or integer_0_64_3 .or integer_0_64_4 .or integer_0_64_5 .or
2617 all_zeroes .emit '0';
2618 integer_0_64_2 /* [7, 9] */
2619 leading_zeroes .and '7'-'9' .emit * .and no_digit;
2620 integer_0_64_3 /* [10, 59] */
2621 leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;
2622 integer_0_64_4 /* [60, 64] */
2623 leading_zeroes .and '6' .emit * .and '0'-'4' .emit * .and no_digit;
2624 integer_0_64_5 /* [1, 6] */
2625 leading_zeroes .and '1'-'6' .emit * .and no_digit;
2626
2627 optional_space
2628 space .or .true;
2629
2630 space_dst
2631 space .error OPERATION_NEEDS_DESTINATION_VARIABLE;
2632
2633 space_src
2634 space .error OPERATION_NEEDS_SOURCE_VARIABLE;
2635
2636 space
2637 single_space .and .loop single_space;
2638
2639 single_space
2640 white_char .or comment_block;
2641
2642 white_char
2643 ' ' .or '\t' .or '\n' .or '\r';
2644
2645 comment_block
2646 '#' .and .loop comment_char .and optional_new_line;
2647
2648 /* All ASCII characters except '\r', '\n' and '\0' */
2649 comment_char
2650 '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
2651
2652 optional_new_line
2653 '\n' .or crlf .or .true;
2654
2655 crlf
2656 '\r' .and '\n';
2657
2658 semicolon
2659 optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;
2660
2661 comma
2662 optional_space .and ',' .error MISSING_COMMA .and optional_space;
2663
2664 comma_ne
2665 optional_space .and ',' .and optional_space;
2666
2667 lbracket
2668 optional_space .and '[' .error MISSING_LBRACKET .and optional_space;
2669
2670 lbracket_ne
2671 optional_space .and '[' .and optional_space;
2672
2673 rbracket
2674 optional_space .and ']' .error MISSING_RBRACKET .and optional_space;
2675
2676 dot
2677 optional_space .and '.' .error MISSING_DOT .and optional_space;
2678
2679 dot_ne
2680 optional_space .and '.' .and optional_space;
2681
2682 equal
2683 optional_space .and '=' .error MISSING_EQUAL .and optional_space;
2684
2685 lbrace
2686 optional_space .and '{' .error MISSING_LBRACE .and optional_space;
2687
2688 lbrace_ne
2689 optional_space .and '{' .and optional_space;
2690
2691 rbrace
2692 optional_space .and '}' .error MISSING_RBRACE .and optional_space;
2693
2694 dotdot
2695 optional_space .and '.' .and '.' .error MISSING_DOTDOT .and optional_space;
2696
2697 dotdot_ne
2698 optional_space .and '.' .and '.' .and optional_space;
2699
2700 /*
2701 The definition below accepts the following floating point number formats:
2702 .99 .99e99 99. 99.99 99.99e99 99.e99 99e99
2703 Also 99 format was considered and accepted because of a large number of existing program
2704 strings with such a format.
2705 */
2706 float
2707 float_1 .or float_2 .or float_legacy;
2708 float_1
2709 '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;
2710 float_2
2711 integer_ne .and float_3;
2712 float_3
2713 float_4 .or float_5;
2714 float_4
2715 '.' .and optional_integer .and optional_exponent;
2716 float_5
2717 exponent .emit 0x00;
2718 float_legacy
2719 integer_ne .and .true .emit 0x00 .emit 0x00;
2720
2721 /*
2722 Below is a correct version of <float> definiton.
2723 */
2724 /*
2725 float
2726 float_1 .or float_2;
2727 float_1
2728 '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;
2729 float_2
2730 integer_ne .and float_3 .error MISSING_DOT_OR_EXPONENT;
2731 float_3
2732 float_4 .or float_5;
2733 float_4
2734 '.' .and optional_integer .and optional_exponent;
2735 float_5
2736 exponent .emit 0x00;
2737 */
2738
2739 integer_ne
2740 integer_ne_1 .and .true .emit 0x00 .emit $;
2741 integer_ne_1
2742 digit10 .emit * .and .loop digit10 .emit *;
2743
2744 optional_integer
2745 integer_ne .or .true .emit 0x00;
2746
2747 /*
2748 NOTE: If exponent part is omited we treat it as if it was "E+1".
2749 */
2750 optional_exponent
2751 exponent .or .true .emit 0x00;
2752
2753 exponent
2754 exponent_1 .and optional_sign_ne .and integer_ne .error EXPONENT_VALUE_EXPECTED;
2755 exponent_1
2756 'e' .or 'E';
2757
2758 optional_sign_ne
2759 minus_ne .or plus_ne .or .true;
2760
2761 plus_ne
2762 optional_space .and '+' .and optional_space;
2763
2764 minus_ne
2765 optional_space .and '-' .emit '-' .and optional_space;
2766
2767 identifier_ne
2768 first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit 0x00 .emit $;
2769
2770 follow_idchar
2771 first_idchar .or digit10;
2772
2773 first_idchar
2774 'a'-'z' .or 'A'-'Z' .or '_' .or '$';
2775
2776 digit10
2777 '0'-'9';
2778
2779 /*
2780 string filtering - if a string is encountered in grammar ("blabla"), the symbol below is
2781 executed to create the string. The symbol must not throw any errors and emit bytes - it should
2782 stop if it encounters invalid character. After this the resulting string (from starting
2783 position up to the invalid character (but without it) is compared with the grammar string.
2784 */
2785 .string __string_filter;
2786
2787 __string_filter
2788 .loop __identifier_char;
2789
2790 __identifier_char
2791 'a'-'z' .or 'A'-'Z' .or '_' .or '$' .or '0'-'9';
2792
2793 /*
2794 error token filtering
2795 */
2796 e_signature
2797 e_signature_char .and .loop e_signature_char;
2798 e_signature_char
2799 '!' .or '.' .or 'A'-'Z' .or 'a'-'z' .or '0'-'9';
2800
2801 e_statement
2802 .loop e_statement_not_term;
2803 /* All ASCII characters to one of '\r', '\n', '\0' and ';' */
2804 e_statement_not_term
2805 '\x3C'-'\xFF' .or '\x0E'-'\x3A' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
2806
2807 e_identifier
2808 e_identifier_first .and .loop e_identifier_next;
2809 e_identifier_first
2810 'a'-'z' .or 'A'-'Z' .or '_' .or '$';
2811 e_identifier_next
2812 e_identifier_first .or '0'-'9';
2813
2814 e_token
2815 e_identifier .or e_token_number .or '[' .or ']' .or '.' .or '{' .or '}' .or '=' .or '+' .or
2816 '-' .or ',' .or ';';
2817 e_token_number
2818 e_token_digit .and .loop e_token_digit;
2819 e_token_digit
2820 '0'-'9';
2821
2822 e_charordigit
2823 'A'-'Z' .or 'a'-'z' .or '0'-'9';
2824