RedPanda-CPP/RedPandaIDE/qsynedit/highlighter/asm.h

83 lines
2.0 KiB
C
Raw Normal View History

2021-07-01 20:24:47 +08:00
#ifndef SYNEDITASMHIGHLIGHTER_H
#define SYNEDITASMHIGHLIGHTER_H
#include "base.h"
class SynEditASMHighlighter : public SynHighlighter
{
enum TokenKind {
Comment,
Identifier,
Key,
Null,
Number,
Space,
String,
Symbol,
Unknown
};
public:
2021-07-02 10:32:29 +08:00
explicit SynEditASMHighlighter();
PSynHighlighterAttribute numberAttribute();
2021-07-01 20:24:47 +08:00
static const QSet<QString> Keywords;
private:
QChar* mLine;
2021-07-01 22:23:24 +08:00
QString mLineString;
2021-07-01 20:24:47 +08:00
int mLineNumber;
int mRun;
int mStringLen;
QChar mToIdent;
int mTokenPos;
SynTokenKind mTokenID;
2021-07-01 22:23:24 +08:00
PSynHighlighterAttribute mNumberAttribute;
2021-07-01 22:29:51 +08:00
private:
void CommentProc();
void CRProc();
2021-07-02 10:32:29 +08:00
void GreaterProc();
void IdentProc();
void LFProc();
void LowerProc();
void NullProc();
void NumberProc();
void SingleQuoteStringProc();
void SlashProc();
void SpaceProc();
void StringProc();
void SymbolProc();
void UnknownProc();
2021-07-01 22:29:51 +08:00
2021-07-01 22:23:24 +08:00
// SynHighlighter interface
public:
bool eol() const override;
QString languageName() override;
SynHighlighterLanguage language() override;
2021-07-01 22:29:51 +08:00
QString getToken() const override;
PSynHighlighterAttribute getTokenAttribute() const override;
SynTokenKind getTokenKind() override;
SynHighlighterTokenType getTokenType() override;
int getTokenPos() override;
void next() override;
void setLine(const QString &newLine, int lineNumber) override;
2021-07-01 22:23:24 +08:00
// SynHighlighter interface
public:
2021-07-01 22:29:51 +08:00
SynHighlighterClass getClass() const override;
QString getName() const override;
2021-07-02 10:32:29 +08:00
// SynHighlighter interface
public:
bool getTokenFinished() const override;
bool isLastLineCommentNotFinished(int state) const override;
bool isLastLineStringNotFinished(int state) const override;
SynRangeState getRangeState() const override;
void setState(SynRangeState rangeState, int braceLevel, int bracketLevel, int parenthesisLevel) override;
void resetState() override;
2021-07-01 20:24:47 +08:00
};
#endif // SYNEDITASMHIGHLIGHTER_H