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