]>
git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/include/KeyWords.h
059ac0da0fd881dbe31aebe03c584cb368837f39
1 // Scintilla source code edit control
3 ** Colourise for particular languages.
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.
8 typedef void (*LexerFunction
)(unsigned int startPos
, int lengthDoc
, int initStyle
,
9 WordList
*keywordlists
[], Accessor
&styler
);
12 * A LexerModule is responsible for lexing and folding a particular language.
13 * The class maintains a list of LexerModules which can be searched to find a
14 * module appropriate to a particular language.
18 const LexerModule
*next
;
20 LexerFunction fnLexer
;
21 LexerFunction fnFolder
;
22 const char * const * wordListDescriptions
;
25 static const LexerModule
*base
;
26 static int nextLanguage
;
29 const char *languageName
;
30 LexerModule(int language_
,
31 LexerFunction fnLexer_
,
32 const char *languageName_
=0,
33 LexerFunction fnFolder_
=0,
34 const char * const wordListDescriptions_
[] = NULL
,
36 virtual ~LexerModule() {
38 int GetLanguage() const { return language
; }
40 // -1 is returned if no WordList information is available
41 int GetNumWordLists() const;
42 const char *GetWordListDescription(int index
) const;
44 int GetStyleBitsNeeded() const;
46 virtual void Lex(unsigned int startPos
, int lengthDoc
, int initStyle
,
47 WordList
*keywordlists
[], Accessor
&styler
) const;
48 virtual void Fold(unsigned int startPos
, int lengthDoc
, int initStyle
,
49 WordList
*keywordlists
[], Accessor
&styler
) const;
50 static const LexerModule
*Find(int language
);
51 static const LexerModule
*Find(const char *languageName
);
55 * Check if a character is a space.
56 * This is ASCII specific but is safe with chars >= 0x80.
58 inline bool isspacechar(unsigned char ch
) {
59 return (ch
== ' ') || ((ch
>= 0x09) && (ch
<= 0x0d));
62 inline bool iswordchar(char ch
) {
63 return isascii(ch
) && (isalnum(ch
) || ch
== '.' || ch
== '_');
66 inline bool iswordstart(char ch
) {
67 return isascii(ch
) && (isalnum(ch
) || ch
== '_');
70 inline bool isoperator(char ch
) {
71 if (isascii(ch
) && isalnum(ch
))
73 // '.' left out as it is used to make up numbers
74 if (ch
== '%' || ch
== '^' || ch
== '&' || ch
== '*' ||
75 ch
== '(' || ch
== ')' || ch
== '-' || ch
== '+' ||
76 ch
== '=' || ch
== '|' || ch
== '{' || ch
== '}' ||
77 ch
== '[' || ch
== ']' || ch
== ':' || ch
== ';' ||
78 ch
== '<' || ch
== '>' || ch
== ',' || ch
== '/' ||
79 ch
== '?' || ch
== '!' || ch
== '.' || ch
== '~')