142 if(f_pos < f_in.length())
174 return token_t::EOF_TOKEN;
188 value = value * 10 + c -
'0';
190 if(c <
'0' || c >
'9')
193 return token_t::INTEGER;
205 if(c ==
'v' || c ==
'V')
208 if(c ==
'e' || c ==
'E')
211 if(c ==
'n' || c ==
'N')
213 return token_t::EVEN;
222 if(c ==
'd' || c ==
'D')
225 if(c ==
'd' || c ==
'D')
233 return token_t::PLUS;
236 return token_t::MINUS;
240 return token_t::UNKNOWN;
254 in_t::token_t token(in.token(first_int));
257 if(token == in_t::token_t::EVEN)
261 if(in.token(first_int) == in_t::token_t::EOF_TOKEN)
265 f_error =
"'even' cannot be followed by anything else in an An+B expression.";
270 if(token == in_t::token_t::ODD)
274 if(in.token(first_int) == in_t::token_t::EOF_TOKEN)
278 f_error =
"'odd' cannot be followed by anything else in an An+B expression.";
284 if(token == in_t::token_t::PLUS)
286 token = in.token(first_int);
288 else if(token == in_t::token_t::MINUS)
290 token = in.token(first_int);
295 if(token != in_t::token_t::INTEGER)
297 f_error =
"In an An+B expression, we expect an optional signed followed by a number or 'even' or 'odd'.";
302 token = in.token(second_int);
303 if(token == in_t::token_t::EOF_TOKEN)
307 f_b = first_int * first_sign;
311 if(token != in_t::token_t::N)
314 f_error =
"The first number has to be followed by the 'n' character.";
319 token = in.token(second_int);
320 if(token == in_t::token_t::PLUS)
324 else if(token == in_t::token_t::MINUS)
331 f_error =
"A sign (+ or -) is expected between the 'An' and the 'B' parts in 'An+B'.";
335 token = in.token(second_int);
336 if(token != in_t::token_t::INTEGER)
339 f_error =
"The value B must be a valid integer in 'An+B'.";
343 f_a = first_int * first_sign;
344 f_b = second_int * second_sign;
346 if(in.token(second_int) == in_t::token_t::EOF_TOKEN)
351 f_error =
"An 'An+B' expression cannot be followed by anything else.";