]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/Parser.cpp
Fix more warnings and simplify a tiny bit.
[lyx.git] / src / tex2lyx / Parser.cpp
index cf8586b7135d70da799c325839275fa88df04592..a538c760efe2ac8f83002cd2a581544bf5c8cfe4 100644 (file)
@@ -577,6 +577,26 @@ string Parser::getFullParentheseArg()
 }
 
 
+bool Parser::hasListPreamble(string const itemcmd)
+{
+       // remember current position
+       unsigned int oldpos = pos_;
+       // jump over arguments
+       if (hasOpt())
+               getOpt();
+       if (hasOpt("{"))
+               getArg('{', '}');
+       // and swallow spaces and comments
+       skip_spaces(true);
+       // we have a list preamble if the next thing
+       // that follows is not the \item command
+       bool res =  next_token().cs() != itemcmd;
+       // back to orig position
+       pos_ = oldpos;
+       return res;
+}
+
+
 string const Parser::ertEnvironment(string const & name)
 {
        if (!good())
@@ -650,6 +670,27 @@ string const Parser::plainCommand(char left, char right, string const & name)
 }
 
 
+string const Parser::getCommandLatexParam()
+{
+       if (!good())
+               return string();
+       string res;
+       size_t offset = 0;
+       while (true) {
+               if (pos_ + offset >= tokens_.size())
+                       tokenize_one();
+               if (pos_ + offset >= tokens_.size())
+                       break;
+               Token t = tokens_[pos_ + offset];
+               if (t.cat() == catBegin)
+                       break;
+               res += t.asInput();
+               ++offset;
+       }
+       return res;
+}
+
+
 Parser::Arg Parser::verbatimStuff(string const & end_string, bool const allow_linebreak)
 {
        if (!good())