]> git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/lexlib/LexerNoExceptions.cxx
Initial copy of Scintilla 3.21 code
[wxWidgets.git] / src / stc / scintilla / lexlib / LexerNoExceptions.cxx
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.
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 #include "LexerNoExceptions.h"
26
27 #ifdef SCI_NAMESPACE
28 using namespace Scintilla;
29 #endif
30
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
36 }
37 return -1;
38 }
39
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
45 }
46 return -1;
47 }
48
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);
57 }
58 }
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);
67 }
68 }