Quark  0.1
LanguageSyntax Class Reference

A base class for recognizing a language syntax. More...

#include <LanguageSyntax.h++>

Inheritance diagram for LanguageSyntax:

Public Member Functions

virtual ~LanguageSyntax ()
 Destructor. More...
 
QString language () const
 Returns the name of the language. More...
 

Protected Member Functions

 LanguageSyntax (const QString &language)
 Constructs a LanguageSyntax for the specified language. More...
 
void addHighlightingRule (const QString &element, const QString &pattern, bool caseInsensitive=false)
 Adds a highlighting rule to the language for syntax elements that do not span multiple lines of text. More...
 
void addMultilineHighlightingRule (const QString &element, const QString &startPattern, const QString &endPattern, bool caseInsensitive=false)
 Adds a highlighting rule to the language for syntax elements that can span multiple lines of text, such as multi-line comments. More...
 

Static Protected Attributes

static const char * SINGLE_QUOTED_STRING_PATTERN
 A pattern for matching a single-quoted string in which embedded single-quotes are escaped using a backslash character. More...
 
static const char * DOUBLE_QUOTED_STRING_PATTERN
 A pattern for matching a double-quoted string in which embedded double-quotes are escaped using a backslash character. More...
 

Detailed Description

A base class for recognizing a language syntax.

Used in conjunction with a SyntaxHighlighter to perform syntax highlighting of a document.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ ~LanguageSyntax()

virtual ~LanguageSyntax ( )
virtual

Destructor.

◆ LanguageSyntax()

LanguageSyntax ( const QString &  language)
protected

Constructs a LanguageSyntax for the specified language.

Parameters
languageThe name of the language.

Member Function Documentation

◆ addHighlightingRule()

void addHighlightingRule ( const QString &  element,
const QString &  pattern,
bool  caseInsensitive = false 
)
protected

Adds a highlighting rule to the language for syntax elements that do not span multiple lines of text.

Parameters
elementThe name of the syntax element.
patternThe regular expression pattern for matching the element.
caseInsensitiveWhether the match should be case-insensitive.

◆ addMultilineHighlightingRule()

void addMultilineHighlightingRule ( const QString &  element,
const QString &  startPattern,
const QString &  endPattern,
bool  caseInsensitive = false 
)
protected

Adds a highlighting rule to the language for syntax elements that can span multiple lines of text, such as multi-line comments.

Parameters
elementThe name of the syntax element.
startPatternThe regular expression pattern for matching the beginning of the element.
endPatternThe regular expression pattern for matching the end of the element.
caseInsensitiveWhether the match should be case-insensitive.

◆ language()

QString language ( ) const
inline

Returns the name of the language.

Member Data Documentation

◆ DOUBLE_QUOTED_STRING_PATTERN

const char* DOUBLE_QUOTED_STRING_PATTERN
staticprotected

A pattern for matching a double-quoted string in which embedded double-quotes are escaped using a backslash character.

◆ SINGLE_QUOTED_STRING_PATTERN

const char* SINGLE_QUOTED_STRING_PATTERN
staticprotected

A pattern for matching a single-quoted string in which embedded single-quotes are escaped using a backslash character.


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