]> git.saurik.com Git - wxWidgets.git/blob - contrib/src/stc/scintilla/src/KeyWords.cxx
This commit includes the following changes:
[wxWidgets.git] / contrib / src / stc / scintilla / src / KeyWords.cxx
1 // SciTE - Scintilla based Text Editor
2 // KeyWords.cxx - 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 #include <stdlib.h>
7 #include <string.h>
8 #include <ctype.h>
9 #include <stdio.h>
10 #include <stdarg.h>
11
12 #include "Platform.h"
13
14 #include "PropSet.h"
15 #include "Accessor.h"
16 #include "KeyWords.h"
17 #include "Scintilla.h"
18 #include "SciLexer.h"
19
20 LexerModule *LexerModule::base = 0;
21
22 LexerModule::LexerModule(int language_, LexerFunction fn_) :
23 language(language_), fn(fn_) {
24 next = base;
25 base = this;
26 }
27
28 void LexerModule::Colourise(unsigned int startPos, int lengthDoc, int initStyle,
29 int language, WordList *keywordlists[], StylingContext &styler) {
30 LexerModule *lm = base;
31 while (lm) {
32 if (lm->language == language) {
33 lm->fn(startPos, lengthDoc, initStyle, keywordlists, styler);
34 return;
35 }
36 lm = lm->next;
37 }
38 // Unknown language
39 // Null language means all style bytes are 0 so just mark the end - no need to fill in.
40 if (lengthDoc > 0) {
41 styler.StartAt(startPos + lengthDoc - 1);
42 styler.StartSegment(startPos + lengthDoc - 1);
43 styler.ColourTo(startPos + lengthDoc - 1, 0);
44 }
45 }