~ubuntu-branches/ubuntu/quantal/mysql-workbench/quantal

« back to all changes in this revision

Viewing changes to ext/scintilla/lexlib/LexerSimple.cxx

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2012-03-01 21:57:30 UTC
  • Revision ID: package-import@ubuntu.com-20120301215730-o7y8av8y38n162ro
Tags: upstream-5.2.38+dfsg
ImportĀ upstreamĀ versionĀ 5.2.38+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
}