updated Scintilla to 2.29
[TortoiseGit.git] / ext / scintilla / lexlib / LexerNoExceptions.cxx
blobe179a74beefdf5d03f67766b91ab3051a1544277
1 // Scintilla source code edit control
2 /** @file LexerNoExceptions.cxx
3 ** A simple lexer with no state which does not throw exceptions so can be used in an external lexer.
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.
8 #include <stdlib.h>
9 #include <string.h>
10 #include <stdio.h>
11 #include <stdarg.h>
12 #include <assert.h>
13 #include <ctype.h>
15 #include "ILexer.h"
16 #include "Scintilla.h"
17 #include "SciLexer.h"
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 #include "LexerNoExceptions.h"
27 #ifdef SCI_NAMESPACE
28 using namespace Scintilla;
29 #endif
31 int SCI_METHOD LexerNoExceptions::PropertySet(const char *key, const char *val) {
32 try {
33 return LexerBase::PropertySet(key, val);
34 } catch (...) {
35 // Should not throw into caller as may be compiled with different compiler or options
37 return -1;
40 int SCI_METHOD LexerNoExceptions::WordListSet(int n, const char *wl) {
41 try {
42 return LexerBase::WordListSet(n, wl);
43 } catch (...) {
44 // Should not throw into caller as may be compiled with different compiler or options
46 return -1;
49 void SCI_METHOD LexerNoExceptions::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
50 try {
51 Accessor astyler(pAccess, &props);
52 Lexer(startPos, length, initStyle, pAccess, astyler);
53 astyler.Flush();
54 } catch (...) {
55 // Should not throw into caller as may be compiled with different compiler or options
56 pAccess->SetErrorStatus(SC_STATUS_FAILURE);
59 void SCI_METHOD LexerNoExceptions::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
60 try {
61 Accessor astyler(pAccess, &props);
62 Folder(startPos, length, initStyle, pAccess, astyler);
63 astyler.Flush();
64 } catch (...) {
65 // Should not throw into caller as may be compiled with different compiler or options
66 pAccess->SetErrorStatus(SC_STATUS_FAILURE);