X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftex2lyx%2FParser.h;h=19f0c5fbe33a61ab5bbbb5af4a06fcef8dce8fb4;hb=ce8929e9b237af569934b434154d199634363268;hp=3d2bf567ef4c29c94133d1c346e622ea1cf0e9fc;hpb=25fe87e55c2449e4305e1b200469a48c75b0ea6e;p=lyx.git diff --git a/src/tex2lyx/Parser.h b/src/tex2lyx/Parser.h index 3d2bf567ef..19f0c5fbe3 100644 --- a/src/tex2lyx/Parser.h +++ b/src/tex2lyx/Parser.h @@ -123,21 +123,22 @@ class iparserdocstream public: typedef idocstream::int_type int_type; - iparserdocstream(idocstream & is) : is_(is) {}; + iparserdocstream(idocstream & is) : is_(is) {} /// Like std::istream::operator bool() - operator bool() const { return s_.empty() ? is_ : true; } + /// Do not convert is_ implicitly to bool, since that is forbidden in C++11. + explicit operator bool() const { return s_.empty() ? !is_.fail() : true; } /// change the encoding of the input stream to \p e (iconv name) - bool setEncoding(std::string const & e); + void setEncoding(std::string const & e); // add to the list of characters to read before actually reading // the stream void putback(char_type c); - // add before the list of characters to read before actually reading + // add to the list of characters to read before actually reading // the stream - void put_almost_back(docstring s); + void putback(docstring s); /// Like std::istream::get() iparserdocstream & get(char_type &c); @@ -172,7 +173,7 @@ class Parser { Parser & operator=(Parser const & p); public: /// - Parser(idocstream & is); + Parser(idocstream & is, std::string const & fixedenc); /// Parser(std::string const & s); /// @@ -206,6 +207,8 @@ public: void pushPosition(); /// restore previous position void popPosition(); + /// forget last saved position + void dropPosition(); /// dump contents to screen void dump() const; @@ -278,9 +281,13 @@ public: * stopped at string \p end_string. Contrary to the other * methods, this uses proper catcode setting. This function is * designed to parse verbatim environments and command. The - * intention is to eventually replace all of its siblings. + * intention is to eventually replace all of its siblings. the + * member \p first of the result tells whether the arg was + * found and the member \p second is the value. If \p + * allow_linebreak is false, then the parsing is limited to one line */ - std::string const verbatimStuff(std::string const & end_string); + Arg verbatimStuff(std::string const & end_string, + bool allow_linebreak = true); /* * \returns the contents of the environment \p name. * \begin{name} must be parsed already, @@ -345,10 +352,12 @@ private: std::string encoding_iconv_; /// CatCode theCatcode_[256]; - // + /// cat_type theCatcodesType_; - // + /// cat_type curr_cat_; + /// + bool fixed_enc_; };