]>
Commit | Line | Data |
---|---|---|
1dcf666d RD |
1 | // Scintilla source code edit control |
2 | /** @file LexerSimple.cxx | |
3 | ** A simple lexer with no state. | |
4 | **/ | |
5 | // Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> | |
6 | // The License.txt file describes the conditions under which this software may be distributed. | |
7 | ||
8 | #include <stdlib.h> | |
9 | #include <string.h> | |
10 | #include <stdio.h> | |
11 | #include <stdarg.h> | |
12 | #include <assert.h> | |
13 | #include <ctype.h> | |
14 | ||
15 | #include "ILexer.h" | |
16 | #include "Scintilla.h" | |
17 | #include "SciLexer.h" | |
18 | ||
19 | #include "PropSetSimple.h" | |
20 | #include "WordList.h" | |
21 | #include "LexAccessor.h" | |
22 | #include "Accessor.h" | |
23 | #include "LexerModule.h" | |
24 | #include "LexerBase.h" | |
25 | ||
26 | #ifdef SCI_NAMESPACE | |
27 | using namespace Scintilla; | |
28 | #endif | |
29 | ||
30 | LexerBase::LexerBase() { | |
31 | for (int wl = 0; wl < numWordLists; wl++) | |
32 | keyWordLists[wl] = new WordList; | |
33 | keyWordLists[numWordLists] = 0; | |
34 | } | |
35 | ||
36 | LexerBase::~LexerBase() { | |
37 | for (int wl = 0; wl < numWordLists; wl++) { | |
38 | delete keyWordLists[wl]; | |
39 | keyWordLists[wl] = 0; | |
40 | } | |
41 | keyWordLists[numWordLists] = 0; | |
42 | } | |
43 | ||
44 | void SCI_METHOD LexerBase::Release() { | |
45 | delete this; | |
46 | } | |
47 | ||
48 | int SCI_METHOD LexerBase::Version() const { | |
49 | return lvOriginal; | |
50 | } | |
51 | ||
52 | const char * SCI_METHOD LexerBase::PropertyNames() { | |
53 | return ""; | |
54 | } | |
55 | ||
56 | int SCI_METHOD LexerBase::PropertyType(const char *) { | |
57 | return SC_TYPE_BOOLEAN; | |
58 | } | |
59 | ||
60 | const char * SCI_METHOD LexerBase::DescribeProperty(const char *) { | |
61 | return ""; | |
62 | } | |
63 | ||
64 | int SCI_METHOD LexerBase::PropertySet(const char *key, const char *val) { | |
65 | const char *valOld = props.Get(key); | |
66 | if (strcmp(val, valOld) != 0) { | |
67 | props.Set(key, val); | |
68 | return 0; | |
69 | } else { | |
70 | return -1; | |
71 | } | |
72 | } | |
73 | ||
74 | const char * SCI_METHOD LexerBase::DescribeWordListSets() { | |
75 | return ""; | |
76 | } | |
77 | ||
78 | int SCI_METHOD LexerBase::WordListSet(int n, const char *wl) { | |
79 | if (n < numWordLists) { | |
80 | WordList wlNew; | |
81 | wlNew.Set(wl); | |
82 | if (*keyWordLists[n] != wlNew) { | |
83 | keyWordLists[n]->Set(wl); | |
84 | return 0; | |
85 | } | |
86 | } | |
87 | return -1; | |
88 | } | |
89 | ||
90 | void * SCI_METHOD LexerBase::PrivateCall(int, void *) { | |
91 | return 0; | |
92 | } |