summaryrefslogtreecommitdiff
path: root/src/plugins/haskell/haskellhighlighter.h
blob: 9bf71413b32737d18d6eeb8e4ed4bd4929154d83 (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
30
31
32
33
34
35
36
// Copyright (c) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include <texteditor/syntaxhighlighter.h>

#include <QHash>
#include <QTextFormat>

namespace Haskell {
namespace Internal {

class Token;

class HaskellHighlighter : public TextEditor::SyntaxHighlighter
{
    Q_OBJECT

public:
    HaskellHighlighter();

protected:
    void highlightBlock(const QString &text) override;

private:
    void setFontSettings(const TextEditor::FontSettings &fontSettings) override;
    void updateFormats(const TextEditor::FontSettings &fontSettings);
    void setTokenFormat(const Token &token, TextEditor::TextStyle style);
    void setTokenFormatWithSpaces(const QString &text, const Token &token,
                                  TextEditor::TextStyle style);
    QTextCharFormat m_toplevelDeclFormat;
};

} // Internal
} // Haskell