The branch, master, has been updated. - Log -----------------------------------------------------------------
commit 9631c36ff061d2f32561094b59e24198f66be018 Author: Jean-Marc Lasgouttes <lasgout...@lyx.org> Date: Fri Feb 15 14:44:45 2013 +0100 Move stuff around diff --git a/src/tex2lyx/Parser.cpp b/src/tex2lyx/Parser.cpp index 178746a..7139d1e 100644 --- a/src/tex2lyx/Parser.cpp +++ b/src/tex2lyx/Parser.cpp @@ -599,6 +599,45 @@ string const Parser::verbatimEnvironment(string const & name) } +string Parser::verbatimOption() +{ + string res; + if (next_token().character() == '[') { + Token t = get_token(); + for (t = get_token(); t.character() != ']' && good(); t = get_token()) { + if (t.cat() == catBegin) { + putback(); + res += '{' + verbatim_item() + '}'; + } else + res += t.cs(); + } + } + return res; +} + + +string Parser::verbatim_item() +{ + if (!good()) + error("stream bad"); + skip_spaces(); + if (next_token().cat() == catBegin) { + Token t = get_token(); // skip brace + string res; + for (Token t = get_token(); t.cat() != catEnd && good(); t = get_token()) { + if (t.cat() == catBegin) { + putback(); + res += '{' + verbatim_item() + '}'; + } + else + res += t.asInput(); + } + return res; + } + return get_token().asInput(); +} + + void Parser::tokenize_one() { catInit(); @@ -696,45 +735,6 @@ void Parser::error(string const & msg) } -string Parser::verbatimOption() -{ - string res; - if (next_token().character() == '[') { - Token t = get_token(); - for (t = get_token(); t.character() != ']' && good(); t = get_token()) { - if (t.cat() == catBegin) { - putback(); - res += '{' + verbatim_item() + '}'; - } else - res += t.cs(); - } - } - return res; -} - - -string Parser::verbatim_item() -{ - if (!good()) - error("stream bad"); - skip_spaces(); - if (next_token().cat() == catBegin) { - Token t = get_token(); // skip brace - string res; - for (Token t = get_token(); t.cat() != catEnd && good(); t = get_token()) { - if (t.cat() == catBegin) { - putback(); - res += '{' + verbatim_item() + '}'; - } - else - res += t.asInput(); - } - return res; - } - return get_token().asInput(); -} - - void Parser::reset() { pos_ = 0; diff --git a/src/tex2lyx/Parser.h b/src/tex2lyx/Parser.h index ea57b0f..fc4ae35 100644 --- a/src/tex2lyx/Parser.h +++ b/src/tex2lyx/Parser.h @@ -247,6 +247,10 @@ public: * removed from head and tail of the string if applicable. */ std::string const verbatimEnvironment(std::string const & end_string); + /// + std::string verbatim_item(); + /// + std::string verbatimOption(); /*! * Returns the character of the current token and increments * the token position. @@ -254,8 +258,6 @@ public: char getChar(); /// void error(std::string const & msg); - /// Parses one token from \p is - void tokenize_one(); /// void push_back(Token const & t); /// The previous token. @@ -276,19 +278,15 @@ public: /// puts back spaces (and comments if \p skip_comments is true) void unskip_spaces(bool skip_comments = false); /// - void lex(std::string const & s); - /// bool good(); - /// - std::string verbatim_item(); - /// - std::string verbatimOption(); /// resets the parser to initial state void reset(); private: /// Setup catcode table void catInit(); + /// Parses one token from \p is + void tokenize_one(); /// int lineno_; /// ----------------------------------------------------------------------- Summary of changes: src/tex2lyx/Parser.cpp | 78 ++++++++++++++++++++++++------------------------ src/tex2lyx/Parser.h | 14 ++++----- 2 files changed, 45 insertions(+), 47 deletions(-) hooks/post-receive -- The LyX Source Repository