]>
git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/include/KeyWords.h
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
;
23 static const LexerModule
*base
;
24 static int nextLanguage
;
27 const char *languageName
;
28 LexerModule(int language_
, LexerFunction fnLexer_
,
29 const char *languageName_
=0, LexerFunction fnFolder_
=0);
30 int GetLanguage() const { return language
; }
31 virtual void Lex(unsigned int startPos
, int lengthDoc
, int initStyle
,
32 WordList
*keywordlists
[], Accessor
&styler
) const;
33 virtual void Fold(unsigned int startPos
, int lengthDoc
, int initStyle
,
34 WordList
*keywordlists
[], Accessor
&styler
) const;
35 static const LexerModule
*Find(int language
);
36 static const LexerModule
*Find(const char *languageName
);
40 * Check if a character is a space.
41 * This is ASCII specific but is safe with chars >= 0x80.
43 inline bool isspacechar(unsigned char ch
) {
44 return (ch
== ' ') || ((ch
>= 0x09) && (ch
<= 0x0d));
47 inline bool iswordchar(char ch
) {
48 return isascii(ch
) && (isalnum(ch
) || ch
== '.' || ch
== '_');
51 inline bool iswordstart(char ch
) {
52 return isascii(ch
) && (isalnum(ch
) || ch
== '_');
55 inline bool isoperator(char ch
) {
56 if (isascii(ch
) && isalnum(ch
))
58 // '.' left out as it is used to make up numbers
59 if (ch
== '%' || ch
== '^' || ch
== '&' || ch
== '*' ||
60 ch
== '(' || ch
== ')' || ch
== '-' || ch
== '+' ||
61 ch
== '=' || ch
== '|' || ch
== '{' || ch
== '}' ||
62 ch
== '[' || ch
== ']' || ch
== ':' || ch
== ';' ||
63 ch
== '<' || ch
== '>' || ch
== ',' || ch
== '/' ||
64 ch
== '?' || ch
== '!' || ch
== '.' || ch
== '~')