Changeset 218


Ignore:
Timestamp:
Oct 1, 2006, 10:17:47 AM (17 years ago)
Author:
Peter Johansson
Message:

refs #69 added text-mode for parsing. For time being "*.txt", "AUTHORS", "ChangeLog?", "INSTALL", "NEWS", and "README" are parsed in this mode.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Parser.cc

    r217 r218  
    4242        match_end(path.rbegin(), path.rend(), ".pl") ||
    4343        match_end(path.rbegin(), path.rend(), ".pm") ||
    44         match_end(path.rbegin(), path.rend(), ".sh"))
     44        match_end(path.rbegin(), path.rend(), ".sh") ||
     45        file_name(path)=="Makefile")
    4546      line_com_mode(is, "#");
    4647    else if (match_end(path.rbegin(), path.rend(), ".tex"))
    4748      line_com_mode(is, "%");
     49    else if (match_end(path.rbegin(), path.rend(), ".txt") ||
     50             file_name(path)=="AUTHORS" ||
     51             file_name(path)=="ChangeLog" ||
     52             file_name(path)=="INSTALL" ||
     53             file_name(path)=="NEWS" ||
     54             file_name(path)=="README")
     55      text_mode(is);
    4856    else
    4957      cc_mode(is);
     
    133141
    134142
     143  void Parser::text_mode(std::istream& is)
     144  {
     145    std::string str;
     146    while(getline(is,str)) {
     147      line_type lt=empty;
     148      for (std::string::iterator iter=str.begin(); iter!=str.end(); ++iter){
     149        if (lt==empty && isalnum(*iter))
     150          lt = comment;
     151      }
     152      type_.push_back(lt);
     153    }
     154  }
     155
     156
    135157}} // end of namespace svndigest and namespace theplu
  • trunk/lib/Parser.h

    r214 r218  
    7272    void line_com_mode(std::istream& is, const std::string& com_start);
    7373
     74    void text_mode(std::istream&);
     75
    7476    std::vector<line_type> type_;
    7577
  • trunk/test/parser.cc

    r217 r218  
    3535  ok = ok && test("parser.cc",os);
    3636  ok = ok && test("Makefile.am",os);
     37  ok = ok && test("../INSTALL",os);
    3738  return 0;
    3839}
Note: See TracChangeset for help on using the changeset viewer.