23 std::ostringstream
expr;
24 while( (i1 != i2) && (*i1 !=
'\n') ) {
31 throw token_error(
"Unrecognized token", expr.str() );
45 if( *i1 <=
'Z' || ( *i1 >=
'a' && *it <=
'z' ) || *i1 ==
'_' ) {
47 while( i1 != i2 && ( ( *i1 >=
'a' && *i1 <=
'z' ) || *i1 ==
'_' || ( *i1 >=
'A' && *i1 <=
'Z' ) ) )
59 }
else if( diff == 2 ) {
60 if( *it ==
'o' && *(it+1) ==
'r' )
62 else if( *it ==
'i' && *(it+1) ==
'n' )
64 }
else if( diff == 3 ) {
66 if( *(it+1) ==
'e' && *(it+2) ==
'f' )
68 }
else if( *it ==
'a' ) {
69 if( *(it+1) ==
'n' && *(it+2) ==
'd' )
71 }
else if( *it ==
'n' ) {
72 if( *(it+1) ==
'o' && *(it+2) ==
't' )
74 }
else if( *it ==
'f' ) {
75 if( *(it+1) ==
'a' && *(it+2) ==
'i' )
77 }
else if( *it ==
'w' ) {
78 if( *(it+1) ==
'f' && *(it+2) ==
'l' )
81 }
else if( diff == 5 ) {
85 }
else if( diff == 6 ) {
89 else if( s ==
"wflend" )
91 }
else if( diff == 9 ) {
93 if( s ==
"functions" )
97 return token( it, i1, t);
124 while( i1 != i2 && *i1 <=
' ' && *i1 !=
'\n' )
130 }
else if ( *i1 >=
'0' ){
138 if( *i1 >=
'0' && *i1 <=
'9' ) {
147 raise_exception(it, i2,
"Multiple dots near decimal expression");
168 }
else if( *i1 ==
'=' ) {
170 }
else if( *i1 ==
'<' ) {
179 }
else if( *i1 ==
'>' ) {
197 }
else if ( *i1 ==
',' ) {
200 }
else if ( *i1 ==
'.' ) {
204 if( *i1 ==
'+' || *i1 ==
'-' || *i1 ==
'*' || *i1 ==
'/' || *i1 ==
'.')
212 }
else if ( *i1 ==
'(' ) {
215 }
else if ( *i1 ==
')' ) {
218 }
else if ( *i1 ==
'\'' ) {
219 int bracket_depth = 0;
224 }
else if(bracket_depth > 0 && *i1 ==
']') {
226 }
else if(bracket_depth == 0 && *i1 ==
'\'') {
235 raise_exception(it, i2,
"Missing closing ' for formula string");
238 }
else if ( *i1 ==
'#' ) {
240 while( i1 != i2 && *i1 !=
'#' )
246 raise_exception(it, i2,
"Missing closing # for formula comment");
249 }
else if ( *i1 ==
'+' ) {
252 }
else if ( *i1 ==
'-' ) {
264 }
else if ( *i1 ==
'*' ) {
267 }
else if ( *i1 ==
'/' ) {
270 }
else if ( *i1 ==
'%' ) {
273 }
else if ( *i1 ==
'!' ) {
287 #ifdef UNIT_TEST_TOKENIZER
293 std::string::const_iterator i1 = test.begin();
294 std::string::const_iterator i2 = test.end();
304 std::string tokens[] = {
"(",
"abc",
" ",
"+",
" ",
"4",
" ",
305 "*",
" ",
"(",
"5",
"+",
"3",
")",
")",
"functions"};
306 for(
int n = 0;
n !=
sizeof(
types)/
sizeof(*types); ++
n) {
309 assert(t.
type == types[
n]);
GLsizei GLenum GLenum * types
static void expr(LexState *ls, expdesc *v)
int main(int argc, char **argv)
GLsizei const GLcharARB ** string