2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2013-01-14 23:11:10 +04:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2013-01-14 23:11:10 +04:00
|
|
|
|
|
|
|
|
#include <texteditor/syntaxhighlighter.h>
|
|
|
|
|
|
2019-07-15 12:50:29 +02:00
|
|
|
namespace Python {
|
2014-08-27 13:38:02 +02:00
|
|
|
namespace Internal {
|
2013-01-14 23:11:10 +04:00
|
|
|
|
2014-08-27 13:38:02 +02:00
|
|
|
class Scanner;
|
2013-01-14 23:11:10 +04:00
|
|
|
|
2013-08-23 13:41:17 +02:00
|
|
|
class PythonHighlighter : public TextEditor::SyntaxHighlighter
|
2013-01-14 23:11:10 +04:00
|
|
|
{
|
|
|
|
|
public:
|
2014-08-27 13:38:02 +02:00
|
|
|
PythonHighlighter();
|
2013-01-14 23:11:10 +04:00
|
|
|
|
|
|
|
|
private:
|
2016-08-03 00:07:44 +02:00
|
|
|
void highlightBlock(const QString &text) override;
|
2013-01-14 23:11:10 +04:00
|
|
|
int highlightLine(const QString &text, int initialState);
|
|
|
|
|
void highlightImport(Internal::Scanner &scanner);
|
2017-09-12 13:57:54 +02:00
|
|
|
|
|
|
|
|
int m_lastIndent = 0;
|
|
|
|
|
bool withinLicenseHeader = false;
|
2013-01-14 23:11:10 +04:00
|
|
|
};
|
|
|
|
|
|
2014-08-27 13:38:02 +02:00
|
|
|
} // namespace Internal
|
2019-07-15 12:50:29 +02:00
|
|
|
} // namespace Python
|