]> git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/lexlib/LexerSimple.cxx
Avoid calling gtk_window_get_position() from "configure-event" handler, if possible.
[wxWidgets.git] / src / stc / scintilla / lexlib / LexerSimple.cxx
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 <string>
16
17 #include "ILexer.h"
18 #include "Scintilla.h"
19 #include "SciLexer.h"
20
21 #include "PropSetSimple.h"
22 #include "WordList.h"
23 #include "LexAccessor.h"
24 #include "Accessor.h"
25 #include "LexerModule.h"
26 #include "LexerBase.h"
27 #include "LexerSimple.h"
28
29 #ifdef SCI_NAMESPACE
30 using namespace Scintilla;
31 #endif
32
33 LexerSimple::LexerSimple(const LexerModule *module_) : module(module_) {
34 for (int wl = 0; wl < module->GetNumWordLists(); wl++) {
35 if (!wordLists.empty())
36 wordLists += "\n";
37 wordLists += module->GetWordListDescription(wl);
38 }
39 }
40
41 const char * SCI_METHOD LexerSimple::DescribeWordListSets() {
42 return wordLists.c_str();
43 }
44
45 void SCI_METHOD LexerSimple::Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) {
46 Accessor astyler(pAccess, &props);
47 module->Lex(startPos, lengthDoc, initStyle, keyWordLists, astyler);
48 astyler.Flush();
49 }
50
51 void SCI_METHOD LexerSimple::Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) {
52 if (props.GetInt("fold")) {
53 Accessor astyler(pAccess, &props);
54 module->Fold(startPos, lengthDoc, initStyle, keyWordLists, astyler);
55 astyler.Flush();
56 }
57 }