]> git.lyx.org Git - lyx.git/blobdiff - src/Lexer.h
Fix crash on OS-switch of dark/light mode (#12786)
[lyx.git] / src / Lexer.h
index 887f7f77fa55293e177b6aaa87602c667eef44ec..02ec7470e18d8214a196588bf4fbede18114014f 100644 (file)
 #define LEXER_H
 
 #include "support/strfwd.h"
-
+#include <string>
 
 namespace lyx {
 
 namespace support { class FileName; }
 
-class PushPopHelper;
-
 /** A helper structure to describe a keyword for the Lexer.
-       Usually used bundled in C style arrays and passed to the 
+       Usually used bundled in C style arrays and passed to the
        Lexer using a LexerKeywordTable object.
 */
 struct LexerKeyword
@@ -64,10 +62,10 @@ class Lexer
 {
 public:
        /// initialize Lexer with no special keywords.
-       Lexer(); 
+       Lexer();
        /// initialize Lexer with a bunch of keywords
        template<int N> Lexer(LexerKeyword (&table)[N])
-               : pimpl_(0) { init(table, N); }
+       : pimpl_(0), lastReadOk_(false) { init(table, N); }
 
        ///
        ~Lexer();
@@ -110,8 +108,8 @@ public:
        /// returns a lex code
        int lex();
 
-       /// Read the next string, as delimited by double quotes or 
-       /// whitespace. If esc is true, then we remember that some chars 
+       /// Read the next string, as delimited by double quotes or
+       /// whitespace. If esc is true, then we remember that some chars
        /// might be escaped: \" at least.
        bool next(bool esc = false);
 
@@ -120,7 +118,7 @@ public:
        /// split a word if it contains a backslash.
        bool nextToken();
 
-       /// Puts the rest of the line in the buffer, where it will 
+       /// Puts the rest of the line in the buffer, where it will
        /// be available via getString() or getDocString().
        bool eatLine();
 
@@ -137,17 +135,15 @@ public:
        ///
        double getFloat() const;
        ///
-       std::string const getString() const;
+       std::string const getString(bool trim = false) const;
        ///
-       docstring const getDocString() const;
-       /** Get a long string, ended by the tag `endtag'.
-           This string can span several lines. The first line
-           serves as a template for how many spaces the lines
-           are indented. This much white space is skipped from
-           each following line. This mechanism does not work
-           perfectly if you use tabs.
+       docstring const getDocString(bool trim = false) const;
+       /** Get a long string, ended by the tag `endtoken'. This string
+           can span several lines. The first line serves as a template
+           for what sequence of tabs and spaces make up the indentation.
+           This prefix is skipped from each following line.
        */
-       std::string const getLongString(std::string const & endtag);
+       docstring getLongString(docstring const & endtoken);
 
        /// Pushes a token list on a stack and replaces it with a new one.
        template<int N> void pushTable(LexerKeyword (&table)[N])