]>
Commit | Line | Data |
---|---|---|
1 | // SciTE - Scintilla based Text Editor | |
2 | // KeyWords.h - colourise for particular languages | |
3 | // Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> | |
4 | // The License.txt file describes the conditions under which this software may be distributed. | |
5 | ||
6 | typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle, | |
7 | WordList *keywordlists[], Accessor &styler); | |
8 | ||
9 | class LexerModule { | |
10 | static LexerModule *base; | |
11 | LexerModule *next; | |
12 | int language; | |
13 | LexerFunction fn; | |
14 | public: | |
15 | LexerModule(int language_, LexerFunction fn_); | |
16 | static void Colourise(unsigned int startPos, int lengthDoc, int initStyle, | |
17 | int language, WordList *keywordlists[], Accessor &styler); | |
18 | }; | |
19 | ||
20 | inline bool iswordchar(char ch) { | |
21 | return isalnum(ch) || ch == '.' || ch == '_'; | |
22 | } | |
23 | ||
24 | inline bool iswordstart(char ch) { | |
25 | return isalnum(ch) || ch == '_'; | |
26 | } | |
27 | ||
28 | inline bool isoperator(char ch) { | |
29 | if (isalnum(ch)) | |
30 | return false; | |
31 | // '.' left out as it is used to make up numbers | |
32 | if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || | |
33 | ch == '(' || ch == ')' || ch == '-' || ch == '+' || | |
34 | ch == '=' || ch == '|' || ch == '{' || ch == '}' || | |
35 | ch == '[' || ch == ']' || ch == ':' || ch == ';' || | |
36 | ch == '<' || ch == '>' || ch == ',' || ch == '/' || | |
37 | ch == '?' || ch == '!' || ch == '.' || ch == '~') | |
38 | return true; | |
39 | return false; | |
40 | } | |
41 |