diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-30 11:36:13 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-30 11:36:13 -0600 |
commit | 664e37abfe5c796c1279b8295fb030f126b0a7d8 (patch) | |
tree | 85f4e661e5c615f01ee1cdf51ca1250b96efe315 /qt/qextscintillalexerhtml.h | |
download | tqscintilla-664e37abfe5c796c1279b8295fb030f126b0a7d8.tar.gz tqscintilla-664e37abfe5c796c1279b8295fb030f126b0a7d8.zip |
Initial import of qscintilla from 2007
Diffstat (limited to 'qt/qextscintillalexerhtml.h')
-rw-r--r-- | qt/qextscintillalexerhtml.h | 486 |
1 files changed, 486 insertions, 0 deletions
diff --git a/qt/qextscintillalexerhtml.h b/qt/qextscintillalexerhtml.h new file mode 100644 index 0000000..1a71fe9 --- /dev/null +++ b/qt/qextscintillalexerhtml.h @@ -0,0 +1,486 @@ +// This defines the interface to the QextScintillaLexerHTML class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERHTML_H +#define QEXTSCINTILLALEXERHTML_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerHTML class encapsulates the Scintilla HTML +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerHTML : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! HTML lexer. + enum { + //! The default. + Default = 0, + + //! A tag. + Tag = 1, + + //! An unknown tag. + UnknownTag = 2, + + //! An attribute. + Attribute = 3, + + //! An unknown attribute. + UnknownAttribute = 4, + + //! An HTML number. + HTMLNumber = 5, + + //! An HTML double-quoted string. + HTMLDoubleQuotedString = 6, + + //! An HTML single-quoted string. + HTMLSingleQuotedString = 7, + + //! Other text within a tag. + OtherInTag = 8, + + //! An HTML comment. + HTMLComment = 9, + + //! An entity. + Entity = 10, + + //! The end of an XML style tag. + XMLTagEnd = 11, + + //! The start of an XML fragment. + XMLStart = 12, + + //! The end of an XML fragment. + XMLEnd = 13, + + //! A script tag. + Script = 14, + + //! The start of an ASP fragment with @. + ASPAtStart = 15, + + //! The start of an ASP fragment. + ASPStart = 16, + + //! CDATA. + CDATA = 17, + + //! The start of a PHP fragment. + PHPStart = 18, + + //! An unquoted HTML value. + HTMLValue = 19, + + //! An ASP X-Code comment. + ASPXCComment = 20, + + //! The default for SGML. + SGMLDefault = 21, + + //! An SGML command. + SGMLCommand = 22, + + //! The first parameter of an SGML command. + SGMLParameter = 23, + + //! An SGML double-quoted string. + SGMLDoubleQuotedString = 24, + + //! An SGML single-quoted string. + SGMLSingleQuotedString = 25, + + //! An SGML error. + SGMLError = 26, + + //! An SGML special entity. + SGMLSpecial = 27, + + //! An SGML entity. + SGMLEntity = 28, + + //! An SGML comment. + SGMLComment = 29, + + //! A comment with the first parameter of an SGML command. + SGMLParameterComment = 30, + + //! The default for an SGML block. + SGMLBlockDefault = 31, + + //! The start of a JavaScript fragment. + JavaScriptStart = 40, + + //! The default for JavaScript. + JavaScriptDefault = 41, + + //! A JavaScript comment. + JavaScriptComment = 42, + + //! A JavaScript line comment. + JavaScriptCommentLine = 43, + + //! A JavaDoc style JavaScript comment. + JavaScriptCommentDoc = 44, + + //! A JavaScript number. + JavaScriptNumber = 45, + + //! A JavaScript word. + JavaScriptWord = 46, + + //! A JavaScript keyword. + JavaScriptKeyword = 47, + + //! A JavaScript double-quoted string. + JavaScriptDoubleQuotedString = 48, + + //! A JavaScript single-quoted string. + JavaScriptSingleQuotedString = 49, + + //! A JavaScript symbol. + JavaScriptSymbol = 50, + + //! The end of a JavaScript line where a string is not closed. + JavaScriptUnclosedString = 51, + + //! A JavaScript regular expression. + JavaScriptRegex = 52, + + //! The start of an ASP JavaScript fragment. + ASPJavaScriptStart = 55, + + //! The default for ASP JavaScript. + ASPJavaScriptDefault = 56, + + //! An ASP JavaScript comment. + ASPJavaScriptComment = 57, + + //! An ASP JavaScript line comment. + ASPJavaScriptCommentLine = 58, + + //! An ASP JavaDoc style JavaScript comment. + ASPJavaScriptCommentDoc = 59, + + //! An ASP JavaScript number. + ASPJavaScriptNumber = 60, + + //! An ASP JavaScript word. + ASPJavaScriptWord = 61, + + //! An ASP JavaScript keyword. + ASPJavaScriptKeyword = 62, + + //! An ASP JavaScript double-quoted string. + ASPJavaScriptDoubleQuotedString = 63, + + //! An ASP JavaScript single-quoted string. + ASPJavaScriptSingleQuotedString = 64, + + //! An ASP JavaScript symbol. + ASPJavaScriptSymbol = 65, + + //! The end of an ASP JavaScript line where a string is not + //! closed. + ASPJavaScriptUnclosedString = 66, + + //! An ASP JavaScript regular expression. + ASPJavaScriptRegex = 67, + + //! The start of a VBScript fragment. + VBScriptStart = 70, + + //! The default for VBScript. + VBScriptDefault = 71, + + //! A VBScript comment. + VBScriptComment = 72, + + //! A VBScript number. + VBScriptNumber = 73, + + //! A VBScript keyword. + VBScriptKeyword = 74, + + //! A VBScript string. + VBScriptString = 75, + + //! A VBScript identifier. + VBScriptIdentifier = 76, + + //! The end of a VBScript line where a string is not closed. + VBScriptUnclosedString = 77, + + //! The start of an ASP VBScript fragment. + ASPVBScriptStart = 80, + + //! The default for ASP VBScript. + ASPVBScriptDefault = 81, + + //! An ASP VBScript comment. + ASPVBScriptComment = 82, + + //! An ASP VBScript number. + ASPVBScriptNumber = 83, + + //! An ASP VBScript keyword. + ASPVBScriptKeyword = 84, + + //! An ASP VBScript string. + ASPVBScriptString = 85, + + //! An ASP VBScript identifier. + ASPVBScriptIdentifier = 86, + + //! The end of an ASP VBScript line where a string is not + //! closed. + ASPVBScriptUnclosedString = 87, + + //! The start of a Python fragment. + PythonStart = 90, + + //! The default for Python. + PythonDefault = 91, + + //! A Python comment. + PythonComment = 92, + + //! A Python number. + PythonNumber = 93, + + //! A Python double-quoted string. + PythonDoubleQuotedString = 94, + + //! A Python single-quoted string. + PythonSingleQuotedString = 95, + + //! A Python keyword. + PythonKeyword = 96, + + //! A Python triple single-quoted string. + PythonTripleSingleQuotedString = 97, + + //! A Python triple double-quoted string. + PythonTripleDoubleQuotedString = 98, + + //! The name of a Python class. + PythonClassName = 99, + + //! The name of a Python function or method. + PythonFunctionMethodName = 100, + + //! A Python operator. + PythonOperator = 101, + + //! A Python identifier. + PythonIdentifier = 102, + + //! The start of an ASP Python fragment. + ASPPythonStart = 105, + + //! The default for ASP Python. + ASPPythonDefault = 106, + + //! An ASP Python comment. + ASPPythonComment = 107, + + //! An ASP Python number. + ASPPythonNumber = 108, + + //! An ASP Python double-quoted string. + ASPPythonDoubleQuotedString = 109, + + //! An ASP Python single-quoted string. + ASPPythonSingleQuotedString = 110, + + //! An ASP Python keyword. + ASPPythonKeyword = 111, + + //! An ASP Python triple single-quoted string. + ASPPythonTripleSingleQuotedString = 112, + + //! An ASP Python triple double-quoted string. + ASPPythonTripleDoubleQuotedString = 113, + + //! The name of an ASP Python class. + ASPPythonClassName = 114, + + //! The name of an ASP Python function or method. + ASPPythonFunctionMethodName = 115, + + //! An ASP Python operator. + ASPPythonOperator = 116, + + //! An ASP Python identifier + ASPPythonIdentifier = 117, + + //! The default for PHP. + PHPDefault = 118, + + //! A PHP double-quoted string. + PHPDoubleQuotedString = 119, + + //! A PHP single-quoted string. + PHPSingleQuotedString = 120, + + //! A PHP keyword. + PHPKeyword = 121, + + //! A PHP number. + PHPNumber = 122, + + //! A PHP variable. + PHPVariable = 123, + + //! A PHP comment. + PHPComment = 124, + + //! A PHP line comment. + PHPCommentLine = 125, + + //! A PHP double-quoted variable. + PHPDoubleQuotedVariable = 126, + + //! A PHP operator. + PHPOperator = 127 + }; + + //! Construct a QextScintillaLexerHTML with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerHTML(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerHTML instance. + virtual ~QextScintillaLexerHTML(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns the string of characters that comprise a word. + const char *wordCharacters() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool eolFill(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa color() + QColor paper(int style) const; + + //! Causes all properties to be refreshed by emitting the + //! propertyChanged() signal as required. + void refreshProperties(); + + //! Returns TRUE if trailing blank lines are included in a fold block. + //! + //! \sa setFoldCompact() + bool foldCompact() const; + + //! Returns TRUE if preprocessor blocks can be folded. + //! + //! \sa setFoldPreprocessor() + bool foldPreprocessor() const; + + //! Returns TRUE if tags are case sensitive. + //! + //! \sa setCaseSensitiveTags() + bool caseSensitiveTags() const; + +public slots: + //! If \a fold is TRUE then trailing blank lines are included in a fold + //! block. The default is TRUE. + //! + //! \sa foldCompact() + virtual void setFoldCompact(bool fold); + + //! If \a fold is TRUE then preprocessor blocks can be folded. The + //! default is FALSE. + //! + //! \sa foldPreprocessor() + virtual void setFoldPreprocessor(bool fold); + + //! If \a sens is TRUE then tags are case sensitive. The default is + //! FALSE. + //! + //! \sa caseSensitiveTags() + virtual void setCaseSensitiveTags(bool sens); + +protected: + //! The lexer's properties are read from the settings \a qs. \a 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. + //! + bool readProperties(QSettings &qs,const QString &prefix); + + //! The lexer's properties are written to the settings \a qs. + //! \a 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. + //! + bool writeProperties(QSettings &qs,const QString &prefix) const; + +private: + void setCompactProp(); + void setPreprocProp(); + void setCaseSensTagsProp(); + + bool fold_compact; + bool fold_preproc; + bool case_sens_tags; + +#if defined(Q_DISABLE_COPY) + QextScintillaLexerHTML(const QextScintillaLexerHTML &); + QextScintillaLexerHTML &operator=(const QextScintillaLexerHTML &); +#endif +}; + +#endif |