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