~ubuntu-branches/ubuntu/wily/tora/wily-proposed

« back to all changes in this revision

Viewing changes to src/qscintilla2/Qt4/Qsci/qscilexerbash.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Meskes
  • Date: 2009-11-19 15:18:19 UTC
  • mfrom: (1.2.9 upstream) (3.3.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091119151819-me89ezmxzkvl0lws
Tags: 2.1.1-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// This defines the interface to the QsciLexerBash class.
 
2
//
 
3
// Copyright (c) 2008 Riverbank Computing Limited <info@riverbankcomputing.com>
 
4
// 
 
5
// This file is part of QScintilla.
 
6
// 
 
7
// This file may be used under the terms of the GNU General Public
 
8
// License versions 2.0 or 3.0 as published by the Free Software
 
9
// Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
 
10
// included in the packaging of this file.  Alternatively you may (at
 
11
// your option) use any later version of the GNU General Public
 
12
// License if such license has been publicly approved by Riverbank
 
13
// Computing Limited (or its successors, if any) and the KDE Free Qt
 
14
// Foundation. In addition, as a special exception, Riverbank gives you
 
15
// certain additional rights. These rights are described in the Riverbank
 
16
// GPL Exception version 1.1, which can be found in the file
 
17
// GPL_EXCEPTION.txt in this package.
 
18
// 
 
19
// Please review the following information to ensure GNU General
 
20
// Public Licensing requirements will be met:
 
21
// http://trolltech.com/products/qt/licenses/licensing/opensource/. If
 
22
// you are unsure which license is appropriate for your use, please
 
23
// review the following information:
 
24
// http://trolltech.com/products/qt/licenses/licensing/licensingoverview
 
25
// or contact the sales department at sales@riverbankcomputing.com.
 
26
// 
 
27
// This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
 
28
// INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
 
29
// A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly
 
30
// granted herein.
 
31
// 
 
32
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
33
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
34
 
 
35
 
 
36
#ifndef QSCILEXERBASH_H
 
37
#define QSCILEXERBASH_H
 
38
 
 
39
#ifdef __APPLE__
 
40
extern "C++" {
 
41
#endif
 
42
 
 
43
#include <qobject.h>
 
44
 
 
45
#include <Qsci/qsciglobal.h>
 
46
#include <Qsci/qscilexer.h>
 
47
 
 
48
 
 
49
//! \brief The QsciLexerBash class encapsulates the Scintilla Bash lexer.
 
50
class QSCINTILLA_EXPORT QsciLexerBash : public QsciLexer
 
51
{
 
52
        Q_OBJECT
 
53
 
 
54
public:
 
55
        //! This enum defines the meanings of the different styles used by the
 
56
        //! Bash lexer.
 
57
        enum {
 
58
                //! The default.
 
59
                Default = 0,
 
60
 
 
61
                //! An error.
 
62
                Error = 1,
 
63
 
 
64
                //! A comment.
 
65
                Comment = 2,
 
66
 
 
67
                //! A number.
 
68
                Number = 3,
 
69
 
 
70
                //! A keyword.
 
71
                Keyword = 4,
 
72
 
 
73
                //! A double-quoted string.
 
74
                DoubleQuotedString = 5,
 
75
 
 
76
                //! A single-quoted string.
 
77
                SingleQuotedString = 6,
 
78
 
 
79
                //! An operator.
 
80
                Operator = 7,
 
81
 
 
82
                //! An identifier
 
83
                Identifier = 8,
 
84
 
 
85
                //! A scalar.
 
86
                Scalar = 9,
 
87
 
 
88
                //! Parameter expansion.
 
89
                ParameterExpansion = 10,
 
90
 
 
91
                //! Backticks.
 
92
                Backticks = 11,
 
93
 
 
94
                //! A here document delimiter.
 
95
                HereDocumentDelimiter = 12,
 
96
 
 
97
                //! A single quoted here document.
 
98
                SingleQuotedHereDocument = 13
 
99
        };
 
100
 
 
101
        //! Construct a QsciLexerBash with parent \a parent.  \a parent is
 
102
    //! typically the QsciScintilla instance.
 
103
        QsciLexerBash(QObject *parent = 0);
 
104
 
 
105
        //! Destroys the QsciLexerBash instance.
 
106
        virtual ~QsciLexerBash();
 
107
 
 
108
        //! Returns the name of the language.
 
109
        const char *language() const;
 
110
 
 
111
        //! Returns the name of the lexer.  Some lexers support a number of
 
112
        //! languages.
 
113
        const char *lexer() const;
 
114
 
 
115
        //! \internal Returns the style used for braces for brace matching.
 
116
        int braceStyle() const;
 
117
 
 
118
        //! \internal Returns the string of characters that comprise a word.
 
119
        const char *wordCharacters() const;
 
120
 
 
121
        //! Returns the foreground colour of the text for style number \a style.
 
122
        //!
 
123
        //! \sa defaultPaper()
 
124
        QColor defaultColor(int style) const;
 
125
 
 
126
        //! Returns the end-of-line fill for style number \a style.
 
127
        bool defaultEolFill(int style) const;
 
128
 
 
129
        //! Returns the font for style number \a style.
 
130
        QFont defaultFont(int style) const;
 
131
 
 
132
        //! Returns the background colour of the text for style number \a style.
 
133
        //!
 
134
        //! \sa defaultColor()
 
135
        QColor defaultPaper(int style) const;
 
136
 
 
137
        //! Returns the set of keywords for the keyword set \a set recognised
 
138
        //! by the lexer as a space separated string.
 
139
        const char *keywords(int set) const;
 
140
 
 
141
        //! Returns the descriptive name for style number \a style.  If the
 
142
        //! style is invalid for this language then an empty QString is returned.
 
143
        //! This is intended to be used in user preference dialogs.
 
144
        QString description(int style) const;
 
145
 
 
146
        //! Causes all properties to be refreshed by emitting the
 
147
        //! propertyChanged() signal as required.
 
148
        void refreshProperties();
 
149
 
 
150
        //! Returns true if multi-line comment blocks can be folded.
 
151
        //!
 
152
        //! \sa setFoldComments()
 
153
        bool foldComments() const;
 
154
 
 
155
        //! Returns true if trailing blank lines are included in a fold block.
 
156
        //!
 
157
        //! \sa setFoldCompact()
 
158
        bool foldCompact() const;
 
159
 
 
160
public slots:
 
161
        //! If \a fold is true then multi-line comment blocks can be folded.
 
162
        //! The default is false.
 
163
        //!
 
164
        //! \sa foldComments()
 
165
        virtual void setFoldComments(bool fold);
 
166
 
 
167
        //! If \a fold is true then trailing blank lines are included in a fold
 
168
        //! block. The default is true.
 
169
        //!
 
170
        //! \sa foldCompact()
 
171
        virtual void setFoldCompact(bool fold);
 
172
 
 
173
protected:
 
174
        //! The lexer's properties are read from the settings \a qs.  \a prefix
 
175
        //! (which has a trailing '/') should be used as a prefix to the key of
 
176
        //! each setting.  true is returned if there is no error.
 
177
        //!
 
178
        bool readProperties(QSettings &qs,const QString &prefix);
 
179
 
 
180
        //! The lexer's properties are written to the settings \a qs.
 
181
        //! \a prefix (which has a trailing '/') should be used as a prefix to
 
182
        //! the key of each setting.  true is returned if there is no error.
 
183
        //!
 
184
        bool writeProperties(QSettings &qs,const QString &prefix) const;
 
185
 
 
186
private:
 
187
        void setCommentProp();
 
188
        void setCompactProp();
 
189
 
 
190
        bool fold_comments;
 
191
        bool fold_compact;
 
192
 
 
193
        QsciLexerBash(const QsciLexerBash &);
 
194
        QsciLexerBash &operator=(const QsciLexerBash &);
 
195
};
 
196
 
 
197
#ifdef __APPLE__
 
198
}
 
199
#endif
 
200
 
 
201
#endif