diff options
author | nyamatongwe <devnull@localhost> | 2000-03-16 11:34:13 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2000-03-16 11:34:13 +0000 |
commit | 6e7fcf47e44f5ec298ec3314a395397271b99572 (patch) | |
tree | dd46256eb90cc2e65b201e7b72937776c2b4ac14 /include/KeyWords.h | |
parent | 9f269884e78e6ed2005dd21b70bc0bdc0dcc66e0 (diff) | |
download | scintilla-mirror-6e7fcf47e44f5ec298ec3314a395397271b99572.tar.gz |
Moved some functionality from KeyWords into StylingContext so all the
lexing code could be moved out to files containing one lexer each.
Diffstat (limited to 'include/KeyWords.h')
-rw-r--r-- | include/KeyWords.h | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/include/KeyWords.h b/include/KeyWords.h index 2cc03b788..1b42ecdd9 100644 --- a/include/KeyWords.h +++ b/include/KeyWords.h @@ -3,6 +3,39 @@ // Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. -void ColouriseDoc(int codePage, int startPos, int lengthDoc, int initStyle, - int language, WordList *keywordlists[], StylingContext &styler); +typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], StylingContext &styler); + +class LexerModule { + static LexerModule *base; + LexerModule *next; + int language; + LexerFunction fn; +public: + LexerModule(int language_, LexerFunction fn_); + static void Colourise(unsigned int startPos, int lengthDoc, int initStyle, + int language, WordList *keywordlists[], StylingContext &styler); +}; + +inline bool iswordchar(char ch) { + return isalnum(ch) || ch == '.' || ch == '_'; +} + +inline bool iswordstart(char ch) { + return isalnum(ch) || ch == '_'; +} + +inline bool isoperator(char ch) { + if (isalnum(ch)) + return false; + // '.' left out as it is used to make up numbers + if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || + ch == '(' || ch == ')' || ch == '-' || ch == '+' || + ch == '=' || ch == '|' || ch == '{' || ch == '}' || + ch == '[' || ch == ']' || ch == ':' || ch == ';' || + ch == '<' || ch == '>' || ch == ',' || ch == '/' || + ch == '?' || ch == '!' || ch == '.' || ch == '~') + return true; + return false; +} |