knowL: Knowledge Libraries
Loading...
Searching...
No Matches
LexerTextStream.h
1#include <QString>
2
3class QIODevice;
4
5namespace knowCore
6{
18 {
19 public:
25 LexerTextStream(QIODevice* sstream);
31 LexerTextStream(const QString& string);
33 void setDevice(QIODevice* sstream);
34 void setString(const QString& string);
35 struct Element
36 {
37 QString content;
38 int line;
39 int column;
40 bool operator==(char c) const {
41 return content.size() == 1 and content[0] == c;
42 }
43 bool operator!=(char c) const {
44 return not (*this == c);
45 }
46 #define KNOWCORE_CORE_LEXERBASE_CHAR_F(_F_) \
47 bool _F_() const \
48 { \
49 return content.size() == 1 and content[0]._F_(); \
50 }
51 KNOWCORE_CORE_LEXERBASE_CHAR_F(isSpace)
52 KNOWCORE_CORE_LEXERBASE_CHAR_F(isLetter)
53 KNOWCORE_CORE_LEXERBASE_CHAR_F(isDigit)
54 bool isLetterOrDigit() const \
55 { \
56 return content.size() == 1 and (content[0].isLetter() or content[0].isDigit()); \
57 }
58 };
70 void unget(Element c);
74 std::tuple<Element, bool> getString(const QString& terminator);
78 std::tuple<Element, bool> getDigit(Element start);
79 bool eof() const;
83 void setBufferSize(std::size_t _size);
87 std::size_t bufferSize();
99 std::size_t currentBufferSize();
100 private:
101 struct Private;
102 Private* const d;
103 };
104}
Definition LexerTextStream.h:18
std::size_t bufferSize()
Definition LexerTextStream.cpp:104
std::tuple< Element, bool > getString(const QString &terminator)
Definition LexerTextStream.cpp:197
std::size_t currentBufferSize()
Definition LexerTextStream.cpp:109
void unget(Element c)
Definition LexerTextStream.cpp:326
void setBufferSize(std::size_t _size)
Definition LexerTextStream.cpp:99
std::tuple< Element, bool > getDigit(Element start)
Definition LexerTextStream.cpp:289
Element getNextChar()
Definition LexerTextStream.cpp:151
Element getNextNonSeparatorChar()
Definition LexerTextStream.cpp:140
Definition LexerTextStream.cpp:10
Definition LexerTextStream.h:36