Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/RenderSystems/GL/src/nvparse/ts1.0_tokens.l @ 3

Last change on this file since 3 was 3, checked in by anonymous, 17 years ago

=update

File size: 4.7 KB
Line 
1/* definitions */
2digit    [0-9]
3char     [a-zA-Z_.]
4alphanum [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
67tex0            {
68                            ts10_lval.fval = (float)0;
69                            return(texVariable);
70                        }
71
72tex1            {
73                            ts10_lval.fval = (float)1;
74                            return(texVariable);
75                        }
76
77tex2            {
78                            ts10_lval.fval = (float)2;
79                            return(texVariable);
80                        }
81
82expand          return(expandString);
83
84GEQUAL_TO_ZERO  {
85                                ts10_lval.fval = (float)GL_GEQUAL;
86                                return (gequal);
87                        }
88
89LESS_THAN_ZERO  {
90                                ts10_lval.fval = (float)GL_LESS;
91                                return(less);
92                        }
93
94nop                     return(nop);
95texture_1d              return(texture_1d);
96texture_2d              return(texture_2d);
97texture_rectangle       return(texture_rectangle);
98texture_3d              return(texture_3d);
99texture_cube_map return(texture_cube_map);
100cull_fragment   return(cull_fragment);
101pass_through    return(pass_through);
102offset_2d_scale return(offset_2d_scale);
103offset_2d       return(offset_2d);
104offset_rectangle_scale return(offset_rectangle_scale);
105offset_rectangle        return(offset_rectangle);
106dependent_ar    return(dependent_ar);
107dependent_gb    return(dependent_gb);
108
109dot_product_2d_1of2     return(dot_product_2d_1of2);
110dot_product_2d_2of2 return(dot_product_2d_2of2);
111
112dot_product_rectangle_1of2      return(dot_product_rectangle_1of2);
113dot_product_rectangle_2of2 return(dot_product_rectangle_2of2);
114
115dot_product_depth_replace_1of2  return(dot_product_depth_replace_1of2);
116dot_product_depth_replace_2of2 return(dot_product_depth_replace_2of2);
117
118dot_product_3d_1of3     return(dot_product_3d_1of3);
119dot_product_3d_2of3     return(dot_product_3d_2of3);
120dot_product_3d_3of3     return(dot_product_3d_3of3);
121
122dot_product_cube_map_1of3       return(dot_product_cube_map_1of3);
123dot_product_cube_map_2of3       return(dot_product_cube_map_2of3);
124dot_product_cube_map_3of3       return(dot_product_cube_map_3of3);
125
126dot_product_reflect_cube_map_eye_from_qs_1of3   return(dot_product_reflect_cube_map_eye_from_qs_1of3);
127dot_product_reflect_cube_map_eye_from_qs_2of3   return(dot_product_reflect_cube_map_eye_from_qs_2of3);
128dot_product_reflect_cube_map_eye_from_qs_3of3   return(dot_product_reflect_cube_map_eye_from_qs_3of3);
129
130dot_product_reflect_cube_map_const_eye_1of3     return(dot_product_reflect_cube_map_const_eye_1of3);
131dot_product_reflect_cube_map_const_eye_2of3     return(dot_product_reflect_cube_map_const_eye_2of3);
132dot_product_reflect_cube_map_const_eye_3of3     return(dot_product_reflect_cube_map_const_eye_3of3);
133
134dot_product_cube_map_and_reflect_cube_map_eye_from_qs_1of3      return(dot_product_cube_map_and_reflect_cube_map_eye_from_qs_1of3);
135dot_product_cube_map_and_reflect_cube_map_eye_from_qs_2of3      return(dot_product_cube_map_and_reflect_cube_map_eye_from_qs_2of3);
136dot_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
138dot_product_cube_map_and_reflect_cube_map_const_eye_1of3        return(dot_product_cube_map_and_reflect_cube_map_const_eye_1of3);
139dot_product_cube_map_and_reflect_cube_map_const_eye_2of3        return(dot_product_cube_map_and_reflect_cube_map_const_eye_2of3);
140dot_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
170bool ts10_init_more();
171
172bool ts10_init(char* inputString)
173{
174    myin = inputString;
175        return ts10_init_more();
176}
177
178
179#ifndef ts10_wrap
180int ts10_wrap(void)
181{
182  return(1);
183}
184#endif
Note: See TracBrowser for help on using the repository browser.