]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/Parser.cpp
- tex2lyx/text.cpp:
[lyx.git] / src / tex2lyx / Parser.cpp
index 06027e880ad2d0209116f7ebf840535a739e3258..20f5058901e163d9ab7f54eece6a73b0b31e1cd3 100644 (file)
@@ -502,6 +502,28 @@ string const Parser::plainEnvironment(string const & name)
 }
 
 
+string const Parser::plainCommand(char left, char right, string const & name)
+{
+       if (!good())
+               return string();
+       // check if first token is really the start character
+       Token tok = get_token();
+       if (tok.character() != left) {
+               cerr << "first character does not match start character of command \\" << name << endl;
+               return string();
+       }
+       ostringstream os;
+       for (Token t = get_token(); good(); t = get_token()) {
+               if (t.character() == right) {
+                       return os.str();
+               } else
+                       os << t.asInput();
+       }
+       cerr << "unexpected end of input" << endl;
+       return os.str();
+}
+
+
 void Parser::tokenize_one()
 {
        catInit();