Changeset 2460:3c347c306703 in lemon-0.x
- Timestamp:
- 07/26/07 14:18:02 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3298
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/lemon_reader.h
r2416 r2460 617 617 return EOF; 618 618 } 619 620 public: 621 622 int line_num() const { 623 int r = _num; 624 for (char_type* p = gptr(); p != egptr(); ++p) { 625 if (*p == '\n') --r; 626 } 627 return r; 628 } 629 619 630 }; 620 631 … … 701 712 int line_num = 0; 702 713 std::string line; 703 try { 704 SectionReaders::iterator it; 705 while ((++line_num, getline(*is, line)) && line.find("@end") != 0) { 706 for (it = readers.begin(); it != readers.end(); ++it) { 707 if (it->first->header(line)) { 708 it->second = true; 709 char buf[2048]; 710 FilterStreamBuf buffer(*is, line_num); 714 715 SectionReaders::iterator it; 716 while ((++line_num, getline(*is, line)) && line.find("@end") != 0) { 717 for (it = readers.begin(); it != readers.end(); ++it) { 718 if (it->first->header(line)) { 719 it->second = true; 720 char buf[2048]; 721 FilterStreamBuf buffer(*is, line_num); 722 723 try { 711 724 buffer.pubsetbuf(buf, sizeof(buf)); 712 725 std::istream ss(&buffer); 713 726 it->first->read(ss); 714 727 break; 715 } 728 } catch (DataFormatError& error) { 729 error.line(buffer.line_num()); 730 throw; 731 } 716 732 } 717 733 } 718 for (it = readers.begin(); it != readers.end(); ++it) { 719 if (!it->second) { 720 it->first->missing(); 721 } 722 } 723 } catch (DataFormatError& error) { 724 error.line(line_num); 725 throw; 726 } 734 } 735 for (it = readers.begin(); it != readers.end(); ++it) { 736 if (!it->second) { 737 try { 738 it->first->missing(); 739 } catch (DataFormatError& error) { 740 error.line(line_num); 741 throw; 742 } 743 } 744 } 727 745 } 728 746
Note: See TracChangeset
for help on using the changeset viewer.