blob: 6253575ac7d1de736fc45c1987a26c6d44216d61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include "../tools/nimlexer.h"
#include <texteditor/syntaxhighlighter.h>
namespace Nim {
class NimHighlighter : public TextEditor::SyntaxHighlighter
{
Q_OBJECT
public:
NimHighlighter();
protected:
void highlightBlock(const QString &text) override;
private:
TextEditor::TextStyle styleForToken(const NimLexer::Token &token, const QString &tokenValue);
TextEditor::TextStyle styleForIdentifier(const NimLexer::Token &token, const QString &tokenValue);
int highlightLine(const QString &text, int initialState);
};
}
|