QScintilla
2.10
|
#include <qscilexer.h>
Inherits QObject.
Inherited by QsciLexerAVS, QsciLexerBash, QsciLexerBatch, QsciLexerCMake, QsciLexerCoffeeScript, QsciLexerCPP, QsciLexerCSS, QsciLexerCustom, QsciLexerD, QsciLexerDiff, QsciLexerFortran77, QsciLexerHTML, QsciLexerJSON, QsciLexerLua, QsciLexerMakefile, QsciLexerMarkdown, QsciLexerMatlab, QsciLexerPascal, QsciLexerPerl, QsciLexerPO, QsciLexerPostScript, QsciLexerPOV, QsciLexerProperties, QsciLexerPython, QsciLexerRuby, QsciLexerSpice, QsciLexerSQL, QsciLexerTCL, QsciLexerTeX, QsciLexerVerilog, QsciLexerVHDL, and QsciLexerYAML.
Public Slots | |
virtual void | setAutoIndentStyle (int autoindentstyle) |
virtual void | setColor (const QColor &c, int style=-1) |
virtual void | setEolFill (bool eoffill, int style=-1) |
virtual void | setFont (const QFont &f, int style=-1) |
virtual void | setPaper (const QColor &c, int style=-1) |
Signals | |
void | colorChanged (const QColor &c, int style) |
void | eolFillChanged (bool eolfilled, int style) |
void | fontChanged (const QFont &f, int style) |
void | paperChanged (const QColor &c, int style) |
void | propertyChanged (const char *prop, const char *val) |
Public Member Functions | |
QsciLexer (QObject *parent=0) | |
virtual | ~QsciLexer () |
virtual const char * | language () const =0 |
virtual const char * | lexer () const |
virtual int | lexerId () const |
QsciAbstractAPIs * | apis () const |
virtual const char * | autoCompletionFillups () const |
virtual QStringList | autoCompletionWordSeparators () const |
int | autoIndentStyle () |
virtual const char * | blockEnd (int *style=0) const |
virtual int | blockLookback () const |
virtual const char * | blockStart (int *style=0) const |
virtual const char * | blockStartKeyword (int *style=0) const |
virtual int | braceStyle () const |
virtual bool | caseSensitive () const |
virtual QColor | color (int style) const |
virtual bool | eolFill (int style) const |
virtual QFont | font (int style) const |
virtual int | indentationGuideView () const |
virtual const char * | keywords (int set) const |
virtual int | defaultStyle () const |
virtual QString | description (int style) const =0 |
virtual QColor | paper (int style) const |
QColor | defaultColor () const |
virtual QColor | defaultColor (int style) const |
virtual bool | defaultEolFill (int style) const |
QFont | defaultFont () const |
virtual QFont | defaultFont (int style) const |
QColor | defaultPaper () const |
virtual QColor | defaultPaper (int style) const |
QsciScintilla * | editor () const |
void | setAPIs (QsciAbstractAPIs *apis) |
void | setDefaultColor (const QColor &c) |
void | setDefaultFont (const QFont &f) |
void | setDefaultPaper (const QColor &c) |
virtual void | setEditor (QsciScintilla *editor) |
bool | readSettings (QSettings &qs, const char *prefix="/Scintilla") |
virtual void | refreshProperties () |
virtual int | styleBitsNeeded () const |
virtual const char * | wordCharacters () const |
bool | writeSettings (QSettings &qs, const char *prefix="/Scintilla") const |
Protected Member Functions | |
virtual bool | readProperties (QSettings &qs, const QString &prefix) |
virtual bool | writeProperties (QSettings &qs, const QString &prefix) const |
The QsciLexer class is an abstract class used as a base for language lexers.
A lexer scans the text breaking it up into separate language objects, e.g. keywords, strings, operators. The lexer then uses a different style to draw each object. A style is identified by a style number and has a number of attributes, including colour and font. A specific language lexer will implement appropriate default styles which can be overriden by an application by further sub-classing the specific language lexer.
A lexer may provide one or more sets of words to be recognised as keywords. Most lexers only provide one set, but some may support languages embedded in other languages and provide several sets.
QsciLexer provides convenience methods for saving and restoring user preferences for fonts and colours.
If you want to write a lexer for a new language then you can add it to the underlying Scintilla code and implement a corresponding QsciLexer sub-class to manage the different styles used. Alternatively you can implement a sub-class of QsciLexerCustom.
QsciLexer::QsciLexer | ( | QObject * | parent = 0 | ) |
Construct a QsciLexer with parent parent. parent is typically the QsciScintilla instance.
|
pure virtual |
Returns the name of the language. It must be re-implemented by a sub-class.
Implemented in QsciLexerHTML, QsciLexerPerl, QsciLexerCPP, QsciLexerRuby, QsciLexerVerilog, QsciLexerCSS, QsciLexerCoffeeScript, QsciLexerSQL, QsciLexerD, QsciLexerMarkdown, QsciLexerPython, QsciLexerTCL, QsciLexerLua, QsciLexerPOV, QsciLexerPostScript, QsciLexerVHDL, QsciLexerAVS, QsciLexerCMake, QsciLexerFortran77, QsciLexerPascal, QsciLexerPO, QsciLexerBash, QsciLexerJSON, QsciLexerYAML, QsciLexerMatlab, QsciLexerSpice, QsciLexerBatch, QsciLexerDiff, QsciLexerMakefile, QsciLexerProperties, QsciLexerTeX, QsciLexerCSharp, QsciLexerIDL, QsciLexerJavaScript, QsciLexerOctave, QsciLexerFortran, QsciLexerJava, and QsciLexerXML.
|
virtual |
Returns the name of the lexer. If 0 is returned then the lexer's numeric identifier is used. The default implementation returns 0.
Reimplemented in QsciLexerHTML, QsciLexerPerl, QsciLexerCPP, QsciLexerRuby, QsciLexerVerilog, QsciLexerCSS, QsciLexerCoffeeScript, QsciLexerSQL, QsciLexerD, QsciLexerMarkdown, QsciLexerPython, QsciLexerTCL, QsciLexerLua, QsciLexerPOV, QsciLexerPostScript, QsciLexerVHDL, QsciLexerAVS, QsciLexerCMake, QsciLexerFortran77, QsciLexerPascal, QsciLexerPO, QsciLexerBash, QsciLexerJSON, QsciLexerYAML, QsciLexerMatlab, QsciLexerSpice, QsciLexerBatch, QsciLexerDiff, QsciLexerMakefile, QsciLexerProperties, QsciLexerTeX, QsciLexerOctave, QsciLexerFortran, and QsciLexerXML.
|
virtual |
Returns the identifier (i.e. a QsciScintillaBase::SCLEX_* value) of the lexer. This is only used if lexer() returns 0. The default implementation returns QsciScintillaBase::SCLEX_CONTAINER.
QsciAbstractAPIs* QsciLexer::apis | ( | ) | const |
Returns the current API set or 0 if there isn't one.
|
virtual |
Returns the list of character sequences that can separate auto-completion words. The first in the list is assumed to be the sequence used to separate words in the lexer's API files.
Reimplemented in QsciLexerPerl, QsciLexerCPP, QsciLexerCoffeeScript, QsciLexerD, QsciLexerPython, QsciLexerLua, and QsciLexerPascal.
int QsciLexer::autoIndentStyle | ( | ) |
Returns the auto-indentation style. The default is 0 if the language is block structured, or QsciScintilla::AiMaintain if not.
|
virtual |
Returns a space separated list of words or characters in a particular style that define the end of a block for auto-indentation. The style is returned via style.
Reimplemented in QsciLexerPerl, QsciLexerCPP, QsciLexerRuby, QsciLexerCoffeeScript, QsciLexerCSS, QsciLexerD, and QsciLexerPascal.
|
virtual |
Returns the number of lines prior to the current one when determining the scope of a block when auto-indenting.
Reimplemented in QsciLexerPython.
|
virtual |
Returns a space separated list of words or characters in a particular style that define the start of a block for auto-indentation. The style is returned via style.
Reimplemented in QsciLexerPerl, QsciLexerCPP, QsciLexerRuby, QsciLexerCoffeeScript, QsciLexerCSS, QsciLexerD, QsciLexerPython, QsciLexerLua, and QsciLexerPascal.
|
virtual |
Returns a space separated list of keywords in a particular style that define the start of a block for auto-indentation. The style is returned via style.
Reimplemented in QsciLexerCPP, QsciLexerRuby, QsciLexerCoffeeScript, QsciLexerD, and QsciLexerPascal.
|
virtual |
Returns the foreground colour of the text for style number style. The default colour is that returned by defaultColor().
|
virtual |
Returns the end-of-line for style number style. The default is false.
|
virtual |
Returns the font for style number style. The default font is that returned by defaultFont().
|
virtual |
Returns the set of keywords for the keyword set set recognised by the lexer as a space separated string. 0 is returned if there is no such set.
Reimplemented in QsciLexerHTML, QsciLexerCPP, QsciLexerPerl, QsciLexerRuby, QsciLexerCoffeeScript, QsciLexerD, QsciLexerPython, QsciLexerVerilog, QsciLexerCSS, QsciLexerLua, QsciLexerSQL, QsciLexerTCL, QsciLexerPascal, QsciLexerPOV, QsciLexerVHDL, QsciLexerPostScript, QsciLexerFortran77, QsciLexerBash, QsciLexerAVS, QsciLexerCMake, QsciLexerJSON, QsciLexerBatch, QsciLexerYAML, QsciLexerMatlab, QsciLexerSpice, QsciLexerTeX, QsciLexerXML, QsciLexerCSharp, QsciLexerJavaScript, QsciLexerOctave, QsciLexerFortran, QsciLexerIDL, and QsciLexerJava.
|
virtual |
Returns the number of the style used for whitespace. The default implementation returns 0 which is the convention adopted by most lexers.
|
pure virtual |
Returns the descriptive name for style number style. For a valid style number for this language a non-empty QString must be returned. If the style number is invalid then an empty QString must be returned. This is intended to be used in user preference dialogs.
Implemented in QsciLexerHTML, QsciLexerCPP, QsciLexerPerl, QsciLexerRuby, QsciLexerCoffeeScript, QsciLexerD, QsciLexerPython, QsciLexerVerilog, QsciLexerCSS, QsciLexerLua, QsciLexerSQL, QsciLexerTCL, QsciLexerPascal, QsciLexerMarkdown, QsciLexerPOV, QsciLexerVHDL, QsciLexerPostScript, QsciLexerFortran77, QsciLexerBash, QsciLexerAVS, QsciLexerCMake, QsciLexerJSON, QsciLexerPO, QsciLexerBatch, QsciLexerYAML, QsciLexerSpice, QsciLexerMakefile, QsciLexerMatlab, QsciLexerProperties, QsciLexerDiff, QsciLexerTeX, QsciLexerCSharp, QsciLexerJavaScript, and QsciLexerIDL.
|
virtual |
Returns the background colour of the text for style number style.
QColor QsciLexer::defaultColor | ( | ) | const |
Returns the default text colour.
|
virtual |
Returns the default end-of-line for style number style. The default is false.
Reimplemented in QsciLexerHTML, QsciLexerPerl, QsciLexerCPP, QsciLexerRuby, QsciLexerCoffeeScript, QsciLexerD, QsciLexerVerilog, QsciLexerPython, QsciLexerLua, QsciLexerSQL, QsciLexerTCL, QsciLexerPascal, QsciLexerPOV, QsciLexerVHDL, QsciLexerFortran77, QsciLexerBash, QsciLexerJSON, QsciLexerBatch, QsciLexerYAML, QsciLexerMakefile, QsciLexerProperties, QsciLexerXML, QsciLexerCSharp, and QsciLexerJavaScript.
QFont QsciLexer::defaultFont | ( | ) | const |
Returns the default font.
QColor QsciLexer::defaultPaper | ( | ) | const |
Returns the default paper colour.
|
inline |
Returns the QsciScintilla instance that the lexer is currently attached to or 0 if it is unattached.
void QsciLexer::setAPIs | ( | QsciAbstractAPIs * | apis | ) |
The current set of APIs is set to apis. If apis is 0 then any existing APIs for this lexer are removed.
void QsciLexer::setDefaultColor | ( | const QColor & | c | ) |
The default text colour is set to c.
void QsciLexer::setDefaultFont | ( | const QFont & | f | ) |
The default font is set to f.
void QsciLexer::setDefaultPaper | ( | const QColor & | c | ) |
The default paper colour is set to c.
bool QsciLexer::readSettings | ( | QSettings & | qs, |
const char * | prefix = "/Scintilla" |
||
) |
The colour, paper, font and end-of-line for each style number, and all lexer specific properties are read from the settings qs. prefix is prepended to the key of each entry. true is returned if there was no error.
|
virtual |
Causes all properties to be refreshed by emitting the propertyChanged() signal as required.
Reimplemented in QsciLexerHTML, QsciLexerCPP, QsciLexerPerl, QsciLexerRuby, QsciLexerCoffeeScript, QsciLexerD, QsciLexerPython, QsciLexerVerilog, QsciLexerCSS, QsciLexerLua, QsciLexerSQL, QsciLexerTCL, QsciLexerPascal, QsciLexerPOV, QsciLexerVHDL, QsciLexerPostScript, QsciLexerFortran77, QsciLexerBash, QsciLexerAVS, QsciLexerCMake, QsciLexerJSON, QsciLexerPO, QsciLexerYAML, QsciLexerProperties, QsciLexerTeX, and QsciLexerXML.
|
virtual |
Returns the number of style bits needed by the lexer. Normally this should only be re-implemented by custom lexers.
Reimplemented in QsciLexerCustom.
|
virtual |
Returns the string of characters that comprise a word. The default is 0 which implies the upper and lower case alphabetic characters and underscore.
Reimplemented in QsciLexerHTML, QsciLexerPerl, QsciLexerCPP, QsciLexerCoffeeScript, QsciLexerD, QsciLexerCSS, QsciLexerVerilog, QsciLexerPOV, QsciLexerAVS, QsciLexerBash, QsciLexerBatch, QsciLexerDiff, QsciLexerMakefile, QsciLexerProperties, and QsciLexerTeX.
bool QsciLexer::writeSettings | ( | QSettings & | qs, |
const char * | prefix = "/Scintilla" |
||
) | const |
The colour, paper, font and end-of-line for each style number, and all lexer specific properties are written to the settings qs. prefix is prepended to the key of each entry. true is returned if there was no error.
|
virtualslot |
The auto-indentation style is set to autoindentstyle.
|
virtualslot |
The foreground colour for style number style is set to c. If style is -1 then the colour is set for all styles.
|
virtualslot |
The end-of-line fill for style number style is set to eoffill. If style is -1 then the fill is set for all styles.
|
virtualslot |
The font for style number style is set to f. If style is -1 then the font is set for all styles.
|
virtualslot |
The background colour for style number style is set to c. If style is -1 then the colour is set for all styles.
|
signal |
This signal is emitted when the foreground colour of style number style has changed. The new colour is c.
|
signal |
This signal is emitted when the end-of-file fill of style number style has changed. The new fill is eolfilled.
|
signal |
This signal is emitted when the font of style number style has changed. The new font is f.
|
signal |
This signal is emitted when the background colour of style number style has changed. The new colour is c.
|
signal |
This signal is emitted when the value of the lexer property prop needs to be changed. The new value is val.
|
protectedvirtual |
The lexer's properties are read from the settings qs. prefix (which has a trailing '/') should be used as a prefix to the key of each setting. true is returned if there is no error.
Reimplemented in QsciLexerHTML, QsciLexerCPP, QsciLexerPerl, QsciLexerPython, QsciLexerSQL, QsciLexerCoffeeScript, QsciLexerVerilog, QsciLexerCSS, QsciLexerRuby, QsciLexerD, QsciLexerPascal, QsciLexerVHDL, QsciLexerPOV, QsciLexerPostScript, QsciLexerLua, QsciLexerTCL, QsciLexerJSON, QsciLexerBash, QsciLexerAVS, QsciLexerFortran77, QsciLexerPO, QsciLexerCMake, QsciLexerTeX, QsciLexerProperties, QsciLexerYAML, and QsciLexerXML.
Referenced by QsciLexerPerl::foldAtElse(), QsciLexerVerilog::foldAtModule(), QsciLexerTCL::foldComments(), QsciLexerJSON::foldCompact(), QsciLexerRuby::foldCompact(), QsciLexerProperties::initialSpaces(), QsciLexerHTML::makoTemplates(), QsciLexerTeX::processIf(), QsciLexerSQL::quotedIdentifiers(), QsciLexerCSS::SCSSLanguage(), QsciLexerCoffeeScript::stylePreprocessor(), QsciLexerPython::v3BytesAllowed(), and QsciLexerCPP::verbatimStringEscapeSequencesAllowed().
|
protectedvirtual |
The lexer's properties are written to the settings qs. prefix (which has a trailing '/') should be used as a prefix to the key of each setting. true is returned if there is no error.
Reimplemented in QsciLexerHTML, QsciLexerCPP, QsciLexerPerl, QsciLexerPython, QsciLexerSQL, QsciLexerCoffeeScript, QsciLexerVerilog, QsciLexerCSS, QsciLexerD, QsciLexerRuby, QsciLexerPascal, QsciLexerVHDL, QsciLexerPOV, QsciLexerPostScript, QsciLexerLua, QsciLexerTCL, QsciLexerJSON, QsciLexerBash, QsciLexerAVS, QsciLexerFortran77, QsciLexerPO, QsciLexerCMake, QsciLexerTeX, QsciLexerProperties, QsciLexerYAML, and QsciLexerXML.
Referenced by QsciLexerPerl::foldAtElse(), QsciLexerVerilog::foldAtModule(), QsciLexerTCL::foldComments(), QsciLexerJSON::foldCompact(), QsciLexerRuby::foldCompact(), QsciLexerProperties::initialSpaces(), QsciLexerHTML::makoTemplates(), QsciLexerTeX::processIf(), QsciLexerSQL::quotedIdentifiers(), QsciLexerCSS::SCSSLanguage(), QsciLexerCoffeeScript::stylePreprocessor(), QsciLexerPython::v3BytesAllowed(), and QsciLexerCPP::verbatimStringEscapeSequencesAllowed().