edbee - Qt Editor Library v0.11.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
grammartextlexer.h
Go to the documentation of this file.
1// edbee - Copyright (c) 2012-2025 by Rick Blommers and contributors
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include "edbee/exports.h"
7
8#include <QMap>
9#include <QList>
10#include <QVector>
11
13
14namespace edbee {
15
17class RegExp;
18class ScopedTextRange;
21class TextGrammar;
22class TextGrammarRule;
23
26{
27public:
29 virtual ~GrammarTextLexer();
30
31 virtual void textChanged( const TextBufferChange& change );
32
33private:
34 virtual bool lexLine(int line, int& currentDocOffset );
35
36public:
37 virtual void lexLines( int line, int lineCount );
38 virtual void lexRange( int beginOffset, int endOffset );
39
40private:
41
42 RegExp* createEndRegExp( RegExp* startRegExp, const QString &endRegExpStringIn);
43
44 void findNextGrammarRule(const QString &line, int offsetInLine, TextGrammarRule *activeRule, TextGrammarRule *&foundRule, RegExp*& foundRegExp, int& foundPosition );
45 void processCaptures( RegExp *foundRegExp, const QMap<int,QString>* foundCaptures );
46
47 TextGrammarRule* findAndApplyNextGrammarRule(int currentDocOffset, const QString& line, int& offsetInLine );
48
49 MultiLineScopedTextRange* activeMultiLineRange();
50 ScopedTextRange* activeScopedTextRange();
51
52 void popActiveRange();
53 void pushActiveRange( ScopedTextRange* range, MultiLineScopedTextRange* multiRange );
54
55 TextGrammarRule* findIncludeGrammarRule( TextGrammarRule* base );
56
57private:
58
59 QVector<MultiLineScopedTextRange*> activeMultiLineRangesRefList_;
60 QVector<MultiLineScopedTextRange*> currentMultiLineRangeList_;
61 QVector<MultiLineScopedTextRange*> closedMultiRangesRangesRefList_;
62
63 QVector<ScopedTextRange*> activeScopedRangesRefList_;
64
65// QVector<MultiLineScopedTextRange*> currentLineRangesList_; ///< The current scope ranges (only valid during parsing)
66
67 ScopedTextRangeList* lineRangeList_;
68
69};
70
71} // edbee
virtual void lexRange(int beginOffset, int endOffset)
This method is called when the given range needs to be lexed.
Definition grammartextlexer.cpp:512
GrammarTextLexer(TextDocumentScopes *scopes)
Constructs the grammar textlexer.
Definition grammartextlexer.cpp:21
virtual void textChanged(const TextBufferChange &change)
This method is called to notify the lexer some data has been changed.
Definition grammartextlexer.cpp:339
virtual void lexLines(int line, int lineCount)
This method lexes a range of line.
Definition grammartextlexer.cpp:454
This class 'defines' a single document scope.
Definition textdocumentscopes.h:254
A class for matching QStrings with the Oniguruma API We need this Regular Expression library to be ab...
Definition regexp.h:35
A base scoped text range.
Definition textdocumentscopes.h:176
a list of textscopes This class is used for single-line scopes (Todo, this needs to be optimized)
Definition textdocumentscopes.h:220
This clas represents a text buffer change and is used to pass around between events This is a sharedd...
Definition textbuffer.h:45
This class is used to 'contain' all document scope information.
Definition textdocumentscopes.h:322
This class defines a single language grammar.
Definition textgrammar.h:124
defines a single grammar rule
Definition textgrammar.h:24
TextLexer(TextDocumentScopes *scopes)
Definition textlexer.cpp:13
#define EDBEE_EXPORT
Definition exports.h:15
QT Acessibility has an issue with reporting blank lines between elements lines. defining 'WINDOWS_EMP...
Definition commentcommand.cpp:20