~ubuntu-branches/ubuntu/utopic/geany/utopic

« back to all changes in this revision

Viewing changes to scintilla/lexlib/LexerModule.h

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2011-12-10 07:43:26 UTC
  • mfrom: (3.3.7 sid)
  • Revision ID: package-import@ubuntu.com-20111210074326-s8yqbew5i20h33tf
Tags: 0.21-1ubuntu1
* Merge from Debian Unstable, remaining changes:
  - debian/patches/20_use_evince_viewer.patch:
     + use evince as viewer for pdf and dvi files
  - debian/patches/20_use_x_terminal_emulator.patch:
     + use x-terminal-emulator as terminal
  - debian/control
     + Add breaks on geany-plugins-common << 0.20
* Also fixes bugs:
  - Filter for MATLAB/Octave files filters everythign (LP: 885505)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Scintilla source code edit control
 
2
/** @file LexerModule.h
 
3
 ** Colourise for particular languages.
 
4
 **/
 
5
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 
6
// The License.txt file describes the conditions under which this software may be distributed.
 
7
 
 
8
#ifndef LEXERMODULE_H
 
9
#define LEXERMODULE_H
 
10
 
 
11
#ifdef SCI_NAMESPACE
 
12
namespace Scintilla {
 
13
#endif
 
14
 
 
15
class Accessor;
 
16
class WordList;
 
17
 
 
18
typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
 
19
                  WordList *keywordlists[], Accessor &styler);
 
20
typedef ILexer *(*LexerFactoryFunction)();
 
21
 
 
22
/**
 
23
 * A LexerModule is responsible for lexing and folding a particular language.
 
24
 * The class maintains a list of LexerModules which can be searched to find a
 
25
 * module appropriate to a particular language.
 
26
 */
 
27
class LexerModule {
 
28
protected:
 
29
        int language;
 
30
        LexerFunction fnLexer;
 
31
        LexerFunction fnFolder;
 
32
        LexerFactoryFunction fnFactory;
 
33
        const char * const * wordListDescriptions;
 
34
        int styleBits;
 
35
 
 
36
public:
 
37
        const char *languageName;
 
38
        LexerModule(int language_,
 
39
                LexerFunction fnLexer_,
 
40
                const char *languageName_=0,
 
41
                LexerFunction fnFolder_=0,
 
42
                const char * const wordListDescriptions_[] = NULL,
 
43
                int styleBits_=5);
 
44
        LexerModule(int language_,
 
45
                LexerFactoryFunction fnFactory_,
 
46
                const char *languageName_,
 
47
                const char * const wordListDescriptions_[] = NULL,
 
48
                int styleBits_=8);
 
49
        virtual ~LexerModule() {
 
50
        }
 
51
        int GetLanguage() const { return language; }
 
52
 
 
53
        // -1 is returned if no WordList information is available
 
54
        int GetNumWordLists() const;
 
55
        const char *GetWordListDescription(int index) const;
 
56
 
 
57
        int GetStyleBitsNeeded() const;
 
58
 
 
59
        ILexer *Create() const;
 
60
 
 
61
        virtual void Lex(unsigned int startPos, int length, int initStyle,
 
62
                  WordList *keywordlists[], Accessor &styler) const;
 
63
        virtual void Fold(unsigned int startPos, int length, int initStyle,
 
64
                  WordList *keywordlists[], Accessor &styler) const;
 
65
 
 
66
        friend class Catalogue;
 
67
};
 
68
 
 
69
inline int Maximum(int a, int b) {
 
70
        return (a > b) ? a : b;
 
71
}
 
72
 
 
73
// Shut up annoying Visual C++ warnings:
 
74
#ifdef _MSC_VER
 
75
#pragma warning(disable: 4244 4309 4514 4710)
 
76
#endif
 
77
 
 
78
#ifdef SCI_NAMESPACE
 
79
}
 
80
#endif
 
81
 
 
82
#endif