]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/Parser.cpp
Remove wmf2eps as EMF > EPS converter
[lyx.git] / src / tex2lyx / Parser.cpp
index 23a1bf1a013e104088b33d01ec7f1f64f6cbbe08..ec63b77da83e7c063724746427fa64be8c0c127e 100644 (file)
@@ -12,7 +12,6 @@
 
 #include "Encoding.h"
 #include "Parser.h"
-#include "support/foreach.h"
 #include "support/lstrings.h"
 #include "support/textutils.h"
 
@@ -49,7 +48,7 @@ char_type getNewline(iparserdocstream & is, char_type c)
        return c;
 }
 
-}
+} // namespace
 
 //
 // Token
@@ -162,6 +161,7 @@ Parser::Parser(idocstream & is, std::string const & fixedenc)
 {
        if (fixed_enc_)
                is_.setEncoding(fixedenc);
+       catInit();
 }
 
 
@@ -173,6 +173,7 @@ Parser::Parser(string const & s)
          // An idocstringstream can not change the encoding
          fixed_enc_(true)
 {
+       catInit();
 }
 
 
@@ -319,11 +320,10 @@ Token const Parser::next_next_token()
                return dummy;
        // If tokenize_one() has not been called after the last get_token() we
        // need to tokenize two more tokens.
-       if (pos_ >= tokens_.size()) {
+       if (pos_ >= tokens_.size())
+               tokenize_one();
+       if (pos_ + 1 >= tokens_.size())
                tokenize_one();
-               if (pos_ + 1 >= tokens_.size())
-                       tokenize_one();
-       }
        return pos_ + 1 < tokens_.size() ? tokens_[pos_ + 1] : dummy;
 }
 
@@ -339,7 +339,7 @@ Token const Parser::get_token()
                if (pos_ >= tokens_.size())
                        return dummy;
        }
-       // cerr << "looking at token " << tokens_[pos_] 
+       // cerr << "looking at token " << tokens_[pos_]
        //      << " pos: " << pos_ << '\n';
        return tokens_[pos_++];
 }
@@ -662,7 +662,7 @@ Parser::Arg Parser::verbatimStuff(string const & end_string, bool const allow_li
                                return Arg(false, string());
                        }
                        if (match_index) {
-                               oss << end_string.substr(0, match_index) 
+                               oss << end_string.substr(0, match_index)
                                    << t.asInput();
                                match_index = 0;
                        } else
@@ -705,7 +705,7 @@ string Parser::verbatimOption()
                                putback();
                                res += '{' + verbatim_item() + '}';
                        } else
-                               res += t.cs();
+                               res += t.asInput();
                }
        }
        return res;