- if (!esc) {
- unsigned char c = 0; // getc() returns an int
- char cc = 0;
- status = 0;
- while (is && !status) {
- is.get(cc);
- c = cc;
- if (c == commentChar) {
- // Read rest of line (fast :-)
-#if 1
- // That is not fast... (Lgb)
- string dummy;
- getline(is, dummy);
-
- LYXERR(Debug::LYXLEX, "Comment read: `" << c << dummy << '\'');
-#else
- // unfortunately ignore is buggy (Lgb)
- is.ignore(100, '\n');
-#endif
- ++lineno;
- continue;
- }
-
- if (c == '\"') {
- buff.clear();
-
- do {
- is.get(cc);
- c = cc;
- if (c != '\r')
- buff.push_back(c);
- } while (c != '\"' && c != '\n' && is);
-
- if (c != '\"') {
- printError("Missing quote");
- if (c == '\n')
- ++lineno;
- }
-
- buff.resize(buff.size()-1);
- status = LEX_DATA;
- break;
- }
-
- if (c == ',')
- continue; /* Skip ','s */
-
- // using relational operators with chars other
- // than == and != is not safe. And if it is done
- // the type _have_ to be unsigned. It usually a
- // lot better to use the functions from cctype
- if (c > ' ' && is) {
- buff.clear();
-
- do {
- buff.push_back(c);
- is.get(cc);
- c = cc;
- } while (c > ' ' && c != ',' && is);
-
- status = LEX_TOKEN;
- }
-
- if (c == '\r' && is) {
- // The Windows support has lead to the
- // possibility of "\r\n" at the end of
- // a line. This will stop LyX choking
- // when it expected to find a '\n'
- is.get(cc);
- c = cc;
- }