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

103 lines
2.7 KiB
C
Raw Normal View History

2021-12-26 23:18:28 +08:00
/*
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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(const SynRangeState& rangeState) override;
2021-07-02 10:32:29 +08:00
void resetState() override;
// SynHighlighter interface
public:
QSet<QString> keywords() const override;
2021-07-01 20:24:47 +08:00
};
#endif // SYNEDITASMHIGHLIGHTER_H