]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/texparser.C
Add a Buffer::fully_loaded member function, returning true only when
[lyx.git] / src / tex2lyx / texparser.C
index a642a167e097c22c31634028057a78bdd9c639a2..e5612667d2ce3a2a8f1283c349ba545f6c5baf16 100644 (file)
@@ -1,19 +1,27 @@
+/**
+ * \file texparser.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
 
 #include <config.h>
 
 #include "texparser.h"
-#include "Lsstream.h"
 
 #include <iostream>
+#include <sstream>
 
 using std::cerr;
 using std::endl;
 using std::fill;
-using std::ios;
 using std::istream;
 using std::istringstream;
 using std::ostream;
-using std::vector;
+using std::string;
 
 
 namespace {
@@ -37,30 +45,30 @@ void catInit()
        fill(theCatcode + 'a', theCatcode + 'z' + 1, catLetter);
        fill(theCatcode + 'A', theCatcode + 'Z' + 1, catLetter);
 
-       theCatcode['\\'] = catEscape;
-       theCatcode['{']  = catBegin;
-       theCatcode['}']  = catEnd;
-       theCatcode['$']  = catMath;
-       theCatcode['&']  = catAlign;
+       theCatcode[int('\\')] = catEscape;
+       theCatcode[int('{')]  = catBegin;
+       theCatcode[int('}')]  = catEnd;
+       theCatcode[int('$')]  = catMath;
+       theCatcode[int('&')]  = catAlign;
        theCatcode[10]   = catNewline;
-       theCatcode['#']  = catParameter;
-       theCatcode['^']  = catSuper;
-       theCatcode['_']  = catSub;
-       theCatcode['\7f'] = catIgnore;
-       theCatcode[' ']  = catSpace;
-       theCatcode['\t'] = catSpace;
+       theCatcode[int('#')]  = catParameter;
+       theCatcode[int('^')]  = catSuper;
+       theCatcode[int('_')]  = catSub;
+       theCatcode[0x7f] = catIgnore;
+       theCatcode[int(' ')]  = catSpace;
+       theCatcode[int('\t')] = catSpace;
        theCatcode[13]   = catIgnore;
-       theCatcode['~']  = catActive;
-       theCatcode['%']  = catComment;
+       theCatcode[int('~')]  = catActive;
+       theCatcode[int('%')]  = catComment;
 
        // This is wrong!
-       theCatcode['@']  = catLetter;
+       theCatcode[int('@')]  = catLetter;
 }
 
 }
 
 
-// 
+//
 // catcodes
 //
 
@@ -126,7 +134,7 @@ Parser::Parser(istream & is)
 Parser::Parser(string const & s)
        : lineno_(0), pos_(0)
 {
-       istringstream is(STRCONV(s));
+       istringstream is(s);
        tokenize(is);
 }
 
@@ -170,7 +178,7 @@ void Parser::skip_spaces()
        while (1) {
                if (next_token().cat() == catSpace || next_token().cat() == catNewline)
                        get_token();
-               else if (next_token().cat() == catComment) 
+               else if (next_token().cat() == catComment)
                        while (next_token().cat() != catNewline)
                                get_token();
                else
@@ -367,11 +375,11 @@ string Parser::verbatim_item()
 
 void Parser::setCatCode(char c, CatCode cat)
 {
-       theCatcode[c] = cat;    
+       theCatcode[(unsigned char)c] = cat;
 }
 
 
 CatCode Parser::getCatCode(char c) const
 {
-       return theCatcode[c];
+       return theCatcode[(unsigned char)c];
 }