Builds on windows again
This commit is contained in:
parent
33cf39b799
commit
bebb3391c3
160 changed files with 138 additions and 117 deletions
50
core/SqlLexer.h
Normal file
50
core/SqlLexer.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#ifndef SQLLEXER_H
|
||||
#define SQLLEXER_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
enum class BasicTokenType {
|
||||
None,
|
||||
End, // End of input
|
||||
Symbol, // can be many things, keyword, object name, operator, ..
|
||||
Comment,
|
||||
BlockComment,
|
||||
OpenBlockComment, // Busy with a block comment end not detected before end of current input
|
||||
QuotedString,
|
||||
DollarQuote, // Return the dollar quote tag, do not consume the entire string (potentially long)
|
||||
QuotedIdentifier,
|
||||
Parameter
|
||||
};
|
||||
|
||||
enum class LexerState {
|
||||
Null,
|
||||
InDollarQuotedString,
|
||||
InBlockComment
|
||||
};
|
||||
|
||||
|
||||
class SqlLexer {
|
||||
public:
|
||||
SqlLexer(const QString &block, LexerState currentstate);
|
||||
QChar nextChar();
|
||||
QChar peekChar();
|
||||
/**
|
||||
* @brief NextBasicToken
|
||||
* @param in
|
||||
* @param ofs
|
||||
* @param start
|
||||
* @param length
|
||||
* @return false when input seems invalid, it will return what it did recognize but something wasn't right, parser should try to recover
|
||||
*/
|
||||
bool nextBasicToken(int &startpos, int &length, BasicTokenType &tokentype, QString &out);
|
||||
|
||||
LexerState currentState() const { return m_state; }
|
||||
private:
|
||||
QString m_block;
|
||||
int m_pos = 0;
|
||||
LexerState m_state;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // SQLLEXER_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue