+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 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 arbparse.c
+ * ARB_*_program parser syntax
+ * \author Michal Krole
+ */
+
+
static char arb_grammar_text[] = ".syntax program;\n"
-".emtcode REVISION 0x04\n"
+".emtcode REVISION 0x05\n"
".emtcode FRAGMENT_PROGRAM 0x01\n"
".emtcode VERTEX_PROGRAM 0x02\n"
".emtcode OPTION 0x01\n"
".emtcode ARB_FOG_EXP2 0x08\n"
".emtcode ARB_FOG_LINEAR 0x10\n"
".emtcode ARB_POSITION_INVARIANT 0x20\n"
-".emtcode F_ALU_INST 0x01\n"
-".emtcode F_TEX_INST 0x02\n"
-".emtcode F_ALU_VECTOR 0x01\n"
-".emtcode F_ALU_SCALAR 0x02\n"
-".emtcode F_ALU_BINSC 0x03\n"
-".emtcode F_ALU_BIN 0x04\n"
-".emtcode F_ALU_TRI 0x05\n"
-".emtcode F_ALU_SWZ 0x06\n"
-".emtcode F_TEX_SAMPLE 0x07\n"
-".emtcode F_TEX_KIL 0x08\n"
-".emtcode V_GEN_ARL 0x01\n"
-".emtcode V_GEN_VECTOR 0x02\n"
-".emtcode V_GEN_SCALAR 0x03\n"
-".emtcode V_GEN_BINSC 0x04\n"
-".emtcode V_GEN_BIN 0x05\n"
-".emtcode V_GEN_TRI 0x06\n"
-".emtcode V_GEN_SWZ 0x07\n"
-".emtcode F_ABS 0x00\n"
-".emtcode F_ABS_SAT 0x01\n"
-".emtcode F_FLR 0x02\n"
-".emtcode F_FLR_SAT 0x03\n"
-".emtcode F_FRC 0x04\n"
-".emtcode F_FRC_SAT 0x05\n"
-".emtcode F_LIT 0x06\n"
-".emtcode F_LIT_SAT 0x07\n"
-".emtcode F_MOV 0x08\n"
-".emtcode F_MOV_SAT 0x09\n"
-".emtcode F_COS 0x0A\n"
-".emtcode F_COS_SAT 0x0B\n"
-".emtcode F_EX2 0x0C\n"
-".emtcode F_EX2_SAT 0x0D\n"
-".emtcode F_LG2 0x0E\n"
-".emtcode F_LG2_SAT 0x0F\n"
-".emtcode F_RCP 0x10\n"
-".emtcode F_RCP_SAT 0x11\n"
-".emtcode F_RSQ 0x12\n"
-".emtcode F_RSQ_SAT 0x13\n"
-".emtcode F_SIN 0x14\n"
-".emtcode F_SIN_SAT 0x15\n"
-".emtcode F_SCS 0x16\n"
-".emtcode F_SCS_SAT 0x17\n"
-".emtcode F_POW 0x18\n"
-".emtcode F_POW_SAT 0x19\n"
-".emtcode F_ADD 0x1A\n"
-".emtcode F_ADD_SAT 0x1B\n"
-".emtcode F_DP3 0x1C\n"
-".emtcode F_DP3_SAT 0x1D\n"
-".emtcode F_DP4 0x1E\n"
-".emtcode F_DP4_SAT 0x1F\n"
-".emtcode F_DPH 0x20\n"
-".emtcode F_DPH_SAT 0x21\n"
-".emtcode F_DST 0x22\n"
-".emtcode F_DST_SAT 0x23\n"
-".emtcode F_MAX 0x24\n"
-".emtcode F_MAX_SAT 0x25\n"
-".emtcode F_MIN 0x26\n"
-".emtcode F_MIN_SAT 0x27\n"
-".emtcode F_MUL 0x28\n"
-".emtcode F_MUL_SAT 0x29\n"
-".emtcode F_SGE 0x2A\n"
-".emtcode F_SGE_SAT 0x2B\n"
-".emtcode F_SLT 0x2C\n"
-".emtcode F_SLT_SAT 0x2D\n"
-".emtcode F_SUB 0x2E\n"
-".emtcode F_SUB_SAT 0x2F\n"
-".emtcode F_XPD 0x30\n"
-".emtcode F_XPD_SAT 0x31\n"
-".emtcode F_CMP 0x32\n"
-".emtcode F_CMP_SAT 0x33\n"
-".emtcode F_LRP 0x34\n"
-".emtcode F_LRP_SAT 0x35\n"
-".emtcode F_MAD 0x36\n"
-".emtcode F_MAD_SAT 0x37\n"
-".emtcode F_SWZ 0x38\n"
-".emtcode F_SWZ_SAT 0x39\n"
-".emtcode F_TEX 0x3A\n"
-".emtcode F_TEX_SAT 0x3B\n"
-".emtcode F_TXB 0x3C\n"
-".emtcode F_TXB_SAT 0x3D\n"
-".emtcode F_TXP 0x3E\n"
-".emtcode F_TXP_SAT 0x3F\n"
-".emtcode F_KIL 0x40\n"
-".emtcode V_ARL 0x01\n"
-".emtcode V_ABS 0x02\n"
-".emtcode V_FLR 0x03\n"
-".emtcode V_FRC 0x04\n"
-".emtcode V_LIT 0x05\n"
-".emtcode V_MOV 0x06\n"
-".emtcode V_EX2 0x07\n"
-".emtcode V_EXP 0x08\n"
-".emtcode V_LG2 0x09\n"
-".emtcode V_LOG 0x0A\n"
-".emtcode V_RCP 0x0B\n"
-".emtcode V_RSQ 0x0C\n"
-".emtcode V_POW 0x0D\n"
-".emtcode V_ADD 0x0E\n"
-".emtcode V_DP3 0x0F\n"
-".emtcode V_DP4 0x10\n"
-".emtcode V_DPH 0x11\n"
-".emtcode V_DST 0x12\n"
-".emtcode V_MAX 0x13\n"
-".emtcode V_MIN 0x14\n"
-".emtcode V_MUL 0x15\n"
-".emtcode V_SGE 0x16\n"
-".emtcode V_SLT 0x17\n"
-".emtcode V_SUB 0x18\n"
-".emtcode V_XPD 0x19\n"
-".emtcode V_MAD 0x1A\n"
-".emtcode V_SWZ 0x1B\n"
+".emtcode OP_ALU_INST 0x00\n"
+".emtcode OP_TEX_INST 0x01\n"
+".emtcode OP_ALU_VECTOR 0x06\n"
+".emtcode OP_ALU_SCALAR 0x03\n"
+".emtcode OP_ALU_BINSC 0x02\n"
+".emtcode OP_ALU_BIN 0x01\n"
+".emtcode OP_ALU_TRI 0x05\n"
+".emtcode OP_ALU_SWZ 0x04\n"
+".emtcode OP_TEX_SAMPLE 0x07\n"
+".emtcode OP_TEX_KIL 0x08\n"
+".emtcode OP_ALU_ARL 0x00\n"
+".emtcode OP_ABS 0x00\n"
+".emtcode OP_ABS_SAT 0x1B\n"
+".emtcode OP_FLR 0x09\n"
+".emtcode OP_FLR_SAT 0x26\n"
+".emtcode OP_FRC 0x0A\n"
+".emtcode OP_FRC_SAT 0x27\n"
+".emtcode OP_LIT 0x0C\n"
+".emtcode OP_LIT_SAT 0x2A\n"
+".emtcode OP_MOV 0x11\n"
+".emtcode OP_MOV_SAT 0x30\n"
+".emtcode OP_COS 0x1F\n"
+".emtcode OP_COS_SAT 0x20\n"
+".emtcode OP_EX2 0x07\n"
+".emtcode OP_EX2_SAT 0x25\n"
+".emtcode OP_LG2 0x0B\n"
+".emtcode OP_LG2_SAT 0x29\n"
+".emtcode OP_RCP 0x14\n"
+".emtcode OP_RCP_SAT 0x33\n"
+".emtcode OP_RSQ 0x15\n"
+".emtcode OP_RSQ_SAT 0x34\n"
+".emtcode OP_SIN 0x38\n"
+".emtcode OP_SIN_SAT 0x39\n"
+".emtcode OP_SCS 0x35\n"
+".emtcode OP_SCS_SAT 0x36\n"
+".emtcode OP_POW 0x13\n"
+".emtcode OP_POW_SAT 0x32\n"
+".emtcode OP_ADD 0x01\n"
+".emtcode OP_ADD_SAT 0x1C\n"
+".emtcode OP_DP3 0x03\n"
+".emtcode OP_DP3_SAT 0x21\n"
+".emtcode OP_DP4 0x04\n"
+".emtcode OP_DP4_SAT 0x22\n"
+".emtcode OP_DPH 0x05\n"
+".emtcode OP_DPH_SAT 0x23\n"
+".emtcode OP_DST 0x06\n"
+".emtcode OP_DST_SAT 0x24\n"
+".emtcode OP_MAX 0x0F\n"
+".emtcode OP_MAX_SAT 0x2E\n"
+".emtcode OP_MIN 0x10\n"
+".emtcode OP_MIN_SAT 0x2F\n"
+".emtcode OP_MUL 0x12\n"
+".emtcode OP_MUL_SAT 0x31\n"
+".emtcode OP_SGE 0x16\n"
+".emtcode OP_SGE_SAT 0x37\n"
+".emtcode OP_SLT 0x17\n"
+".emtcode OP_SLT_SAT 0x3A\n"
+".emtcode OP_SUB 0x18\n"
+".emtcode OP_SUB_SAT 0x3B\n"
+".emtcode OP_XPD 0x1A\n"
+".emtcode OP_XPD_SAT 0x43\n"
+".emtcode OP_CMP 0x1D\n"
+".emtcode OP_CMP_SAT 0x1E\n"
+".emtcode OP_LRP 0x2B\n"
+".emtcode OP_LRP_SAT 0x2C\n"
+".emtcode OP_MAD 0x0E\n"
+".emtcode OP_MAD_SAT 0x2D\n"
+".emtcode OP_SWZ 0x19\n"
+".emtcode OP_SWZ_SAT 0x3C\n"
+".emtcode OP_TEX 0x3D\n"
+".emtcode OP_TEX_SAT 0x3E\n"
+".emtcode OP_TXB 0x3F\n"
+".emtcode OP_TXB_SAT 0x40\n"
+".emtcode OP_TXP 0x41\n"
+".emtcode OP_TXP_SAT 0x42\n"
+".emtcode OP_KIL 0x28\n"
+".emtcode OP_ARL 0x02\n"
+".emtcode OP_EXP 0x08\n"
+".emtcode OP_LOG 0x0D\n"
".emtcode FRAGMENT_ATTRIB_COLOR 0x01\n"
".emtcode FRAGMENT_ATTRIB_TEXCOORD 0x02\n"
".emtcode FRAGMENT_ATTRIB_FOGCOORD 0x03\n"
".errtext MISSING_FRACTION_OR_EXPONENT \"1051: missing fraction part or exponent\"\n"
".errtext MISSING_DOT_OR_EXPONENT \"1052: missing '.' or exponent\"\n"
".errtext EXPONENT_VALUE_EXPECTED \"1053: exponent value expected\"\n"
+".errtext INTEGER_OUT_OF_RANGE \"1054: integer value out of range\"\n"
"program\n"
" programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;\n"
"programs\n"
"vp_statement_2\n"
" vp_namingStatement .emit DECLARATION .and semicolon;\n"
"fp_instruction\n"
-" ALUInstruction .emit F_ALU_INST .or\n"
-" TexInstruction .emit F_TEX_INST;\n"
+" ALUInstruction .emit OP_ALU_INST .or\n"
+" TexInstruction .emit OP_TEX_INST;\n"
"vp_instruction\n"
-" ARL_instruction .emit V_GEN_ARL .or\n"
-" vp_VECTORop_instruction .emit V_GEN_VECTOR .or\n"
-" vp_SCALARop_instruction .emit V_GEN_SCALAR .or\n"
-" vp_BINSCop_instruction .emit V_GEN_BINSC .or\n"
-" vp_BINop_instruction .emit V_GEN_BIN .or\n"
-" vp_TRIop_instruction .emit V_GEN_TRI .or\n"
-" vp_SWZ_instruction .emit V_GEN_SWZ;\n"
+" ARL_instruction .emit OP_ALU_ARL .or\n"
+" vp_VECTORop_instruction .emit OP_ALU_VECTOR .or\n"
+" vp_SCALARop_instruction .emit OP_ALU_SCALAR .or\n"
+" vp_BINSCop_instruction .emit OP_ALU_BINSC .or\n"
+" vp_BINop_instruction .emit OP_ALU_BIN .or\n"
+" vp_TRIop_instruction .emit OP_ALU_TRI .or\n"
+" vp_SWZ_instruction .emit OP_ALU_SWZ;\n"
"ALUInstruction\n"
-" fp_VECTORop_instruction .emit F_ALU_VECTOR .or\n"
-" fp_SCALARop_instruction .emit F_ALU_SCALAR .or\n"
-" fp_BINSCop_instruction .emit F_ALU_BINSC .or\n"
-" fp_BINop_instruction .emit F_ALU_BIN .or\n"
-" fp_TRIop_instruction .emit F_ALU_TRI .or\n"
-" fp_SWZ_instruction .emit F_ALU_SWZ;\n"
+" fp_VECTORop_instruction .emit OP_ALU_VECTOR .or\n"
+" fp_SCALARop_instruction .emit OP_ALU_SCALAR .or\n"
+" fp_BINSCop_instruction .emit OP_ALU_BINSC .or\n"
+" fp_BINop_instruction .emit OP_ALU_BIN .or\n"
+" fp_TRIop_instruction .emit OP_ALU_TRI .or\n"
+" fp_SWZ_instruction .emit OP_ALU_SWZ;\n"
"TexInstruction\n"
-" SAMPLE_instruction .emit F_TEX_SAMPLE .or\n"
-" KIL_instruction .emit F_TEX_KIL;\n"
+" SAMPLE_instruction .emit OP_TEX_SAMPLE .or\n"
+" KIL_instruction .emit OP_TEX_KIL;\n"
"ARL_instruction\n"
-" \"ARL\" .emit V_ARL .and space .and maskedAddrReg .and comma .and vp_scalarSrcReg;\n"
+" \"ARL\" .emit OP_ARL .and space .and maskedAddrReg .and comma .and vp_scalarSrcReg;\n"
"fp_VECTORop_instruction\n"
" fp_VECTORop .and space .and fp_maskedDstReg .and comma .and vectorSrcReg;\n"
"vp_VECTORop_instruction\n"
" vp_VECTORop .and space .and vp_maskedDstReg .and comma .and swizzleSrcReg;\n"
"fp_VECTORop\n"
-" \"ABS\" .emit F_ABS .or \"ABS_SAT\" .emit F_ABS_SAT .or\n"
-" \"FLR\" .emit F_FLR .or \"FLR_SAT\" .emit F_FLR_SAT .or\n"
-" \"FRC\" .emit F_FRC .or \"FRC_SAT\" .emit F_FRC_SAT .or\n"
-" \"LIT\" .emit F_LIT .or \"LIT_SAT\" .emit F_LIT_SAT .or\n"
-" \"MOV\" .emit F_MOV .or \"MOV_SAT\" .emit F_MOV_SAT;\n"
+" \"ABS\" .emit OP_ABS .or \"ABS_SAT\" .emit OP_ABS_SAT .or\n"
+" \"FLR\" .emit OP_FLR .or \"FLR_SAT\" .emit OP_FLR_SAT .or\n"
+" \"FRC\" .emit OP_FRC .or \"FRC_SAT\" .emit OP_FRC_SAT .or\n"
+" \"LIT\" .emit OP_LIT .or \"LIT_SAT\" .emit OP_LIT_SAT .or\n"
+" \"MOV\" .emit OP_MOV .or \"MOV_SAT\" .emit OP_MOV_SAT;\n"
"vp_VECTORop\n"
-" \"ABS\" .emit V_ABS .or\n"
-" \"FLR\" .emit V_FLR .or\n"
-" \"FRC\" .emit V_FRC .or\n"
-" \"LIT\" .emit V_LIT .or\n"
-" \"MOV\" .emit V_MOV;\n"
+" \"ABS\" .emit OP_ABS .or\n"
+" \"FLR\" .emit OP_FLR .or\n"
+" \"FRC\" .emit OP_FRC .or\n"
+" \"LIT\" .emit OP_LIT .or\n"
+" \"MOV\" .emit OP_MOV;\n"
"fp_SCALARop_instruction\n"
" fp_SCALARop .and space .and fp_maskedDstReg .and comma .and fp_scalarSrcReg;\n"
"vp_SCALARop_instruction\n"
" vp_SCALARop .and space .and vp_maskedDstReg .and comma .and vp_scalarSrcReg;\n"
"fp_SCALARop\n"
-" \"COS\" .emit F_COS .or \"COS_SAT\" .emit F_COS_SAT .or\n"
-" \"EX2\" .emit F_EX2 .or \"EX2_SAT\" .emit F_EX2_SAT .or\n"
-" \"LG2\" .emit F_LG2 .or \"LG2_SAT\" .emit F_LG2_SAT .or\n"
-" \"RCP\" .emit F_RCP .or \"RCP_SAT\" .emit F_RCP_SAT .or\n"
-" \"RSQ\" .emit F_RSQ .or \"RSQ_SAT\" .emit F_RSQ_SAT .or\n"
-" \"SIN\" .emit F_SIN .or \"SIN_SAT\" .emit F_SIN_SAT .or\n"
-" \"SCS\" .emit F_SCS .or \"SCS_SAT\" .emit F_SCS_SAT;\n"
+" \"COS\" .emit OP_COS .or \"COS_SAT\" .emit OP_COS_SAT .or\n"
+" \"EX2\" .emit OP_EX2 .or \"EX2_SAT\" .emit OP_EX2_SAT .or\n"
+" \"LG2\" .emit OP_LG2 .or \"LG2_SAT\" .emit OP_LG2_SAT .or\n"
+" \"RCP\" .emit OP_RCP .or \"RCP_SAT\" .emit OP_RCP_SAT .or\n"
+" \"RSQ\" .emit OP_RSQ .or \"RSQ_SAT\" .emit OP_RSQ_SAT .or\n"
+" \"SIN\" .emit OP_SIN .or \"SIN_SAT\" .emit OP_SIN_SAT .or\n"
+" \"SCS\" .emit OP_SCS .or \"SCS_SAT\" .emit OP_SCS_SAT;\n"
"vp_SCALARop\n"
-" \"EX2\" .emit V_EX2 .or\n"
-" \"EXP\" .emit V_EXP .or\n"
-" \"LG2\" .emit V_LG2 .or\n"
-" \"LOG\" .emit V_LOG .or\n"
-" \"RCP\" .emit V_RCP .or\n"
-" \"RSQ\" .emit V_RSQ;\n"
+" \"EX2\" .emit OP_EX2 .or\n"
+" \"EXP\" .emit OP_EXP .or\n"
+" \"LG2\" .emit OP_LG2 .or\n"
+" \"LOG\" .emit OP_LOG .or\n"
+" \"RCP\" .emit OP_RCP .or\n"
+" \"RSQ\" .emit OP_RSQ;\n"
"fp_BINSCop_instruction\n"
" fp_BINSCop .and space .and fp_maskedDstReg .and comma .and fp_scalarSrcReg .and comma .and\n"
" fp_scalarSrcReg;\n"
" vp_BINSCop .and space .and vp_maskedDstReg .and comma .and vp_scalarSrcReg .and comma .and\n"
" vp_scalarSrcReg;\n"
"fp_BINSCop\n"
-" \"POW\" .emit F_POW .or \"POW_SAT\" .emit F_POW_SAT;\n"
+" \"POW\" .emit OP_POW .or \"POW_SAT\" .emit OP_POW_SAT;\n"
"vp_BINSCop\n"
-" \"POW\" .emit V_POW;\n"
+" \"POW\" .emit OP_POW;\n"
"fp_BINop_instruction\n"
" fp_BINop .and space .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and\n"
" vectorSrcReg;\n"
" vp_BINop .and space .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and\n"
" swizzleSrcReg;\n"
"fp_BINop\n"
-" \"ADD\" .emit F_ADD .or \"ADD_SAT\" .emit F_ADD_SAT .or\n"
-" \"DP3\" .emit F_DP3 .or \"DP3_SAT\" .emit F_DP3_SAT .or\n"
-" \"DP4\" .emit F_DP4 .or \"DP4_SAT\" .emit F_DP4_SAT .or\n"
-" \"DPH\" .emit F_DPH .or \"DPH_SAT\" .emit F_DPH_SAT .or\n"
-" \"DST\" .emit F_DST .or \"DST_SAT\" .emit F_DST_SAT .or\n"
-" \"MAX\" .emit F_MAX .or \"MAX_SAT\" .emit F_MAX_SAT .or\n"
-" \"MIN\" .emit F_MIN .or \"MIN_SAT\" .emit F_MIN_SAT .or\n"
-" \"MUL\" .emit F_MUL .or \"MUL_SAT\" .emit F_MUL_SAT .or\n"
-" \"SGE\" .emit F_SGE .or \"SGE_SAT\" .emit F_SGE_SAT .or\n"
-" \"SLT\" .emit F_SLT .or \"SLT_SAT\" .emit F_SLT_SAT .or\n"
-" \"SUB\" .emit F_SUB .or \"SUB_SAT\" .emit F_SUB_SAT .or\n"
-" \"XPD\" .emit F_XPD .or \"XPD_SAT\" .emit F_XPD_SAT;\n"
+" \"ADD\" .emit OP_ADD .or \"ADD_SAT\" .emit OP_ADD_SAT .or\n"
+" \"DP3\" .emit OP_DP3 .or \"DP3_SAT\" .emit OP_DP3_SAT .or\n"
+" \"DP4\" .emit OP_DP4 .or \"DP4_SAT\" .emit OP_DP4_SAT .or\n"
+" \"DPH\" .emit OP_DPH .or \"DPH_SAT\" .emit OP_DPH_SAT .or\n"
+" \"DST\" .emit OP_DST .or \"DST_SAT\" .emit OP_DST_SAT .or\n"
+" \"MAX\" .emit OP_MAX .or \"MAX_SAT\" .emit OP_MAX_SAT .or\n"
+" \"MIN\" .emit OP_MIN .or \"MIN_SAT\" .emit OP_MIN_SAT .or\n"
+" \"MUL\" .emit OP_MUL .or \"MUL_SAT\" .emit OP_MUL_SAT .or\n"
+" \"SGE\" .emit OP_SGE .or \"SGE_SAT\" .emit OP_SGE_SAT .or\n"
+" \"SLT\" .emit OP_SLT .or \"SLT_SAT\" .emit OP_SLT_SAT .or\n"
+" \"SUB\" .emit OP_SUB .or \"SUB_SAT\" .emit OP_SUB_SAT .or\n"
+" \"XPD\" .emit OP_XPD .or \"XPD_SAT\" .emit OP_XPD_SAT;\n"
"vp_BINop\n"
-" \"ADD\" .emit V_ADD .or\n"
-" \"DP3\" .emit V_DP3 .or\n"
-" \"DP4\" .emit V_DP4 .or\n"
-" \"DPH\" .emit V_DPH .or\n"
-" \"DST\" .emit V_DST .or\n"
-" \"MAX\" .emit V_MAX .or\n"
-" \"MIN\" .emit V_MIN .or\n"
-" \"MUL\" .emit V_MUL .or\n"
-" \"SGE\" .emit V_SGE .or\n"
-" \"SLT\" .emit V_SLT .or\n"
-" \"SUB\" .emit V_SUB .or\n"
-" \"XPD\" .emit V_XPD;\n"
+" \"ADD\" .emit OP_ADD .or\n"
+" \"DP3\" .emit OP_DP3 .or\n"
+" \"DP4\" .emit OP_DP4 .or\n"
+" \"DPH\" .emit OP_DPH .or\n"
+" \"DST\" .emit OP_DST .or\n"
+" \"MAX\" .emit OP_MAX .or\n"
+" \"MIN\" .emit OP_MIN .or\n"
+" \"MUL\" .emit OP_MUL .or\n"
+" \"SGE\" .emit OP_SGE .or\n"
+" \"SLT\" .emit OP_SLT .or\n"
+" \"SUB\" .emit OP_SUB .or\n"
+" \"XPD\" .emit OP_XPD;\n"
"fp_TRIop_instruction\n"
" fp_TRIop .and space .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and\n"
" vectorSrcReg .and comma .and vectorSrcReg;\n"
" vp_TRIop .and space .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and\n"
" swizzleSrcReg .and comma .and swizzleSrcReg;\n"
"fp_TRIop\n"
-" \"CMP\" .emit F_CMP .or \"CMP_SAT\" .emit F_CMP_SAT .or\n"
-" \"LRP\" .emit F_LRP .or \"LRP_SAT\" .emit F_LRP_SAT .or\n"
-" \"MAD\" .emit F_MAD .or \"MAD_SAT\" .emit F_MAD_SAT;\n"
+" \"CMP\" .emit OP_CMP .or \"CMP_SAT\" .emit OP_CMP_SAT .or\n"
+" \"LRP\" .emit OP_LRP .or \"LRP_SAT\" .emit OP_LRP_SAT .or\n"
+" \"MAD\" .emit OP_MAD .or \"MAD_SAT\" .emit OP_MAD_SAT;\n"
"vp_TRIop\n"
-" \"MAD\" .emit V_MAD;\n"
+" \"MAD\" .emit OP_MAD;\n"
"fp_SWZ_instruction\n"
" SWZop .and space .and fp_maskedDstReg .and comma .and fp_srcReg .and comma .and\n"
" fp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;\n"
"vp_SWZ_instruction\n"
-" \"SWZ\" .emit V_SWZ .and space .and vp_maskedDstReg .and comma .and vp_srcReg .and comma .and\n"
+" \"SWZ\" .emit OP_SWZ .and space .and vp_maskedDstReg .and comma .and vp_srcReg .and comma .and\n"
" vp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;\n"
"SWZop\n"
-" \"SWZ\" .emit F_SWZ .or \"SWZ_SAT\" .emit F_SWZ_SAT;\n"
+" \"SWZ\" .emit OP_SWZ .or \"SWZ_SAT\" .emit OP_SWZ_SAT;\n"
"SAMPLE_instruction\n"
" SAMPLEop .and space .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and\n"
" texImageUnit .and comma .and texTarget .error TEX_TARGET_EXPECTED;\n"
"SAMPLEop\n"
-" \"TEX\" .emit F_TEX .or \"TEX_SAT\" .emit F_TEX_SAT .or\n"
-" \"TXB\" .emit F_TXB .or \"TXB_SAT\" .emit F_TXB_SAT .or\n"
-" \"TXP\" .emit F_TXP .or \"TXP_SAT\" .emit F_TXP_SAT;\n"
+" \"TEX\" .emit OP_TEX .or \"TEX_SAT\" .emit OP_TEX_SAT .or\n"
+" \"TXB\" .emit OP_TXB .or \"TXB_SAT\" .emit OP_TXB_SAT .or\n"
+" \"TXP\" .emit OP_TXP .or \"TXP_SAT\" .emit OP_TXP_SAT;\n"
"KIL_instruction\n"
-" \"KIL\" .emit F_KIL .and space .and vectorSrcReg;\n"
+" \"KIL\" .emit OP_KIL .and space .and vectorSrcReg;\n"
"texImageUnit\n"
" \"texture\" .error TEXTURE_EXPECTED .and optTexImageUnitNum;\n"
"texTarget\n"
"progParamArrayMem\n"
" progParamArrayAbs .or progParamArrayRel;\n"
"progParamArrayAbs\n"
-" integer .emit ARRAY_INDEX_ABSOLUTE;\n"
+" integer_ne .emit ARRAY_INDEX_ABSOLUTE;\n"
"progParamArrayRel\n"
" addrReg .emit ARRAY_INDEX_RELATIVE .and addrComponent .and addrRegRelOffset;\n"
"addrRegRelOffset\n"
" \"XPD\" .or \"program\" .or \"result\" .or \"state\" .or \"vertex\";\n"
"integer\n"
" integer_ne .error INTEGER_EXPECTED;\n"
+"zero\n"
+" '0';\n"
+"leading_zeroes\n"
+" .loop zero;\n"
+"no_digit\n"
+" no_digit_1 .or .true;\n"
+"no_digit_1\n"
+" digit10 .and .false .error INTEGER_OUT_OF_RANGE;\n"
+"all_zeroes\n"
+" all_zeroes_1 .or no_digit_1;\n"
+"all_zeroes_1\n"
+" '0' .and .loop zero .and no_digit;\n"
"integer_0_3\n"
-" integer;\n"
+" integer_0_3_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;\n"
+"integer_0_3_1\n"
+" integer_0_3_2 .or all_zeroes .emit '0';\n"
+"integer_0_3_2 \n"
+" leading_zeroes .and '1'-'3' .emit * .and no_digit;\n"
"integer_0_63\n"
-" integer;\n"
+" integer_0_63_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;\n"
+"integer_0_63_1\n"
+" integer_0_63_2 .or integer_0_63_3 .or integer_0_63_4 .or integer_0_63_5 .or\n"
+" all_zeroes .emit '0';\n"
+"integer_0_63_2 \n"
+" leading_zeroes .and '7'-'9' .emit * .and no_digit;\n"
+"integer_0_63_3 \n"
+" leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;\n"
+"integer_0_63_4 \n"
+" leading_zeroes .and '6' .emit * .and '0'-'3' .emit * .and no_digit;\n"
+"integer_0_63_5 \n"
+" leading_zeroes .and '1'-'6' .emit * .and no_digit;\n"
"integer_0_64\n"
-" integer;\n"
+" integer_0_64_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;\n"
+"integer_0_64_1\n"
+" integer_0_64_2 .or integer_0_64_3 .or integer_0_64_4 .or integer_0_64_5 .or\n"
+" all_zeroes .emit '0';\n"
+"integer_0_64_2 \n"
+" leading_zeroes .and '7'-'9' .emit * .and no_digit;\n"
+"integer_0_64_3 \n"
+" leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;\n"
+"integer_0_64_4 \n"
+" leading_zeroes .and '6' .emit * .and '0'-'4' .emit * .and no_digit;\n"
+"integer_0_64_5 \n"
+" leading_zeroes .and '1'-'6' .emit * .and no_digit;\n"
"optional_space\n"
" space .or .true;\n"
"space\n"
"float_5\n"
" exponent .emit 0x00;\n"
"float_legacy\n"
-" integer_ne .and .true .emit 0x00 .emit '1' .emit 0x00 .emit $;\n"
+" integer_ne .and .true .emit 0x00 .emit 0x00;\n"
"integer_ne\n"
" integer_ne_1 .and .true .emit 0x00 .emit $;\n"
"integer_ne_1\n"
"optional_integer\n"
" integer_ne .or .true .emit 0x00;\n"
"optional_exponent\n"
-" exponent .or .true .emit '1' .emit 0x00 .emit $;\n"
+" exponent .or .true .emit 0x00;\n"
"exponent\n"
" exponent_1 .and optional_sign_ne .and integer_ne .error EXPONENT_VALUE_EXPECTED;\n"
"exponent_1\n"