author | Ryan C. Gordon <icculus@icculus.org> |
Sat, 04 Apr 2009 02:09:48 -0400 | |
changeset 730 | d4fe68d04624 |
parent 724 | e96f140736f0 |
child 731 | a3ce99bdc376 |
permissions | -rw-r--r-- |
709
6fbd0e20b40f
Removed some ANSI C things from the HLSL grammar that shaders don't do.
Ryan C. Gordon <icculus@icculus.org>
parents:
706
diff
changeset
|
1 |
#define __MOJOSHADER_INTERNAL__ 1 |
6fbd0e20b40f
Removed some ANSI C things from the HLSL grammar that shaders don't do.
Ryan C. Gordon <icculus@icculus.org>
parents:
706
diff
changeset
|
2 |
#include "mojoshader_internal.h" |
706
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
3 |
|
709
6fbd0e20b40f
Removed some ANSI C things from the HLSL grammar that shaders don't do.
Ryan C. Gordon <icculus@icculus.org>
parents:
706
diff
changeset
|
4 |
typedef struct Context |
706
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
5 |
{ |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
6 |
Preprocessor *preprocessor; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
7 |
const char *token; // assembler token! |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
8 |
unsigned int tokenlen; // assembler token! |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
9 |
Token tokenval; // assembler token! |
709
6fbd0e20b40f
Removed some ANSI C things from the HLSL grammar that shaders don't do.
Ryan C. Gordon <icculus@icculus.org>
parents:
706
diff
changeset
|
10 |
} Context; |
6fbd0e20b40f
Removed some ANSI C things from the HLSL grammar that shaders don't do.
Ryan C. Gordon <icculus@icculus.org>
parents:
706
diff
changeset
|
11 |
|
716
94a804b54078
Cleaned up HLSL parser tracing.
Ryan C. Gordon <icculus@icculus.org>
parents:
714
diff
changeset
|
12 |
#if DEBUG_COMPILER_PARSER |
94a804b54078
Cleaned up HLSL parser tracing.
Ryan C. Gordon <icculus@icculus.org>
parents:
714
diff
changeset
|
13 |
#define LEMON_SUPPORT_TRACING 1 |
94a804b54078
Cleaned up HLSL parser tracing.
Ryan C. Gordon <icculus@icculus.org>
parents:
714
diff
changeset
|
14 |
#endif |
94a804b54078
Cleaned up HLSL parser tracing.
Ryan C. Gordon <icculus@icculus.org>
parents:
714
diff
changeset
|
15 |
|
709
6fbd0e20b40f
Removed some ANSI C things from the HLSL grammar that shaders don't do.
Ryan C. Gordon <icculus@icculus.org>
parents:
706
diff
changeset
|
16 |
#define __MOJOSHADER_HLSL_COMPILER__ 1 |
714
e8ed66bfff18
Make parser generate a header, to avoid external project build confusion.
Ryan C. Gordon <icculus@icculus.org>
parents:
713
diff
changeset
|
17 |
#include "mojoshader_parser_hlsl.h" |
706
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
18 |
|
730
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
19 |
// This does not check correctness (POSITIONT993842 passes, etc). |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
20 |
static int is_semantic(const Context *ctx) |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
21 |
{ |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
22 |
static const char *names[] = { |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
23 |
"BINORMAL", "BLENDINDICES", "BLENDWEIGHT", |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
24 |
"COLOR", "NORMAL", "POSITION", "POSITIONT", "PSIZE", "TANGENT", |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
25 |
"TEXCOORD", "FOG", "TESSFACTOR", "TEXCOORD", "VFACE", "VPOS", NULL |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
26 |
}; |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
27 |
|
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
28 |
// !!! FIXME: DX10 has SV_* ("System Value Semantics"). |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
29 |
const char **i; |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
30 |
for (i = names; *i; i++) |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
31 |
{ |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
32 |
const char *name = *i; |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
33 |
const size_t namelen = strlen(name); |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
34 |
if (ctx->tokenlen < namelen) |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
35 |
continue; |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
36 |
else if (memcmp(ctx->token, name, namelen) != 0) |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
37 |
continue; |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
38 |
|
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
39 |
for (name += namelen; *name; name++) |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
40 |
{ |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
41 |
if ((*name < '0') || (*name > '9')) |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
42 |
break; |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
43 |
} // for |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
44 |
|
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
45 |
if (*name == '\0') |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
46 |
return 1; |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
47 |
} // for |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
48 |
|
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
49 |
return 0; |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
50 |
} // is_semantic |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
51 |
|
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
52 |
|
706
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
53 |
static int ConvertToLemonToken(const Context *ctx) |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
54 |
{ |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
55 |
switch (ctx->tokenval) |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
56 |
{ |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
57 |
case ((Token) ','): return TOKEN_HLSL_COMMA; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
58 |
case ((Token) '='): return TOKEN_HLSL_ASSIGN; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
59 |
case ((Token) TOKEN_ADDASSIGN): return TOKEN_HLSL_ADDASSIGN; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
60 |
case ((Token) TOKEN_SUBASSIGN): return TOKEN_HLSL_SUBASSIGN; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
61 |
case ((Token) TOKEN_MULTASSIGN): return TOKEN_HLSL_MULASSIGN; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
62 |
case ((Token) TOKEN_DIVASSIGN): return TOKEN_HLSL_DIVASSIGN; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
63 |
case ((Token) TOKEN_MODASSIGN): return TOKEN_HLSL_MODASSIGN; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
64 |
case ((Token) TOKEN_LSHIFTASSIGN): return TOKEN_HLSL_LSHIFTASSIGN; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
65 |
case ((Token) TOKEN_RSHIFTASSIGN): return TOKEN_HLSL_RSHIFTASSIGN; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
66 |
case ((Token) TOKEN_ANDASSIGN): return TOKEN_HLSL_ANDASSIGN; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
67 |
case ((Token) TOKEN_ORASSIGN): return TOKEN_HLSL_ORASSIGN; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
68 |
case ((Token) TOKEN_XORASSIGN): return TOKEN_HLSL_XORASSIGN; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
69 |
case ((Token) '?'): return TOKEN_HLSL_QUESTION; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
70 |
case ((Token) TOKEN_OROR): return TOKEN_HLSL_OROR; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
71 |
case ((Token) TOKEN_ANDAND): return TOKEN_HLSL_ANDAND; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
72 |
case ((Token) '|'): return TOKEN_HLSL_OR; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
73 |
case ((Token) '^'): return TOKEN_HLSL_XOR; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
74 |
case ((Token) '&'): return TOKEN_HLSL_AND; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
75 |
case ((Token) TOKEN_EQL): return TOKEN_HLSL_EQL; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
76 |
case ((Token) TOKEN_NEQ): return TOKEN_HLSL_NEQ; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
77 |
case ((Token) '<'): return TOKEN_HLSL_LT; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
78 |
case ((Token) TOKEN_LEQ): return TOKEN_HLSL_LEQ; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
79 |
case ((Token) '>'): return TOKEN_HLSL_GT; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
80 |
case ((Token) TOKEN_GEQ): return TOKEN_HLSL_GEQ; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
81 |
case ((Token) TOKEN_LSHIFT): return TOKEN_HLSL_LSHIFT; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
82 |
case ((Token) TOKEN_RSHIFT): return TOKEN_HLSL_RSHIFT; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
83 |
case ((Token) '+'): return TOKEN_HLSL_PLUS; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
84 |
case ((Token) '-'): return TOKEN_HLSL_MINUS; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
85 |
case ((Token) '*'): return TOKEN_HLSL_STAR; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
86 |
case ((Token) '/'): return TOKEN_HLSL_SLASH; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
87 |
case ((Token) '%'): return TOKEN_HLSL_PERCENT; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
88 |
case ((Token) '!'): return TOKEN_HLSL_EXCLAMATION; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
89 |
case ((Token) '~'): return TOKEN_HLSL_COMPLEMENT; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
90 |
case ((Token) TOKEN_DECREMENT): return TOKEN_HLSL_MINUSMINUS; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
91 |
case ((Token) TOKEN_INCREMENT): return TOKEN_HLSL_PLUSPLUS; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
92 |
case ((Token) '.'): return TOKEN_HLSL_DOT; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
93 |
case ((Token) '['): return TOKEN_HLSL_LBRACKET; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
94 |
case ((Token) ']'): return TOKEN_HLSL_RBRACKET; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
95 |
case ((Token) '('): return TOKEN_HLSL_LPAREN; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
96 |
case ((Token) ')'): return TOKEN_HLSL_RPAREN; |
721
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
97 |
case ((Token) TOKEN_INT_LITERAL): return TOKEN_HLSL_INT_CONSTANT; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
98 |
case ((Token) TOKEN_FLOAT_LITERAL): return TOKEN_HLSL_FLOAT_CONSTANT; |
706
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
99 |
case ((Token) TOKEN_STRING_LITERAL): return TOKEN_HLSL_STRING_LITERAL; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
100 |
case ((Token) ':'): return TOKEN_HLSL_COLON; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
101 |
case ((Token) ';'): return TOKEN_HLSL_SEMICOLON; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
102 |
case ((Token) '{'): return TOKEN_HLSL_LBRACE; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
103 |
case ((Token) '}'): return TOKEN_HLSL_RBRACE; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
104 |
|
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
105 |
case ((Token) TOKEN_IDENTIFIER): |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
106 |
#define tokencmp(t) ((ctx->tokenlen == strlen(t)) && (memcmp(ctx->token, t, ctx->tokenlen) == 0)) |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
107 |
//case ((Token) ''): return TOKEN_HLSL_TYPECAST |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
108 |
//if (tokencmp("")) return TOKEN_HLSL_TYPE_NAME |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
109 |
//if (tokencmp("...")) return TOKEN_HLSL_ELIPSIS |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
110 |
if (tokencmp("else")) return TOKEN_HLSL_ELSE; |
721
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
111 |
if (tokencmp("inline")) return TOKEN_HLSL_INLINE; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
112 |
if (tokencmp("void")) return TOKEN_HLSL_VOID; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
113 |
if (tokencmp("in")) return TOKEN_HLSL_IN; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
114 |
if (tokencmp("inout")) return TOKEN_HLSL_INOUT; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
115 |
if (tokencmp("out")) return TOKEN_HLSL_OUT; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
116 |
if (tokencmp("uniform")) return TOKEN_HLSL_UNIFORM; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
117 |
if (tokencmp("linear")) return TOKEN_HLSL_LINEAR; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
118 |
if (tokencmp("centroid")) return TOKEN_HLSL_CENTROID; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
119 |
if (tokencmp("nointerpolation")) return TOKEN_HLSL_NOINTERPOLATION; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
120 |
if (tokencmp("noperspective")) return TOKEN_HLSL_NOPERSPECTIVE; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
121 |
if (tokencmp("sample")) return TOKEN_HLSL_SAMPLE; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
122 |
if (tokencmp("struct")) return TOKEN_HLSL_STRUCT; |
706
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
123 |
if (tokencmp("typedef")) return TOKEN_HLSL_TYPEDEF; |
721
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
124 |
if (tokencmp("const")) return TOKEN_HLSL_CONST; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
125 |
if (tokencmp("packoffset")) return TOKEN_HLSL_PACKOFFSET; |
706
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
126 |
if (tokencmp("register")) return TOKEN_HLSL_REGISTER; |
721
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
127 |
if (tokencmp("extern")) return TOKEN_HLSL_EXTERN; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
128 |
if (tokencmp("shared")) return TOKEN_HLSL_SHARED; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
129 |
if (tokencmp("static")) return TOKEN_HLSL_STATIC; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
130 |
if (tokencmp("volatile")) return TOKEN_HLSL_VOLATILE; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
131 |
if (tokencmp("row_major")) return TOKEN_HLSL_ROWMAJOR; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
132 |
if (tokencmp("column_major")) return TOKEN_HLSL_COLUMNMAJOR; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
133 |
if (tokencmp("bool")) return TOKEN_HLSL_BOOL; |
706
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
134 |
if (tokencmp("int")) return TOKEN_HLSL_INT; |
721
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
135 |
if (tokencmp("uint")) return TOKEN_HLSL_UINT; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
136 |
if (tokencmp("half")) return TOKEN_HLSL_HALF; |
706
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
137 |
if (tokencmp("float")) return TOKEN_HLSL_FLOAT; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
138 |
if (tokencmp("double")) return TOKEN_HLSL_DOUBLE; |
721
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
139 |
if (tokencmp("string")) return TOKEN_HLSL_STRING; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
140 |
if (tokencmp("snorm")) return TOKEN_HLSL_SNORM; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
141 |
if (tokencmp("unorm")) return TOKEN_HLSL_UNORM; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
142 |
if (tokencmp("buffer")) return TOKEN_HLSL_BUFFER; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
143 |
if (tokencmp("vector")) return TOKEN_HLSL_VECTOR; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
144 |
if (tokencmp("bool1")) return TOKEN_HLSL_BOOL1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
145 |
if (tokencmp("bool2")) return TOKEN_HLSL_BOOL2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
146 |
if (tokencmp("bool3")) return TOKEN_HLSL_BOOL3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
147 |
if (tokencmp("bool4")) return TOKEN_HLSL_BOOL4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
148 |
if (tokencmp("int1")) return TOKEN_HLSL_INT1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
149 |
if (tokencmp("int2")) return TOKEN_HLSL_INT2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
150 |
if (tokencmp("int3")) return TOKEN_HLSL_INT3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
151 |
if (tokencmp("int4")) return TOKEN_HLSL_INT4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
152 |
if (tokencmp("uint1")) return TOKEN_HLSL_UINT1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
153 |
if (tokencmp("uint2")) return TOKEN_HLSL_UINT2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
154 |
if (tokencmp("uint3")) return TOKEN_HLSL_UINT3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
155 |
if (tokencmp("uint4")) return TOKEN_HLSL_UINT4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
156 |
if (tokencmp("half1")) return TOKEN_HLSL_HALF1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
157 |
if (tokencmp("half2")) return TOKEN_HLSL_HALF2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
158 |
if (tokencmp("half3")) return TOKEN_HLSL_HALF3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
159 |
if (tokencmp("half4")) return TOKEN_HLSL_HALF4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
160 |
if (tokencmp("float1")) return TOKEN_HLSL_FLOAT1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
161 |
if (tokencmp("float2")) return TOKEN_HLSL_FLOAT2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
162 |
if (tokencmp("float3")) return TOKEN_HLSL_FLOAT3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
163 |
if (tokencmp("float4")) return TOKEN_HLSL_FLOAT4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
164 |
if (tokencmp("double1")) return TOKEN_HLSL_DOUBLE1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
165 |
if (tokencmp("double2")) return TOKEN_HLSL_DOUBLE2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
166 |
if (tokencmp("double3")) return TOKEN_HLSL_DOUBLE3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
167 |
if (tokencmp("double4")) return TOKEN_HLSL_DOUBLE4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
168 |
if (tokencmp("matrix")) return TOKEN_HLSL_MATRIX; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
169 |
if (tokencmp("bool1x1")) return TOKEN_HLSL_BOOL1X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
170 |
if (tokencmp("bool1x2")) return TOKEN_HLSL_BOOL1X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
171 |
if (tokencmp("bool1x3")) return TOKEN_HLSL_BOOL1X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
172 |
if (tokencmp("bool1x4")) return TOKEN_HLSL_BOOL1X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
173 |
if (tokencmp("bool2x1")) return TOKEN_HLSL_BOOL2X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
174 |
if (tokencmp("bool2x2")) return TOKEN_HLSL_BOOL2X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
175 |
if (tokencmp("bool2x3")) return TOKEN_HLSL_BOOL2X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
176 |
if (tokencmp("bool2x4")) return TOKEN_HLSL_BOOL2X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
177 |
if (tokencmp("bool3x1")) return TOKEN_HLSL_BOOL3X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
178 |
if (tokencmp("bool3x2")) return TOKEN_HLSL_BOOL3X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
179 |
if (tokencmp("bool3x3")) return TOKEN_HLSL_BOOL3X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
180 |
if (tokencmp("bool3x4")) return TOKEN_HLSL_BOOL3X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
181 |
if (tokencmp("bool4x1")) return TOKEN_HLSL_BOOL4X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
182 |
if (tokencmp("bool4x2")) return TOKEN_HLSL_BOOL4X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
183 |
if (tokencmp("bool4x3")) return TOKEN_HLSL_BOOL4X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
184 |
if (tokencmp("bool4x4")) return TOKEN_HLSL_BOOL4X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
185 |
if (tokencmp("int1x1")) return TOKEN_HLSL_INT1X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
186 |
if (tokencmp("int1x2")) return TOKEN_HLSL_INT1X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
187 |
if (tokencmp("int1x3")) return TOKEN_HLSL_INT1X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
188 |
if (tokencmp("int1x4")) return TOKEN_HLSL_INT1X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
189 |
if (tokencmp("int2x1")) return TOKEN_HLSL_INT2X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
190 |
if (tokencmp("int2x2")) return TOKEN_HLSL_INT2X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
191 |
if (tokencmp("int2x3")) return TOKEN_HLSL_INT2X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
192 |
if (tokencmp("int2x4")) return TOKEN_HLSL_INT2X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
193 |
if (tokencmp("int3x1")) return TOKEN_HLSL_INT3X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
194 |
if (tokencmp("int3x2")) return TOKEN_HLSL_INT3X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
195 |
if (tokencmp("int3x3")) return TOKEN_HLSL_INT3X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
196 |
if (tokencmp("int3x4")) return TOKEN_HLSL_INT3X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
197 |
if (tokencmp("int4x1")) return TOKEN_HLSL_INT4X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
198 |
if (tokencmp("int4x2")) return TOKEN_HLSL_INT4X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
199 |
if (tokencmp("int4x3")) return TOKEN_HLSL_INT4X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
200 |
if (tokencmp("int4x4")) return TOKEN_HLSL_INT4X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
201 |
if (tokencmp("uint1x1")) return TOKEN_HLSL_UINT1X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
202 |
if (tokencmp("uint1x2")) return TOKEN_HLSL_UINT1X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
203 |
if (tokencmp("uint1x3")) return TOKEN_HLSL_UINT1X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
204 |
if (tokencmp("uint1x4")) return TOKEN_HLSL_UINT1X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
205 |
if (tokencmp("uint2x1")) return TOKEN_HLSL_UINT2X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
206 |
if (tokencmp("uint2x2")) return TOKEN_HLSL_UINT2X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
207 |
if (tokencmp("uint2x3")) return TOKEN_HLSL_UINT2X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
208 |
if (tokencmp("uint2x4")) return TOKEN_HLSL_UINT2X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
209 |
if (tokencmp("uint3x1")) return TOKEN_HLSL_UINT3X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
210 |
if (tokencmp("uint3x2")) return TOKEN_HLSL_UINT3X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
211 |
if (tokencmp("uint3x3")) return TOKEN_HLSL_UINT3X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
212 |
if (tokencmp("uint3x4")) return TOKEN_HLSL_UINT3X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
213 |
if (tokencmp("uint4x1")) return TOKEN_HLSL_UINT4X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
214 |
if (tokencmp("uint4x2")) return TOKEN_HLSL_UINT4X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
215 |
if (tokencmp("uint4x3")) return TOKEN_HLSL_UINT4X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
216 |
if (tokencmp("uint4x4")) return TOKEN_HLSL_UINT4X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
217 |
if (tokencmp("half1x1")) return TOKEN_HLSL_HALF1X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
218 |
if (tokencmp("half1x2")) return TOKEN_HLSL_HALF1X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
219 |
if (tokencmp("half1x3")) return TOKEN_HLSL_HALF1X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
220 |
if (tokencmp("half1x4")) return TOKEN_HLSL_HALF1X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
221 |
if (tokencmp("half2x1")) return TOKEN_HLSL_HALF2X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
222 |
if (tokencmp("half2x2")) return TOKEN_HLSL_HALF2X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
223 |
if (tokencmp("half2x3")) return TOKEN_HLSL_HALF2X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
224 |
if (tokencmp("half2x4")) return TOKEN_HLSL_HALF2X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
225 |
if (tokencmp("half3x1")) return TOKEN_HLSL_HALF3X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
226 |
if (tokencmp("half3x2")) return TOKEN_HLSL_HALF3X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
227 |
if (tokencmp("half3x3")) return TOKEN_HLSL_HALF3X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
228 |
if (tokencmp("half3x4")) return TOKEN_HLSL_HALF3X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
229 |
if (tokencmp("half4x1")) return TOKEN_HLSL_HALF4X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
230 |
if (tokencmp("half4x2")) return TOKEN_HLSL_HALF4X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
231 |
if (tokencmp("half4x3")) return TOKEN_HLSL_HALF4X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
232 |
if (tokencmp("half4x4")) return TOKEN_HLSL_HALF4X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
233 |
if (tokencmp("float1x1")) return TOKEN_HLSL_FLOAT1X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
234 |
if (tokencmp("float1x2")) return TOKEN_HLSL_FLOAT1X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
235 |
if (tokencmp("float1x3")) return TOKEN_HLSL_FLOAT1X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
236 |
if (tokencmp("float1x4")) return TOKEN_HLSL_FLOAT1X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
237 |
if (tokencmp("float2x1")) return TOKEN_HLSL_FLOAT2X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
238 |
if (tokencmp("float2x2")) return TOKEN_HLSL_FLOAT2X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
239 |
if (tokencmp("float2x3")) return TOKEN_HLSL_FLOAT2X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
240 |
if (tokencmp("float2x4")) return TOKEN_HLSL_FLOAT2X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
241 |
if (tokencmp("float3x1")) return TOKEN_HLSL_FLOAT3X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
242 |
if (tokencmp("float3x2")) return TOKEN_HLSL_FLOAT3X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
243 |
if (tokencmp("float3x3")) return TOKEN_HLSL_FLOAT3X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
244 |
if (tokencmp("float3x4")) return TOKEN_HLSL_FLOAT3X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
245 |
if (tokencmp("float4x1")) return TOKEN_HLSL_FLOAT4X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
246 |
if (tokencmp("float4x2")) return TOKEN_HLSL_FLOAT4X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
247 |
if (tokencmp("float4x3")) return TOKEN_HLSL_FLOAT4X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
248 |
if (tokencmp("float4x4")) return TOKEN_HLSL_FLOAT4X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
249 |
if (tokencmp("double1x1")) return TOKEN_HLSL_DOUBLE1X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
250 |
if (tokencmp("double1x2")) return TOKEN_HLSL_DOUBLE1X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
251 |
if (tokencmp("double1x3")) return TOKEN_HLSL_DOUBLE1X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
252 |
if (tokencmp("double1x4")) return TOKEN_HLSL_DOUBLE1X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
253 |
if (tokencmp("double2x1")) return TOKEN_HLSL_DOUBLE2X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
254 |
if (tokencmp("double2x2")) return TOKEN_HLSL_DOUBLE2X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
255 |
if (tokencmp("double2x3")) return TOKEN_HLSL_DOUBLE2X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
256 |
if (tokencmp("double2x4")) return TOKEN_HLSL_DOUBLE2X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
257 |
if (tokencmp("double3x1")) return TOKEN_HLSL_DOUBLE3X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
258 |
if (tokencmp("double3x2")) return TOKEN_HLSL_DOUBLE3X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
259 |
if (tokencmp("double3x3")) return TOKEN_HLSL_DOUBLE3X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
260 |
if (tokencmp("double3x4")) return TOKEN_HLSL_DOUBLE3X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
261 |
if (tokencmp("double4x1")) return TOKEN_HLSL_DOUBLE4X1; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
262 |
if (tokencmp("double4x2")) return TOKEN_HLSL_DOUBLE4X2; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
263 |
if (tokencmp("double4x3")) return TOKEN_HLSL_DOUBLE4X3; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
264 |
if (tokencmp("double4x4")) return TOKEN_HLSL_DOUBLE4X4; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
265 |
if (tokencmp("break")) return TOKEN_HLSL_BREAK; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
266 |
if (tokencmp("continue")) return TOKEN_HLSL_CONTINUE; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
267 |
if (tokencmp("discard")) return TOKEN_HLSL_DISCARD; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
268 |
if (tokencmp("return")) return TOKEN_HLSL_RETURN; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
269 |
if (tokencmp("while")) return TOKEN_HLSL_WHILE; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
270 |
if (tokencmp("for")) return TOKEN_HLSL_FOR; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
271 |
if (tokencmp("unroll")) return TOKEN_HLSL_UNROLL; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
272 |
if (tokencmp("loop")) return TOKEN_HLSL_LOOP; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
273 |
if (tokencmp("do")) return TOKEN_HLSL_DO; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
274 |
if (tokencmp("if")) return TOKEN_HLSL_IF; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
275 |
if (tokencmp("branch")) return TOKEN_HLSL_BRANCH; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
276 |
if (tokencmp("flatten")) return TOKEN_HLSL_FLATTEN; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
277 |
if (tokencmp("switch")) return TOKEN_HLSL_SWITCH; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
278 |
if (tokencmp("forcecase")) return TOKEN_HLSL_FORCECASE; |
82d1aec6b549
Rewrote HLSL grammar, mostly from scratch.
Ryan C. Gordon <icculus@icculus.org>
parents:
716
diff
changeset
|
279 |
if (tokencmp("call")) return TOKEN_HLSL_CALL; |
706
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
280 |
if (tokencmp("case")) return TOKEN_HLSL_CASE; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
281 |
if (tokencmp("default")) return TOKEN_HLSL_DEFAULT; |
724
e96f140736f0
Initial work on parsing sampler declarations.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
282 |
if (tokencmp("sampler")) return TOKEN_HLSL_SAMPLER; |
e96f140736f0
Initial work on parsing sampler declarations.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
283 |
if (tokencmp("sampler1D")) return TOKEN_HLSL_SAMPLER1D; |
e96f140736f0
Initial work on parsing sampler declarations.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
284 |
if (tokencmp("sampler2D")) return TOKEN_HLSL_SAMPLER2D; |
e96f140736f0
Initial work on parsing sampler declarations.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
285 |
if (tokencmp("sampler3D")) return TOKEN_HLSL_SAMPLER3D; |
e96f140736f0
Initial work on parsing sampler declarations.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
286 |
if (tokencmp("samplerCUBE")) return TOKEN_HLSL_SAMPLERCUBE; |
e96f140736f0
Initial work on parsing sampler declarations.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
287 |
if (tokencmp("sampler_state")) return TOKEN_HLSL_SAMPLER_STATE; |
e96f140736f0
Initial work on parsing sampler declarations.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
288 |
if (tokencmp("SamplerState")) return TOKEN_HLSL_SAMPLERSTATE; |
e96f140736f0
Initial work on parsing sampler declarations.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
289 |
if (tokencmp("SamplerComparisonState")) return TOKEN_HLSL_SAMPLERCOMPARISONSTATE; |
e96f140736f0
Initial work on parsing sampler declarations.
Ryan C. Gordon <icculus@icculus.org>
parents:
721
diff
changeset
|
290 |
|
706
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
291 |
#undef tokencmp |
730
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
292 |
|
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
293 |
if (is_semantic(ctx)) |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
294 |
return TOKEN_HLSL_SEMANTIC; |
d4fe68d04624
Fixed semantic name parsing in HLSL grammar.
Ryan C. Gordon <icculus@icculus.org>
parents:
724
diff
changeset
|
295 |
|
706
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
296 |
return TOKEN_HLSL_IDENTIFIER; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
297 |
|
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
298 |
case TOKEN_EOI: return 0; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
299 |
case TOKEN_BAD_CHARS: printf("bad chars from lexer\n"); return 0; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
300 |
case TOKEN_PREPROCESSING_ERROR: printf("error from lexer\n"); return 0; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
301 |
default: assert(0 && "unexpected token from lexer\n"); return 0; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
302 |
} // switch |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
303 |
|
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
304 |
return 0; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
305 |
} |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
306 |
|
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
307 |
|
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
308 |
void MOJOSHADER_compile(const char *filename, |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
309 |
const char *source, unsigned int sourcelen, |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
310 |
const MOJOSHADER_preprocessorDefine *defines, |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
311 |
unsigned int define_count, |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
312 |
MOJOSHADER_includeOpen include_open, |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
313 |
MOJOSHADER_includeClose include_close, |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
314 |
MOJOSHADER_malloc m, MOJOSHADER_free f, void *d) |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
315 |
{ |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
316 |
Context ctx; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
317 |
if (m == NULL) m = MOJOSHADER_internal_malloc; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
318 |
if (f == NULL) f = MOJOSHADER_internal_free; |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
319 |
|
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
320 |
ctx.preprocessor = preprocessor_start(filename, source, sourcelen, |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
321 |
include_open, include_close, |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
322 |
defines, define_count, 0, m, f, d); |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
323 |
|
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
324 |
void *pParser = ParseHLSLAlloc(m, d); |
716
94a804b54078
Cleaned up HLSL parser tracing.
Ryan C. Gordon <icculus@icculus.org>
parents:
714
diff
changeset
|
325 |
|
94a804b54078
Cleaned up HLSL parser tracing.
Ryan C. Gordon <icculus@icculus.org>
parents:
714
diff
changeset
|
326 |
#if DEBUG_COMPILER_PARSER |
94a804b54078
Cleaned up HLSL parser tracing.
Ryan C. Gordon <icculus@icculus.org>
parents:
714
diff
changeset
|
327 |
ParseHLSLTrace(stdout, "COMPILER: "); |
94a804b54078
Cleaned up HLSL parser tracing.
Ryan C. Gordon <icculus@icculus.org>
parents:
714
diff
changeset
|
328 |
#endif |
706
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
329 |
|
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
330 |
do { |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
331 |
ctx.token = preprocessor_nexttoken(ctx.preprocessor, |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
332 |
&ctx.tokenlen, |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
333 |
&ctx.tokenval); |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
334 |
ParseHLSL(pParser, ConvertToLemonToken(&ctx), 0, 0); |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
335 |
} while (ctx.tokenval != TOKEN_EOI); |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
336 |
ParseHLSLFree(pParser, f, d); |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
337 |
} |
01a92f30b84f
Added some basic compiler stub stuff, just to get this building at all.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
338 |