"L. Spiro Engine"
|
00001 00016 #ifndef __LSG_SHADERSYNTAXNODES_H__ 00017 #define __LSG_SHADERSYNTAXNODES_H__ 00018 00019 #include "../LSGGraphicsLib.h" 00020 00021 00022 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00023 // MACROS 00024 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00025 #ifndef yy 00026 #define yy lsg 00027 #endif // #ifndef yy 00028 #ifdef YYSTYPE 00029 #undef YYSTYPE 00030 #endif // #ifdef YYSTYPE 00031 #define YYSTYPE LSG_SHADER_SYNTAX_NODES 00032 00033 namespace lsg { 00034 00038 enum LSG_NODE { 00039 LSG_N_STRINGCONSTANT, 00040 LSG_N_NUMERICCONSTANT, 00041 LSG_N_IDENTIFIER, 00042 LSG_N_BOOLEAN, 00043 LSG_N_ARRAYACCESS, 00044 LSG_N_POSTFIXINC, 00045 LSG_N_POSTFIXDEC, 00046 LSG_N_PREFIXINC, 00047 LSG_N_PREFIXDEC, 00048 LSG_N_UNARY, 00049 LSG_N_CAST, 00050 LSG_N_MATH, 00051 LSG_N_TERTIARY, 00052 LSG_N_ASSIGNMENT, 00053 LSG_N_COMMA, 00054 LSG_N_INTRINSIC, 00055 LSG_N_ARGLIST, 00056 LSG_N_FUNCTIONCALL, 00057 LSG_N_FIELDSELECT, 00058 LSG_N_CONSTRUCTOR, 00059 LSG_N_EXPRESSIONSTATEMENT, 00060 LSG_N_DECLARATIONSTATEMENT, 00061 LSG_N_SEMANTIC, 00062 LSG_N_TYPESPECIFIERNOPREC, 00063 LSG_N_FULLYSPECIFIEDTYPE, 00064 LSG_N_SINGLEDECL, 00065 LSG_N_INITLIST, 00066 LSG_N_INITLISTWRAP, 00067 LSG_N_STATEMENTLIST, 00068 LSG_N_NEWSCOPESTATEMENT, 00069 LSG_N_BLANKSTATEMENT, 00070 LSG_N_STRUCTDECLARATOR, 00071 LSG_N_STRUCTDECLARATORLIST, 00072 LSG_N_STRUCTDECLARATION, 00073 LSG_N_STRUCTDECLARATIONLIST, 00074 LSG_N_STRUCT, 00075 LSG_N_PARMDECLARATOR, 00076 LSG_N_PARMDECLARATION, 00077 LSG_N_PARMDECLARATIONLIST, 00078 LSG_N_FUNCDECL, 00079 LSG_N_FUNCDEFINITION, 00080 LSG_N_SELECTION, 00081 LSG_N_FORINIT, 00082 LSG_N_WHILE, 00083 LSG_N_DOWHILE, 00084 LSG_N_FOR, 00085 LSG_N_CONTINUE, 00086 LSG_N_BREAK, 00087 LSG_N_RETURN, 00088 LSG_N_DISCARD, 00089 LSG_N_EXTERNALDECLARATIONLIST, 00090 }; 00091 00095 enum LSG_NUM_CONSTANTS { 00096 LSG_NC_SIGNED, 00097 LSG_NC_UNSIGNED, 00098 LSG_NC_FLOATING, 00099 LSG_NC_INVALID, 00100 }; 00101 00105 enum LSG_STORAGE_QUALIFIER { 00106 LSG_SQ_BASEBIT = 16UL, 00107 LSG_SQ_CONST = (1UL << (0UL + LSG_SQ_BASEBIT)), 00108 LSG_SQ_IN = (1UL << (1UL + LSG_SQ_BASEBIT)), 00109 LSG_SQ_OUT = (1UL << (2UL + LSG_SQ_BASEBIT)), 00110 LSG_SQ_INOUT = (LSG_SQ_IN | LSG_SQ_OUT), 00111 LSG_SQ_UNIFORM = (1UL << (3UL + LSG_SQ_BASEBIT)), 00112 00113 LSG_SQ_BITSUSED = 4UL + LSG_SQ_BASEBIT, 00114 LSG_SQ_FORCEDWORD = 0x7FFFFFFF, 00115 }; 00116 00120 enum LSG_INTERPOLATION_QUALIFIER { 00121 LSG_IQ_SMOOTH = (1UL << (0UL + LSG_SQ_BITSUSED)), 00122 LSG_IQ_FLAT = (1UL << (1UL + LSG_SQ_BITSUSED)), 00123 00124 LSG_IQ_BITSUSED = 2UL + LSG_SQ_BITSUSED, 00125 LSG_IQ_FORCEDWORD = 0x7FFFFFFF, 00126 }; 00127 00131 union YYSTYPE { 00132 LSUINT32 ui32StringIndex; // Strings are stored as indices into a master list of shared 00133 // strings. 00134 LSUINT64 ui64Op; // Operators (mainly unary). 00135 struct LSG_NODE_DATA { 00136 LSG_NODE nNodeType; // One of the LSG_N_* constants. 00137 LSUINT32 ui32NodeIndex; // Index of the node within the stack of nodes. 00138 LSUINT32 ui32NodeLine; // Line of the node in the original file. 00139 LSUINT32 ui32NodeFile; // Name of the file. 00140 union LSG_NODE_UNION { 00141 LSUINT32 ui32StringIndex; // Index of a string in the master list of strings. 00142 LSUINT32 ui32IdentifierIndex;// Index of an identifier in the master list of identifiers. 00143 LSUINT64 ui64Const; // Value of unsigned constant numeric. 00144 LSINT64 i64Const; // Value of signed constant numeric. 00145 LSDOUBLE dConst; // Value of floating-point numeric. 00146 LSUINT32 ui32NodeIndex; // Index of a node. Multi-purpose. 00147 LSUINT32 ui32UnaryOp; // Unary operator. 00148 LSUINT64 ui64CastType; // Cast type. 00149 } nuNodeData; // Node data. 00150 union LSG_NODE_UNION_EX { 00151 LSG_NUM_CONSTANTS ncConstantType; // Whether the given numeric constant is signed, unsigned, or floating. 00152 LSUINT32 ui32NodeIndexEx; // Index of a node. Multi-purpose. 00153 } nueNodeDataEx; 00154 union LSG_NODE_UNION_OP { 00155 LSUINT32 ui32Op; // Operator. 00156 LSUINT32 ui32NodeIndex3; // Tertiary expression and initializer index in single declarations. 00157 } nuoOp; 00158 LSUINT32 ui32SingleDeclName; // Index of the identifier in a single declaration or the body of a for (). 00159 LSUINT32 ui32Semantic; // Semantic on declarations. 00160 } ndData; 00161 00162 }; 00163 00164 00165 } // namespace lsg 00166 00167 #endif // __LSG_SHADERSYNTAXNODES_H__