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