1 | /* definitions */ |
---|
2 | digit [0-9] |
---|
3 | char [a-zA-Z_.] |
---|
4 | alphanum [0-9a-zA-Z_] |
---|
5 | %option prefix="ts10_" |
---|
6 | %{ /* code to be included */ |
---|
7 | #include <stdlib.h> |
---|
8 | #include "ts1.0_inst.h" |
---|
9 | #include "ts1.0_inst_list.h" |
---|
10 | #include "_ts1.0_parser.h" |
---|
11 | #ifdef _WIN32 |
---|
12 | # include <windows.h> |
---|
13 | #endif |
---|
14 | |
---|
15 | #if defined(__APPLE__) && defined(__GNUC__) |
---|
16 | #include <OpenGL/gl.h> |
---|
17 | #else |
---|
18 | #include <GL/gl.h> |
---|
19 | #endif |
---|
20 | |
---|
21 | #include "nvparse_errors.h" |
---|
22 | #include "nvparse_externs.h" |
---|
23 | |
---|
24 | |
---|
25 | #define YY_INPUT(buf,result,max_size) \ |
---|
26 | { \ |
---|
27 | int c = *myin++; \ |
---|
28 | result = (c == 0) ? YY_NULL : (buf[0] = c, 1); \ |
---|
29 | } |
---|
30 | |
---|
31 | #define YY_ALWAYS_INTERACTIVE 1 |
---|
32 | |
---|
33 | %} |
---|
34 | /* end of definitions */ |
---|
35 | %% |
---|
36 | |
---|
37 | \/\* { |
---|
38 | A: |
---|
39 | switch (yyinput()) { |
---|
40 | case '*': goto B; |
---|
41 | case 0: errors.set("end-of-file in comment", line_number); break; |
---|
42 | case '\n': line_number++; |
---|
43 | default: goto A; |
---|
44 | } |
---|
45 | B: |
---|
46 | switch (yyinput()) { |
---|
47 | case '*': goto B; |
---|
48 | case '/': break; |
---|
49 | case 0: errors.set("end-of-file in comment", line_number); break; |
---|
50 | case '\n': line_number++; |
---|
51 | default: goto A; |
---|
52 | } |
---|
53 | } |
---|
54 | |
---|
55 | \/\/ { |
---|
56 | char ch; |
---|
57 | while ((ch = yyinput()) != '\n'); |
---|
58 | if (ch == '\n') line_number++; |
---|
59 | } |
---|
60 | |
---|
61 | \# { |
---|
62 | char ch; |
---|
63 | while ((ch = yyinput()) != '\n'); |
---|
64 | if (ch == '\n') line_number++; |
---|
65 | } |
---|
66 | |
---|
67 | \( return(openParen); |
---|
68 | \) return(closeParen); |
---|
69 | ; return(semicolon); |
---|
70 | , return(comma); |
---|
71 | |
---|
72 | !!TS1\.0 { /* eat header */ } |
---|
73 | |
---|
74 | tex0 { |
---|
75 | ts10_lval.fval = (float)0; |
---|
76 | return(texVariable); |
---|
77 | } |
---|
78 | |
---|
79 | tex1 { |
---|
80 | ts10_lval.fval = (float)1; |
---|
81 | return(texVariable); |
---|
82 | } |
---|
83 | |
---|
84 | tex2 { |
---|
85 | ts10_lval.fval = (float)2; |
---|
86 | return(texVariable); |
---|
87 | } |
---|
88 | |
---|
89 | expand return(expandString); |
---|
90 | |
---|
91 | GEQUAL_TO_ZERO { |
---|
92 | ts10_lval.fval = (float)GL_GEQUAL; |
---|
93 | return (gequal); |
---|
94 | } |
---|
95 | |
---|
96 | LESS_THAN_ZERO { |
---|
97 | ts10_lval.fval = (float)GL_LESS; |
---|
98 | return(less); |
---|
99 | } |
---|
100 | |
---|
101 | nop return(nop); |
---|
102 | texture_1d return(texture_1d); |
---|
103 | texture_2d return(texture_2d); |
---|
104 | texture_rectangle return(texture_rectangle); |
---|
105 | texture_3d return(texture_3d); |
---|
106 | texture_cube_map return(texture_cube_map); |
---|
107 | cull_fragment return(cull_fragment); |
---|
108 | pass_through return(pass_through); |
---|
109 | offset_2d_scale return(offset_2d_scale); |
---|
110 | offset_2d return(offset_2d); |
---|
111 | offset_rectangle_scale return(offset_rectangle_scale); |
---|
112 | offset_rectangle return(offset_rectangle); |
---|
113 | dependent_ar return(dependent_ar); |
---|
114 | dependent_gb return(dependent_gb); |
---|
115 | |
---|
116 | dot_product_2d_1of2 return(dot_product_2d_1of2); |
---|
117 | dot_product_2d_2of2 return(dot_product_2d_2of2); |
---|
118 | |
---|
119 | dot_product_rectangle_1of2 return(dot_product_rectangle_1of2); |
---|
120 | dot_product_rectangle_2of2 return(dot_product_rectangle_2of2); |
---|
121 | |
---|
122 | dot_product_depth_replace_1of2 return(dot_product_depth_replace_1of2); |
---|
123 | dot_product_depth_replace_2of2 return(dot_product_depth_replace_2of2); |
---|
124 | |
---|
125 | dot_product_3d_1of3 return(dot_product_3d_1of3); |
---|
126 | dot_product_3d_2of3 return(dot_product_3d_2of3); |
---|
127 | dot_product_3d_3of3 return(dot_product_3d_3of3); |
---|
128 | |
---|
129 | dot_product_cube_map_1of3 return(dot_product_cube_map_1of3); |
---|
130 | dot_product_cube_map_2of3 return(dot_product_cube_map_2of3); |
---|
131 | dot_product_cube_map_3of3 return(dot_product_cube_map_3of3); |
---|
132 | |
---|
133 | dot_product_reflect_cube_map_eye_from_qs_1of3 return(dot_product_reflect_cube_map_eye_from_qs_1of3); |
---|
134 | dot_product_reflect_cube_map_eye_from_qs_2of3 return(dot_product_reflect_cube_map_eye_from_qs_2of3); |
---|
135 | dot_product_reflect_cube_map_eye_from_qs_3of3 return(dot_product_reflect_cube_map_eye_from_qs_3of3); |
---|
136 | |
---|
137 | dot_product_reflect_cube_map_const_eye_1of3 return(dot_product_reflect_cube_map_const_eye_1of3); |
---|
138 | dot_product_reflect_cube_map_const_eye_2of3 return(dot_product_reflect_cube_map_const_eye_2of3); |
---|
139 | dot_product_reflect_cube_map_const_eye_3of3 return(dot_product_reflect_cube_map_const_eye_3of3); |
---|
140 | |
---|
141 | dot_product_cube_map_and_reflect_cube_map_eye_from_qs_1of3 return(dot_product_cube_map_and_reflect_cube_map_eye_from_qs_1of3); |
---|
142 | dot_product_cube_map_and_reflect_cube_map_eye_from_qs_2of3 return(dot_product_cube_map_and_reflect_cube_map_eye_from_qs_2of3); |
---|
143 | dot_product_cube_map_and_reflect_cube_map_eye_from_qs_3of3 return(dot_product_cube_map_and_reflect_cube_map_eye_from_qs_3of3); |
---|
144 | |
---|
145 | dot_product_cube_map_and_reflect_cube_map_const_eye_1of3 return(dot_product_cube_map_and_reflect_cube_map_const_eye_1of3); |
---|
146 | dot_product_cube_map_and_reflect_cube_map_const_eye_2of3 return(dot_product_cube_map_and_reflect_cube_map_const_eye_2of3); |
---|
147 | dot_product_cube_map_and_reflect_cube_map_const_eye_3of3 return(dot_product_cube_map_and_reflect_cube_map_const_eye_3of3); |
---|
148 | |
---|
149 | [+-]?[0-9]+\.[0-9]* { |
---|
150 | ts10_lval.fval = (float)atof(yytext); |
---|
151 | return(floatValue); |
---|
152 | } |
---|
153 | |
---|
154 | [+-]?[0-9]*\.[0-9]+ { |
---|
155 | ts10_lval.fval = (float)atof(yytext); |
---|
156 | return(floatValue); |
---|
157 | } |
---|
158 | |
---|
159 | [+-]?[0-9]+ { |
---|
160 | ts10_lval.fval = (float)atof(yytext); |
---|
161 | return(floatValue); |
---|
162 | } |
---|
163 | |
---|
164 | \r*\n { |
---|
165 | line_number++; |
---|
166 | } |
---|
167 | |
---|
168 | [ \t]+ {} |
---|
169 | |
---|
170 | {alphanum}+ { |
---|
171 | errors.set("unrecognized token", line_number); |
---|
172 | } |
---|
173 | |
---|
174 | |
---|
175 | %% |
---|
176 | |
---|
177 | bool ts10_init_more(); |
---|
178 | |
---|
179 | bool ts10_init(char* inputString) |
---|
180 | { |
---|
181 | myin = inputString; |
---|
182 | return ts10_init_more(); |
---|
183 | } |
---|
184 | |
---|
185 | |
---|
186 | #ifndef ts10_wrap |
---|
187 | int ts10_wrap(void) |
---|
188 | { |
---|
189 | return(1); |
---|
190 | } |
---|
191 | #endif |
---|