Changeset 512
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Configuration.cc
r510 r512 171 171 parsing_found=true; 172 172 string2codons_.clear(); 173 std::cout << "clear" << std::endl;174 173 } 175 174 … … 190 189 throw std::runtime_error(mess.str()); 191 190 } 192 std::cout << "lhs:" << lhs << " " << "rhs:" << rhs << std::endl;193 191 std::stringstream ss(rhs); 194 192 std::string start; -
trunk/lib/Parser.cc
r506 r512 23 23 24 24 #include "Parser.h" 25 #include "Configuration.h" 25 26 #include "utility.h" 26 27 … … 42 43 std::ifstream is(path.c_str()); 43 44 assert(is.good()); 44 std::vector<std::pair<std::string, std::string> > codon;45 45 // Ignore trailing '.in' in file names 46 46 if (match_end(path.rbegin(), path.rend(), ".in")) 47 47 path = path.substr(0, path.size()-3); 48 if (match_end(path.rbegin(), path.rend(), ".ac") || 49 match_end(path.rbegin(), path.rend(), ".am") || 50 match_end(path.rbegin(), path.rend(), ".m4")) { 51 codon.reserve(2); 52 codon.push_back(std::make_pair("#", "\n")); 53 codon.push_back(std::make_pair("dnl", "\n")); 54 parse(is, codon); 55 } 56 else if (match_end(path.rbegin(), path.rend(), ".c") || 57 match_end(path.rbegin(), path.rend(), ".cc") || 58 match_end(path.rbegin(), path.rend(), ".cpp") || 59 match_end(path.rbegin(), path.rend(), ".cxx") || 60 match_end(path.rbegin(), path.rend(), ".h") || 61 match_end(path.rbegin(), path.rend(), ".hh") || 62 match_end(path.rbegin(), path.rend(), ".hpp") || 63 match_end(path.rbegin(), path.rend(), ".java")) { 64 codon.reserve(2); 65 codon.push_back(std::make_pair("//", "\n")); 66 codon.push_back(std::make_pair("/*", "*/")); 67 parse(is, codon); 68 } 69 else if (match_end(path.rbegin(), path.rend(), ".pl") || 70 match_end(path.rbegin(), path.rend(), ".pm") || 71 match_end(path.rbegin(), path.rend(), ".sh") || 72 match_end(path.rbegin(), path.rend(), "config") || 73 file_name(path)=="bootstrap" || 74 file_name(path)=="Makefile") { 75 codon.push_back(std::make_pair("#", "\n")); 76 parse(is,codon); 77 } 78 else if (match_end(path.rbegin(), path.rend(), ".tex") || 79 match_end(path.rbegin(), path.rend(), ".m")) { 80 codon.push_back(std::make_pair("%", "\n")); 81 parse(is,codon); 82 } 83 else if (match_end(path.rbegin(), path.rend(), ".jsp")) { 84 codon.reserve(2); 85 codon.push_back(std::make_pair("<!--", "-->")); 86 codon.push_back(std::make_pair("<%--", "--%>")); 87 parse(is,codon); 88 } 89 else if (match_end(path.rbegin(), path.rend(), ".html") || 90 match_end(path.rbegin(), path.rend(), ".xml") || 91 match_end(path.rbegin(), path.rend(), ".xsl") || 92 match_end(path.rbegin(), path.rend(), ".xsd") || 93 match_end(path.rbegin(), path.rend(), ".xhtml") || 94 match_end(path.rbegin(), path.rend(), ".shtml") || 95 match_end(path.rbegin(), path.rend(), ".xml") || 96 match_end(path.rbegin(), path.rend(), ".css") || 97 match_end(path.rbegin(), path.rend(), ".rss") || 98 match_end(path.rbegin(), path.rend(), ".sgml") ){ 99 codon.push_back(std::make_pair("<!--", "-->")); 100 parse(is,codon); 101 } 48 const std::vector<std::pair<std::string, std::string> >* codon = 49 Configuration::instance().codon(path); 50 if (codon) 51 parse(is, *codon); 102 52 else 103 53 text_mode(is); … … 107 57 108 58 void Parser::parse(std::istream& is, 109 std::vector<std::pair<std::string, std::string> >& codon)59 const std::vector<std::pair<std::string, std::string> >& codon) 110 60 { 111 61 // mode zero means we are currently not in a comment -
trunk/lib/Parser.h
r439 r512 70 70 71 71 void parse(std::istream& is, 72 std::vector<std::pair<std::string, std::string> >& codon);72 const std::vector<std::pair<std::string, std::string> >& codon); 73 73 74 74 void text_mode(std::istream&);
Note: See TracChangeset
for help on using the changeset viewer.