lemon/bits/item_writer.h
changeset 2323 8b18b6fed090
parent 2254 50cb2b90daa9
child 2386 81b47fc5c444
equal deleted inserted replaced
8:f3df706d4c42 9:5c7654d7f0c6
    82         break;
    82         break;
    83       case '{':
    83       case '{':
    84         is.putback(c);
    84         is.putback(c);
    85         if (!readableParsed('{', '}', is)) return false;
    85         if (!readableParsed('{', '}', is)) return false;
    86         break;
    86         break;
       
    87       case '/':
       
    88         is.putback(c);
       
    89         if (!readableParsed('/', '/', is)) return false;
       
    90         break;
    87       case '\"':
    91       case '\"':
    88         is.putback(c);
    92         is.putback(c);
    89         if (!readableQuoted('\"', is)) return false;
    93         if (!readableQuoted('\"', is)) return false;
    90         break;
    94         break;
    91       case '\'':
    95       case '\'':
   110 
   114 
   111     bool readableQuoted(char quote, std::istream& is) const {
   115     bool readableQuoted(char quote, std::istream& is) const {
   112       char c;
   116       char c;
   113       bool esc = false;
   117       bool esc = false;
   114       if (!is.get(c) || c != quote) return false;
   118       if (!is.get(c) || c != quote) return false;
   115       while (is.get(c) && c != quote && !esc) {
   119       while (is.get(c) && (c != quote || esc)) {
   116         if (c == '\\') esc = !esc;
   120         if (c == '\\') esc = !esc;
   117         else esc = false;
   121         else esc = false;
   118       }
   122       }
   119       if (!is) return false;
   123       if (!is) return false;
   120       return true;
   124       return true;