scriptreader.cxx

changeset 35
3d3f6ed40171
parent 34
0a9a5902beaa
child 36
a8838b5f1213
equal deleted inserted replaced
34:0a9a5902beaa 35:3d3f6ed40171
354 } 354 }
355 355
356 token = string; 356 token = string;
357 } 357 }
358 358
359 void ScriptReader::MustNumber () { 359 void ScriptReader::MustNumber (bool fromthis) {
360 str num; 360 str num;
361 MustNext (); 361 if (!fromthis)
362 MustNext ();
362 num += token; 363 num += token;
363 364
364 // Cater for a possible minus sign, since it 365 // Cater for a possible minus sign, since it
365 // breaks the token, read a new one with the number. 366 // breaks the token, read a new one with the number.
366 if (!token.compare ("-")) { 367 if (!token.compare ("-")) {
368 num += token; 369 num += token;
369 } 370 }
370 371
371 if (!num.isnumber()) 372 if (!num.isnumber())
372 ParserError ("expected a number, got `%s`", num.chars()); 373 ParserError ("expected a number, got `%s`", num.chars());
374
375 token = num;
373 } 376 }
374 377
375 void ScriptReader::MustBool () { 378 void ScriptReader::MustBool () {
376 MustNext(); 379 MustNext();
377 if (!token.compare ("0") || !token.compare ("1") || 380 if (!token.compare ("0") || !token.compare ("1") ||

mercurial