Changeset 217 for trunk/lib


Ignore:
Timestamp:
Oct 1, 2006, 9:58:52 AM (15 years ago)
Author:
Peter Johansson
Message:

refs #69 fixed so it works for '#' and '%'

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Parser.cc

    r214 r217  
    3838  {
    3939    std::ifstream is(path.c_str());
    40     if (match_end(path.begin(), path.end(), ".ac") ||
    41         match_end(path.begin(), path.end(), ".am") ||
    42         match_end(path.begin(), path.end(), ".pl") ||
    43         match_end(path.begin(), path.end(), ".pm") ||
    44         match_end(path.begin(), path.end(), ".sh"))
     40    if (match_end(path.rbegin(), path.rend(), ".ac") ||
     41        match_end(path.rbegin(), path.rend(), ".am") ||
     42        match_end(path.rbegin(), path.rend(), ".pl") ||
     43        match_end(path.rbegin(), path.rend(), ".pm") ||
     44        match_end(path.rbegin(), path.rend(), ".sh"))
    4545      line_com_mode(is, "#");
    46     else if (match_end(path.begin(), path.end(), ".tex"))
     46    else if (match_end(path.rbegin(), path.rend(), ".tex"))
    4747      line_com_mode(is, "%");
    4848    else
  • trunk/lib/utility.h

    r214 r217  
    7070  }
    7171
    72   inline bool match_end(std::string::const_iterator first,
    73                         std::string::const_iterator last,
     72  inline bool match_end(std::string::const_reverse_iterator first,
     73                        std::string::const_reverse_iterator last,
    7474                        const std::string& str)
    7575  { return (std::distance(first,last)>=static_cast<int>(str.size()) &&
Note: See TracChangeset for help on using the changeset viewer.