QsciLexer Class Reference

The QsciLexer class is an abstract class used as a base for language lexers. More...

#include <qscilexer.h>

Inherited by QsciLexerBash, QsciLexerBatch, QsciLexerCMake, QsciLexerCPP, QsciLexerCSS, QsciLexerCustom, QsciLexerD, QsciLexerDiff, QsciLexerFortran77, QsciLexerHTML, QsciLexerLua, QsciLexerMakefile, QsciLexerPascal, QsciLexerPerl, QsciLexerPostScript, QsciLexerPOV, QsciLexerProperties, QsciLexerPython, QsciLexerRuby, QsciLexerSpice, QsciLexerSQL, QsciLexerTCL, QsciLexerTeX, QsciLexerVerilog, QsciLexerVHDL, and QsciLexerYAML.

List of all members.

Classes

Public Slots

Signals

Public Member Functions

Protected Member Functions


Detailed Description

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.


Constructor & Destructor Documentation

QsciLexer::QsciLexer ( QObject *  parent = 0  ) 

Construct a QsciLexer with parent parent. parent is typically the QsciScintilla instance.


Member Function Documentation

virtual const char* QsciLexer::language (  )  const [pure virtual]
virtual const char* QsciLexer::lexer (  )  const [virtual]
virtual int QsciLexer::lexerId (  )  const [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.

See also:
lexer()
QsciAbstractAPIs* QsciLexer::apis (  )  const

Returns the current API set or 0 if there isn't one.

See also:
setAPIs()
int QsciLexer::autoIndentStyle (  ) 

Returns the auto-indentation style. The default is 0 if the language is block structured, or QsciScintilla::AiMaintain if not.

See also:
setAutoIndentStyle(), QsciScintilla::AiMaintain, QsciScintilla::AiOpening, QsciScintilla::AiClosing
virtual QColor QsciLexer::color ( int  style  )  const [virtual]

Returns the foreground colour of the text for style number style. The default colour is that returned by defaultColor().

See also:
defaultColor(), paper()
virtual bool QsciLexer::eolFill ( int  style  )  const [virtual]

Returns the end-of-line for style number style. The default is false.

virtual QFont QsciLexer::font ( int  style  )  const [virtual]

Returns the font for style number style. The default font is that returned by defaultFont().

See also:
defaultFont()
virtual const char* QsciLexer::keywords ( int  set  )  const [virtual]
virtual QString QsciLexer::description ( int  style  )  const [pure virtual]

Returns the descriptive name for style number style. If the style is invalid for this language then an empty QString is returned. This is intended to be used in user preference dialogs.

Implemented in QsciLexerBash, QsciLexerBatch, QsciLexerCMake, QsciLexerCPP, QsciLexerCSharp, QsciLexerCSS, QsciLexerD, QsciLexerDiff, QsciLexerFortran77, QsciLexerHTML, QsciLexerIDL, QsciLexerJavaScript, QsciLexerLua, QsciLexerMakefile, QsciLexerPascal, QsciLexerPerl, QsciLexerPostScript, QsciLexerPOV, QsciLexerProperties, QsciLexerPython, QsciLexerRuby, QsciLexerSpice, QsciLexerSQL, QsciLexerTCL, QsciLexerTeX, QsciLexerVerilog, QsciLexerVHDL, and QsciLexerYAML.

virtual QColor QsciLexer::paper ( int  style  )  const [virtual]

Returns the background colour of the text for style number style.

See also:
defaultPaper(), color()
QColor QsciLexer::defaultColor (  )  const

Returns the default text colour.

See also:
setDefaultColor()
virtual bool QsciLexer::defaultEolFill ( int  style  )  const [virtual]
QFont QsciLexer::defaultFont (  )  const

Returns the default font.

See also:
setDefaultFont()
QColor QsciLexer::defaultPaper (  )  const

Returns the default paper colour.

See also:
setDefaultPaper()
QsciScintilla* QsciLexer::editor (  )  const [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.

See also:
apis()
void QsciLexer::setDefaultColor ( const QColor &  c  ) 

The default text colour is set to c.

See also:
defaultColor(), color()
void QsciLexer::setDefaultFont ( const QFont &  f  ) 

The default font is set to f.

See also:
defaultFont(), font()
void QsciLexer::setDefaultPaper ( const QColor &  c  ) 

The default paper colour is set to c.

See also:
defaultPaper(), paper()
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.

See also:
writeSettings(), QsciScintilla::setLexer()
virtual void QsciLexer::refreshProperties (  )  [virtual]
virtual int QsciLexer::styleBitsNeeded (  )  const [virtual]

Returns the number of style bits needed by the lexer. Normally this should only be re-implemented by custom lexers.

Reimplemented in QsciLexerCustom.

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.

See also:
readSettings()
virtual void QsciLexer::setAutoIndentStyle ( int  autoindentstyle  )  [virtual, slot]

The auto-indentation style is set to autoindentstyle.

See also:
autoIndentStyle(), QsciScintilla::AiMaintain, QsciScintilla::AiOpening, QsciScintilla::AiClosing
virtual void QsciLexer::setColor ( const QColor &  c,
int  style = -1 
) [virtual, slot]

The foreground colour for style number style is set to c. If style is -1 then the colour is set for all styles.

virtual void QsciLexer::setEolFill ( bool  eoffill,
int  style = -1 
) [virtual, slot]

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.

virtual void QsciLexer::setFont ( const QFont &  f,
int  style = -1 
) [virtual, slot]

The font for style number style is set to f. If style is -1 then the font is set for all styles.

virtual void QsciLexer::setPaper ( const QColor &  c,
int  style = -1 
) [virtual, slot]

The background colour for style number style is set to c. If style is -1 then the colour is set for all styles.

void QsciLexer::colorChanged ( const QColor &  c,
int  style 
) [signal]

This signal is emitted when the foreground colour of style number style has changed. The new colour is c.

void QsciLexer::eolFillChanged ( bool  eolfilled,
int  style 
) [signal]

This signal is emitted when the end-of-file fill of style number style has changed. The new fill is eolfilled.

void QsciLexer::fontChanged ( const QFont &  f,
int  style 
) [signal]

This signal is emitted when the font of style number style has changed. The new font is f.

void QsciLexer::paperChanged ( const QColor &  c,
int  style 
) [signal]

This signal is emitted when the background colour of style number style has changed. The new colour is c.

void QsciLexer::propertyChanged ( const char *  prop,
const char *  val 
) [signal]

This signal is emitted when the value of the lexer property prop needs to be changed. The new value is val.

virtual bool QsciLexer::readProperties ( QSettings &  qs,
const QString &  prefix 
) [protected, virtual]

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 QsciLexerBash, QsciLexerCMake, QsciLexerCPP, QsciLexerCSS, QsciLexerD, QsciLexerFortran77, QsciLexerHTML, QsciLexerLua, QsciLexerPascal, QsciLexerPerl, QsciLexerPostScript, QsciLexerPOV, QsciLexerProperties, QsciLexerPython, QsciLexerSQL, QsciLexerTCL, QsciLexerVerilog, QsciLexerVHDL, QsciLexerXML, and QsciLexerYAML.

virtual bool QsciLexer::writeProperties ( QSettings &  qs,
const QString &  prefix 
) const [protected, virtual]

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 QsciLexerBash, QsciLexerCMake, QsciLexerCPP, QsciLexerCSS, QsciLexerD, QsciLexerFortran77, QsciLexerHTML, QsciLexerLua, QsciLexerPascal, QsciLexerPerl, QsciLexerPostScript, QsciLexerPOV, QsciLexerProperties, QsciLexerPython, QsciLexerSQL, QsciLexerTCL, QsciLexerVerilog, QsciLexerVHDL, QsciLexerXML, and QsciLexerYAML.

Generated on Tue Aug 31 08:49:37 2010 for QScintilla by  doxygen 1.6.3