DynExp
Highly flexible laboratory automation for dynamically changing experiments.
PythonSyntaxHighlighter Class Reference

Implementation of highlighting for Python code. More...

+ Inheritance diagram for PythonSyntaxHighlighter:

Public Member Functions

 PythonSyntaxHighlighter (QObject *parent)
 
 PythonSyntaxHighlighter (QTextDocument *parent)
 

Protected Member Functions

void highlightBlock (const QString &text)
 

Private Member Functions

void Init ()
 
void initializeRules ()
 
bool matchMultiline (const QString &text, const QRegularExpression &delimiter, const int inState, const QTextCharFormat &style)
 Highlighst multi-line strings, returns true if after processing we are still within the multi-line section. More...
 
const QTextCharFormat getTextCharFormat (const QString &colorName, const QString &style=QString())
 

Private Attributes

QStringList keywords
 
QStringList operators
 
QStringList braces
 
QHash< QString, QTextCharFormat > basicStyles
 
QList< HighlightingRulerules
 
QRegularExpression triSingleQuote
 
QRegularExpression triDoubleQuote
 

Detailed Description

Implementation of highlighting for Python code.

Definition at line 47 of file PythonSyntaxHighlighter.h.

Constructor & Destructor Documentation

◆ PythonSyntaxHighlighter() [1/2]

PythonSyntaxHighlighter::PythonSyntaxHighlighter ( QObject *  parent)
inline

Definition at line 51 of file PythonSyntaxHighlighter.h.

◆ PythonSyntaxHighlighter() [2/2]

PythonSyntaxHighlighter::PythonSyntaxHighlighter ( QTextDocument *  parent)
inline

Definition at line 52 of file PythonSyntaxHighlighter.h.

Member Function Documentation

◆ getTextCharFormat()

const QTextCharFormat PythonSyntaxHighlighter::getTextCharFormat ( const QString &  colorName,
const QString &  style = QString() 
)
private

Definition at line 177 of file PythonSyntaxHighlighter.cpp.

◆ highlightBlock()

void PythonSyntaxHighlighter::highlightBlock ( const QString &  text)
protected

Definition at line 107 of file PythonSyntaxHighlighter.cpp.

◆ Init()

void PythonSyntaxHighlighter::Init ( )
private

Definition at line 28 of file PythonSyntaxHighlighter.cpp.

◆ initializeRules()

void PythonSyntaxHighlighter::initializeRules ( )
private

Definition at line 66 of file PythonSyntaxHighlighter.cpp.

◆ matchMultiline()

bool PythonSyntaxHighlighter::matchMultiline ( const QString &  text,
const QRegularExpression &  delimiter,
const int  inState,
const QTextCharFormat &  style 
)
private

Highlighst multi-line strings, returns true if after processing we are still within the multi-line section.

Definition at line 130 of file PythonSyntaxHighlighter.cpp.

Member Data Documentation

◆ basicStyles

QHash<QString, QTextCharFormat> PythonSyntaxHighlighter::basicStyles
private

Definition at line 62 of file PythonSyntaxHighlighter.h.

◆ braces

QStringList PythonSyntaxHighlighter::braces
private

Definition at line 60 of file PythonSyntaxHighlighter.h.

◆ keywords

QStringList PythonSyntaxHighlighter::keywords
private

Definition at line 58 of file PythonSyntaxHighlighter.h.

◆ operators

QStringList PythonSyntaxHighlighter::operators
private

Definition at line 59 of file PythonSyntaxHighlighter.h.

◆ rules

QList<HighlightingRule> PythonSyntaxHighlighter::rules
private

Definition at line 72 of file PythonSyntaxHighlighter.h.

◆ triDoubleQuote

QRegularExpression PythonSyntaxHighlighter::triDoubleQuote
private

Definition at line 74 of file PythonSyntaxHighlighter.h.

◆ triSingleQuote

QRegularExpression PythonSyntaxHighlighter::triSingleQuote
private

Definition at line 73 of file PythonSyntaxHighlighter.h.


The documentation for this class was generated from the following files: