diff options
author | nyamatongwe <devnull@localhost> | 2000-04-04 09:17:32 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2000-04-04 09:17:32 +0000 |
commit | 3032c371bd9231f097226869e80bf56543ae2cab (patch) | |
tree | 5438281b06996314dfc3c8250769b1604b413728 /src | |
parent | 943cf3a48da52953c1f2377d9e412ae81b79b5e0 (diff) | |
download | scintilla-mirror-3032c371bd9231f097226869e80bf56543ae2cab.tar.gz |
Split a Document based Accessor (DocumentAccessor) off from
the old accessor which is now called WindowAccessor.
Accessor.h defines a common interface which is the type consumed
by the lexers.
Diffstat (limited to 'src')
-rw-r--r-- | src/KeyWords.cxx | 2 | ||||
-rw-r--r-- | src/LexCPP.cxx | 4 | ||||
-rw-r--r-- | src/LexHTML.cxx | 20 | ||||
-rw-r--r-- | src/LexOthers.cxx | 16 | ||||
-rw-r--r-- | src/LexPerl.cxx | 6 | ||||
-rw-r--r-- | src/LexPython.cxx | 6 | ||||
-rw-r--r-- | src/LexSQL.cxx | 4 | ||||
-rw-r--r-- | src/LexVB.cxx | 4 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 5 |
9 files changed, 35 insertions, 32 deletions
diff --git a/src/KeyWords.cxx b/src/KeyWords.cxx index 5d6d9c6cf..7cc69bd28 100644 --- a/src/KeyWords.cxx +++ b/src/KeyWords.cxx @@ -26,7 +26,7 @@ LexerModule::LexerModule(int language_, LexerFunction fn_) : } void LexerModule::Colourise(unsigned int startPos, int lengthDoc, int initStyle, - int language, WordList *keywordlists[], StylingContext &styler) { + int language, WordList *keywordlists[], BufferAccess &styler) { LexerModule *lm = base; while (lm) { if (lm->language == language) { diff --git a/src/LexCPP.cxx b/src/LexCPP.cxx index 4afae231f..d3c00164f 100644 --- a/src/LexCPP.cxx +++ b/src/LexCPP.cxx @@ -17,7 +17,7 @@ #include "Scintilla.h" #include "SciLexer.h" -static bool classifyWordCpp(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { +static bool classifyWordCpp(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); bool wordIsUUID = false; @@ -39,7 +39,7 @@ static bool classifyWordCpp(unsigned int start, unsigned int end, WordList &keyw } static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], - StylingContext &styler) { + BufferAccess &styler) { WordList &keywords = *keywordlists[0]; diff --git a/src/LexHTML.cxx b/src/LexHTML.cxx index ae2de8ff2..490bed6ee 100644 --- a/src/LexHTML.cxx +++ b/src/LexHTML.cxx @@ -18,7 +18,7 @@ #include "SciLexer.h" enum { eScriptNone, eScriptJS, eScriptVBS, eScriptPython }; -static int segIsScriptingIndicator(StylingContext &styler, unsigned int start, unsigned int end, int prevValue) { +static int segIsScriptingIndicator(BufferAccess &styler, unsigned int start, unsigned int end, int prevValue) { char s[100]; s[0] = '\0'; for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -38,7 +38,7 @@ static int segIsScriptingIndicator(StylingContext &styler, unsigned int start, u return prevValue; } -static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { +static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler) { bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.') || (styler[start] == '-') || (styler[start] == '#'); char chAttr = SCE_H_ATTRIBUTEUNKNOWN; @@ -58,7 +58,7 @@ static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &k } static int classifyTagHTML(unsigned int start, unsigned int end, - WordList &keywords, StylingContext &styler) { + WordList &keywords, BufferAccess &styler) { char s[100]; // Copy after the '<' unsigned int i = 0; @@ -86,7 +86,7 @@ static int classifyTagHTML(unsigned int start, unsigned int end, } static void classifyWordHTJS(unsigned int start, unsigned int end, - WordList &keywords, StylingContext &styler) { + WordList &keywords, BufferAccess &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -104,7 +104,7 @@ static void classifyWordHTJS(unsigned int start, unsigned int end, } static void classifyWordHTJSA(unsigned int start, unsigned int end, - WordList &keywords, StylingContext &styler) { + WordList &keywords, BufferAccess &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -121,7 +121,7 @@ static void classifyWordHTJSA(unsigned int start, unsigned int end, styler.ColourTo(end, chAttr); } -static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { +static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -145,7 +145,7 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw return SCE_HB_DEFAULT; } -static int classifyWordHTVBA(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { +static int classifyWordHTVBA(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -169,7 +169,7 @@ static int classifyWordHTVBA(unsigned int start, unsigned int end, WordList &key return SCE_HBA_DEFAULT; } -static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler, char *prevWord) { +static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler, char *prevWord) { char s[100]; bool wordIsNumber = isdigit(styler[start]); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -189,7 +189,7 @@ static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &key strcpy(prevWord, s); } -static void classifyWordHTPyA(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler, char *prevWord) { +static void classifyWordHTPyA(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler, char *prevWord) { char s[100]; bool wordIsNumber = isdigit(styler[start]); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -226,7 +226,7 @@ static bool isLineEnd(char ch) { } static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], - StylingContext &styler) { + BufferAccess &styler) { WordList &keywords=*keywordlists[0]; WordList &keywords2=*keywordlists[1]; diff --git a/src/LexOthers.cxx b/src/LexOthers.cxx index d2a0d563b..abaf3ce75 100644 --- a/src/LexOthers.cxx +++ b/src/LexOthers.cxx @@ -17,7 +17,7 @@ #include "Scintilla.h" #include "SciLexer.h" -static void ColouriseBatchLine(char *lineBuffer, int endLine, StylingContext &styler) { +static void ColouriseBatchLine(char *lineBuffer, int endLine, BufferAccess &styler) { if (0 == strncmp(lineBuffer, "REM", 3)) { styler.ColourTo(endLine, 1); } else if (0 == strncmp(lineBuffer, "rem", 3)) { @@ -33,7 +33,7 @@ static void ColouriseBatchLine(char *lineBuffer, int endLine, StylingContext &st } } -static void ColouriseBatchDoc(unsigned int startPos, int length, int, WordList *[], StylingContext &styler) { +static void ColouriseBatchDoc(unsigned int startPos, int length, int, WordList *[], BufferAccess &styler) { char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); @@ -49,7 +49,7 @@ static void ColouriseBatchDoc(unsigned int startPos, int length, int, WordList * ColouriseBatchLine(lineBuffer, startPos + length, styler); } -static void ColourisePropsLine(char *lineBuffer, int lengthLine, int startLine, int endPos, StylingContext &styler) { +static void ColourisePropsLine(char *lineBuffer, int lengthLine, int startLine, int endPos, BufferAccess &styler) { int i = 0; while (isspace(lineBuffer[i]) && (i < lengthLine)) // Skip initial spaces i++; @@ -75,7 +75,7 @@ static void ColourisePropsLine(char *lineBuffer, int lengthLine, int startLine, } } -static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *[], StylingContext &styler) { +static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *[], BufferAccess &styler) { char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); @@ -96,7 +96,7 @@ static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList * ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length, styler); } -static void ColouriseMakeLine(char *lineBuffer, int lengthLine, int endPos, StylingContext &styler) { +static void ColouriseMakeLine(char *lineBuffer, int lengthLine, int endPos, BufferAccess &styler) { int i = 0; while (isspace(lineBuffer[i]) && (i < lengthLine)) i++; @@ -107,7 +107,7 @@ static void ColouriseMakeLine(char *lineBuffer, int lengthLine, int endPos, Styl } } -static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[], StylingContext &styler) { +static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[], BufferAccess &styler) { char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); @@ -123,7 +123,7 @@ static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[ ColouriseMakeLine(lineBuffer, linePos, startPos + length, styler); } -static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos, StylingContext &styler) { +static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos, BufferAccess &styler) { if (lineBuffer[0] == '>') { // Command or return status styler.ColourTo(endPos, 4); @@ -178,7 +178,7 @@ static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos, } } -static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], StylingContext &styler) { +static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], BufferAccess &styler) { char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); diff --git a/src/LexPerl.cxx b/src/LexPerl.cxx index f9170b9c3..c52aa8c4f 100644 --- a/src/LexPerl.cxx +++ b/src/LexPerl.cxx @@ -31,7 +31,7 @@ inline bool isPerlOperator(char ch) { return false; } -static int classifyWordPerl(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { +static int classifyWordPerl(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -54,7 +54,7 @@ static bool isEndVar(char ch) { ch != '_' && ch != '\''; } -static bool isMatch(StylingContext &styler, int lengthDoc, int pos, const char *val) { +static bool isMatch(BufferAccess &styler, int lengthDoc, int pos, const char *val) { if ((pos + static_cast<int>(strlen(val))) >= lengthDoc) { return false; } @@ -90,7 +90,7 @@ static char opposite(char ch) { } static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], StylingContext &styler) { + WordList *keywordlists[], BufferAccess &styler) { // Lexer for perl often has to backtrack to start of current style to determine // which characters are being used as quotes, how deeply nested is the diff --git a/src/LexPython.cxx b/src/LexPython.cxx index d7830b0b7..fcaa541ac 100644 --- a/src/LexPython.cxx +++ b/src/LexPython.cxx @@ -17,7 +17,7 @@ #include "Scintilla.h" #include "SciLexer.h" -static void classifyWordPy(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler, char *prevWord) { +static void classifyWordPy(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler, char *prevWord) { char s[100]; bool wordIsNumber = isdigit(styler[start]); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -37,12 +37,12 @@ static void classifyWordPy(unsigned int start, unsigned int end, WordList &keywo strcpy(prevWord, s); } -static bool IsPyComment(StylingContext &styler, int pos, int len) { +static bool IsPyComment(BufferAccess &styler, int pos, int len) { return len>0 && styler[pos]=='#'; } static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], StylingContext &styler) { + WordList *keywordlists[], BufferAccess &styler) { // Python uses a different mask because bad indentation is marked by oring with 32 styler.StartAt(startPos, 127); diff --git a/src/LexSQL.cxx b/src/LexSQL.cxx index 900f8ddc2..6433776ca 100644 --- a/src/LexSQL.cxx +++ b/src/LexSQL.cxx @@ -17,7 +17,7 @@ #include "Scintilla.h" #include "SciLexer.h" -static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { +static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -35,7 +35,7 @@ static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keyw } static void ColouriseSQLDoc(unsigned int startPos, int length, - int initStyle, WordList *keywordlists[], StylingContext &styler) { + int initStyle, WordList *keywordlists[], BufferAccess &styler) { WordList &keywords = *keywordlists[0]; diff --git a/src/LexVB.cxx b/src/LexVB.cxx index a78ea07b5..2b2154f21 100644 --- a/src/LexVB.cxx +++ b/src/LexVB.cxx @@ -17,7 +17,7 @@ #include "Scintilla.h" #include "SciLexer.h" -static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { +static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); @@ -43,7 +43,7 @@ static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywor } static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], StylingContext &styler) { + WordList *keywordlists[], BufferAccess &styler) { WordList &keywords = *keywordlists[0]; diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 21f984044..76177f242 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -15,6 +15,8 @@ #include "SciLexer.h" #include "PropSet.h" #include "Accessor.h" +#include "WindowAccessor.h" +#include "DocumentAccessor.h" #include "KeyWords.h" #endif #include "ContractionState.h" @@ -276,7 +278,8 @@ void ScintillaBase::Colourise(int start, int end) { end = lengthDoc; int len = end - start; - StylingContext styler(wMain.GetID(), props); + //WindowAccessor styler(wMain.GetID(), props); + DocumentAccessor styler(pdoc, props); int styleStart = 0; if (start > 0) |