comparison src/tokenizer.cpp @ 213:44ffef730bc4

cleanup tokenizer differences with other projects, update tld list
author Carl Byington <carl@five-ten-sg.com>
date Wed, 30 Apr 2008 13:11:32 -0700
parents 4db1457cd11a
children 82886d4dd71f
comparison
equal deleted inserted replaced
212:a47f161c76c9 213:44ffef730bc4
301 301
302 void TOKEN::pop() { 302 void TOKEN::pop() {
303 ifstream *is = streams.front(); 303 ifstream *is = streams.front();
304 char *fn = filenames.front(); 304 char *fn = filenames.front();
305 streams.pop_front(); 305 streams.pop_front();
306 filenames.pop_front();
307 filenamess.erase(fn); 306 filenamess.erase(fn);
308 linenumbers.pop_front(); 307 if (filenames.size() > 1) filenames.pop_front();
308 if (linenumbers.size() > 1) linenumbers.pop_front();
309 is->close(); 309 is->close();
310 delete is; 310 delete is;
311 } 311 }
312 312
313 313
435 } 435 }
436 } break; 436 } break;
437 437
438 default: { 438 default: {
439 token_error(); 439 token_error();
440 token_error("unknown state %d %s \n", st, " "); 440 token_error("unknown state %d %s", st, " ");
441 } break; 441 } break;
442 } 442 }
443 if (st == s_init) break; 443 if (st == s_init) break;
444 } 444 }
445 445
507 } 507 }
508 508
509 509
510 void TOKEN::token_error(const char *want, const char *have) { 510 void TOKEN::token_error(const char *want, const char *have) {
511 token_error(); 511 token_error();
512 token_error("expecting %s, found %s \n", want, have); 512 token_error("expecting %s, found %s", want, have);
513 } 513 }
514 514
515 515
516 void TOKEN::token_error() { 516 void TOKEN::token_error() {
517 token_error("syntax error at line %d in file %s -- ", cur_line(), cur_fn()); 517 token_error("syntax error at line %d in file %s -- ", cur_line(), cur_fn());
519 string_list::iterator i = filenames.begin(); 519 string_list::iterator i = filenames.begin();
520 for (; i!=filenames.end(); i++,j++) { 520 for (; i!=filenames.end(); i++,j++) {
521 if (i != filenames.begin()) { 521 if (i != filenames.begin()) {
522 char *fn = (*i); 522 char *fn = (*i);
523 int li = (*j); 523 int li = (*j);
524 token_error("\n included from line %d in file %s -- ", li, fn); 524 token_error(" included from line %d in file %s -- ", li, fn);
525 } 525 }
526 } 526 }
527 } 527 }
528 528