9#ifndef KATE_HIGHLIGHT_H
10#define KATE_HIGHLIGHT_H
12#include <KSyntaxHighlighting/AbstractHighlighter>
13#include <KSyntaxHighlighting/Definition>
14#include <KSyntaxHighlighting/FoldingRegion>
15#include <KSyntaxHighlighting/Format>
16#include <KSyntaxHighlighting/Theme>
18#include <KTextEditor/Attribute>
19#include <KTextEditor/Range>
21#include "spellcheck/prefixstore.h"
26#include <QRegularExpression>
29#include <unordered_map>
44 explicit KateHighlighting(
const KSyntaxHighlighting::Definition &def);
84 typedef std::vector<Folding> Foldings;
143 const QString &style()
const
147 const QString &getIdentifier()
const
156 bool isInWord(QChar c,
int attrib = 0)
const;
162 bool canBreakAt(QChar c,
int attrib = 0)
const;
166 const QList<QRegularExpression> &emptyLines(
int attribute = 0)
const;
168 bool isEmptyLine(
const Kate::TextLine *textline)
const;
174 bool canComment(
int startAttr,
int endAttr)
const;
180 QString getCommentStart(
int attrib = 0)
const;
186 QString getCommentEnd(
int attrib = 0)
const;
192 QString getCommentSingleLineStart(
int attrib = 0)
const;
194 const QHash<QString, QChar> &characterEncodings(
int attrib = 0)
const;
202 bool attributeRequiresSpellchecking(
int attr);
208 QString nameForAttrib(
int attrib)
const;
216 int attributeForLocation(KTextEditor::DocumentPrivate *doc,
const KTextEditor::Cursor cursor);
224 QStringList keywordsForLocation(KTextEditor::DocumentPrivate *doc,
const KTextEditor::Cursor cursor);
232 bool spellCheckingRequiredForLocation(KTextEditor::DocumentPrivate *doc,
const KTextEditor::Cursor cursor);
240 QString higlightingModeForLocation(KTextEditor::DocumentPrivate *doc,
const KTextEditor::Cursor cursor);
244 void clearAttributeArrays();
246 QList<KTextEditor::Attribute::Ptr> attributes(
const QString &schema);
248 inline bool noHighlighting()
const
257 const QString &indentation()
const
259 return m_indentation;
262 const QHash<QString, QChar> &getCharacterEncodings(
int attrib)
const;
263 const KatePrefixStore &getCharacterEncodingsPrefixStore(
int attrib)
const;
264 const QHash<QChar, QString> &getReverseCharacterEncodings(
int attrib)
const;
269 QStringList getEmbeddedHighlightingModes()
const;
276 QList<KTextEditor::Attribute::Ptr> attributesForDefinition(
const QString &schema)
const;
282 const std::vector<KSyntaxHighlighting::Format> &formats()
const
288 int sanitizeFormatIndex(
int attrib)
const;
291 QStringList embeddedHighlightingModes;
294 bool folding =
false;
298 bool iHidden =
false;
305 QString m_indentation;
307 bool m_foldingIndentationSensitive =
false;
310 QHash<QString, QList<KTextEditor::Attribute::Ptr>> m_attributeArrays;
316 class HighlightPropertyBag
319 KSyntaxHighlighting::Definition definition;
320 QString singleLineCommentMarker;
321 QString multiLineCommentStart;
322 QString multiLineCommentEnd;
324 QList<QRegularExpression> emptyLines;
325 QHash<QString, QChar> characterEncodings;
326 KatePrefixStore characterEncodingsPrefixStore;
327 QHash<QChar, QString> reverseCharacterEncodings;
331 inline bool foldingIndentationSensitive()
333 return m_foldingIndentationSensitive;
335 inline bool allowsFolding()
343 std::vector<HighlightPropertyBag> m_properties;
349 std::vector<KSyntaxHighlighting::Format> m_formats;
354 std::vector<const HighlightPropertyBag *> m_propertiesForFormat;
359 std::unordered_map<int, int> m_formatsIdToIndex;
364 Kate::TextLine *m_textLineToHighlight =
nullptr;
370 Foldings *m_foldings =
nullptr;
376 QHash<int, int> m_foldingStartToCount;
Backend of KTextEditor::Document related public KTextEditor interfaces.
Folding(int _offset, int _length, KSyntaxHighlighting::FoldingRegion _foldingRegion)
Construct folding.
KSyntaxHighlighting::FoldingRegion foldingRegion
folding region, includes if we start or end a region and the id
Class representing a single text line.
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...