aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/KeyWords.h
diff options
context:
space:
mode:
authornyamatongwe <unknown>2000-03-16 11:34:13 +0000
committernyamatongwe <unknown>2000-03-16 11:34:13 +0000
commiteb094bf04da0485bb06f683e1aa59ade3ebc37fa (patch)
treedd46256eb90cc2e65b201e7b72937776c2b4ac14 /include/KeyWords.h
parentda55fb1293a9c2ae87db143c6d1a1640aa5f934f (diff)
downloadscintilla-mirror-eb094bf04da0485bb06f683e1aa59ade3ebc37fa.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.h37
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;
+}