diff options
-rw-r--r-- | Readme-mod.txt | 2 | ||||
-rw-r--r-- | scintilla/include/Accessor.h | 79 | ||||
-rw-r--r-- | scintilla/include/ILexer.h | 69 | ||||
-rw-r--r-- | scintilla/include/KeyWords.h | 113 | ||||
-rw-r--r-- | scintilla/include/PropSet.h | 26 | ||||
-rw-r--r-- | scintilla/include/SciLexer.h | 32 | ||||
-rw-r--r-- | scintilla/include/Scintilla.h | 25 | ||||
-rw-r--r-- | scintilla/include/ScintillaWidget.h | 2 | ||||
-rw-r--r-- | scintilla/include/WindowAccessor.h | 67 | ||||
-rw-r--r-- | scintilla/lexers/LexAHK.cxx (renamed from scintilla/src/LexAHK.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexAPDL.cxx (renamed from scintilla/src/LexAPDL.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexASY.cxx (renamed from scintilla/src/LexASY.cxx) | 28 | ||||
-rw-r--r-- | scintilla/lexers/LexAU3.cxx (renamed from scintilla/src/LexAU3.cxx) | 136 | ||||
-rw-r--r-- | scintilla/lexers/LexAVE.cxx (renamed from scintilla/src/LexAVE.cxx) | 18 | ||||
-rw-r--r-- | scintilla/lexers/LexAbaqus.cxx (renamed from scintilla/src/LexAbaqus.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexAda.cxx (renamed from scintilla/src/LexAda.cxx) | 15 | ||||
-rw-r--r-- | scintilla/lexers/LexAsm.cxx (renamed from scintilla/src/LexAsm.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexAsn1.cxx (renamed from scintilla/src/LexAsn1.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexBaan.cxx (renamed from scintilla/src/LexBaan.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexBash.cxx (renamed from scintilla/src/LexBash.cxx) | 238 | ||||
-rw-r--r-- | scintilla/lexers/LexBasic.cxx (renamed from scintilla/src/LexBasic.cxx) | 15 | ||||
-rw-r--r-- | scintilla/lexers/LexBullant.cxx (renamed from scintilla/src/LexBullant.cxx) | 17 | ||||
-rw-r--r-- | scintilla/lexers/LexCLW.cxx (renamed from scintilla/src/LexCLW.cxx) | 46 | ||||
-rw-r--r-- | scintilla/lexers/LexCOBOL.cxx (renamed from scintilla/src/LexCOBOL.cxx) | 20 | ||||
-rw-r--r-- | scintilla/lexers/LexCPP.cxx | 1088 | ||||
-rw-r--r-- | scintilla/lexers/LexCSS.cxx (renamed from scintilla/src/LexCSS.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexCaml.cxx (renamed from scintilla/src/LexCaml.cxx) | 19 | ||||
-rw-r--r-- | scintilla/lexers/LexCmake.cxx (renamed from scintilla/src/LexCmake.cxx) | 19 | ||||
-rw-r--r-- | scintilla/lexers/LexConf.cxx (renamed from scintilla/src/LexConf.cxx) | 17 | ||||
-rw-r--r-- | scintilla/lexers/LexCrontab.cxx (renamed from scintilla/src/LexCrontab.cxx) | 17 | ||||
-rw-r--r-- | scintilla/lexers/LexCsound.cxx (renamed from scintilla/src/LexCsound.cxx) | 23 | ||||
-rw-r--r-- | scintilla/lexers/LexD.cxx (renamed from scintilla/src/LexD.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexEScript.cxx (renamed from scintilla/src/LexEScript.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexEiffel.cxx (renamed from scintilla/src/LexEiffel.cxx) | 18 | ||||
-rw-r--r-- | scintilla/lexers/LexErlang.cxx (renamed from scintilla/src/LexErlang.cxx) | 27 | ||||
-rw-r--r-- | scintilla/lexers/LexFlagship.cxx (renamed from scintilla/src/LexFlagship.cxx) | 15 | ||||
-rw-r--r-- | scintilla/lexers/LexForth.cxx (renamed from scintilla/src/LexForth.cxx) | 20 | ||||
-rw-r--r-- | scintilla/lexers/LexFortran.cxx (renamed from scintilla/src/LexFortran.cxx) | 18 | ||||
-rw-r--r-- | scintilla/lexers/LexGAP.cxx (renamed from scintilla/src/LexGAP.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexGui4Cli.cxx (renamed from scintilla/src/LexGui4Cli.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexHTML.cxx (renamed from scintilla/src/LexHTML.cxx) | 38 | ||||
-rw-r--r-- | scintilla/lexers/LexHaskell.cxx | 368 | ||||
-rw-r--r-- | scintilla/lexers/LexInno.cxx (renamed from scintilla/src/LexInno.cxx) | 17 | ||||
-rw-r--r-- | scintilla/lexers/LexKix.cxx (renamed from scintilla/src/LexKix.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexLisp.cxx (renamed from scintilla/src/LexLisp.cxx) | 18 | ||||
-rw-r--r-- | scintilla/lexers/LexLout.cxx (renamed from scintilla/src/LexLout.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexLua.cxx (renamed from scintilla/src/LexLua.cxx) | 17 | ||||
-rw-r--r-- | scintilla/lexers/LexMMIXAL.cxx (renamed from scintilla/src/LexMMIXAL.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexMPT.cxx (renamed from scintilla/src/LexMPT.cxx) | 31 | ||||
-rw-r--r-- | scintilla/lexers/LexMSSQL.cxx (renamed from scintilla/src/LexMSSQL.cxx) | 17 | ||||
-rw-r--r-- | scintilla/lexers/LexMagik.cxx (renamed from scintilla/src/LexMagik.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexMarkdown.cxx (renamed from scintilla/src/LexMarkdown.cxx) | 77 | ||||
-rw-r--r-- | scintilla/lexers/LexMatlab.cxx (renamed from scintilla/src/LexMatlab.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexMetapost.cxx (renamed from scintilla/src/LexMetapost.cxx) | 32 | ||||
-rw-r--r-- | scintilla/lexers/LexMySQL.cxx (renamed from scintilla/src/LexMySQL.cxx) | 216 | ||||
-rw-r--r-- | scintilla/lexers/LexNimrod.cxx (renamed from scintilla/src/LexNimrod.cxx) | 34 | ||||
-rw-r--r-- | scintilla/lexers/LexNsis.cxx (renamed from scintilla/src/LexNsis.cxx) | 19 | ||||
-rw-r--r-- | scintilla/lexers/LexOpal.cxx (renamed from scintilla/src/LexOpal.cxx) | 64 | ||||
-rw-r--r-- | scintilla/lexers/LexOthers.cxx (renamed from scintilla/src/LexOthers.cxx) | 20 | ||||
-rw-r--r-- | scintilla/lexers/LexPB.cxx (renamed from scintilla/src/LexPB.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexPLM.cxx (renamed from scintilla/src/LexPLM.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexPOV.cxx (renamed from scintilla/src/LexPOV.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexPS.cxx (renamed from scintilla/src/LexPS.cxx) | 18 | ||||
-rw-r--r-- | scintilla/lexers/LexPascal.cxx (renamed from scintilla/src/LexPascal.cxx) | 163 | ||||
-rw-r--r-- | scintilla/lexers/LexPerl.cxx (renamed from scintilla/src/LexPerl.cxx) | 86 | ||||
-rw-r--r-- | scintilla/lexers/LexPowerPro.cxx (renamed from scintilla/src/LexPowerPro.cxx) | 396 | ||||
-rw-r--r-- | scintilla/lexers/LexPowerShell.cxx (renamed from scintilla/src/LexPowerShell.cxx) | 45 | ||||
-rw-r--r-- | scintilla/lexers/LexProgress.cxx (renamed from scintilla/src/LexProgress.cxx) | 20 | ||||
-rw-r--r-- | scintilla/lexers/LexPython.cxx (renamed from scintilla/src/LexPython.cxx) | 18 | ||||
-rw-r--r-- | scintilla/lexers/LexR.cxx (renamed from scintilla/src/LexR.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexRebol.cxx (renamed from scintilla/src/LexRebol.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexRuby.cxx (renamed from scintilla/src/LexRuby.cxx) | 159 | ||||
-rw-r--r-- | scintilla/lexers/LexSML.cxx (renamed from scintilla/src/LexSML.cxx) | 21 | ||||
-rw-r--r-- | scintilla/lexers/LexSQL.cxx (renamed from scintilla/src/LexSQL.cxx) | 26 | ||||
-rw-r--r-- | scintilla/lexers/LexScriptol.cxx (renamed from scintilla/src/LexScriptol.cxx) | 22 | ||||
-rw-r--r-- | scintilla/lexers/LexSmalltalk.cxx (renamed from scintilla/src/LexSmalltalk.cxx) | 34 | ||||
-rw-r--r-- | scintilla/lexers/LexSorcus.cxx (renamed from scintilla/src/LexSorcus.cxx) | 136 | ||||
-rw-r--r-- | scintilla/lexers/LexSpecman.cxx (renamed from scintilla/src/LexSpecman.cxx) | 14 | ||||
-rw-r--r-- | scintilla/lexers/LexSpice.cxx (renamed from scintilla/src/LexSpice.cxx) | 15 | ||||
-rw-r--r-- | scintilla/lexers/LexTACL.cxx (renamed from scintilla/src/LexTACL.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexTADS3.cxx (renamed from scintilla/src/LexTADS3.cxx) | 28 | ||||
-rw-r--r-- | scintilla/lexers/LexTAL.cxx (renamed from scintilla/src/LexTAL.cxx) | 18 | ||||
-rw-r--r-- | scintilla/lexers/LexTCL.cxx (renamed from scintilla/src/LexTCL.cxx) | 30 | ||||
-rw-r--r-- | scintilla/lexers/LexTeX.cxx (renamed from scintilla/src/LexTeX.cxx) | 56 | ||||
-rw-r--r-- | scintilla/lexers/LexTxt2tags.cxx | 481 | ||||
-rw-r--r-- | scintilla/lexers/LexVB.cxx (renamed from scintilla/src/LexVB.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexVHDL.cxx (renamed from scintilla/src/LexVHDL.cxx) | 18 | ||||
-rw-r--r-- | scintilla/lexers/LexVerilog.cxx (renamed from scintilla/src/LexVerilog.cxx) | 16 | ||||
-rw-r--r-- | scintilla/lexers/LexYAML.cxx (renamed from scintilla/src/LexYAML.cxx) | 18 | ||||
-rw-r--r-- | scintilla/lexlib/Accessor.cxx | 79 | ||||
-rw-r--r-- | scintilla/lexlib/Accessor.h | 35 | ||||
-rw-r--r-- | scintilla/lexlib/CharacterSet.cxx | 61 | ||||
-rw-r--r-- | scintilla/lexlib/CharacterSet.h | 149 | ||||
-rw-r--r-- | scintilla/lexlib/LexAccessor.h | 175 | ||||
-rw-r--r-- | scintilla/lexlib/LexerBase.cxx | 92 | ||||
-rw-r--r-- | scintilla/lexlib/LexerBase.h | 41 | ||||
-rw-r--r-- | scintilla/lexlib/LexerModule.cxx | 121 | ||||
-rw-r--r-- | scintilla/lexlib/LexerModule.h | 82 | ||||
-rw-r--r-- | scintilla/lexlib/LexerNoExceptions.cxx | 68 | ||||
-rw-r--r-- | scintilla/lexlib/LexerNoExceptions.h | 32 | ||||
-rw-r--r-- | scintilla/lexlib/LexerSimple.cxx | 57 | ||||
-rw-r--r-- | scintilla/lexlib/LexerSimple.h | 30 | ||||
-rw-r--r-- | scintilla/lexlib/OptionSet.h | 140 | ||||
-rw-r--r-- | scintilla/lexlib/PropSetSimple.cxx (renamed from scintilla/src/PropSet.cxx) | 25 | ||||
-rw-r--r-- | scintilla/lexlib/PropSetSimple.h (renamed from scintilla/src/PropSetSimple.h) | 4 | ||||
-rw-r--r-- | scintilla/lexlib/StyleContext.cxx (renamed from scintilla/src/StyleContext.cxx) | 9 | ||||
-rw-r--r-- | scintilla/lexlib/StyleContext.h (renamed from scintilla/src/StyleContext.h) | 43 | ||||
-rw-r--r-- | scintilla/lexlib/WordList.cxx | 200 | ||||
-rw-r--r-- | scintilla/lexlib/WordList.h | 41 | ||||
-rw-r--r-- | scintilla/src/AutoComplete.cxx | 3 | ||||
-rw-r--r-- | scintilla/src/Catalogue.cxx | 184 | ||||
-rw-r--r-- | scintilla/src/Catalogue.h | 26 | ||||
-rw-r--r-- | scintilla/src/CellBuffer.cxx | 18 | ||||
-rw-r--r-- | scintilla/src/CellBuffer.h | 9 | ||||
-rw-r--r-- | scintilla/src/CharClassify.cxx | 38 | ||||
-rw-r--r-- | scintilla/src/CharClassify.h | 15 | ||||
-rw-r--r-- | scintilla/src/CharacterSet.h | 59 | ||||
-rw-r--r-- | scintilla/src/ContractionState.cxx | 17 | ||||
-rw-r--r-- | scintilla/src/ContractionState.h | 1 | ||||
-rw-r--r-- | scintilla/src/Document.cxx | 327 | ||||
-rw-r--r-- | scintilla/src/Document.h | 75 | ||||
-rw-r--r-- | scintilla/src/DocumentAccessor.cxx | 199 | ||||
-rw-r--r-- | scintilla/src/DocumentAccessor.h | 77 | ||||
-rw-r--r-- | scintilla/src/Editor.cxx | 210 | ||||
-rw-r--r-- | scintilla/src/Editor.h | 10 | ||||
-rw-r--r-- | scintilla/src/ExternalLexer.cxx | 92 | ||||
-rw-r--r-- | scintilla/src/ExternalLexer.h | 19 | ||||
-rw-r--r-- | scintilla/src/KeyWords.cxx | 429 | ||||
-rw-r--r-- | scintilla/src/LexCPP.cxx | 508 | ||||
-rw-r--r-- | scintilla/src/LexHaskell.cxx | 275 | ||||
-rw-r--r-- | scintilla/src/PerLine.cxx | 17 | ||||
-rw-r--r-- | scintilla/src/PerLine.h | 2 | ||||
-rw-r--r-- | scintilla/src/PositionCache.cxx | 1 | ||||
-rw-r--r-- | scintilla/src/RESearch.cxx | 97 | ||||
-rw-r--r-- | scintilla/src/ScintillaBase.cxx | 289 | ||||
-rw-r--r-- | scintilla/src/ScintillaBase.h | 15 | ||||
-rw-r--r-- | scintilla/src/SplitVector.h | 17 | ||||
-rw-r--r-- | scintilla/src/ViewStyle.cxx | 6 | ||||
-rw-r--r-- | scintilla/src/ViewStyle.h | 1 | ||||
-rw-r--r-- | scintilla/src/WindowAccessor.cxx | 191 | ||||
-rw-r--r-- | scintilla/version.txt | 2 | ||||
-rw-r--r-- | scintilla/win32/PlatWin.cxx | 89 | ||||
-rw-r--r-- | scintilla/win32/ScintillaWin.cxx | 81 | ||||
-rw-r--r-- | src/Notepad2.c | 5 | ||||
-rw-r--r-- | src/Notepad2.vcxproj | 116 | ||||
-rw-r--r-- | src/Notepad2.vcxproj.filters | 220 | ||||
-rw-r--r-- | src/Notepad2_icl12.vcxproj | 168 | ||||
-rw-r--r-- | src/Notepad2_icl12.vcxproj.filters | 437 | ||||
-rw-r--r-- | src/Styles.c | 11 | ||||
-rw-r--r-- | wdkbuild/build_base.bat | 68 |
150 files changed, 7082 insertions, 4229 deletions
diff --git a/Readme-mod.txt b/Readme-mod.txt index 02c72af..691ca52 100644 --- a/Readme-mod.txt +++ b/Readme-mod.txt @@ -1,4 +1,4 @@ -Notepad2-mod 4.1.24 has been created with Scintilla 2.12. See Notepad2 Readme
+Notepad2-mod 4.1.24 has been created with Scintilla 2.22. See Notepad2 Readme
for more information. You can use WDK 7.1, or MSVC 2010, or ICL 12 to build it.
This version of Notepad2 has been modified from Florian Balmer's original
diff --git a/scintilla/include/Accessor.h b/scintilla/include/Accessor.h deleted file mode 100644 index bfe4d4d..0000000 --- a/scintilla/include/Accessor.h +++ /dev/null @@ -1,79 +0,0 @@ -// Scintilla source code edit control
-/** @file Accessor.h
- ** Rapid easy access to contents of a Scintilla.
- **/
-// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
-// The License.txt file describes the conditions under which this software may be distributed.
-
-enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8};
-
-class Accessor;
-
-typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len);
-
-/**
- * Interface to data in a Scintilla.
- */
-class Accessor {
-protected:
- enum {extremePosition=0x7FFFFFFF};
- /** @a bufferSize is a trade off between time taken to copy the characters
- * and retrieval overhead.
- * @a slopSize positions the buffer before the desired position
- * in case there is some backtracking. */
- enum {bufferSize=4000, slopSize=bufferSize/8};
- char buf[bufferSize+1];
- int startPos;
- int endPos;
- int codePage;
-
- virtual bool InternalIsLeadByte(char ch)=0;
- virtual void Fill(int position)=0;
-
-public:
- Accessor() : startPos(extremePosition), endPos(0), codePage(0) {}
- virtual ~Accessor() {}
- char operator[](int position) {
- if (position < startPos || position >= endPos) {
- Fill(position);
- }
- return buf[position - startPos];
- }
- /** Safe version of operator[], returning a defined value for invalid position. */
- char SafeGetCharAt(int position, char chDefault=' ') {
- if (position < startPos || position >= endPos) {
- Fill(position);
- if (position < startPos || position >= endPos) {
- // Position is outside range of document
- return chDefault;
- }
- }
- return buf[position - startPos];
- }
- bool IsLeadByte(char ch) {
- return codePage && InternalIsLeadByte(ch);
- }
- void SetCodePage(int codePage_) { codePage = codePage_; }
-
- virtual bool Match(int pos, const char *s)=0;
- virtual char StyleAt(int position)=0;
- virtual int GetLine(int position)=0;
- virtual int LineStart(int line)=0;
- virtual int LevelAt(int line)=0;
- virtual int Length()=0;
- virtual void Flush()=0;
- virtual int GetLineState(int line)=0;
- virtual int SetLineState(int line, int state)=0;
- virtual int GetPropertyInt(const char *key, int defaultValue=0)=0;
- virtual char *GetProperties()=0;
-
- // Style setting
- virtual void StartAt(unsigned int start, char chMask=31)=0;
- virtual void SetFlags(char chFlags_, char chWhile_)=0;
- virtual unsigned int GetStartSegment()=0;
- virtual void StartSegment(unsigned int pos)=0;
- virtual void ColourTo(unsigned int pos, int chAttr)=0;
- virtual void SetLevel(int line, int level)=0;
- virtual int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0)=0;
- virtual void IndicatorFill(int start, int end, int indicator, int value)=0;
-};
diff --git a/scintilla/include/ILexer.h b/scintilla/include/ILexer.h new file mode 100644 index 0000000..15d2c99 --- /dev/null +++ b/scintilla/include/ILexer.h @@ -0,0 +1,69 @@ +// Scintilla source code edit control
+/** @file ILexer.h
+ ** Interface between Scintilla and lexers.
+ **/
+// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef ILEXER_H
+#define ILEXER_H
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+#ifdef _WIN32
+ #define SCI_METHOD __stdcall
+#else
+ #define SCI_METHOD
+#endif
+
+enum { dvOriginal=0 };
+
+class IDocument {
+public:
+ virtual int SCI_METHOD Version() const = 0;
+ virtual void SCI_METHOD SetErrorStatus(int status) = 0;
+ virtual int SCI_METHOD Length() const = 0;
+ virtual void SCI_METHOD GetCharRange(char *buffer, int position, int lengthRetrieve) const = 0;
+ virtual char SCI_METHOD StyleAt(int position) const = 0;
+ virtual int SCI_METHOD LineFromPosition(int position) const = 0;
+ virtual int SCI_METHOD LineStart(int line) const = 0;
+ virtual int SCI_METHOD GetLevel(int line) const = 0;
+ virtual int SCI_METHOD SetLevel(int line, int level) = 0;
+ virtual int SCI_METHOD GetLineState(int line) const = 0;
+ virtual int SCI_METHOD SetLineState(int line, int state) = 0;
+ virtual void SCI_METHOD StartStyling(int position, char mask) = 0;
+ virtual bool SCI_METHOD SetStyleFor(int length, char style) = 0;
+ virtual bool SCI_METHOD SetStyles(int length, const char *styles) = 0;
+ virtual void SCI_METHOD DecorationSetCurrentIndicator(int indicator) = 0;
+ virtual void SCI_METHOD DecorationFillRange(int position, int value, int fillLength) = 0;
+ virtual void SCI_METHOD ChangeLexerState(int start, int end) = 0;
+ virtual int SCI_METHOD CodePage() const = 0;
+ virtual bool SCI_METHOD IsDBCSLeadByte(char ch) const = 0;
+ virtual const char * SCI_METHOD BufferPointer() = 0;
+ virtual int SCI_METHOD GetLineIndentation(int line) = 0;
+};
+
+enum { lvOriginal=0 };
+
+class ILexer {
+public:
+ virtual int SCI_METHOD Version() const = 0;
+ virtual void SCI_METHOD Release() = 0;
+ virtual const char * SCI_METHOD PropertyNames() = 0;
+ virtual int SCI_METHOD PropertyType(const char *name) = 0;
+ virtual const char * SCI_METHOD DescribeProperty(const char *name) = 0;
+ virtual int SCI_METHOD PropertySet(const char *key, const char *val) = 0;
+ virtual const char * SCI_METHOD DescribeWordListSets() = 0;
+ virtual int SCI_METHOD WordListSet(int n, const char *wl) = 0;
+ virtual void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0;
+ virtual void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0;
+ virtual void * SCI_METHOD PrivateCall(int operation, void *pointer) = 0;
+};
+
+#ifdef SCI_NAMESPACE
+}
+#endif
+
+#endif
diff --git a/scintilla/include/KeyWords.h b/scintilla/include/KeyWords.h deleted file mode 100644 index ab9438f..0000000 --- a/scintilla/include/KeyWords.h +++ /dev/null @@ -1,113 +0,0 @@ -// Scintilla source code edit control
-/** @file KeyWords.h
- ** Colourise for particular languages.
- **/
-// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
-// The License.txt file describes the conditions under which this software may be distributed.
-
-#ifdef SCI_NAMESPACE
-namespace Scintilla {
-#endif
-
-/**
- */
-class WordList {
-public:
- // Each word contains at least one character - a empty word acts as sentinel at the end.
- char **words;
- char *list;
- int len;
- bool onlyLineEnds; ///< Delimited by any white space or only line ends
- bool sorted;
- int starts[256];
- WordList(bool onlyLineEnds_ = false) :
- words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_),
- sorted(false)
- {}
- ~WordList() { Clear(); }
- operator bool() { return len ? true : false; }
- void Clear();
- void Set(const char *s);
- bool InList(const char *s);
- bool InListAbbreviated(const char *s, const char marker);
-};
-
-typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
- WordList *keywordlists[], Accessor &styler);
-
-/**
- * A LexerModule is responsible for lexing and folding a particular language.
- * The class maintains a list of LexerModules which can be searched to find a
- * module appropriate to a particular language.
- */
-class LexerModule {
-protected:
- const LexerModule *next;
- int language;
- LexerFunction fnLexer;
- LexerFunction fnFolder;
- const char * const * wordListDescriptions;
- int styleBits;
-
- static const LexerModule *base;
- static int nextLanguage;
-
-public:
- const char *languageName;
- LexerModule(int language_,
- LexerFunction fnLexer_,
- const char *languageName_=0,
- LexerFunction fnFolder_=0,
- const char * const wordListDescriptions_[] = NULL,
- int styleBits_=5);
- virtual ~LexerModule() {
- }
- int GetLanguage() const { return language; }
-
- // -1 is returned if no WordList information is available
- int GetNumWordLists() const;
- const char *GetWordListDescription(int index) const;
-
- int GetStyleBitsNeeded() const;
-
- virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
- WordList *keywordlists[], Accessor &styler) const;
- virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,
- WordList *keywordlists[], Accessor &styler) const;
- static const LexerModule *Find(int language);
- static const LexerModule *Find(const char *languageName);
-};
-
-#ifdef SCI_NAMESPACE
-}
-#endif
-
-/**
- * Check if a character is a space.
- * This is ASCII specific but is safe with chars >= 0x80.
- */
-inline bool isspacechar(unsigned char ch) {
- return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
-}
-
-inline bool iswordchar(char ch) {
- return isascii(ch) && (isalnum(ch) || ch == '.' || ch == '_');
-}
-
-inline bool iswordstart(char ch) {
- return isascii(ch) && (isalnum(ch) || ch == '_');
-}
-
-inline bool isoperator(char ch) {
- if (isascii(ch) && isalnum(ch))
- return false;
- // '.' left out as it is used to make up numbers
- if (ch == '%' || ch == '^' || ch == '&' || ch == '*' ||
- ch == '(' || ch == ')' || ch == '-' || ch == '+' ||
- ch == '=' || ch == '|' || ch == '{' || ch == '}' ||
- ch == '[' || ch == ']' || ch == ':' || ch == ';' ||
- ch == '<' || ch == '>' || ch == ',' || ch == '/' ||
- ch == '?' || ch == '!' || ch == '.' || ch == '~')
- return true;
- return false;
-}
diff --git a/scintilla/include/PropSet.h b/scintilla/include/PropSet.h deleted file mode 100644 index 692044e..0000000 --- a/scintilla/include/PropSet.h +++ /dev/null @@ -1,26 +0,0 @@ -// Scintilla source code edit control
-/** @file PropSet.h
- ** An interface to the methods needed for access to property sets inside lexers.
- **/
-// Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org>
-// The License.txt file describes the conditions under which this software may be distributed.
-
-#ifndef PROPSET_H
-#define PROPSET_H
-
-#ifdef SCI_NAMESPACE
-namespace Scintilla {
-#endif
-
-class PropertyGet {
-public:
- virtual char *ToString() const=0; // Caller must delete[] the return value
- virtual int GetInt(const char *key, int defaultValue=0) const=0;
- virtual ~PropertyGet() {}
-};
-
-#ifdef SCI_NAMESPACE
-}
-#endif
-
-#endif
diff --git a/scintilla/include/SciLexer.h b/scintilla/include/SciLexer.h index 8673799..b9e2a82 100644 --- a/scintilla/include/SciLexer.h +++ b/scintilla/include/SciLexer.h @@ -111,7 +111,8 @@ #define SCLEX_NIMROD 96
#define SCLEX_SML 97
#define SCLEX_MARKDOWN 98
-#define SCLEX_AHK 99
+#define SCLEX_TXT2TAGS 99
+#define SCLEX_AHK 100
#define SCLEX_AUTOMATIC 1000
#define SCE_AHK_DEFAULT 0
#define SCE_AHK_COMMENTLINE 1
@@ -1297,6 +1298,9 @@ #define SCE_POWERSHELL_KEYWORD 8
#define SCE_POWERSHELL_CMDLET 9
#define SCE_POWERSHELL_ALIAS 10
+#define SCE_POWERSHELL_FUNCTION 11
+#define SCE_POWERSHELL_USER1 12
+#define SCE_POWERSHELL_COMMENTSTREAM 13
#define SCE_MYSQL_DEFAULT 0
#define SCE_MYSQL_COMMENT 1
#define SCE_MYSQL_COMMENTLINE 2
@@ -1407,6 +1411,32 @@ #define SCE_MARKDOWN_CODE 19
#define SCE_MARKDOWN_CODE2 20
#define SCE_MARKDOWN_CODEBK 21
+#define SCE_TXT2TAGS_DEFAULT 0
+#define SCE_TXT2TAGS_LINE_BEGIN 1
+#define SCE_TXT2TAGS_STRONG1 2
+#define SCE_TXT2TAGS_STRONG2 3
+#define SCE_TXT2TAGS_EM1 4
+#define SCE_TXT2TAGS_EM2 5
+#define SCE_TXT2TAGS_HEADER1 6
+#define SCE_TXT2TAGS_HEADER2 7
+#define SCE_TXT2TAGS_HEADER3 8
+#define SCE_TXT2TAGS_HEADER4 9
+#define SCE_TXT2TAGS_HEADER5 10
+#define SCE_TXT2TAGS_HEADER6 11
+#define SCE_TXT2TAGS_PRECHAR 12
+#define SCE_TXT2TAGS_ULIST_ITEM 13
+#define SCE_TXT2TAGS_OLIST_ITEM 14
+#define SCE_TXT2TAGS_BLOCKQUOTE 15
+#define SCE_TXT2TAGS_STRIKEOUT 16
+#define SCE_TXT2TAGS_HRULE 17
+#define SCE_TXT2TAGS_LINK 18
+#define SCE_TXT2TAGS_CODE 19
+#define SCE_TXT2TAGS_CODE2 20
+#define SCE_TXT2TAGS_CODEBK 21
+#define SCE_TXT2TAGS_COMMENT 22
+#define SCE_TXT2TAGS_OPTION 23
+#define SCE_TXT2TAGS_PREPROC 24
+#define SCE_TXT2TAGS_POSTPROC 25
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif
diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h index 1c98a88..691b2f5 100644 --- a/scintilla/include/Scintilla.h +++ b/scintilla/include/Scintilla.h @@ -91,7 +91,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETTABWIDTH 2036
#define SCI_GETTABWIDTH 2121
#define SC_CP_UTF8 65001
-#define SC_CP_DBCS 1
#define SCI_SETCODEPAGE 2037
#define SCI_SETUSEPALETTE 2039
#define MARKER_MAX 31
@@ -669,6 +668,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_FINDCOLUMN 2456
#define SCI_GETCARETSTICKY 2457
#define SCI_SETCARETSTICKY 2458
+#define SC_CARETSTICKY_OFF 0
+#define SC_CARETSTICKY_ON 1
+#define SC_CARETSTICKY_WHITESPACE 2
#define SCI_TOGGLECARETSTICKY 2459
#define SCI_SETPASTECONVERTENDINGS 2467
#define SCI_GETPASTECONVERTENDINGS 2468
@@ -783,6 +785,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETADDITIONALCARETFORE 2605
#define SCI_ROTATESELECTION 2606
#define SCI_SWAPMAINANCHORCARET 2607
+#define SCI_CHANGELEXERSTATE 2617
+#define SCI_CONTRACTEDFOLDNEXT 2618
+#define SCI_VERTICALCENTRECARET 2619
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
@@ -798,6 +803,14 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETPROPERTYINT 4010
#define SCI_GETSTYLEBITSNEEDED 4011
#define SCI_GETLEXERLANGUAGE 4012
+#define SCI_PRIVATELEXERCALL 4013
+#define SCI_PROPERTYNAMES 4014
+#define SC_TYPE_BOOLEAN 0
+#define SC_TYPE_INTEGER 1
+#define SC_TYPE_STRING 2
+#define SCI_PROPERTYTYPE 4015
+#define SCI_DESCRIBEPROPERTY 4016
+#define SCI_DESCRIBEKEYWORDSETS 4017
#define SC_MOD_INSERTTEXT 0x1
#define SC_MOD_DELETETEXT 0x2
#define SC_MOD_CHANGESTYLE 0x4
@@ -817,7 +830,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_MOD_CHANGEMARGIN 0x10000
#define SC_MOD_CHANGEANNOTATION 0x20000
#define SC_MOD_CONTAINER 0x40000
-#define SC_MODEVENTMASKALL 0x7FFFF
+#define SC_MOD_LEXERSTATE 0x80000
+#define SC_MODEVENTMASKALL 0xFFFFF
#define SCEN_CHANGE 768
#define SCEN_SETFOCUS 512
#define SCEN_KILLFOCUS 256
@@ -872,6 +886,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCN_INDICATORRELEASE 2024
#define SCN_AUTOCCANCELLED 2025
#define SCN_AUTOCCHARDELETED 2026
+#define SCN_HOTSPOTRELEASECLICK 2027
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
/* These structures are defined to be exactly the same shape as the Win32
@@ -962,4 +977,10 @@ struct SCNotification { }
#endif
+#ifdef INCLUDE_DEPRECATED_FEATURES
+
+#define SC_CP_DBCS 1
+
+#endif
+
#endif
diff --git a/scintilla/include/ScintillaWidget.h b/scintilla/include/ScintillaWidget.h index 44cff60..3a3c7ca 100644 --- a/scintilla/include/ScintillaWidget.h +++ b/scintilla/include/ScintillaWidget.h @@ -15,7 +15,7 @@ extern "C" {
#endif
-#define SCINTILLA(obj) GTK_CHECK_CAST (obj, scintilla_get_type (), ScintillaObject)
+#define SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, scintilla_get_type (), ScintillaObject)
#define SCINTILLA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass)
#define IS_SCINTILLA(obj) GTK_CHECK_TYPE (obj, scintilla_get_type ())
diff --git a/scintilla/include/WindowAccessor.h b/scintilla/include/WindowAccessor.h deleted file mode 100644 index ed67e29..0000000 --- a/scintilla/include/WindowAccessor.h +++ /dev/null @@ -1,67 +0,0 @@ -// Scintilla source code edit control
-/** @file WindowAccessor.h
- ** Implementation of BufferAccess and StylingAccess on a Scintilla
- ** rapid easy access to contents of a Scintilla.
- **/
-// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
-// The License.txt file describes the conditions under which this software may be distributed.
-
-#ifdef SCI_NAMESPACE
-namespace Scintilla {
-#endif
-
-/**
- */
-
-class WindowAccessor : public Accessor {
- // Private so WindowAccessor objects can not be copied
- WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {}
- WindowAccessor &operator=(const WindowAccessor &) { return *this; }
-protected:
- WindowID id;
- PropertyGet &props;
- int lenDoc;
-
- char styleBuf[bufferSize];
- int validLen;
- char chFlags;
- char chWhile;
- unsigned int startSeg;
-
- bool InternalIsLeadByte(char ch);
- void Fill(int position);
-public:
- WindowAccessor(WindowID id_, PropertyGet &props_) :
- Accessor(), id(id_), props(props_),
- lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
- }
- ~WindowAccessor();
- bool Match(int pos, const char *s);
- char StyleAt(int position);
- int GetLine(int position);
- int LineStart(int line);
- int LevelAt(int line);
- int Length();
- void Flush();
- int GetLineState(int line);
- int SetLineState(int line, int state);
- int GetPropertyInt(const char *key, int defaultValue=0) {
- return props.GetInt(key, defaultValue);
- }
- char *GetProperties() {
- return props.ToString();
- }
-
- void StartAt(unsigned int start, char chMask=31);
- void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }
- unsigned int GetStartSegment() { return startSeg; }
- void StartSegment(unsigned int pos);
- void ColourTo(unsigned int pos, int chAttr);
- void SetLevel(int line, int level);
- int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
- void IndicatorFill(int start, int end, int indicator, int value);
-};
-
-#ifdef SCI_NAMESPACE
-}
-#endif
diff --git a/scintilla/src/LexAHK.cxx b/scintilla/lexers/LexAHK.cxx index 5fa329a..2355973 100644 --- a/scintilla/src/LexAHK.cxx +++ b/scintilla/lexers/LexAHK.cxx @@ -8,18 +8,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
static inline bool IsAWordChar(const int ch) {
diff --git a/scintilla/src/LexAPDL.cxx b/scintilla/lexers/LexAPDL.cxx index a9a6c54..ff89418 100644 --- a/scintilla/src/LexAPDL.cxx +++ b/scintilla/lexers/LexAPDL.cxx @@ -8,18 +8,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexASY.cxx b/scintilla/lexers/LexASY.cxx index 8a1785a..e5f06ce 100644 --- a/scintilla/src/LexASY.cxx +++ b/scintilla/lexers/LexASY.cxx @@ -4,25 +4,27 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
-static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
@@ -118,7 +120,7 @@ static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_ASY_IDENTIFIER);
} else if (sc.Match('/', '*')) {
sc.SetState(SCE_ASY_COMMENT);
- sc.Forward(); //
+ sc.Forward(); //
} else if (sc.Match('/', '/')) {
sc.SetState(SCE_ASY_COMMENTLINE);
} else if (sc.ch == '\"') {
@@ -162,14 +164,14 @@ static int ParseASYWord(unsigned int pos, Accessor &styler, char *word) length++;
ch=styler.SafeGetCharAt(pos+length);
}
- word[length]=0;
+ word[length]=0;
return length;
}
static bool IsASYDrawingLine(int line, Accessor &styler) {
int pos = styler.LineStart(line);
int eol_pos = styler.LineStart(line + 1) - 1;
-
+
int startpos = pos;
char buffer[100]="";
@@ -181,11 +183,11 @@ static bool IsASYDrawingLine(int line, Accessor &styler) { if (!drawcommands && ch!=' ') return false;
else if (drawcommands) return true;
startpos++;
- }
+ }
return false;
}
-static void FoldAsyDoc(unsigned int startPos, int length, int initStyle,
+static void FoldAsyDoc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
@@ -236,7 +238,7 @@ static void FoldAsyDoc(unsigned int startPos, int length, int initStyle, else if (lineCurrent!=0 && IsASYDrawingLine(lineCurrent - 1, styler) &&
!IsASYDrawingLine(lineCurrent+1, styler))
levelNext--;
- }
+ }
if (atEOL) {
int levelUse = levelCurrent;
diff --git a/scintilla/src/LexAU3.cxx b/scintilla/lexers/LexAU3.cxx index bcf7929..4500214 100644 --- a/scintilla/src/LexAU3.cxx +++ b/scintilla/lexers/LexAU3.cxx @@ -1,15 +1,15 @@ // Scintilla source code edit control
// @file LexAU3.cxx
// Lexer for AutoIt3 http://www.hiddensoft.com/autoit3
-// by Jos van der Zande, jvdzande@yahoo.com
+// by Jos van der Zande, jvdzande@yahoo.com
//
// Changes:
// March 28, 2004 - Added the standard Folding code
// April 21, 2004 - Added Preprosessor Table + Syntax Highlighting
// Fixed Number highlighting
// Changed default isoperator to IsAOperator to have a better match to AutoIt3
-// Fixed "#comments_start" -> "#comments-start"
-// Fixed "#comments_end" -> "#comments-end"
+// Fixed "#comments_start" -> "#comments-start"
+// Fixed "#comments_end" -> "#comments-end"
// Fixed Sendkeys in Strings when not terminated with }
// Added support for Sendkey strings that have second parameter e.g. {UP 5} or {a down}
// April 26, 2004 - Fixed # pre-processor statement inside of comment block would invalidly change the color.
@@ -25,9 +25,9 @@ // Added fold.compact support set with fold.compact=1
// Changed folding inside of #cs-#ce. Default is no keyword folding inside comment blocks when fold.comment=1
// it will now only happen when fold.comment=2.
-// Sep 5, 2004 - Added logic to handle colourizing words on the last line.
+// Sep 5, 2004 - Added logic to handle colourizing words on the last line.
// Typed Characters now show as "default" till they match any table.
-// Oct 10, 2004 - Added logic to show Comments in "Special" directives.
+// Oct 10, 2004 - Added logic to show Comments in "Special" directives.
// Nov 1, 2004 - Added better testing for Numbers supporting x and e notation.
// Nov 28, 2004 - Added logic to handle continuation lines for syntax highlighting.
// Jan 10, 2005 - Added Abbreviations Keyword used for expansion
@@ -52,18 +52,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -127,7 +131,7 @@ static int GetSendKey(const char *szLine, char *szKey) }
else if (cTemp == ' ')
{
- // skip other spaces
+ // skip other spaces
}
else if (nFlag == 0)
{
@@ -139,7 +143,7 @@ static int GetSendKey(const char *szLine, char *szKey) // Save second portion into var...
szSpecial[nSpecPos++] = cTemp;
// check if Second portion is all numbers for repeat fuction
- if (isdigit(cTemp) == false) {nSpecNum = 0;}
+ if (isdigit(cTemp) == false) {nSpecNum = 0;}
}
}
nPos++; // skip to next char
@@ -151,7 +155,7 @@ static int GetSendKey(const char *szLine, char *szKey) szKey[nKeyPos] = '\0';
szSpecial[nSpecPos] = '\0';
if (strcmp(szSpecial,"down")== 0 || strcmp(szSpecial,"up")== 0 ||
- strcmp(szSpecial,"on")== 0 || strcmp(szSpecial,"off")== 0 ||
+ strcmp(szSpecial,"on")== 0 || strcmp(szSpecial,"off")== 0 ||
strcmp(szSpecial,"toggle")== 0 || nSpecNum == 1 )
{
nFlag = 0;
@@ -160,13 +164,13 @@ static int GetSendKey(const char *szLine, char *szKey) {
nFlag = 1;
}
- return nFlag; // 1 is bad, 0 is good
+ return nFlag; // 1 is bad, 0 is good
-} // GetSendKey()
+} // GetSendKey()
//
// Routine to check the last "none comment" character on a line to see if its a continuation
-//
+//
static bool IsContinuationLine(unsigned int szLine, Accessor &styler)
{
int nsPos = styler.LineStart(szLine);
@@ -192,7 +196,7 @@ static bool IsContinuationLine(unsigned int szLine, Accessor &styler) //
// syntax highlighting logic
-static void ColouriseAU3Doc(unsigned int startPos,
+static void ColouriseAU3Doc(unsigned int startPos,
int length, int initStyle,
WordList *keywordlists[],
Accessor &styler) {
@@ -214,19 +218,19 @@ static void ColouriseAU3Doc(unsigned int startPos, (lineCurrent > 1 && IsContinuationLine(lineCurrent-1,styler))) {
lineCurrent--;
startPos = styler.LineStart(lineCurrent); // get start position
- initStyle = 0; // reset the start style to 0
+ initStyle = 0; // reset the start style to 0
}
}
// Set the new length to include it from the start and set the start position
length = length + s_startPos - startPos; // correct the total length to process
styler.StartAt(startPos);
-
+
StyleContext sc(startPos, length, initStyle, styler);
char si; // string indicator "=1 '=2
char ni; // Numeric indicator error=9 normal=0 normal+dec=1 hex=2 Enot=3
- char ci; // comment indicator 0=not linecomment(;)
+ char ci; // comment indicator 0=not linecomment(;)
char s_save[100];
- si=0;
+ si=0;
ni=0;
ci=0;
//$$$
@@ -234,8 +238,8 @@ static void ColouriseAU3Doc(unsigned int startPos, char s[100];
sc.GetCurrentLowered(s, sizeof(s));
// **********************************************
- // save the total current word for eof processing
- if (IsAWordChar(sc.ch) || sc.ch == '}')
+ // save the total current word for eof processing
+ if (IsAWordChar(sc.ch) || sc.ch == '}')
{
strcpy(s_save,s);
int tp = strlen(s_save);
@@ -254,9 +258,9 @@ static void ColouriseAU3Doc(unsigned int startPos, if (sc.atLineEnd) {
ci=0;
if (strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0) {
- if (sc.atLineEnd)
+ if (sc.atLineEnd)
sc.SetState(SCE_AU3_DEFAULT);
- else
+ else
sc.SetState(SCE_AU3_COMMENTBLOCK);
}
break;
@@ -267,9 +271,9 @@ static void ColouriseAU3Doc(unsigned int startPos, sc.SetState(SCE_AU3_COMMENTBLOCK);
}
// skip rest of the line
- if (ci==2)
+ if (ci==2)
break;
- // check when first character is detected on the line
+ // check when first character is detected on the line
if (ci==0) {
if (IsAWordStart(static_cast<char>(sc.ch)) || IsAOperator(static_cast<char>(sc.ch))) {
ci=1;
@@ -292,10 +296,10 @@ static void ColouriseAU3Doc(unsigned int startPos, }
case SCE_AU3_OPERATOR:
{
- // check if its a COMobject
+ // check if its a COMobject
if (sc.chPrev == '.' && IsAWordChar(sc.ch)) {
sc.SetState(SCE_AU3_COMOBJ);
- }
+ }
else {
sc.SetState(SCE_AU3_DEFAULT);
}
@@ -360,7 +364,7 @@ static void ColouriseAU3Doc(unsigned int startPos, sc.SetState(SCE_AU3_DEFAULT);
}
}
- }
+ }
if (sc.atLineEnd) {
sc.SetState(SCE_AU3_DEFAULT);}
break;
@@ -433,7 +437,7 @@ static void ColouriseAU3Doc(unsigned int startPos, case SCE_AU3_STRING:
{
// check for " to end a double qouted string or
- // check for ' to end a single qouted string
+ // check for ' to end a single qouted string
if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\'') || (si == 3 && sc.ch == '>'))
{
sc.ForwardSetState(SCE_AU3_DEFAULT);
@@ -445,7 +449,7 @@ static void ColouriseAU3Doc(unsigned int startPos, si=0;
// at line end and not found a continuation char then reset to default
int lineCurrent = styler.GetLine(sc.currentPos);
- if (!IsContinuationLine(lineCurrent,styler))
+ if (!IsContinuationLine(lineCurrent,styler))
{
sc.SetState(SCE_AU3_DEFAULT);
break;
@@ -456,27 +460,27 @@ static void ColouriseAU3Doc(unsigned int startPos, sc.SetState(SCE_AU3_SENT);}
break;
}
-
+
case SCE_AU3_SENT:
{
- // Send key string ended
- if (sc.chPrev == '}' && sc.ch != '}')
+ // Send key string ended
+ if (sc.chPrev == '}' && sc.ch != '}')
{
// set color to SENDKEY when valid sendkey .. else set back to regular string
char sk[100];
// split {111 222} and return {111} and check if 222 is valid.
// if return code = 1 then invalid 222 so must be string
- if (GetSendKey(s,sk))
+ if (GetSendKey(s,sk))
{
sc.ChangeState(SCE_AU3_STRING);
}
// if single char between {?} then its ok as sendkey for a single character
- else if (strlen(sk) == 3)
+ else if (strlen(sk) == 3)
{
sc.ChangeState(SCE_AU3_SENT);
}
// if sendkey {111} is in table then ok as sendkey
- else if (keywords4.InList(sk))
+ else if (keywords4.InList(sk))
{
sc.ChangeState(SCE_AU3_SENT);
}
@@ -492,9 +496,9 @@ static void ColouriseAU3Doc(unsigned int startPos, int nPos = 0;
int nState = 1;
char cTemp;
- while (!(nState == 2) && ((cTemp = s[nPos]) != '\0'))
+ while (!(nState == 2) && ((cTemp = s[nPos]) != '\0'))
{
- if (cTemp == '{' && nState == 1)
+ if (cTemp == '{' && nState == 1)
{
nState = 2;
}
@@ -509,14 +513,14 @@ static void ColouriseAU3Doc(unsigned int startPos, sc.ChangeState(SCE_AU3_STRING);
sc.SetState(SCE_AU3_STRING);
}
- // If invalid character found then assume its a regular string
+ // If invalid character found then assume its a regular string
if (nState == 0) {
sc.ChangeState(SCE_AU3_STRING);
sc.SetState(SCE_AU3_STRING);
}
}
// check if next portion is again a sendkey
- if (sc.atLineEnd)
+ if (sc.atLineEnd)
{
sc.ChangeState(SCE_AU3_STRING);
sc.SetState(SCE_AU3_DEFAULT);
@@ -547,14 +551,14 @@ static void ColouriseAU3Doc(unsigned int startPos, else if (sc.ch == '.' && !IsADigit(sc.chNext)) {sc.SetState(SCE_AU3_OPERATOR);}
else if (sc.ch == '@') {sc.SetState(SCE_AU3_KEYWORD);}
//else if (sc.ch == '_') {sc.SetState(SCE_AU3_KEYWORD);}
- else if (sc.ch == '<' && si==3) {sc.SetState(SCE_AU3_STRING);} // string after #include
+ else if (sc.ch == '<' && si==3) {sc.SetState(SCE_AU3_STRING);} // string after #include
else if (sc.ch == '\"') {
sc.SetState(SCE_AU3_STRING);
si = 1; }
else if (sc.ch == '\'') {
sc.SetState(SCE_AU3_STRING);
si = 2; }
- else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)))
+ else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)))
{
sc.SetState(SCE_AU3_NUMBER);
ni = 0;
@@ -566,7 +570,7 @@ static void ColouriseAU3Doc(unsigned int startPos, } //for (; sc.More(); sc.Forward())
//*************************************
- // Colourize the last word correctly
+ // Colourize the last word correctly
//*************************************
if (sc.state == SCE_AU3_KEYWORD)
{
@@ -610,24 +614,24 @@ static void ColouriseAU3Doc(unsigned int startPos, }
if (sc.state == SCE_AU3_SENT)
{
- // Send key string ended
- if (sc.chPrev == '}' && sc.ch != '}')
+ // Send key string ended
+ if (sc.chPrev == '}' && sc.ch != '}')
{
// set color to SENDKEY when valid sendkey .. else set back to regular string
char sk[100];
// split {111 222} and return {111} and check if 222 is valid.
// if return code = 1 then invalid 222 so must be string
- if (GetSendKey(s_save,sk))
+ if (GetSendKey(s_save,sk))
{
sc.ChangeState(SCE_AU3_STRING);
}
// if single char between {?} then its ok as sendkey for a single character
- else if (strlen(sk) == 3)
+ else if (strlen(sk) == 3)
{
sc.ChangeState(SCE_AU3_SENT);
}
// if sendkey {111} is in table then ok as sendkey
- else if (keywords4.InList(sk))
+ else if (keywords4.InList(sk))
{
sc.ChangeState(SCE_AU3_SENT);
}
@@ -638,7 +642,7 @@ static void ColouriseAU3Doc(unsigned int startPos, sc.SetState(SCE_AU3_STRING);
}
// check if next portion is again a sendkey
- if (sc.atLineEnd)
+ if (sc.atLineEnd)
{
sc.ChangeState(SCE_AU3_STRING);
sc.SetState(SCE_AU3_DEFAULT);
@@ -655,7 +659,7 @@ static bool IsStreamCommentStyle(int style) { //
// Routine to find first none space on the current line and return its Style
-// needed for comment lines not starting on pos 1
+// needed for comment lines not starting on pos 1
static int GetStyleFirstWord(unsigned int szLine, Accessor &styler)
{
int nsPos = styler.LineStart(szLine);
@@ -687,7 +691,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc startPos = styler.LineStart(lineCurrent);
}
}
- // vars for style of previous/current/next lines
+ // vars for style of previous/current/next lines
int style = GetStyleFirstWord(lineCurrent,styler);
int stylePrev = 0;
// find the first previous line without continuation character at the end
@@ -712,7 +716,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
int levelNext = levelCurrent;
- //
+ //
int visibleChars = 0;
char chNext = styler.SafeGetCharAt(startPos);
char chPrev = ' ';
@@ -737,7 +741,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc }
}
}
- // start the capture of the first word
+ // start the capture of the first word
if (!(FirstWordStart)) {
if (IsAWordChar(ch) || IsAWordStart(ch) || ch == ';') {
FirstWordStart = true;
@@ -749,7 +753,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc if (ThenFoundLast) {
if (IsAWordChar(ch)) {
ThenFoundLast = false;
- }
+ }
}
// find out if the word "then" is the last on a "if" line
if (FirstWordEnd && strcmp(szKeyword,"if") == 0) {
@@ -770,21 +774,21 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc }
}
}
- // End of Line found so process the information
+ // End of Line found so process the information
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) {
// **************************
// Folding logic for Keywords
// **************************
// if a keyword is found on the current line and the line doesn't end with _ (continuation)
// and we are not inside a commentblock.
- if (szKeywordlen > 0 && (!(chPrev == '_')) &&
+ if (szKeywordlen > 0 && (!(chPrev == '_')) &&
((!(IsStreamCommentStyle(style)) || foldInComment)) ) {
szKeyword[szKeywordlen] = '\0';
// only fold "if" last keyword is "then" (else its a one line if)
if (strcmp(szKeyword,"if") == 0 && ThenFoundLast) {
levelNext++;
}
- // create new fold for these words
+ // create new fold for these words
if (strcmp(szKeyword,"do") == 0 || strcmp(szKeyword,"for") == 0 ||
strcmp(szKeyword,"func") == 0 || strcmp(szKeyword,"while") == 0||
strcmp(szKeyword,"with") == 0 || strcmp(szKeyword,"#region") == 0 ) {
@@ -797,12 +801,12 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc }
// end the fold for these words before the current line
if (strcmp(szKeyword,"endfunc") == 0 || strcmp(szKeyword,"endif") == 0 ||
- strcmp(szKeyword,"next") == 0 || strcmp(szKeyword,"until") == 0 ||
+ strcmp(szKeyword,"next") == 0 || strcmp(szKeyword,"until") == 0 ||
strcmp(szKeyword,"endwith") == 0 ||strcmp(szKeyword,"wend") == 0){
levelNext--;
levelCurrent--;
}
- // end the fold for these words before the current line and Start new fold
+ // end the fold for these words before the current line and Start new fold
if (strcmp(szKeyword,"case") == 0 || strcmp(szKeyword,"else") == 0 ||
strcmp(szKeyword,"elseif") == 0 ) {
levelCurrent--;
@@ -841,16 +845,16 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc // Start of a comment block
if (!(stylePrev==style) && IsStreamCommentStyle(styleNext) && styleNext==style) {
levelNext++;
- }
+ }
// fold till the last line for normal comment lines
- else if (IsStreamCommentStyle(stylePrev)
+ else if (IsStreamCommentStyle(stylePrev)
&& !(styleNext == SCE_AU3_COMMENT)
- && stylePrev == SCE_AU3_COMMENT
+ && stylePrev == SCE_AU3_COMMENT
&& style == SCE_AU3_COMMENT) {
levelNext--;
}
// fold till the one but last line for Blockcomment lines
- else if (IsStreamCommentStyle(stylePrev)
+ else if (IsStreamCommentStyle(stylePrev)
&& !(styleNext == SCE_AU3_COMMENTBLOCK)
&& style == SCE_AU3_COMMENTBLOCK) {
levelNext--;
diff --git a/scintilla/src/LexAVE.cxx b/scintilla/lexers/LexAVE.cxx index 4c1758e..155c31f 100644 --- a/scintilla/src/LexAVE.cxx +++ b/scintilla/lexers/LexAVE.cxx @@ -9,18 +9,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
-#include <stdarg.h>
#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexAbaqus.cxx b/scintilla/lexers/LexAbaqus.cxx index 051a8f4..9ab8bbe 100644 --- a/scintilla/src/LexAbaqus.cxx +++ b/scintilla/lexers/LexAbaqus.cxx @@ -10,18 +10,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexAda.cxx b/scintilla/lexers/LexAda.cxx index ebd23cc..c40bf33 100644 --- a/scintilla/src/LexAda.cxx +++ b/scintilla/lexers/LexAda.cxx @@ -6,19 +6,24 @@ // The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
-#include <ctype.h>
#include <string.h>
#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
#include <string>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "PropSet.h"
-#include "KeyWords.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexAsm.cxx b/scintilla/lexers/LexAsm.cxx index 872ef30..1f5c532 100644 --- a/scintilla/src/LexAsm.cxx +++ b/scintilla/lexers/LexAsm.cxx @@ -10,18 +10,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexAsn1.cxx b/scintilla/lexers/LexAsn1.cxx index 28bf6d9..bacd813 100644 --- a/scintilla/src/LexAsn1.cxx +++ b/scintilla/lexers/LexAsn1.cxx @@ -5,20 +5,24 @@ // Copyright 2004 by Herr Pfarrer rpfarrer <at> yahoo <dot> de
// Last Updated: 20/07/2004
// The License.txt file describes the conditions under which this software may be distributed.
+
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexBaan.cxx b/scintilla/lexers/LexBaan.cxx index 97dd1f4..978af10 100644 --- a/scintilla/src/LexBaan.cxx +++ b/scintilla/lexers/LexBaan.cxx @@ -8,18 +8,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexBash.cxx b/scintilla/lexers/LexBash.cxx index ec3e04a..9080b33 100644 --- a/scintilla/src/LexBash.cxx +++ b/scintilla/lexers/LexBash.cxx @@ -2,44 +2,54 @@ /** @file LexBash.cxx
** Lexer for Bash.
**/
-// Copyright 2004-2008 by Neil Hodgson <neilh@scintilla.org>
+// Copyright 2004-2010 by Neil Hodgson <neilh@scintilla.org>
// Adapted from LexPerl by Kein-Hong Man 2004
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
-#define HERE_DELIM_MAX 256
+#define HERE_DELIM_MAX 256
// define this if you want 'invalid octals' to be marked as errors
// usually, this is not a good idea, permissive lexing is better
#undef PEDANTIC_OCTAL
-#define BASH_BASE_ERROR 65
-#define BASH_BASE_DECIMAL 66
-#define BASH_BASE_HEX 67
+#define BASH_BASE_ERROR 65
+#define BASH_BASE_DECIMAL 66
+#define BASH_BASE_HEX 67
#ifdef PEDANTIC_OCTAL
-#define BASH_BASE_OCTAL 68
-#define BASH_BASE_OCTAL_ERROR 69
+#define BASH_BASE_OCTAL 68
+#define BASH_BASE_OCTAL_ERROR 69
#endif
+// state constants for parts of a bash command segment
+#define BASH_CMD_BODY 0
+#define BASH_CMD_START 1
+#define BASH_CMD_WORD 2
+#define BASH_CMD_TEST 3
+#define BASH_CMD_ARITH 4
+#define BASH_CMD_DELIM 5
+
static inline int translateBashDigit(int ch) {
if (ch >= '0' && ch <= '9') {
return ch - '0';
@@ -80,11 +90,15 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
+ WordList cmdDelimiter, bashStruct, bashStruct_in;
+ cmdDelimiter.Set("| || |& & && ; ;; ( ) { }");
+ bashStruct.Set("if elif fi while until else then do done esac eval");
+ bashStruct_in.Set("for case select");
CharacterSet setWordStart(CharacterSet::setAlpha, "_");
// note that [+-] are often parts of identifiers in shell scripts
CharacterSet setWord(CharacterSet::setAlphaNum, "._+-");
- CharacterSet setBashOperator(CharacterSet::setNone, "^&\\%()-+=|{}[]:;>,*/<?!.~@");
+ CharacterSet setBashOperator(CharacterSet::setNone, "^&%()-+=|{}[]:;>,*/<?!.~@");
CharacterSet setSingleCharOp(CharacterSet::setNone, "rwxoRWXOezsfdlpSbctugkTBMACahGLNn");
CharacterSet setParam(CharacterSet::setAlphaNum, "$_");
CharacterSet setHereDoc(CharacterSet::setAlpha, "_\\-+!");
@@ -144,46 +158,115 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, int numBase = 0;
int digit;
unsigned int endPos = startPos + length;
+ int cmdState = BASH_CMD_START;
+ int testExprType = 0;
- // Backtrack to beginning of style if required...
- // If in a long distance lexical state, backtrack to find quote characters
- if (initStyle == SCE_SH_HERE_Q) {
- while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_SH_HERE_DELIM)) {
- startPos--;
- }
- startPos = styler.LineStart(styler.GetLine(startPos));
- initStyle = styler.StyleAt(startPos - 1);
- }
- // Bash strings can be multi-line with embedded newlines, so backtrack.
- // Bash numbers have additional state during lexing, so backtrack too.
- if (initStyle == SCE_SH_STRING
- || initStyle == SCE_SH_BACKTICKS
- || initStyle == SCE_SH_CHARACTER
- || initStyle == SCE_SH_NUMBER
- || initStyle == SCE_SH_IDENTIFIER
- || initStyle == SCE_SH_COMMENTLINE) {
- while ((startPos > 1) && (styler.StyleAt(startPos - 1) == initStyle)) {
- startPos--;
- }
- initStyle = SCE_SH_DEFAULT;
+ // Always backtracks to the start of a line that is not a continuation
+ // of the previous line (i.e. start of a bash command segment)
+ int ln = styler.GetLine(startPos);
+ for (;;) {
+ startPos = styler.LineStart(ln);
+ if (ln == 0 || styler.GetLineState(ln) == BASH_CMD_START)
+ break;
+ ln--;
}
+ initStyle = SCE_SH_DEFAULT;
StyleContext sc(startPos, endPos - startPos, initStyle, styler);
for (; sc.More(); sc.Forward()) {
+ // handle line continuation, updates per-line stored state
+ if (sc.atLineStart) {
+ ln = styler.GetLine(sc.currentPos);
+ if (sc.state == SCE_SH_STRING
+ || sc.state == SCE_SH_BACKTICKS
+ || sc.state == SCE_SH_CHARACTER
+ || sc.state == SCE_SH_HERE_Q
+ || sc.state == SCE_SH_COMMENTLINE
+ || sc.state == SCE_SH_PARAM) {
+ // force backtrack while retaining cmdState
+ styler.SetLineState(ln, BASH_CMD_BODY);
+ } else {
+ if (ln > 0) {
+ if ((sc.GetRelative(-3) == '\\' && sc.GetRelative(-2) == '\r' && sc.chPrev == '\n')
+ || sc.GetRelative(-2) == '\\') { // handle '\' line continuation
+ // retain last line's state
+ } else
+ cmdState = BASH_CMD_START;
+ }
+ styler.SetLineState(ln, cmdState);
+ }
+ }
+
+ // controls change of cmdState at the end of a non-whitespace element
+ // states BODY|TEST|ARITH persist until the end of a command segment
+ // state WORD persist, but ends with 'in' or 'do' construct keywords
+ int cmdStateNew = BASH_CMD_BODY;
+ if (cmdState == BASH_CMD_TEST || cmdState == BASH_CMD_ARITH || cmdState == BASH_CMD_WORD)
+ cmdStateNew = cmdState;
+ int stylePrev = sc.state;
+
// Determine if the current state should terminate.
switch (sc.state) {
case SCE_SH_OPERATOR:
sc.SetState(SCE_SH_DEFAULT);
+ if (cmdState == BASH_CMD_DELIM) // if command delimiter, start new command
+ cmdStateNew = BASH_CMD_START;
+ else if (sc.chPrev == '\\') // propagate command state if line continued
+ cmdStateNew = cmdState;
break;
case SCE_SH_WORD:
// "." never used in Bash variable names but used in file names
if (!setWord.Contains(sc.ch)) {
- char s[1000];
+ char s[500];
+ char s2[10];
sc.GetCurrent(s, sizeof(s));
- if (s[0] != '-' && // for file operators
- !keywords.InList(s)) {
+ // allow keywords ending in a whitespace or command delimiter
+ s2[0] = static_cast<char>(sc.ch);
+ s2[1] = '\0';
+ bool keywordEnds = IsASpace(sc.ch) || cmdDelimiter.InList(s2);
+ // 'in' or 'do' may be construct keywords
+ if (cmdState == BASH_CMD_WORD) {
+ if (strcmp(s, "in") == 0 && keywordEnds)
+ cmdStateNew = BASH_CMD_BODY;
+ else if (strcmp(s, "do") == 0 && keywordEnds)
+ cmdStateNew = BASH_CMD_START;
+ else
+ sc.ChangeState(SCE_SH_IDENTIFIER);
+ sc.SetState(SCE_SH_DEFAULT);
+ break;
+ }
+ // a 'test' keyword starts a test expression
+ if (strcmp(s, "test") == 0) {
+ if (cmdState == BASH_CMD_START && keywordEnds) {
+ cmdStateNew = BASH_CMD_TEST;
+ testExprType = 0;
+ } else
+ sc.ChangeState(SCE_SH_IDENTIFIER);
+ }
+ // detect bash construct keywords
+ else if (bashStruct.InList(s)) {
+ if (cmdState == BASH_CMD_START && keywordEnds)
+ cmdStateNew = BASH_CMD_START;
+ else
+ sc.ChangeState(SCE_SH_IDENTIFIER);
+ }
+ // 'for'|'case'|'select' needs 'in'|'do' to be highlighted later
+ else if (bashStruct_in.InList(s)) {
+ if (cmdState == BASH_CMD_START && keywordEnds)
+ cmdStateNew = BASH_CMD_WORD;
+ else
+ sc.ChangeState(SCE_SH_IDENTIFIER);
+ }
+ // disambiguate option items and file test operators
+ else if (s[0] == '-') {
+ if (cmdState != BASH_CMD_TEST)
+ sc.ChangeState(SCE_SH_IDENTIFIER);
+ }
+ // disambiguate keywords and identifiers
+ else if (cmdState != BASH_CMD_START
+ || !(keywords.InList(s) && keywordEnds)) {
sc.ChangeState(SCE_SH_IDENTIFIER);
}
sc.SetState(SCE_SH_DEFAULT);
@@ -324,8 +407,8 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, if (s[strlen(s) - 1] == '\r')
s[strlen(s) - 1] = '\0';
if (strcmp(HereDoc.Delimiter, s) == 0) {
- if ((prefixws > 0 && HereDoc.Indent) || // indentation rule
- (prefixws == 0 && !HereDoc.Indent)) {
+ if ((prefixws == 0) || // indentation rule
+ (prefixws > 0 && HereDoc.Indent)) {
sc.SetState(SCE_SH_DEFAULT);
break;
}
@@ -376,10 +459,17 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_SH_HERE_Q);
}
+ // update cmdState about the current command segment
+ if (stylePrev != SCE_SH_DEFAULT && sc.state == SCE_SH_DEFAULT) {
+ cmdState = cmdStateNew;
+ }
// Determine if a new state should be entered.
if (sc.state == SCE_SH_DEFAULT) {
- if (sc.ch == '\\') { // escaped character
+ if (sc.ch == '\\') {
+ // Bash can escape any non-newline as a literal
sc.SetState(SCE_SH_IDENTIFIER);
+ if (sc.chNext == '\r' || sc.chNext == '\n')
+ sc.SetState(SCE_SH_OPERATOR);
} else if (IsADigit(sc.ch)) {
sc.SetState(SCE_SH_NUMBER);
numBase = BASH_BASE_DECIMAL;
@@ -409,6 +499,10 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_SH_BACKTICKS);
Quote.Start(sc.ch);
} else if (sc.ch == '$') {
+ if (sc.Match("$((")) {
+ sc.SetState(SCE_SH_OPERATOR); // handle '((' later
+ continue;
+ }
sc.SetState(SCE_SH_SCALAR);
sc.Forward();
if (sc.ch == '{') {
@@ -419,9 +513,6 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, sc.ChangeState(SCE_SH_STRING);
} else if (sc.ch == '(' || sc.ch == '`') {
sc.ChangeState(SCE_SH_BACKTICKS);
- if (sc.chNext == '(') { // $(( is lexed as operator
- sc.ChangeState(SCE_SH_OPERATOR);
- }
} else {
continue; // scalar has no delimiter pair
}
@@ -438,9 +529,66 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_SH_WORD);
sc.Forward();
} else if (setBashOperator.Contains(sc.ch)) {
+ char s[10];
+ bool isCmdDelim = false;
sc.SetState(SCE_SH_OPERATOR);
+ // handle opening delimiters for test/arithmetic expressions - ((,[[,[
+ if (cmdState == BASH_CMD_START
+ || cmdState == BASH_CMD_BODY) {
+ if (sc.Match('(', '(')) {
+ cmdState = BASH_CMD_ARITH;
+ sc.Forward();
+ } else if (sc.Match('[', '[') && IsASpace(sc.GetRelative(2))) {
+ cmdState = BASH_CMD_TEST;
+ testExprType = 1;
+ sc.Forward();
+ } else if (sc.ch == '[' && IsASpace(sc.chNext)) {
+ cmdState = BASH_CMD_TEST;
+ testExprType = 2;
+ }
+ }
+ // special state -- for ((x;y;z)) in ... looping
+ if (cmdState == BASH_CMD_WORD && sc.Match('(', '(')) {
+ cmdState = BASH_CMD_ARITH;
+ sc.Forward();
+ continue;
+ }
+ // handle command delimiters in command START|BODY|WORD state, also TEST if 'test'
+ if (cmdState == BASH_CMD_START
+ || cmdState == BASH_CMD_BODY
+ || cmdState == BASH_CMD_WORD
+ || (cmdState == BASH_CMD_TEST && testExprType == 0)) {
+ s[0] = static_cast<char>(sc.ch);
+ if (setBashOperator.Contains(sc.chNext)) {
+ s[1] = static_cast<char>(sc.chNext);
+ s[2] = '\0';
+ isCmdDelim = cmdDelimiter.InList(s);
+ if (isCmdDelim)
+ sc.Forward();
+ }
+ if (!isCmdDelim) {
+ s[1] = '\0';
+ isCmdDelim = cmdDelimiter.InList(s);
+ }
+ if (isCmdDelim) {
+ cmdState = BASH_CMD_DELIM;
+ continue;
+ }
+ }
+ // handle closing delimiters for test/arithmetic expressions - )),]],]
+ if (cmdState == BASH_CMD_ARITH && sc.Match(')', ')')) {
+ cmdState = BASH_CMD_BODY;
+ sc.Forward();
+ } else if (cmdState == BASH_CMD_TEST && IsASpace(sc.chPrev)) {
+ if (sc.Match(']', ']') && testExprType == 1) {
+ sc.Forward();
+ cmdState = BASH_CMD_BODY;
+ } else if (sc.ch == ']' && testExprType == 2) {
+ cmdState = BASH_CMD_BODY;
+ }
+ }
}
- }
+ }// sc.state
}
sc.Complete();
}
diff --git a/scintilla/src/LexBasic.cxx b/scintilla/lexers/LexBasic.cxx index 9a52186..6721844 100644 --- a/scintilla/src/LexBasic.cxx +++ b/scintilla/lexers/LexBasic.cxx @@ -19,17 +19,20 @@ #include <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include <ctype.h>
#include <stdarg.h>
+#include <assert.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexBullant.cxx b/scintilla/lexers/LexBullant.cxx index 437843f..7253752 100644 --- a/scintilla/src/LexBullant.cxx +++ b/scintilla/lexers/LexBullant.cxx @@ -3,18 +3,23 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
diff --git a/scintilla/src/LexCLW.cxx b/scintilla/lexers/LexCLW.cxx index 3416bf2..168e82a 100644 --- a/scintilla/src/LexCLW.cxx +++ b/scintilla/lexers/LexCLW.cxx @@ -10,16 +10,20 @@ #include <string.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -60,10 +64,10 @@ inline bool IsALabelStart(const int iChar) { // Is a label character
inline bool IsALabelCharacter(const int iChar) {
- return(isalnum(iChar) || iChar == '_' || iChar == ':');
+ return(isalnum(iChar) || iChar == '_' || iChar == ':');
}
-// Is the character is a ! and the the next character is not a !
+// Is the character is a ! and the the next character is not a !
inline bool IsACommentStart(const int iChar) {
return(iChar == '!');
@@ -126,7 +130,7 @@ inline bool SetNumericConstantState(StyleContext &scDoc) { break;
default :
break;
- }
+ }
}
// If points found (can be more than one for improper formatted number
if (iPoints > 0) {
@@ -186,12 +190,12 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS WordList &wlLabelReservedWords = *wlKeywords[7]; // Clarion Reserved Keywords (Labels)
WordList &wlProcLabelReservedWords = *wlKeywords[8]; // Clarion Reserved Keywords (Procedure Labels)
- const char wlProcReservedKeywordList[] =
+ const char wlProcReservedKeywordList[] =
"PROCEDURE FUNCTION";
WordList wlProcReservedKeywords;
wlProcReservedKeywords.Set(wlProcReservedKeywordList);
- const char wlCompilerKeywordList[] =
+ const char wlCompilerKeywordList[] =
"COMPILE OMIT";
WordList wlCompilerKeywords;
wlCompilerKeywords.Set(wlCompilerKeywordList);
@@ -243,7 +247,7 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS // change the label to error state
scDoc.ChangeState(SCE_CLW_ERROR);
}
- // Else if UPPERCASE label string is
+ // Else if UPPERCASE label string is
else if (wlProcLabelReservedWords.InList(cLabel) && iColumn1Label) {
char cWord[512]; // Word buffer
// Get the next word from the current position
@@ -368,13 +372,13 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS // Increment the parenthese level
iParenthesesLevel++;
}
- // Else if the character is a ) (close parenthese)
+ // Else if the character is a ) (close parenthese)
else if (scDoc.ch == ')') {
// If the parenthese level is set to zero
// parentheses matched
if (!iParenthesesLevel) {
scDoc.SetState(SCE_CLW_DEFAULT);
- }
+ }
// Else parenthese level is greater than zero
// still looking for matching parentheses
else {
@@ -399,7 +403,7 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS || IsAHexCharacter(scDoc.ch, bCaseSensitive)
|| scDoc.ch == '.'
|| IsANumericBaseCharacter(scDoc.ch, bCaseSensitive))) {
- // If the number was a real
+ // If the number was a real
if (SetNumericConstantState(scDoc)) {
// Colour the matched string to the real constant state
scDoc.ChangeState(SCE_CLW_REAL_CONSTANT);
@@ -461,7 +465,7 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS }
// Default Handling
else {
- // If in default state
+ // If in default state
if (scDoc.state == SCE_CLW_DEFAULT) {
// If is a letter could be a possible statement
if (isalpha(scDoc.ch)) {
@@ -477,10 +481,10 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS else if (IsACommentStart(scDoc.ch) || scDoc.ch == '|') {
// then set the state to comment.
scDoc.SetState(SCE_CLW_COMMENT);
- }
+ }
// else if the character is a ' (single quote)
else if (scDoc.ch == '\'') {
- // If the character is also a ' (single quote)
+ // If the character is also a ' (single quote)
// Embedded Apostrophe
if (scDoc.chNext == '\'') {
// Move forward colouring it as default state
@@ -490,7 +494,7 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS // move to the next character and then set the state to comment.
scDoc.ForwardSetState(SCE_CLW_STRING);
}
- }
+ }
// else the character is an @ (ampersand)
else if (scDoc.ch == '@') {
// Case insensitive.
@@ -509,7 +513,7 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS scDoc.SetState(SCE_CLW_PICTURE_STRING);
}
}
- }
+ }
}
}
}
@@ -616,7 +620,7 @@ static void FoldClarionDoc(unsigned int uiStartPos, int iLength, int iInitStyle, iStyle = iStyleNext;
iStyleNext = accStyler.StyleAt(uiPos + 1);
bool bEOL = (chChar == '\r' && chNext != '\n') || (chChar == '\n');
-
+
if (iStylePrev == SCE_CLW_DEFAULT) {
if (iStyle == SCE_CLW_KEYWORD || iStyle == SCE_CLW_STRUCTURE_DATA_TYPE) {
// Store last word start point.
@@ -647,7 +651,7 @@ static void FoldClarionDoc(unsigned int uiStartPos, int iLength, int iInitStyle, iLevelPrev = iLevelCurrent;
iVisibleChars = 0;
}
-
+
if (!isspacechar(chChar))
iVisibleChars++;
}
diff --git a/scintilla/src/LexCOBOL.cxx b/scintilla/lexers/LexCOBOL.cxx index eee1fd4..1cbcd40 100644 --- a/scintilla/src/LexCOBOL.cxx +++ b/scintilla/lexers/LexCOBOL.cxx @@ -10,18 +10,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -90,11 +94,11 @@ static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &k getRange(start, end, styler, s, sizeof(s));
char chAttr = SCE_C_IDENTIFIER;
- if (isdigit(s[0]) || (s[0] == '.')) {
+ if (isdigit(s[0]) || (s[0] == '.') || (s[0] == 'v')) {
chAttr = SCE_C_NUMBER;
char *p = s + 1;
while (*p) {
- if (!isdigit(*p) && isCOBOLwordchar(*p)) {
+ if ((!isdigit(*p) && (*p) != 'v') && isCOBOLwordchar(*p)) {
chAttr = SCE_C_IDENTIFIER;
break;
}
diff --git a/scintilla/lexers/LexCPP.cxx b/scintilla/lexers/LexCPP.cxx new file mode 100644 index 0000000..81f961d --- /dev/null +++ b/scintilla/lexers/LexCPP.cxx @@ -0,0 +1,1088 @@ +// Scintilla source code edit control
+/** @file LexCPP.cxx
+ ** Lexer for C++, C, Java, and JavaScript.
+ **/
+// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+
+#ifdef _MSC_VER
+#pragma warning(disable: 4786)
+#endif
+#ifdef __BORLANDC__
+// Borland C++ displays warnings in vector header without this
+#pragma option -w-ccc -w-rch
+#endif
+
+#include <string>
+#include <vector>
+#include <map>
+#include <algorithm>
+
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+#include "OptionSet.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+static bool IsSpaceEquiv(int state) {
+ return (state <= SCE_C_COMMENTDOC) ||
+ // including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE
+ (state == SCE_C_COMMENTLINEDOC) || (state == SCE_C_COMMENTDOCKEYWORD) ||
+ (state == SCE_C_COMMENTDOCKEYWORDERROR);
+}
+
+// Preconditions: sc.currentPos points to a character after '+' or '-'.
+// The test for pos reaching 0 should be redundant,
+// and is in only for safety measures.
+// Limitation: this code will give the incorrect answer for code like
+// a = b+++/ptn/...
+// Putting a space between the '++' post-inc operator and the '+' binary op
+// fixes this, and is highly recommended for readability anyway.
+static bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
+ int pos = (int) sc.currentPos;
+ while (--pos > 0) {
+ char ch = styler[pos];
+ if (ch == '+' || ch == '-') {
+ return styler[pos - 1] == ch;
+ }
+ }
+ return false;
+}
+
+static bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
+ // Don't look at styles, so no need to flush.
+ int pos = (int) sc.currentPos;
+ int currentLine = styler.GetLine(pos);
+ int lineStartPos = styler.LineStart(currentLine);
+ char ch;
+ while (--pos > lineStartPos) {
+ ch = styler.SafeGetCharAt(pos);
+ if (ch != ' ' && ch != '\t') {
+ break;
+ }
+ }
+ const char *retBack = "nruter";
+ const char *s = retBack;
+ while (*s
+ && pos >= lineStartPos
+ && styler.SafeGetCharAt(pos) == *s) {
+ s++;
+ pos--;
+ }
+ return !*s;
+}
+
+static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) {
+ std::string restOfLine;
+ int i =0;
+ char ch = styler.SafeGetCharAt(start + i, '\n');
+ while ((ch != '\r') && (ch != '\n')) {
+ if (allowSpace || (ch != ' '))
+ restOfLine += ch;
+ i++;
+ ch = styler.SafeGetCharAt(start + i, '\n');
+ }
+ return restOfLine;
+}
+
+static bool IsStreamCommentStyle(int style) {
+ return style == SCE_C_COMMENT ||
+ style == SCE_C_COMMENTDOC ||
+ style == SCE_C_COMMENTDOCKEYWORD ||
+ style == SCE_C_COMMENTDOCKEYWORDERROR;
+}
+
+static std::vector<std::string> Tokenize(const std::string &s) {
+ // Break into space separated tokens
+ std::string word;
+ std::vector<std::string> tokens;
+ for (const char *cp = s.c_str(); *cp; cp++) {
+ if ((*cp == ' ') || (*cp == '\t')) {
+ if (!word.empty()) {
+ tokens.push_back(word);
+ word = "";
+ }
+ } else {
+ word += *cp;
+ }
+ }
+ if (!word.empty()) {
+ tokens.push_back(word);
+ }
+ return tokens;
+}
+
+struct PPDefinition {
+ int line;
+ std::string key;
+ std::string value;
+ PPDefinition(int line_, const std::string &key_, const std::string &value_) :
+ line(line_), key(key_), value(value_) {
+ }
+};
+
+class LinePPState {
+ int state;
+ int ifTaken;
+ int level;
+ bool ValidLevel() const {
+ return level >= 0 && level < 32;
+ }
+ int maskLevel() const {
+ return 1 << level;
+ }
+public:
+ LinePPState() : state(0), ifTaken(0), level(-1) {
+ }
+ bool IsInactive() const {
+ return state != 0;
+ }
+ bool CurrentIfTaken() {
+ return (ifTaken & maskLevel()) != 0;
+ }
+ void StartSection(bool on) {
+ level++;
+ if (ValidLevel()) {
+ if (on) {
+ state &= ~maskLevel();
+ ifTaken |= maskLevel();
+ } else {
+ state |= maskLevel();
+ ifTaken &= ~maskLevel();
+ }
+ }
+ }
+ void EndSection() {
+ if (ValidLevel()) {
+ state &= ~maskLevel();
+ ifTaken &= ~maskLevel();
+ }
+ level--;
+ }
+ void InvertCurrentLevel() {
+ if (ValidLevel()) {
+ state ^= maskLevel();
+ ifTaken |= maskLevel();
+ }
+ }
+};
+
+// Hold the preprocessor state for each line seen.
+// Currently one entry per line but could become sparse with just one entry per preprocessor line.
+class PPStates {
+ std::vector<LinePPState> vlls;
+public:
+ LinePPState ForLine(int line) {
+ if ((line > 0) && (vlls.size() > static_cast<size_t>(line))) {
+ return vlls[line];
+ } else {
+ return LinePPState();
+ }
+ }
+ void Add(int line, LinePPState lls) {
+ vlls.resize(line+1);
+ vlls[line] = lls;
+ }
+};
+
+// An individual named option for use in an OptionSet
+
+// Options used for LexerCPP
+struct OptionsCPP {
+ bool stylingWithinPreprocessor;
+ bool identifiersAllowDollars;
+ bool trackPreprocessor;
+ bool updatePreprocessor;
+ bool fold;
+ bool foldComment;
+ bool foldCommentExplicit;
+ bool foldPreprocessor;
+ bool foldCompact;
+ bool foldAtElse;
+ OptionsCPP() {
+ stylingWithinPreprocessor = false;
+ identifiersAllowDollars = true;
+ trackPreprocessor = true;
+ updatePreprocessor = true;
+ fold = false;
+ foldComment = false;
+ foldCommentExplicit = true;
+ foldPreprocessor = false;
+ foldCompact = false;
+ foldAtElse = false;
+ }
+};
+
+static const char *const cppWordLists[] = {
+ "Primary keywords and identifiers",
+ "Secondary keywords and identifiers",
+ "Documentation comment keywords",
+ "Global classes and typedefs",
+ "Preprocessor definitions",
+ 0,
+};
+
+struct OptionSetCPP : public OptionSet<OptionsCPP> {
+ OptionSetCPP() {
+ DefineProperty("styling.within.preprocessor", &OptionsCPP::stylingWithinPreprocessor,
+ "For C++ code, determines whether all preprocessor code is styled in the "
+ "preprocessor style (0, the default) or only from the initial # to the end "
+ "of the command word(1).");
+
+ DefineProperty("lexer.cpp.allow.dollars", &OptionsCPP::identifiersAllowDollars,
+ "Set to 0 to disallow the '$' character in identifiers with the cpp lexer.");
+
+ DefineProperty("lexer.cpp.track.preprocessor", &OptionsCPP::trackPreprocessor,
+ "Set to 1 to interpret #if/#else/#endif to grey out code that is not active.");
+
+ DefineProperty("lexer.cpp.update.preprocessor", &OptionsCPP::updatePreprocessor,
+ "Set to 1 to update preprocessor definitions when #define found.");
+
+ DefineProperty("fold", &OptionsCPP::fold);
+
+ DefineProperty("fold.comment", &OptionsCPP::foldComment,
+ "This option enables folding multi-line comments and explicit fold points when using the C++ lexer. "
+ "Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //} "
+ "at the end of a section that should fold.");
+
+ DefineProperty("fold.cpp.comment.explicit", &OptionsCPP::foldCommentExplicit,
+ "Set this property to 0 to disable folding explicit fold points when fold.comment=1.");
+
+ DefineProperty("fold.preprocessor", &OptionsCPP::foldPreprocessor,
+ "This option enables folding preprocessor directives when using the C++ lexer. "
+ "Includes C#'s explicit #region and #endregion folding directives.");
+
+ DefineProperty("fold.compact", &OptionsCPP::foldCompact);
+
+ DefineProperty("fold.at.else", &OptionsCPP::foldAtElse,
+ "This option enables C++ folding on a \"} else {\" line of an if statement.");
+
+ DefineWordListSets(cppWordLists);
+ }
+};
+
+class LexerCPP : public ILexer {
+ bool caseSensitive;
+ CharacterSet setWord;
+ CharacterSet setNegationOp;
+ CharacterSet setArithmethicOp;
+ CharacterSet setRelOp;
+ CharacterSet setLogicalOp;
+ PPStates vlls;
+ std::vector<PPDefinition> ppDefineHistory;
+ PropSetSimple props;
+ WordList keywords;
+ WordList keywords2;
+ WordList keywords3;
+ WordList keywords4;
+ WordList ppDefinitions;
+ std::map<std::string, std::string> preprocessorDefinitionsStart;
+ OptionsCPP options;
+ OptionSetCPP osCPP;
+public:
+ LexerCPP(bool caseSensitive_) :
+ caseSensitive(caseSensitive_),
+ setWord(CharacterSet::setAlphaNum, "._", 0x80, true),
+ setNegationOp(CharacterSet::setNone, "!"),
+ setArithmethicOp(CharacterSet::setNone, "+-/*%"),
+ setRelOp(CharacterSet::setNone, "=!<>"),
+ setLogicalOp(CharacterSet::setNone, "|&") {
+ }
+ ~LexerCPP() {
+ }
+ void SCI_METHOD Release() {
+ delete this;
+ }
+ int SCI_METHOD Version() const {
+ return lvOriginal;
+ }
+ const char * SCI_METHOD PropertyNames() {
+ return osCPP.PropertyNames();
+ }
+ int SCI_METHOD PropertyType(const char *name) {
+ return osCPP.PropertyType(name);
+ }
+ const char * SCI_METHOD DescribeProperty(const char *name) {
+ return osCPP.DescribeProperty(name);
+ }
+ int SCI_METHOD PropertySet(const char *key, const char *val);
+ const char * SCI_METHOD DescribeWordListSets() {
+ return osCPP.DescribeWordListSets();
+ }
+ int SCI_METHOD WordListSet(int n, const char *wl);
+ void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
+
+ void * SCI_METHOD PrivateCall(int, void *) {
+ return 0;
+ }
+
+ static ILexer *LexerFactoryCPP() {
+ return new LexerCPP(true);
+ }
+ static ILexer *LexerFactoryCPPInsensitive() {
+ return new LexerCPP(false);
+ }
+
+ void EvaluateTokens(std::vector<std::string> &tokens);
+ bool EvaluateExpression(const std::string &expr, const std::map<std::string, std::string> &preprocessorDefinitions);
+};
+
+int SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) {
+ if (osCPP.PropertySet(&options, key, val)) {
+ return 0;
+ }
+ return -1;
+}
+
+int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
+ WordList *wordListN = 0;
+ switch (n) {
+ case 0:
+ wordListN = &keywords;
+ break;
+ case 1:
+ wordListN = &keywords2;
+ break;
+ case 2:
+ wordListN = &keywords3;
+ break;
+ case 3:
+ wordListN = &keywords4;
+ break;
+ case 4:
+ wordListN = &ppDefinitions;
+ break;
+ }
+ int firstModification = -1;
+ if (wordListN) {
+ WordList wlNew;
+ wlNew.Set(wl);
+ if (*wordListN != wlNew) {
+ wordListN->Set(wl);
+ firstModification = 0;
+ if (n == 4) {
+ // Rebuild preprocessorDefinitions
+ preprocessorDefinitionsStart.clear();
+ for (int nDefinition = 0; nDefinition < ppDefinitions.len; nDefinition++) {
+ char *cpDefinition = ppDefinitions.words[nDefinition];
+ char *cpEquals = strchr(cpDefinition, '=');
+ if (cpEquals) {
+ std::string name(cpDefinition, cpEquals - cpDefinition);
+ std::string val(cpEquals+1);
+ preprocessorDefinitionsStart[name] = val;
+ } else {
+ std::string name(cpDefinition);
+ std::string val("1");
+ preprocessorDefinitionsStart[name] = val;
+ }
+ }
+ }
+ }
+ }
+ return firstModification;
+}
+
+// Functor used to truncate history
+struct After {
+ int line;
+ After(int line_) : line(line_) {}
+ bool operator() (PPDefinition &p) const {
+ return p.line > line;
+ }
+};
+
+void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+ LexAccessor styler(pAccess);
+
+ CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-");
+ CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-");
+
+ CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]");
+
+ CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
+ CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
+
+ if (options.identifiersAllowDollars) {
+ setWordStart.Add('$');
+ setWord.Add('$');
+ }
+
+ int chPrevNonWhite = ' ';
+ int visibleChars = 0;
+ bool lastWordWasUUID = false;
+ int styleBeforeDCKeyword = SCE_C_DEFAULT;
+ bool continuationLine = false;
+ bool isIncludePreprocessor = false;
+
+ int lineCurrent = styler.GetLine(startPos);
+ if ((initStyle == SCE_C_PREPROCESSOR) ||
+ (initStyle == SCE_C_COMMENTLINE) ||
+ (initStyle == SCE_C_COMMENTLINEDOC)) {
+ // Set continuationLine if last character of previous line is '\'
+ if (lineCurrent > 0) {
+ int chBack = styler.SafeGetCharAt(startPos-1, 0);
+ int chBack2 = styler.SafeGetCharAt(startPos-2, 0);
+ int lineEndChar = '!';
+ if (chBack2 == '\r' && chBack == '\n') {
+ lineEndChar = styler.SafeGetCharAt(startPos-3, 0);
+ } else if (chBack == '\n' || chBack == '\r') {
+ lineEndChar = chBack2;
+ }
+ continuationLine = lineEndChar == '\\';
+ }
+ }
+
+ // look back to set chPrevNonWhite properly for better regex colouring
+ if (startPos > 0) {
+ int back = startPos;
+ while (--back && IsSpaceEquiv(styler.StyleAt(back)))
+ ;
+ if (styler.StyleAt(back) == SCE_C_OPERATOR) {
+ chPrevNonWhite = styler.SafeGetCharAt(back);
+ }
+ }
+
+ StyleContext sc(startPos, length, initStyle, styler, 0x7f);
+ LinePPState preproc = vlls.ForLine(lineCurrent);
+
+ bool definitionsChanged = false;
+
+ // Truncate ppDefineHistory before current line
+
+ if (!options.updatePreprocessor)
+ ppDefineHistory.clear();
+
+ std::vector<PPDefinition>::iterator itInvalid = std::find_if(ppDefineHistory.begin(), ppDefineHistory.end(), After(lineCurrent-1));
+ if (itInvalid != ppDefineHistory.end()) {
+ ppDefineHistory.erase(itInvalid, ppDefineHistory.end());
+ definitionsChanged = true;
+ }
+
+ std::map<std::string, std::string> preprocessorDefinitions = preprocessorDefinitionsStart;
+ for (std::vector<PPDefinition>::iterator itDef = ppDefineHistory.begin(); itDef != ppDefineHistory.end(); ++itDef) {
+ preprocessorDefinitions[itDef->key] = itDef->value;
+ }
+
+ const int maskActivity = 0x3F;
+
+ int activitySet = preproc.IsInactive() ? 0x40 : 0;
+
+ for (; sc.More(); sc.Forward()) {
+
+ if (sc.atLineStart) {
+ if (sc.state == SCE_C_STRING) {
+ // Prevent SCE_C_STRINGEOL from leaking back to previous line which
+ // ends with a line continuation by locking in the state upto this position.
+ sc.SetState(SCE_C_STRING);
+ }
+ // Reset states to begining of colourise so no surprises
+ // if different sets of lines lexed.
+ visibleChars = 0;
+ lastWordWasUUID = false;
+ isIncludePreprocessor = false;
+ if (preproc.IsInactive()) {
+ activitySet = 0x40;
+ sc.SetState(sc.state | activitySet);
+ }
+ if (activitySet) {
+ if (sc.ch == '#') {
+ if (sc.Match("#else") || sc.Match("#end") || sc.Match("#if")) {
+ //activitySet = 0;
+ }
+ }
+ }
+ }
+
+ if (sc.atLineEnd) {
+ lineCurrent++;
+ vlls.Add(lineCurrent, preproc);
+ }
+
+ // Handle line continuation generically.
+ if (sc.ch == '\\') {
+ if (sc.chNext == '\n' || sc.chNext == '\r') {
+ sc.Forward();
+ if (sc.ch == '\r' && sc.chNext == '\n') {
+ sc.Forward();
+ }
+ continuationLine = true;
+ continue;
+ }
+ }
+
+ const bool atLineEndBeforeSwitch = sc.atLineEnd;
+
+ // Determine if the current state should terminate.
+ switch (sc.state & maskActivity) {
+ case SCE_C_OPERATOR:
+ sc.SetState(SCE_C_DEFAULT|activitySet);
+ break;
+ case SCE_C_NUMBER:
+ // We accept almost anything because of hex. and number suffixes
+ if (!(setWord.Contains(sc.ch) || ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) {
+ sc.SetState(SCE_C_DEFAULT|activitySet);
+ }
+ break;
+ case SCE_C_IDENTIFIER:
+ if (!setWord.Contains(sc.ch) || (sc.ch == '.')) {
+ char s[1000];
+ if (caseSensitive) {
+ sc.GetCurrent(s, sizeof(s));
+ } else {
+ sc.GetCurrentLowered(s, sizeof(s));
+ }
+ if (keywords.InList(s)) {
+ lastWordWasUUID = strcmp(s, "uuid") == 0;
+ sc.ChangeState(SCE_C_WORD|activitySet);
+ } else if (keywords2.InList(s)) {
+ sc.ChangeState(SCE_C_WORD2|activitySet);
+ } else if (keywords4.InList(s)) {
+ sc.ChangeState(SCE_C_GLOBALCLASS|activitySet);
+ }
+ sc.SetState(SCE_C_DEFAULT|activitySet);
+ }
+ break;
+ case SCE_C_PREPROCESSOR:
+ if (sc.atLineStart && !continuationLine) {
+ sc.SetState(SCE_C_DEFAULT|activitySet);
+ } else if (options.stylingWithinPreprocessor) {
+ if (IsASpace(sc.ch)) {
+ sc.SetState(SCE_C_DEFAULT|activitySet);
+ }
+ } else {
+ if (sc.Match('/', '*') || sc.Match('/', '/')) {
+ sc.SetState(SCE_C_DEFAULT|activitySet);
+ }
+ }
+ break;
+ case SCE_C_COMMENT:
+ if (sc.Match('*', '/')) {
+ sc.Forward();
+ sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
+ }
+ break;
+ case SCE_C_COMMENTDOC:
+ if (sc.Match('*', '/')) {
+ sc.Forward();
+ sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
+ } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support
+ // Verify that we have the conditions to mark a comment-doc-keyword
+ if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) {
+ styleBeforeDCKeyword = SCE_C_COMMENTDOC;
+ sc.SetState(SCE_C_COMMENTDOCKEYWORD|activitySet);
+ }
+ }
+ break;
+ case SCE_C_COMMENTLINE:
+ if (sc.atLineStart && !continuationLine) {
+ sc.SetState(SCE_C_DEFAULT|activitySet);
+ }
+ break;
+ case SCE_C_COMMENTLINEDOC:
+ if (sc.atLineStart && !continuationLine) {
+ sc.SetState(SCE_C_DEFAULT|activitySet);
+ } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support
+ // Verify that we have the conditions to mark a comment-doc-keyword
+ if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) {
+ styleBeforeDCKeyword = SCE_C_COMMENTLINEDOC;
+ sc.SetState(SCE_C_COMMENTDOCKEYWORD|activitySet);
+ }
+ }
+ break;
+ case SCE_C_COMMENTDOCKEYWORD:
+ if ((styleBeforeDCKeyword == SCE_C_COMMENTDOC) && sc.Match('*', '/')) {
+ sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
+ sc.Forward();
+ sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
+ } else if (!setDoxygen.Contains(sc.ch)) {
+ char s[100];
+ if (caseSensitive) {
+ sc.GetCurrent(s, sizeof(s));
+ } else {
+ sc.GetCurrentLowered(s, sizeof(s));
+ }
+ if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) {
+ sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet);
+ }
+ sc.SetState(styleBeforeDCKeyword);
+ }
+ break;
+ case SCE_C_STRING:
+ if (sc.atLineEnd) {
+ sc.ChangeState(SCE_C_STRINGEOL|activitySet);
+ } else if (isIncludePreprocessor) {
+ if (sc.ch == '>') {
+ sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
+ isIncludePreprocessor = false;
+ }
+ } else if (sc.ch == '\\') {
+ if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
+ sc.Forward();
+ }
+ } else if (sc.ch == '\"') {
+ sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
+ }
+ break;
+ case SCE_C_CHARACTER:
+ if (sc.atLineEnd) {
+ sc.ChangeState(SCE_C_STRINGEOL|activitySet);
+ } else if (sc.ch == '\\') {
+ if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
+ sc.Forward();
+ }
+ } else if (sc.ch == '\'') {
+ sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
+ }
+ break;
+ case SCE_C_REGEX:
+ if (sc.atLineStart) {
+ sc.SetState(SCE_C_DEFAULT|activitySet);
+ } else if (sc.ch == '/') {
+ sc.Forward();
+ while ((sc.ch < 0x80) && islower(sc.ch))
+ sc.Forward(); // gobble regex flags
+ sc.SetState(SCE_C_DEFAULT|activitySet);
+ } else if (sc.ch == '\\') {
+ // Gobble up the quoted character
+ if (sc.chNext == '\\' || sc.chNext == '/') {
+ sc.Forward();
+ }
+ }
+ break;
+ case SCE_C_STRINGEOL:
+ if (sc.atLineStart) {
+ sc.SetState(SCE_C_DEFAULT|activitySet);
+ }
+ break;
+ case SCE_C_VERBATIM:
+ if (sc.ch == '\"') {
+ if (sc.chNext == '\"') {
+ sc.Forward();
+ } else {
+ sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
+ }
+ }
+ break;
+ case SCE_C_UUID:
+ if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') {
+ sc.SetState(SCE_C_DEFAULT|activitySet);
+ }
+ }
+
+ if (sc.atLineEnd && !atLineEndBeforeSwitch) {
+ // State exit processing consumed characters up to end of line.
+ lineCurrent++;
+ vlls.Add(lineCurrent, preproc);
+ }
+
+ // Determine if a new state should be entered.
+ if ((sc.state & maskActivity) == SCE_C_DEFAULT) {
+ if (sc.Match('@', '\"')) {
+ sc.SetState(SCE_C_VERBATIM|activitySet);
+ sc.Forward();
+ } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
+ if (lastWordWasUUID) {
+ sc.SetState(SCE_C_UUID|activitySet);
+ lastWordWasUUID = false;
+ } else {
+ sc.SetState(SCE_C_NUMBER|activitySet);
+ }
+ } else if (setWordStart.Contains(sc.ch) || (sc.ch == '@')) {
+ if (lastWordWasUUID) {
+ sc.SetState(SCE_C_UUID|activitySet);
+ lastWordWasUUID = false;
+ } else {
+ sc.SetState(SCE_C_IDENTIFIER|activitySet);
+ }
+ } else if (sc.Match('/', '*')) {
+ if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style
+ sc.SetState(SCE_C_COMMENTDOC|activitySet);
+ } else {
+ sc.SetState(SCE_C_COMMENT|activitySet);
+ }
+ sc.Forward(); // Eat the * so it isn't used for the end of the comment
+ } else if (sc.Match('/', '/')) {
+ if ((sc.Match("///") && !sc.Match("////")) || sc.Match("//!"))
+ // Support of Qt/Doxygen doc. style
+ sc.SetState(SCE_C_COMMENTLINEDOC|activitySet);
+ else
+ sc.SetState(SCE_C_COMMENTLINE|activitySet);
+ } else if (sc.ch == '/'
+ && (setOKBeforeRE.Contains(chPrevNonWhite)
+ || followsReturnKeyword(sc, styler))
+ && (!setCouldBePostOp.Contains(chPrevNonWhite)
+ || !FollowsPostfixOperator(sc, styler))) {
+ sc.SetState(SCE_C_REGEX|activitySet); // JavaScript's RegEx
+ } else if (sc.ch == '\"') {
+ sc.SetState(SCE_C_STRING|activitySet);
+ isIncludePreprocessor = false; // ensure that '>' won't end the string
+ } else if (isIncludePreprocessor && sc.ch == '<') {
+ sc.SetState(SCE_C_STRING|activitySet);
+ } else if (sc.ch == '\'') {
+ sc.SetState(SCE_C_CHARACTER|activitySet);
+ } else if (sc.ch == '#' && visibleChars == 0) {
+ // Preprocessor commands are alone on their line
+ sc.SetState(SCE_C_PREPROCESSOR|activitySet);
+ // Skip whitespace between # and preprocessor word
+ do {
+ sc.Forward();
+ } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More());
+ if (sc.atLineEnd) {
+ sc.SetState(SCE_C_DEFAULT|activitySet);
+ } else if (sc.Match("include")) {
+ isIncludePreprocessor = true;
+ } else {
+ if (options.trackPreprocessor) {
+ if (sc.Match("ifdef") || sc.Match("ifndef")) {
+ bool isIfDef = sc.Match("ifdef");
+ int i = isIfDef ? 5 : 6;
+ std::string restOfLine = GetRestOfLine(styler, sc.currentPos + i + 1, false);
+ bool foundDef = preprocessorDefinitions.find(restOfLine) != preprocessorDefinitions.end();
+ preproc.StartSection(isIfDef == foundDef);
+ } else if (sc.Match("if")) {
+ std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 2, true);
+ bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions);
+ preproc.StartSection(ifGood);
+ } else if (sc.Match("else")) {
+ if (!preproc.CurrentIfTaken()) {
+ preproc.InvertCurrentLevel();
+ activitySet = preproc.IsInactive() ? 0x40 : 0;
+ if (!activitySet)
+ sc.ChangeState(SCE_C_PREPROCESSOR|activitySet);
+ } else if (!preproc.IsInactive()) {
+ preproc.InvertCurrentLevel();
+ activitySet = preproc.IsInactive() ? 0x40 : 0;
+ if (!activitySet)
+ sc.ChangeState(SCE_C_PREPROCESSOR|activitySet);
+ }
+ } else if (sc.Match("elif")) {
+ // Ensure only one chosen out of #if .. #elif .. #elif .. #else .. #endif
+ if (!preproc.CurrentIfTaken()) {
+ // Similar to #if
+ std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 2, true);
+ bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions);
+ if (ifGood) {
+ preproc.InvertCurrentLevel();
+ activitySet = preproc.IsInactive() ? 0x40 : 0;
+ if (!activitySet)
+ sc.ChangeState(SCE_C_PREPROCESSOR|activitySet);
+ }
+ } else if (!preproc.IsInactive()) {
+ preproc.InvertCurrentLevel();
+ activitySet = preproc.IsInactive() ? 0x40 : 0;
+ if (!activitySet)
+ sc.ChangeState(SCE_C_PREPROCESSOR|activitySet);
+ }
+ } else if (sc.Match("endif")) {
+ preproc.EndSection();
+ activitySet = preproc.IsInactive() ? 0x40 : 0;
+ sc.ChangeState(SCE_C_PREPROCESSOR|activitySet);
+ } else if (sc.Match("define")) {
+ if (options.updatePreprocessor && !preproc.IsInactive()) {
+ std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 6, true);
+ if (restOfLine.find(")") == std::string::npos) { // Don't handle macros with arguments
+ std::vector<std::string> tokens = Tokenize(restOfLine);
+ std::string key;
+ std::string value("1");
+ if (tokens.size() >= 1) {
+ key = tokens[0];
+ if (tokens.size() >= 2) {
+ value = tokens[1];
+ }
+ preprocessorDefinitions[key] = value;
+ ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value));
+ definitionsChanged = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ } else if (isoperator(static_cast<char>(sc.ch))) {
+ sc.SetState(SCE_C_OPERATOR|activitySet);
+ }
+ }
+
+ if (!IsASpace(sc.ch) && !IsSpaceEquiv(sc.state)) {
+ chPrevNonWhite = sc.ch;
+ visibleChars++;
+ }
+ continuationLine = false;
+ }
+ if (definitionsChanged)
+ styler.ChangeLexerState(startPos, startPos + length);
+ sc.Complete();
+ styler.Flush();
+}
+
+// Store both the current line's fold level and the next lines in the
+// level store to make it easy to pick up with each increment
+// and to make it possible to fiddle the current level for "} else {".
+
+void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+
+ if (!options.fold)
+ return;
+
+ LexAccessor styler(pAccess);
+
+ unsigned int endPos = startPos + length;
+ int visibleChars = 0;
+ int lineCurrent = styler.GetLine(startPos);
+ int levelCurrent = SC_FOLDLEVELBASE;
+ if (lineCurrent > 0)
+ levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
+ int levelMinCurrent = levelCurrent;
+ int levelNext = levelCurrent;
+ char chNext = styler[startPos];
+ int styleNext = styler.StyleAt(startPos);
+ int style = initStyle;
+ for (unsigned int i = startPos; i < endPos; i++) {
+ char ch = chNext;
+ chNext = styler.SafeGetCharAt(i + 1);
+ int stylePrev = style;
+ style = styleNext;
+ styleNext = styler.StyleAt(i + 1);
+ bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+ if (options.foldComment && IsStreamCommentStyle(style)) {
+ if (!IsStreamCommentStyle(stylePrev) && (stylePrev != SCE_C_COMMENTLINEDOC)) {
+ levelNext++;
+ } else if (!IsStreamCommentStyle(styleNext) && (styleNext != SCE_C_COMMENTLINEDOC) && !atEOL) {
+ // Comments don't end at end of line and the next character may be unstyled.
+ levelNext--;
+ }
+ }
+ /* Disable explicit folding; it can often cause problems with non-aware code
+ if (options.foldComment && options.foldCommentExplicit && (style == SCE_C_COMMENTLINE)) {
+ if ((ch == '/') && (chNext == '/')) {
+ char chNext2 = styler.SafeGetCharAt(i + 2);
+ if (chNext2 == '{') {
+ levelNext++;
+ } else if (chNext2 == '}') {
+ levelNext--;
+ }
+ }
+ }
+ */
+ if (options.foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
+ if (ch == '#') {
+ unsigned int j = i + 1;
+ while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
+ j++;
+ }
+ if (styler.Match(j, "region") || styler.Match(j, "if")) {
+ levelNext++;
+ } else if (styler.Match(j, "end")) {
+ levelNext--;
+ }
+ }
+ }
+ if (style == SCE_C_OPERATOR) {
+ if (ch == '{') {
+ // Measure the minimum before a '{' to allow
+ // folding on "} else {"
+ if (levelMinCurrent > levelNext) {
+ levelMinCurrent = levelNext;
+ }
+ levelNext++;
+ } else if (ch == '}') {
+ levelNext--;
+ }
+ }
+ if (!IsASpace(ch))
+ visibleChars++;
+ if (atEOL || (i == endPos-1)) {
+ int levelUse = levelCurrent;
+ if (options.foldAtElse) {
+ levelUse = levelMinCurrent;
+ }
+ int lev = levelUse | levelNext << 16;
+ if (visibleChars == 0 && options.foldCompact)
+ lev |= SC_FOLDLEVELWHITEFLAG;
+ if (levelUse < levelNext)
+ lev |= SC_FOLDLEVELHEADERFLAG;
+ if (lev != styler.LevelAt(lineCurrent)) {
+ styler.SetLevel(lineCurrent, lev);
+ }
+ lineCurrent++;
+ levelCurrent = levelNext;
+ levelMinCurrent = levelCurrent;
+ if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) {
+ // There is an empty line at end of file so give it same level and empty
+ styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG);
+ }
+ visibleChars = 0;
+ }
+ }
+}
+
+void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens) {
+
+ // Evaluate defined() statements to either 0 or 1
+ for (size_t i=0; (i+2)<tokens.size();) {
+ if ((tokens[i] == "defined") && (tokens[i+1] == "(")) {
+ const char *val = "0";
+ if (tokens[i+2] == ")") {
+ // defined()
+ tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 3);
+ } else if (((i+2)<tokens.size()) && (tokens[i+3] == ")")) {
+ // defined(<int>)
+ tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 4);
+ val = "1";
+ }
+ tokens[i] = val;
+ } else {
+ i++;
+ }
+ }
+
+ // Find bracketed subexpressions and recurse on them
+ std::vector<std::string>::iterator itBracket = std::find(tokens.begin(), tokens.end(), "(");
+ std::vector<std::string>::iterator itEndBracket = std::find(tokens.begin(), tokens.end(), ")");
+ while ((itBracket != tokens.end()) && (itEndBracket != tokens.end()) && (itEndBracket > itBracket)) {
+ std::vector<std::string> inBracket(itBracket + 1, itEndBracket);
+ EvaluateTokens(inBracket);
+
+ // The insertion is done before the removal because there were failures with the opposite approach
+ tokens.insert(itBracket, inBracket.begin(), inBracket.end());
+ itBracket = std::find(tokens.begin(), tokens.end(), "(");
+ itEndBracket = std::find(tokens.begin(), tokens.end(), ")");
+ tokens.erase(itBracket, itEndBracket + 1);
+
+ itBracket = std::find(tokens.begin(), tokens.end(), "(");
+ itEndBracket = std::find(tokens.begin(), tokens.end(), ")");
+ }
+
+ // Evaluate logical negations
+ for (size_t j=0; (j+1)<tokens.size();) {
+ if (setNegationOp.Contains(tokens[j][0])) {
+ int isTrue = atoi(tokens[j+1].c_str());
+ if (tokens[j] == "!")
+ isTrue = !isTrue;
+ std::vector<std::string>::iterator itInsert =
+ tokens.erase(tokens.begin() + j, tokens.begin() + j + 2);
+ tokens.insert(itInsert, isTrue ? "1" : "0");
+ } else {
+ j++;
+ }
+ }
+
+ // Evaluate expressions in precedence order
+ enum precedence { precArithmetic, precRelative, precLogical };
+ for (int prec=precArithmetic; prec <= precLogical; prec++) {
+ // Looking at 3 tokens at a time so end at 2 before end
+ for (size_t k=0; (k+2)<tokens.size();) {
+ char chOp = tokens[k+1][0];
+ if (
+ ((prec==precArithmetic) && setArithmethicOp.Contains(chOp)) ||
+ ((prec==precRelative) && setRelOp.Contains(chOp)) ||
+ ((prec==precLogical) && setLogicalOp.Contains(chOp))
+ ) {
+ int valA = atoi(tokens[k].c_str());
+ int valB = atoi(tokens[k+2].c_str());
+ int result = 0;
+ if (tokens[k+1] == "+")
+ result = valA + valB;
+ else if (tokens[k+1] == "-")
+ result = valA - valB;
+ else if (tokens[k+1] == "*")
+ result = valA * valB;
+ else if (tokens[k+1] == "/")
+ result = valA / (valB ? valB : 1);
+ else if (tokens[k+1] == "%")
+ result = valA % (valB ? valB : 1);
+ else if (tokens[k+1] == "<")
+ result = valA < valB;
+ else if (tokens[k+1] == "<=")
+ result = valA <= valB;
+ else if (tokens[k+1] == ">")
+ result = valA > valB;
+ else if (tokens[k+1] == ">=")
+ result = valA >= valB;
+ else if (tokens[k+1] == "==")
+ result = valA == valB;
+ else if (tokens[k+1] == "!=")
+ result = valA != valB;
+ else if (tokens[k+1] == "||")
+ result = valA || valB;
+ else if (tokens[k+1] == "&&")
+ result = valA && valB;
+ char sResult[30];
+ sprintf(sResult, "%d", result);
+ std::vector<std::string>::iterator itInsert =
+ tokens.erase(tokens.begin() + k, tokens.begin() + k + 3);
+ tokens.insert(itInsert, sResult);
+ } else {
+ k++;
+ }
+ }
+ }
+}
+
+bool LexerCPP::EvaluateExpression(const std::string &expr, const std::map<std::string, std::string> &preprocessorDefinitions) {
+ // Break into tokens, replacing with definitions
+ std::string word;
+ std::vector<std::string> tokens;
+ const char *cp = expr.c_str();
+ for (;;) {
+ if (setWord.Contains(*cp)) {
+ word += *cp;
+ } else {
+ std::map<std::string, std::string>::const_iterator it = preprocessorDefinitions.find(word);
+ if (it != preprocessorDefinitions.end()) {
+ tokens.push_back(it->second);
+ } else if (!word.empty() && ((word[0] >= '0' && word[0] <= '9') || (word == "defined"))) {
+ tokens.push_back(word);
+ }
+ word = "";
+ if (!*cp) {
+ break;
+ }
+ if ((*cp != ' ') && (*cp != '\t')) {
+ std::string op(cp, 1);
+ if (setRelOp.Contains(*cp)) {
+ if (setRelOp.Contains(cp[1])) {
+ op += cp[1];
+ cp++;
+ }
+ } else if (setLogicalOp.Contains(*cp)) {
+ if (setLogicalOp.Contains(cp[1])) {
+ op += cp[1];
+ cp++;
+ }
+ }
+ tokens.push_back(op);
+ }
+ }
+ cp++;
+ }
+
+ EvaluateTokens(tokens);
+
+ // "0" or "" -> false else true
+ bool isFalse = tokens.empty() ||
+ ((tokens.size() == 1) && ((tokens[0] == "") || tokens[0] == "0"));
+ return !isFalse;
+}
+
+LexerModule lmCPP(SCLEX_CPP, LexerCPP::LexerFactoryCPP, "cpp", cppWordLists);
+LexerModule lmCPPNoCase(SCLEX_CPPNOCASE, LexerCPP::LexerFactoryCPPInsensitive, "cppnocase", cppWordLists);
diff --git a/scintilla/src/LexCSS.cxx b/scintilla/lexers/LexCSS.cxx index 9e4d1d7..349ba9b 100644 --- a/scintilla/src/LexCSS.cxx +++ b/scintilla/lexers/LexCSS.cxx @@ -9,18 +9,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexCaml.cxx b/scintilla/lexers/LexCaml.cxx index 194063b..982384f 100644 --- a/scintilla/src/LexCaml.cxx +++ b/scintilla/lexers/LexCaml.cxx @@ -20,19 +20,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
// Since the Microsoft __iscsym[f] funcs are not ANSI...
inline int iscaml(int c) {return isalnum(c) || c == '_';}
@@ -51,9 +54,13 @@ using namespace Scintilla; /*
(actually seems to work!)
*/
+#include <string>
#include "WindowAccessor.h"
#include "ExternalLexer.h"
+#undef EXT_LEXER_DECL
+#define EXT_LEXER_DECL __declspec( dllexport ) __stdcall
+
#if PLAT_WIN
#include <windows.h>
#endif
diff --git a/scintilla/src/LexCmake.cxx b/scintilla/lexers/LexCmake.cxx index 483357f..a068216 100644 --- a/scintilla/src/LexCmake.cxx +++ b/scintilla/lexers/LexCmake.cxx @@ -5,21 +5,26 @@ // Copyright 2007 by Cristian Adam <cristian [dot] adam [at] gmx [dot] net>
// based on the NSIS lexer
// The License.txt file describes the conditions under which this software may be distributed.
+
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "CharClassify.h"
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
diff --git a/scintilla/src/LexConf.cxx b/scintilla/lexers/LexConf.cxx index 5bacae9..698fc23 100644 --- a/scintilla/src/LexConf.cxx +++ b/scintilla/lexers/LexConf.cxx @@ -11,18 +11,23 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
diff --git a/scintilla/src/LexCrontab.cxx b/scintilla/lexers/LexCrontab.cxx index 29ef74e..55159c2 100644 --- a/scintilla/src/LexCrontab.cxx +++ b/scintilla/lexers/LexCrontab.cxx @@ -9,18 +9,23 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
diff --git a/scintilla/src/LexCsound.cxx b/scintilla/lexers/LexCsound.cxx index 13eae88..3532b1c 100644 --- a/scintilla/src/LexCsound.cxx +++ b/scintilla/lexers/LexCsound.cxx @@ -8,18 +8,23 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
-#include "Platform.h"
+#include <assert.h>
+#include <ctype.h>
-#include "PropSet.h"
-#include "Accessor.h"
-#include "StyleContext.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
@@ -72,7 +77,7 @@ static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle, continue;
}
}
-
+
// Determine if the current state should terminate.
if (sc.state == SCE_CSOUND_OPERATOR) {
if (!IsCsoundOperator(static_cast<char>(sc.ch))) {
@@ -119,7 +124,7 @@ static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_CSOUND_DEFAULT);
}
}
-
+
// Determine if a new state should be entered.
if (sc.state == SCE_CSOUND_DEFAULT) {
if (sc.ch == ';'){
@@ -146,7 +151,7 @@ static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle, sc.Complete();
}
-static void FoldCsoundInstruments(unsigned int startPos, int length, int /* initStyle */, WordList *[],
+static void FoldCsoundInstruments(unsigned int startPos, int length, int /* initStyle */, WordList *[],
Accessor &styler) {
unsigned int lengthDoc = startPos + length;
int visibleChars = 0;
diff --git a/scintilla/src/LexD.cxx b/scintilla/lexers/LexD.cxx index f116014..8dad3d3 100644 --- a/scintilla/src/LexD.cxx +++ b/scintilla/lexers/LexD.cxx @@ -8,18 +8,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexEScript.cxx b/scintilla/lexers/LexEScript.cxx index 3e53627..9721025 100644 --- a/scintilla/src/LexEScript.cxx +++ b/scintilla/lexers/LexEScript.cxx @@ -9,15 +9,19 @@ #include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -198,7 +202,7 @@ static void FoldESCRIPTDoc(unsigned int startPos, int length, int initStyle, Wor styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
-
+
if (foldComment && IsStreamCommentStyle(style)) {
if (!IsStreamCommentStyle(stylePrev)) {
levelCurrent++;
diff --git a/scintilla/src/LexEiffel.cxx b/scintilla/lexers/LexEiffel.cxx index 4f8e7e2..5058d44 100644 --- a/scintilla/src/LexEiffel.cxx +++ b/scintilla/lexers/LexEiffel.cxx @@ -7,18 +7,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
-#include <stdarg.h>
#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexErlang.cxx b/scintilla/lexers/LexErlang.cxx index 43cff21..f497afc 100644 --- a/scintilla/src/LexErlang.cxx +++ b/scintilla/lexers/LexErlang.cxx @@ -4,24 +4,29 @@ /** @file LexErlang.cxx
** Lexer for Erlang.
** Enhanced by Etienne 'Lenain' Girondel (lenaing@gmail.com)
- ** Originally wrote by Peter-Henry Mander,
+ ** Originally wrote by Peter-Henry Mander,
** based on Matlab lexer by José Fonseca.
**/
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-#include "PropSet.h"
-#include "Accessor.h"
-#include "StyleContext.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
@@ -152,7 +157,7 @@ static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle, // Try to match documentation comment
sc.GetCurrent(cur, sizeof(cur));
- if (parse_state == COMMENT_DOC_MACRO
+ if (parse_state == COMMENT_DOC_MACRO
&& erlangDocMacro.InList(cur)) {
sc.ChangeState(SCE_ERLANG_COMMENT_DOC_MACRO);
while (sc.ch != '}' && !sc.atLineEnd)
@@ -340,7 +345,7 @@ static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle, case NUMERAL_BASE_VALUE : {
if (!is_radix(radix_digits,sc.ch)) {
radix_digits = 0;
-
+
if (!isalnum(sc.ch))
sc.ChangeState(SCE_ERLANG_NUMBER);
@@ -380,7 +385,7 @@ static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle, /* Preprocessor --------------------------------------------------*/
case PREPROCESSOR : {
if (!IsAWordChar(sc.ch)) {
-
+
sc.GetCurrent(cur, sizeof(cur));
if (erlangPreproc.InList(cur)) {
style = SCE_ERLANG_PREPROC;
@@ -421,7 +426,7 @@ static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle, } break;
case SCE_ERLANG_OPERATOR : {
if (sc.chPrev == '.') {
- if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\'
+ if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\'
|| sc.ch == '^') {
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
} else if (sc.ch == '\'') {
diff --git a/scintilla/src/LexFlagship.cxx b/scintilla/lexers/LexFlagship.cxx index c2bfe19..729b9fd 100644 --- a/scintilla/src/LexFlagship.cxx +++ b/scintilla/lexers/LexFlagship.cxx @@ -10,19 +10,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexForth.cxx b/scintilla/lexers/LexForth.cxx index 6365f6c..b9cba77 100644 --- a/scintilla/src/LexForth.cxx +++ b/scintilla/lexers/LexForth.cxx @@ -7,18 +7,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -130,7 +134,7 @@ static void ColouriseForthDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_FORTH_NUMBER);
while(sc.More() && isascii(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1'))
sc.Forward();
- } else if ( isascii(sc.ch) &&
+ } else if ( isascii(sc.ch) &&
(isxdigit(sc.ch) || ((sc.ch == '.' || sc.ch == '-') && isascii(sc.chNext) && isxdigit(sc.chNext)) )
){
sc.SetState(SCE_FORTH_NUMBER);
@@ -173,4 +177,4 @@ static const char * const forthWordLists[] = { LexerModule lmForth(SCLEX_FORTH, ColouriseForthDoc, "forth", FoldForthDoc, forthWordLists);
-
+
diff --git a/scintilla/src/LexFortran.cxx b/scintilla/lexers/LexFortran.cxx index c1b3fee..07337c7 100644 --- a/scintilla/src/LexFortran.cxx +++ b/scintilla/lexers/LexFortran.cxx @@ -8,18 +8,24 @@ /***************************************/
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
/***************************************/
-#include "Platform.h"
-#include "PropSet.h"
-#include "Accessor.h"
-#include "StyleContext.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+/***************************************/
+
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
diff --git a/scintilla/src/LexGAP.cxx b/scintilla/lexers/LexGAP.cxx index a477909..144ba85 100644 --- a/scintilla/src/LexGAP.cxx +++ b/scintilla/lexers/LexGAP.cxx @@ -8,18 +8,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexGui4Cli.cxx b/scintilla/lexers/LexGui4Cli.cxx index a587aac..f9cc176 100644 --- a/scintilla/src/LexGui4Cli.cxx +++ b/scintilla/lexers/LexGui4Cli.cxx @@ -23,18 +23,22 @@ val SCE_GC_OPERATOR=9 #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexHTML.cxx b/scintilla/lexers/LexHTML.cxx index 3019552..38f6e33 100644 --- a/scintilla/src/LexHTML.cxx +++ b/scintilla/lexers/LexHTML.cxx @@ -7,19 +7,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -54,13 +57,6 @@ inline bool IsOperator(int ch) { return false;
}
-static inline int MakeLowerCase(int ch) {
- if (ch < 'A' || ch > 'Z')
- return ch;
- else
- return ch - 'A' + 'a';
-}
-
static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int end, char *s, size_t len) {
size_t i = 0;
for (; (i < end - start + 1) && (i < len-1); i++) {
@@ -619,7 +615,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty int lineCurrent = styler.GetLine(startPos);
int lineState;
if (lineCurrent > 0) {
- lineState = styler.GetLineState(lineCurrent);
+ lineState = styler.GetLineState(lineCurrent-1);
} else {
// Default client and ASP scripting language is JavaScript
lineState = eScriptJS << 8;
@@ -802,8 +798,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty visibleChars = 0;
levelPrev = levelCurrent;
}
- lineCurrent++;
- lineStartVisibleChars = 0;
styler.SetLineState(lineCurrent,
((inScriptType & 0x03) << 0) |
((tagOpened & 0x01) << 2) |
@@ -811,6 +805,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty ((aspScript & 0x0F) << 4) |
((clientScript & 0x0F) << 8) |
((beforePreProc & 0xFF) << 12));
+ lineCurrent++;
+ lineStartVisibleChars = 0;
}
// Allow falling through to mako handling code if newline is going to end a block
@@ -874,6 +870,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty else if ((state != SCE_H_ASPAT) &&
!isPHPStringState(state) &&
(state != SCE_HPHP_COMMENT) &&
+ (state != SCE_HPHP_COMMENTLINE) &&
(ch == '<') &&
(chNext == '?') &&
!IsScriptCommentState(state) ) {
@@ -967,8 +964,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty beforeLanguage = scriptLanguage;
scriptLanguage = eScriptPython;
styler.ColourTo(i, SCE_H_ASP);
- if (foldHTMLPreprocessor && chNext == '%')
- levelCurrent++;
ch = static_cast<unsigned char>(styler.SafeGetCharAt(i));
continue;
@@ -1095,9 +1090,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty inScriptType = eNonHtmlScript;
else
inScriptType = eHtml;
- if (foldHTMLPreprocessor) {
- levelCurrent--;
- }
scriptLanguage = beforeLanguage;
continue;
}
@@ -1636,7 +1628,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty i += 2;
} else if (isLineEnd(ch)) {
styler.ColourTo(i - 1, StateToPrint);
- state = SCE_HJ_STRINGEOL;
+ if (chPrev != '\\' && (chPrev2 != '\\' || chPrev != '\r' || ch != '\n')) {
+ state = SCE_HJ_STRINGEOL;
+ }
}
break;
case SCE_HJ_STRINGEOL:
diff --git a/scintilla/lexers/LexHaskell.cxx b/scintilla/lexers/LexHaskell.cxx new file mode 100644 index 0000000..a4bc2e1 --- /dev/null +++ b/scintilla/lexers/LexHaskell.cxx @@ -0,0 +1,368 @@ +/******************************************************************
+ * LexHaskell.cxx
+ *
+ * A haskell lexer for the scintilla code control.
+ * Some stuff "lended" from LexPython.cxx and LexCPP.cxx.
+ * External lexer stuff inspired from the caml external lexer.
+ *
+ * Written by Tobias Engvall - tumm at dtek dot chalmers dot se
+ *
+ * Several bug fixes by Krasimir Angelov - kr.angelov at gmail.com
+ *
+ * TODO:
+ * * Implement a folder :)
+ * * Nice Character-lexing (stuff inside '\''), LexPython has
+ * this.
+ *
+ *
+ *****************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
+
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+#ifdef BUILD_AS_EXTERNAL_LEXER
+
+#include "ExternalLexer.h"
+#include "WindowAccessor.h"
+
+#define BUILD_EXTERNAL_LEXER 0
+
+#endif
+
+#define HA_MODE_DEFAULT 0
+#define HA_MODE_IMPORT1 1
+#define HA_MODE_IMPORT2 2
+#define HA_MODE_IMPORT3 3
+#define HA_MODE_MODULE 4
+#define HA_MODE_FFI 5
+#define HA_MODE_TYPE 6
+
+static inline bool IsNewline(const int ch) {
+ return (ch == '\n' || ch == '\r');
+}
+
+static inline bool IsWhitespace(const int ch) {
+ return ( ch == ' '
+ || ch == '\t'
+ || IsNewline(ch) );
+}
+
+static inline bool IsAWordStart(const int ch) {
+ return (ch < 0x80) && (isalnum(ch) || ch == '_');
+}
+
+static inline bool IsAWordChar(const int ch) {
+ return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '\'');
+}
+
+static void ColorizeHaskellDoc(unsigned int startPos, int length, int initStyle,
+ WordList *keywordlists[], Accessor &styler) {
+
+ WordList &keywords = *keywordlists[0];
+ WordList &ffi = *keywordlists[1];
+
+ StyleContext sc(startPos, length, initStyle, styler);
+
+ int lineCurrent = styler.GetLine(startPos);
+ int state = lineCurrent ? styler.GetLineState(lineCurrent-1)
+ : HA_MODE_DEFAULT;
+ int mode = state & 0xF;
+ int xmode = state >> 4;
+
+ while (sc.More()) {
+ // Check for state end
+
+ // Operator
+ if (sc.state == SCE_HA_OPERATOR) {
+ if (isascii(sc.ch) && isoperator(static_cast<char>(sc.ch))) {
+ sc.Forward();
+ } else {
+ styler.ColourTo(sc.currentPos - 1, sc.state);
+ sc.ChangeState(SCE_HA_DEFAULT);
+ }
+ }
+ // String
+ else if (sc.state == SCE_HA_STRING) {
+ if (sc.ch == '\"') {
+ sc.Forward();
+ styler.ColourTo(sc.currentPos-1, sc.state);
+ sc.ChangeState(SCE_HA_DEFAULT);
+ } else if (sc.ch == '\\') {
+ sc.Forward(2);
+ } else if (sc.atLineEnd) {
+ styler.ColourTo(sc.currentPos-1, sc.state);
+ sc.ChangeState(SCE_HA_DEFAULT);
+ } else {
+ sc.Forward();
+ }
+ }
+ // Char
+ else if (sc.state == SCE_HA_CHARACTER) {
+ if (sc.ch == '\'') {
+ sc.Forward();
+ styler.ColourTo(sc.currentPos-1, sc.state);
+ sc.ChangeState(SCE_HA_DEFAULT);
+ } else if (sc.ch == '\\') {
+ sc.Forward(2);
+ } else if (sc.atLineEnd) {
+ styler.ColourTo(sc.currentPos-1, sc.state);
+ sc.ChangeState(SCE_HA_DEFAULT);
+ } else {
+ sc.Forward();
+ }
+ }
+ // Number
+ else if (sc.state == SCE_HA_NUMBER) {
+ if (IsADigit(sc.ch, xmode)) {
+ sc.Forward();
+ } else if ((xmode == 10) &&
+ (sc.ch == 'e' || sc.ch == 'E') &&
+ (IsADigit(sc.chNext) || sc.chNext == '+' || sc.chNext == '-')) {
+ sc.Forward();
+ if (sc.ch == '+' || sc.ch == '-')
+ sc.Forward();
+ } else {
+ styler.ColourTo(sc.currentPos - 1, sc.state);
+ sc.ChangeState(SCE_HA_DEFAULT);
+ }
+ }
+ // Identifier
+ else if (sc.state == SCE_HA_IDENTIFIER) {
+ if (IsAWordChar(sc.ch)) {
+ sc.Forward();
+ } else {
+ char s[100];
+ sc.GetCurrent(s, sizeof(s));
+ int style = sc.state;
+ int new_mode = 0;
+ if (keywords.InList(s)) {
+ style = SCE_HA_KEYWORD;
+ } else if (isupper(s[0])) {
+ if (mode >= HA_MODE_IMPORT1 && mode <= HA_MODE_IMPORT3) {
+ style = SCE_HA_MODULE;
+ new_mode = HA_MODE_IMPORT2;
+ } else if (mode == HA_MODE_MODULE)
+ style = SCE_HA_MODULE;
+ else
+ style = SCE_HA_CAPITAL;
+ } else if (mode == HA_MODE_IMPORT1 &&
+ strcmp(s,"qualified") == 0) {
+ style = SCE_HA_KEYWORD;
+ new_mode = HA_MODE_IMPORT1;
+ } else if (mode == HA_MODE_IMPORT2) {
+ if (strcmp(s,"as") == 0) {
+ style = SCE_HA_KEYWORD;
+ new_mode = HA_MODE_IMPORT3;
+ } else if (strcmp(s,"hiding") == 0) {
+ style = SCE_HA_KEYWORD;
+ }
+ } else if (mode == HA_MODE_FFI) {
+ if (ffi.InList(s)) {
+ style = SCE_HA_KEYWORD;
+ new_mode = HA_MODE_FFI;
+ }
+ }
+ else if (mode == HA_MODE_TYPE) {
+ if (strcmp(s,"family") == 0)
+ style = SCE_HA_KEYWORD;
+ }
+ styler.ColourTo(sc.currentPos - 1, style);
+ if (strcmp(s,"import") == 0 && mode != HA_MODE_FFI)
+ new_mode = HA_MODE_IMPORT1;
+ else if (strcmp(s,"module") == 0)
+ new_mode = HA_MODE_MODULE;
+ else if (strcmp(s,"foreign") == 0)
+ new_mode = HA_MODE_FFI;
+ else if (strcmp(s,"type") == 0)
+ new_mode = HA_MODE_TYPE;
+ sc.ChangeState(SCE_HA_DEFAULT);
+ mode = new_mode;
+ }
+ }
+
+ // Comments
+ // Oneliner
+ else if (sc.state == SCE_HA_COMMENTLINE) {
+ if (sc.atLineEnd) {
+ styler.ColourTo(sc.currentPos - 1, sc.state);
+ sc.ChangeState(SCE_HA_DEFAULT);
+ } else {
+ sc.Forward();
+ }
+ }
+ // Nested
+ else if (sc.state == SCE_HA_COMMENTBLOCK) {
+ if (sc.Match("{-")) {
+ sc.Forward(2);
+ xmode++;
+ }
+ else if (sc.Match("-}")) {
+ sc.Forward(2);
+ xmode--;
+ if (xmode == 0) {
+ styler.ColourTo(sc.currentPos - 1, sc.state);
+ sc.ChangeState(SCE_HA_DEFAULT);
+ }
+ } else {
+ if (sc.atLineEnd) {
+ // Remember the line state for future incremental lexing
+ styler.SetLineState(lineCurrent, (xmode << 4) | mode);
+ lineCurrent++;
+ }
+ sc.Forward();
+ }
+ }
+ // New state?
+ if (sc.state == SCE_HA_DEFAULT) {
+ // Digit
+ if (IsADigit(sc.ch) ||
+ (sc.ch == '.' && IsADigit(sc.chNext)) ||
+ (sc.ch == '-' && IsADigit(sc.chNext))) {
+ styler.ColourTo(sc.currentPos - 1, sc.state);
+ sc.ChangeState(SCE_HA_NUMBER);
+ if (sc.ch == '0' && (sc.chNext == 'X' || sc.chNext == 'x')) {
+ // Match anything starting with "0x" or "0X", too
+ sc.Forward(2);
+ xmode = 16;
+ } else if (sc.ch == '0' && (sc.chNext == 'O' || sc.chNext == 'o')) {
+ // Match anything starting with "0x" or "0X", too
+ sc.Forward(2);
+ xmode = 8;
+ } else {
+ sc.Forward();
+ xmode = 10;
+ }
+ mode = HA_MODE_DEFAULT;
+ }
+ // Comment line
+ else if (sc.Match("--")) {
+ styler.ColourTo(sc.currentPos - 1, sc.state);
+ sc.Forward(2);
+ sc.ChangeState(SCE_HA_COMMENTLINE);
+ // Comment block
+ }
+ else if (sc.Match("{-")) {
+ styler.ColourTo(sc.currentPos - 1, sc.state);
+ sc.Forward(2);
+ sc.ChangeState(SCE_HA_COMMENTBLOCK);
+ xmode = 1;
+ }
+ // String
+ else if (sc.Match('\"')) {
+ styler.ColourTo(sc.currentPos - 1, sc.state);
+ sc.Forward();
+ sc.ChangeState(SCE_HA_STRING);
+ }
+ // Character
+ else if (sc.Match('\'')) {
+ styler.ColourTo(sc.currentPos - 1, sc.state);
+ sc.Forward();
+ sc.ChangeState(SCE_HA_CHARACTER);
+ }
+ else if (sc.ch == '(' || sc.ch == ')' ||
+ sc.ch == '{' || sc.ch == '}' ||
+ sc.ch == '[' || sc.ch == ']') {
+ styler.ColourTo(sc.currentPos - 1, sc.state);
+ sc.Forward();
+ styler.ColourTo(sc.currentPos - 1, SCE_HA_OPERATOR);
+ mode = HA_MODE_DEFAULT;
+ }
+ // Operator
+ else if (isascii(sc.ch) && isoperator(static_cast<char>(sc.ch))) {
+ styler.ColourTo(sc.currentPos - 1, sc.state);
+ sc.Forward();
+ sc.ChangeState(SCE_HA_OPERATOR);
+ mode = HA_MODE_DEFAULT;
+ }
+ // Keyword
+ else if (IsAWordStart(sc.ch)) {
+ styler.ColourTo(sc.currentPos - 1, sc.state);
+ sc.Forward();
+ sc.ChangeState(SCE_HA_IDENTIFIER);
+ } else {
+ if (sc.atLineEnd) {
+ // Remember the line state for future incremental lexing
+ styler.SetLineState(lineCurrent, (xmode << 4) | mode);
+ lineCurrent++;
+ }
+ sc.Forward();
+ }
+ }
+ }
+ sc.Complete();
+}
+
+// External stuff - used for dynamic-loading, not implemented in wxStyledTextCtrl yet.
+// Inspired by the caml external lexer - Credits to Robert Roessler - http://www.rftp.com
+#ifdef BUILD_EXTERNAL_LEXER
+static const char* LexerName = "haskell";
+
+void EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length, int initStyle,
+ char *words[], WindowID window, char *props)
+{
+ PropSetSimple ps;
+ ps.SetMultiple(props);
+ WindowAccessor wa(window, ps);
+
+ int nWL = 0;
+ for (; words[nWL]; nWL++) ;
+ WordList** wl = new WordList* [nWL + 1];
+ int i = 0;
+ for (; i<nWL; i++)
+ {
+ wl[i] = new WordList();
+ wl[i]->Set(words[i]);
+ }
+ wl[i] = 0;
+
+ ColorizeHaskellDoc(startPos, length, initStyle, wl, wa);
+ wa.Flush();
+ for (i=nWL-1;i>=0;i--)
+ delete wl[i];
+ delete [] wl;
+}
+
+void EXT_LEXER_DECL Fold (unsigned int lexer, unsigned int startPos, int length, int initStyle,
+ char *words[], WindowID window, char *props)
+{
+
+}
+
+int EXT_LEXER_DECL GetLexerCount()
+{
+ return 1;
+}
+
+void EXT_LEXER_DECL GetLexerName(unsigned int Index, char *name, int buflength)
+{
+ if (buflength > 0) {
+ buflength--;
+ int n = strlen(LexerName);
+ if (n > buflength)
+ n = buflength;
+ memcpy(name, LexerName, n), name[n] = '\0';
+ }
+}
+#endif
+
+LexerModule lmHaskell(SCLEX_HASKELL, ColorizeHaskellDoc, "haskell");
diff --git a/scintilla/src/LexInno.cxx b/scintilla/lexers/LexInno.cxx index e563bd9..f8bcd40 100644 --- a/scintilla/src/LexInno.cxx +++ b/scintilla/lexers/LexInno.cxx @@ -7,19 +7,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "CharClassify.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexKix.cxx b/scintilla/lexers/LexKix.cxx index 2752570..5488a1f 100644 --- a/scintilla/src/LexKix.cxx +++ b/scintilla/lexers/LexKix.cxx @@ -7,18 +7,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexLisp.cxx b/scintilla/lexers/LexLisp.cxx index bad298c..fc8b21d 100644 --- a/scintilla/src/LexLisp.cxx +++ b/scintilla/lexers/LexLisp.cxx @@ -8,18 +8,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -44,7 +48,7 @@ static inline bool isLispwordstart(char ch) { static void classifyWordLisp(unsigned int start, unsigned int end, WordList &keywords, WordList &keywords_kw, Accessor &styler) {
- PLATFORM_ASSERT(end >= start);
+ assert(end >= start);
char s[100];
unsigned int i;
bool digit_flag = true;
diff --git a/scintilla/src/LexLout.cxx b/scintilla/lexers/LexLout.cxx index 8ec3f39..59ada6c 100644 --- a/scintilla/src/LexLout.cxx +++ b/scintilla/lexers/LexLout.cxx @@ -7,18 +7,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexLua.cxx b/scintilla/lexers/LexLua.cxx index d64d3bb..f7171fc 100644 --- a/scintilla/src/LexLua.cxx +++ b/scintilla/lexers/LexLua.cxx @@ -9,19 +9,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
-#include <stdarg.h>
#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexMMIXAL.cxx b/scintilla/lexers/LexMMIXAL.cxx index 4c80907..d970f3d 100644 --- a/scintilla/src/LexMMIXAL.cxx +++ b/scintilla/lexers/LexMMIXAL.cxx @@ -9,18 +9,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexMPT.cxx b/scintilla/lexers/LexMPT.cxx index 9d971de..01feb6a 100644 --- a/scintilla/src/LexMPT.cxx +++ b/scintilla/lexers/LexMPT.cxx @@ -7,21 +7,26 @@ // Copyright 2003 by Marius Gheorghe <mgheorghe@cabletest.com>
// The License.txt file describes the conditions under which this software may be distributed.
+#include <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
+#include <stdarg.h>
+#include <assert.h>
#include <string>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
@@ -66,7 +71,7 @@ static int GetLotLineState(std::string &line) { return SCE_LOT_ABORT;
}
else {
- return i ? SCE_LOT_PASS : SCE_LOT_DEFAULT;
+ return i ? SCE_LOT_PASS : SCE_LOT_DEFAULT;
}
}
}
@@ -135,10 +140,10 @@ static void FoldLotDoc(unsigned int startPos, int length, int, WordList *[], Acc if (ch == '\r' && chNext == '\n') {
// TO DO:
// Should really get the state of the previous line from the styler
- int stylePrev = style;
+ int stylePrev = style;
style = styleNext;
styleNext = styler.StyleAt(i + 2);
-
+
switch (style) {
/*
case SCE_LOT_SET:
@@ -147,7 +152,7 @@ static void FoldLotDoc(unsigned int startPos, int length, int, WordList *[], Acc */
case SCE_LOT_FAIL:
/*
- if (stylePrev != SCE_LOT_FAIL)
+ if (stylePrev != SCE_LOT_FAIL)
lev = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
else
lev = SC_FOLDLEVELBASE + 1;
@@ -156,7 +161,7 @@ static void FoldLotDoc(unsigned int startPos, int length, int, WordList *[], Acc break;
default:
- if (lineCurrent == 0 || stylePrev == SCE_LOT_FAIL)
+ if (lineCurrent == 0 || stylePrev == SCE_LOT_FAIL)
lev = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
else
lev = SC_FOLDLEVELBASE + 1;
@@ -166,7 +171,7 @@ static void FoldLotDoc(unsigned int startPos, int length, int, WordList *[], Acc break;
}
- if (lev != styler.LevelAt(lineCurrent))
+ if (lev != styler.LevelAt(lineCurrent))
styler.SetLevel(lineCurrent, lev);
lineCurrent++;
diff --git a/scintilla/src/LexMSSQL.cxx b/scintilla/lexers/LexMSSQL.cxx index 9f1dff6..ca91a40 100644 --- a/scintilla/src/LexMSSQL.cxx +++ b/scintilla/lexers/LexMSSQL.cxx @@ -7,18 +7,23 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
diff --git a/scintilla/src/LexMagik.cxx b/scintilla/lexers/LexMagik.cxx index a70b0ed..293f492 100644 --- a/scintilla/src/LexMagik.cxx +++ b/scintilla/lexers/LexMagik.cxx @@ -8,18 +8,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexMarkdown.cxx b/scintilla/lexers/LexMarkdown.cxx index 9e69b31..2dcc2bb 100644 --- a/scintilla/src/LexMarkdown.cxx +++ b/scintilla/lexers/LexMarkdown.cxx @@ -2,31 +2,31 @@ * LexMarkdown.cxx
*
* A simple Markdown lexer for scintilla.
- *
+ *
* Includes highlighting for some extra features from the
- * Pandoc implementation; strikeout, using '#.' as a default
+ * Pandoc implementation; strikeout, using '#.' as a default
* ordered list item marker, and delimited code blocks.
- *
+ *
* Limitations:
- *
+ *
* Standard indented code blocks are not highlighted at all,
- * as it would conflict with other indentation schemes. Use
+ * as it would conflict with other indentation schemes. Use
* delimited code blocks for blanket highlighting of an
* entire code block. Embedded HTML is not highlighted either.
* Blanket HTML highlighting has issues, because some Markdown
* implementations allow Markdown markup inside of the HTML. Also,
- * there is a following blank line issue that can't be ignored,
- * explained in the next paragraph. Embedded HTML and code
- * blocks would be better supported with language specific
+ * there is a following blank line issue that can't be ignored,
+ * explained in the next paragraph. Embedded HTML and code
+ * blocks would be better supported with language specific
* highlighting.
- *
+ *
* The highlighting aims to accurately reflect correct syntax,
* but a few restrictions are relaxed. Delimited code blocks are
- * highlighted, even if the line following the code block is not blank.
+ * highlighted, even if the line following the code block is not blank.
* Requiring a blank line after a block, breaks the highlighting
* in certain cases, because of the way Scintilla ends up calling
* the lexer.
- *
+ *
* Written by Jon Strait - jstrait@moonloop.net
*
* The License.txt file describes the conditions under which this
@@ -34,20 +34,23 @@ *
*****************************************************************/
-#include <stdlib.h>
+#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -74,7 +77,7 @@ static bool FollowToLineEnd(const int ch, const int state, const unsigned int en else return false;
}
-// Set the state on text section from current to length characters,
+// Set the state on text section from current to length characters,
// then set the rest until the newline to default, except for any characters matching token
static void SetStateAndZoom(const int state, const int length, const int token, StyleContext &sc) {
sc.SetState(state);
@@ -100,9 +103,9 @@ static void SetStateAndZoom(const int state, const int length, const int token, static bool HasPrevLineContent(StyleContext &sc) {
int i = 0;
// Go back to the previous newline
- while ((--i + sc.currentPos) && !IsNewline(sc.GetRelative(i)))
+ while ((--i + (int)sc.currentPos) >= 0 && !IsNewline(sc.GetRelative(i)))
;
- while (--i + sc.currentPos) {
+ while ((--i + (int)sc.currentPos) >= 0) {
if (IsNewline(sc.GetRelative(i)))
break;
if (!IsASpaceOrTab(sc.GetRelative(i)))
@@ -116,12 +119,12 @@ static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) { unsigned int i = 0;
while (++i) {
c = sc.GetRelative(i);
- if (c == sc.ch)
+ if (c == sc.ch)
++count;
// hit a terminating character
else if (!IsASpaceOrTab(c) || sc.currentPos + i == endPos) {
// Are we a valid HRULE
- if ((IsNewline(c) || sc.currentPos + i == endPos) &&
+ if ((IsNewline(c) || sc.currentPos + i == endPos) &&
count >= 3 && !HasPrevLineContent(sc)) {
sc.SetState(SCE_MARKDOWN_HRULE);
sc.Forward(i);
@@ -145,7 +148,7 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle // Useful in the corner case of having to start at the beginning file position
// in the default state.
bool freezeCursor = false;
-
+
StyleContext sc(startPos, length, initStyle, styler);
while (sc.More()) {
@@ -154,18 +157,18 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle sc.Forward();
continue;
}
-
+
// A blockquotes resets the line semantics
if (sc.state == SCE_MARKDOWN_BLOCKQUOTE)
sc.SetState(SCE_MARKDOWN_LINE_BEGIN);
-
+
// Conditional state-based actions
if (sc.state == SCE_MARKDOWN_CODE2) {
if (sc.Match("``") && sc.GetRelative(-2) != ' ') {
sc.Forward(2);
sc.SetState(SCE_MARKDOWN_DEFAULT);
}
- }
+ }
else if (sc.state == SCE_MARKDOWN_CODE) {
if (sc.ch == '`' && sc.chPrev != ' ')
sc.ForwardSetState(SCE_MARKDOWN_DEFAULT);
@@ -201,14 +204,14 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle sc.Forward(2);
sc.SetState(SCE_MARKDOWN_DEFAULT);
}
- }
- else if (sc.state == SCE_MARKDOWN_STRONG2) {
- if (sc.Match("__") && sc.chPrev != ' ') {
+ }
+ else if (sc.state == SCE_MARKDOWN_STRONG2) {
+ if (sc.Match("__") && sc.chPrev != ' ') {
sc.Forward(2);
sc.SetState(SCE_MARKDOWN_DEFAULT);
}
}
- // Emphasis
+ // Emphasis
else if (sc.state == SCE_MARKDOWN_EM1) {
if (sc.ch == '*' && sc.chPrev != ' ')
sc.ForwardSetState(SCE_MARKDOWN_DEFAULT);
@@ -281,7 +284,7 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle sc.SetState(SCE_MARKDOWN_PRECHAR);
}
}
-
+
// The header lasts until the newline
else if (sc.state == SCE_MARKDOWN_HEADER1 || sc.state == SCE_MARKDOWN_HEADER2 ||
sc.state == SCE_MARKDOWN_HEADER3 || sc.state == SCE_MARKDOWN_HEADER4 ||
@@ -289,7 +292,7 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle if (IsNewline(sc.ch))
sc.SetState(SCE_MARKDOWN_LINE_BEGIN);
}
-
+
// New state only within the initial whitespace
if (sc.state == SCE_MARKDOWN_PRECHAR) {
// Blockquote
@@ -300,8 +303,8 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle else if (!HasPrevLineContent(sc) && (sc.chPrev == '\t' || precharCount >= 4))
sc.SetState(SCE_MARKDOWN_CODEBK);
*/
- // HRule - Total of three or more hyphens, asterisks, or underscores
- // on a line by themselves
+ // HRule - Total of three or more hyphens, asterisks, or underscores
+ // on a line by themselves
else if ((sc.ch == '-' || sc.ch == '*' || sc.ch == '_') && IsValidHrule(endPos, sc))
;
// Unordered list
@@ -314,7 +317,7 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle int digitCount = 0;
while (IsADigit(sc.GetRelative(++digitCount)))
;
- if (sc.GetRelative(digitCount) == '.' &&
+ if (sc.GetRelative(digitCount) == '.' &&
IsASpaceOrTab(sc.GetRelative(digitCount + 1))) {
sc.SetState(SCE_MARKDOWN_OLIST_ITEM);
sc.Forward(digitCount + 1);
@@ -332,7 +335,7 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle else
++precharCount;
}
-
+
// New state anywhere in doc
if (sc.state == SCE_MARKDOWN_DEFAULT) {
if (sc.atLineStart && sc.ch == '#') {
diff --git a/scintilla/src/LexMatlab.cxx b/scintilla/lexers/LexMatlab.cxx index 73e093e..4593b17 100644 --- a/scintilla/src/LexMatlab.cxx +++ b/scintilla/lexers/LexMatlab.cxx @@ -12,18 +12,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexMetapost.cxx b/scintilla/lexers/LexMetapost.cxx index ba39125..2a36a2c 100644 --- a/scintilla/src/LexMetapost.cxx +++ b/scintilla/lexers/LexMetapost.cxx @@ -14,18 +14,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -326,11 +330,11 @@ static const char * const metapostWordListDesc[] = { static int classifyFoldPointMetapost(const char* s,WordList *keywordlists[]) {
WordList& keywordsStart=*keywordlists[3];
WordList& keywordsStop1=*keywordlists[4];
-
+
if (keywordsStart.InList(s)) {return 1;}
else if (keywordsStop1.InList(s)) {return -1;}
return 0;
-
+
}
static int ParseMetapostWord(unsigned int pos, Accessor &styler, char *word)
@@ -344,11 +348,11 @@ static int ParseMetapostWord(unsigned int pos, Accessor &styler, char *word) length++;
ch=styler.SafeGetCharAt(pos+length);
}
- word[length]=0;
+ word[length]=0;
return length;
}
-
-static void FoldMetapostDoc(unsigned int startPos, int length, int, WordList *keywordlists[], Accessor &styler)
+
+static void FoldMetapostDoc(unsigned int startPos, int length, int, WordList *keywordlists[], Accessor &styler)
{
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos+length;
@@ -357,9 +361,9 @@ static void FoldMetapostDoc(unsigned int startPos, int length, int, WordList *ke int levelPrev=styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent=levelPrev;
char chNext=styler[startPos];
-
+
char buffer[100]="";
-
+
for (unsigned int i=startPos; i < endPos; i++) {
char ch=chNext;
chNext=styler.SafeGetCharAt(i+1);
@@ -371,7 +375,7 @@ static void FoldMetapostDoc(unsigned int startPos, int length, int, WordList *ke ParseMetapostWord(i, styler, buffer);
levelCurrent += classifyFoldPointMetapost(buffer,keywordlists);
}
-
+
if (atEOL) {
int lev = levelPrev;
if (visibleChars == 0 && foldCompact)
diff --git a/scintilla/src/LexMySQL.cxx b/scintilla/lexers/LexMySQL.cxx index 767cdfb..18c0231 100644 --- a/scintilla/src/LexMySQL.cxx +++ b/scintilla/lexers/LexMySQL.cxx @@ -12,18 +12,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -113,12 +117,12 @@ static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle, if (!IsAWordChar(sc.ch))
{
CheckForKeyword(sc, keywordlists);
-
+
// Additional check for function keywords needed.
// A function name must be followed by an opening parenthesis.
if (sc.state == SCE_MYSQL_FUNCTION && sc.ch != '(')
sc.ChangeState(SCE_MYSQL_DEFAULT);
-
+
sc.SetState(SCE_MYSQL_DEFAULT);
}
break;
@@ -137,7 +141,7 @@ static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle, if (keywordlists[4]->InList(&s[2]))
sc.ChangeState(SCE_MYSQL_KNOWNSYSTEMVARIABLE);
delete [] s;
-
+
sc.SetState(SCE_MYSQL_DEFAULT);
}
break;
@@ -232,7 +236,7 @@ static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle, if (sc.Match('/', '*'))
{
sc.SetState(SCE_MYSQL_COMMENT);
-
+
// Skip comment introducer and check for hidden command.
sc.Forward(2);
if (sc.ch == '!')
@@ -247,7 +251,7 @@ static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle, // Special MySQL single line comment.
sc.SetState(SCE_MYSQL_COMMENTLINE);
sc.Forward(2);
-
+
// Check the third character too. It must be a space or EOL.
if (sc.ch != ' ' && sc.ch != '\n' && sc.ch != '\r')
sc.ChangeState(SCE_MYSQL_OPERATOR);
@@ -258,7 +262,7 @@ static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle, }
}
}
-
+
// Do a final check for keywords if we currently have an identifier, to highlight them
// also at the end of a line.
if (sc.state == SCE_MYSQL_IDENTIFIER)
@@ -270,7 +274,7 @@ static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle, if (sc.state == SCE_MYSQL_FUNCTION && sc.ch != '(')
sc.ChangeState(SCE_MYSQL_DEFAULT);
}
-
+
sc.Complete();
}
@@ -321,9 +325,9 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL int styleNext = styler.StyleAt(startPos);
int style = initStyle;
- bool endFound = false;
- bool whenFound = false;
- bool elseFound = false;
+ bool endPending = false;
+ bool whenPending = false;
+ bool elseIfPending = false;
char nextChar = styler.SafeGetCharAt(startPos);
for (unsigned int i = startPos; length > 0; i++, length--)
@@ -374,18 +378,42 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL }
break;
case SCE_MYSQL_HIDDENCOMMAND:
+ if (endPending)
+ {
+ // A conditional command is not a white space so it should end the current block
+ // before opening a new one.
+ endPending = false;
+ levelNext--;
+ if (levelNext < SC_FOLDLEVELBASE)
+ levelNext = SC_FOLDLEVELBASE;
+ }
if (style != stylePrev)
levelNext++;
else
if (style != styleNext)
+ {
levelNext--;
+ if (levelNext < SC_FOLDLEVELBASE)
+ levelNext = SC_FOLDLEVELBASE;
+ }
break;
case SCE_MYSQL_OPERATOR:
+ if (endPending)
+ {
+ endPending = false;
+ levelNext--;
+ if (levelNext < SC_FOLDLEVELBASE)
+ levelNext = SC_FOLDLEVELBASE;
+ }
if (currentChar == '(')
levelNext++;
else
if (currentChar == ')')
+ {
levelNext--;
+ if (levelNext < SC_FOLDLEVELBASE)
+ levelNext = SC_FOLDLEVELBASE;
+ }
break;
case SCE_MYSQL_MAJORKEYWORD:
case SCE_MYSQL_KEYWORD:
@@ -394,110 +422,98 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL // Reserved and other keywords.
if (style != stylePrev)
{
- bool beginFound = MatchIgnoreCase(styler, i, "begin");
- bool ifFound = MatchIgnoreCase(styler, i, "if");
- bool thenFound = MatchIgnoreCase(styler, i, "then");
- bool whileFound = MatchIgnoreCase(styler, i, "while");
- bool loopFound = MatchIgnoreCase(styler, i, "loop");
- bool repeatFound = MatchIgnoreCase(styler, i, "repeat");
-
- if (!foldOnlyBegin && endFound && (ifFound || whileFound || loopFound))
+ // END decreases the folding level, regardless which keyword follows.
+ bool endFound = MatchIgnoreCase(styler, i, "end");
+ if (endPending)
{
- endFound = false;
levelNext--;
if (levelNext < SC_FOLDLEVELBASE)
levelNext = SC_FOLDLEVELBASE;
-
- // Note that "else" is special here. It may or may not be followed by an "if .. then",
- // but in any case the level stays the same. When followed by an "if .. then" the level
- // will be increased later, if not, then at eol.
}
else
- if (!foldOnlyBegin && MatchIgnoreCase(styler, i, "else"))
+ if (!endFound)
{
- levelNext--;
- elseFound = true;
- }
- else
- if (!foldOnlyBegin && thenFound)
- {
- if (whenFound)
- whenFound = false;
- else
- levelNext++;
- }
+ if (MatchIgnoreCase(styler, i, "begin"))
+ levelNext++;
else
- if (ifFound)
- elseFound = false;
- else
- if (MatchIgnoreCase(styler, i, "when"))
- whenFound = true;
+ {
+ if (!foldOnlyBegin)
+ {
+ bool whileFound = MatchIgnoreCase(styler, i, "while");
+ bool loopFound = MatchIgnoreCase(styler, i, "loop");
+ bool repeatFound = MatchIgnoreCase(styler, i, "repeat");
+ bool caseFound = MatchIgnoreCase(styler, i, "case");
+
+ if (whileFound || loopFound || repeatFound || caseFound)
+ levelNext++;
else
{
- if (beginFound)
- levelNext++;
- else
- if (!foldOnlyBegin && (loopFound || repeatFound || whileFound))
+ // IF alone does not increase the fold level as it is also used in non-block'ed
+ // code like DROP PROCEDURE blah IF EXISTS.
+ // Instead THEN opens the new level (if not part of an ELSEIF or WHEN (case) branch).
+ if (MatchIgnoreCase(styler, i, "then"))
+ {
+ if (!elseIfPending && !whenPending)
+ levelNext++;
+ else
{
- if (endFound)
- endFound = false;
- else
- levelNext++;
+ elseIfPending = false;
+ whenPending = false;
}
- else
- if (MatchIgnoreCase(styler, i, "end"))
- {
- // Multiple "end" in a row are counted multiple times!
- if (endFound)
- {
- levelNext--;
- if (levelNext < SC_FOLDLEVELBASE)
- levelNext = SC_FOLDLEVELBASE;
- }
- endFound = true;
- whenFound = false;
- }
+ }
+ else
+ {
+ // Neither of if/then/while/loop/repeat/case, so check for
+ // sub parts of IF and CASE.
+ if (MatchIgnoreCase(styler, i, "elseif"))
+ elseIfPending = true;
+ if (MatchIgnoreCase(styler, i, "when"))
+ whenPending = true;
+ }
}
+ }
+ }
+ }
+
+ // Keep the current end state for the next round.
+ endPending = endFound;
+ }
+ break;
+
+ default:
+ if (!isspace(currentChar) && endPending)
+ {
+ // END followed by a non-whitespace character (not covered by other cases like identifiers)
+ // also should end a folding block. Typical case: END followed by self defined delimiter.
+ levelNext--;
+ if (levelNext < SC_FOLDLEVELBASE)
+ levelNext = SC_FOLDLEVELBASE;
}
break;
}
- // Handle the case of a trailing end without an if / while etc, as in the case of a begin.
- if (endFound)
- {
- endFound = false;
- levelNext--;
- if (levelNext < SC_FOLDLEVELBASE)
- levelNext = SC_FOLDLEVELBASE;
- }
-
- if (atEOL)
+ if (atEOL)
{
- if (elseFound)
- {
- levelNext++;
- elseFound = false;
- }
-
- int levelUse = levelCurrent;
- int lev = levelUse | levelNext << 16;
- if (visibleChars == 0 && foldCompact)
- lev |= SC_FOLDLEVELWHITEFLAG;
- if (levelUse < levelNext)
- lev |= SC_FOLDLEVELHEADERFLAG;
- if (lev != styler.LevelAt(lineCurrent))
- styler.SetLevel(lineCurrent, lev);
+ // Apply the new folding level to this line.
+ // Leave pending states as they are otherwise a line break will de-sync
+ // code folding and valid syntax.
+ int levelUse = levelCurrent;
+ int lev = levelUse | levelNext << 16;
+ if (visibleChars == 0 && foldCompact)
+ lev |= SC_FOLDLEVELWHITEFLAG;
+ if (levelUse < levelNext)
+ lev |= SC_FOLDLEVELHEADERFLAG;
+ if (lev != styler.LevelAt(lineCurrent))
+ styler.SetLevel(lineCurrent, lev);
- lineCurrent++;
- levelCurrent = levelNext;
- visibleChars = 0;
- endFound = false;
- whenFound = false;
- }
-
+ lineCurrent++;
+ levelCurrent = levelNext;
+ visibleChars = 0;
+ }
+
if (!isspacechar(currentChar))
- visibleChars++;
- }
+ visibleChars++;
+ }
}
//--------------------------------------------------------------------------------------------------
diff --git a/scintilla/src/LexNimrod.cxx b/scintilla/lexers/LexNimrod.cxx index d798b93..ca2b6a9 100644 --- a/scintilla/src/LexNimrod.cxx +++ b/scintilla/lexers/LexNimrod.cxx @@ -9,18 +9,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -113,7 +117,7 @@ static int scanNumber(Accessor &styler, int pos) { if (ch == '_' || (ch >= '0' && ch <= '1')) ++pos;
else break;
}
- } else if (ch == '0' &&
+ } else if (ch == '0' &&
(ch2 == 'o' || ch2 == 'O' || ch2 == 'c' || ch2 == 'C')) {
/* octal number: */
pos += 2;
@@ -203,7 +207,7 @@ static void ColouriseNimrodDoc(unsigned int startPos, int length, int initStyle, case '#': {
bool doccomment = (styler.SafeGetCharAt(pos+1) == '#');
while (pos < max && !isNewLine(styler.SafeGetCharAt(pos, LF))) pos++;
- if (doccomment)
+ if (doccomment)
styler.ColourTo(pos, SCE_C_COMMENTLINEDOC);
else
styler.ColourTo(pos, SCE_P_COMMENTLINE);
@@ -280,7 +284,7 @@ static bool IsQuoteLine(int line, Accessor &styler) { }
-static void FoldNimrodDoc(unsigned int startPos, int length,
+static void FoldNimrodDoc(unsigned int startPos, int length,
int /*initStyle - unused*/,
WordList *[], Accessor &styler) {
const int maxPos = startPos + length;
@@ -311,7 +315,7 @@ static void FoldNimrodDoc(unsigned int startPos, int length, int prev_state = SCE_P_DEFAULT & 31;
if (lineCurrent >= 1)
prev_state = styler.StyleAt(startPos - 1) & 31;
- int prevQuote = foldQuotes && ((prev_state == SCE_P_TRIPLE) ||
+ int prevQuote = foldQuotes && ((prev_state == SCE_P_TRIPLE) ||
(prev_state == SCE_P_TRIPLEDOUBLE));
int prevComment = 0;
if (lineCurrent >= 1)
@@ -320,7 +324,7 @@ static void FoldNimrodDoc(unsigned int startPos, int length, // Process all characters to end of requested range or end of any triple quote
// or comment that hangs over the end of the range. Cap processing in all cases
// to end of document (in case of unclosed quote or comment at end).
- while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) ||
+ while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) ||
prevQuote || prevComment)) {
// Gather info
@@ -338,7 +342,7 @@ static void FoldNimrodDoc(unsigned int startPos, int length, const int quote_continue = (quote && prevQuote);
const int comment = foldComment && IsCommentLine(lineCurrent, styler);
const int comment_start = (comment && !prevComment && (lineNext <= docLines) &&
- IsCommentLine(lineNext, styler) &&
+ IsCommentLine(lineNext, styler) &&
(lev > SC_FOLDLEVELBASE));
const int comment_continue = (comment && prevComment);
if ((!quote || !prevQuote) && !comment)
@@ -377,8 +381,8 @@ static void FoldNimrodDoc(unsigned int startPos, int length, }
const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK;
- const int levelBeforeComments =
- Platform::Maximum(indentCurrentLevel,levelAfterComments);
+ const int levelBeforeComments =
+ Maximum(indentCurrentLevel,levelAfterComments);
// Now set all the indent levels on the lines we skipped
// Do this from end to start. Once we encounter one line
@@ -401,7 +405,7 @@ static void FoldNimrodDoc(unsigned int startPos, int length, // Set fold header on non-quote/non-comment line
if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) {
- if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) <
+ if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) <
(indentNext & SC_FOLDLEVELNUMBERMASK))
lev |= SC_FOLDLEVELHEADERFLAG;
}
diff --git a/scintilla/src/LexNsis.cxx b/scintilla/lexers/LexNsis.cxx index 37e4a18..667f9a5 100644 --- a/scintilla/src/LexNsis.cxx +++ b/scintilla/lexers/LexNsis.cxx @@ -5,21 +5,26 @@ // Copyright 2003 - 2005 by Angelo Mandato <angelo [at] spaceblue [dot] com>
// Last Updated: 03/13/2005
// The License.txt file describes the conditions under which this software may be distributed.
+
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "CharClassify.h"
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
diff --git a/scintilla/src/LexOpal.cxx b/scintilla/lexers/LexOpal.cxx index 4cbbeaf..97e6a80 100644 --- a/scintilla/src/LexOpal.cxx +++ b/scintilla/lexers/LexOpal.cxx @@ -6,18 +6,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -92,7 +96,7 @@ inline bool HandleString( unsigned int & cur, unsigned int one_too_much, Accesso inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )
{
char ch;
-
+
if( could_fail )
{
cur++;
@@ -101,7 +105,7 @@ inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, A styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
return false; // STOP
}
-
+
ch = styler.SafeGetCharAt( cur );
if( ch != '*' )
{
@@ -110,7 +114,7 @@ inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, A return true;
}
}
-
+
// Wait for comment close
cur++;
bool star_found = false;
@@ -121,7 +125,7 @@ inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, A styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_BLOCK );
return false; // STOP
}
-
+
ch = styler.SafeGetCharAt( cur );
if( star_found )
{
@@ -155,7 +159,7 @@ inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, A inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )
{
char ch;
-
+
if( could_fail )
{
cur++;
@@ -164,7 +168,7 @@ inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Ac styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
return false; // STOP
}
-
+
ch = styler.SafeGetCharAt( cur );
if( ch != '-' )
{
@@ -179,7 +183,7 @@ inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Ac styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
return false; // STOP
}
-
+
ch = styler.SafeGetCharAt( cur );
if( ( ch != ' ' ) && ( ch != '\t' ) )
{
@@ -224,7 +228,7 @@ inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Ac {
if( ch == '\015' )
{
- fifteen_found = true;
+ fifteen_found = true;
}
else if( ch == '\012' )
{
@@ -259,7 +263,7 @@ inline bool HandleSpace( unsigned int & cur, unsigned int one_too_much, Accessor styler.ColourTo( cur - 1, SCE_OPAL_SPACE );
return false;
}
-
+
ch = styler.SafeGetCharAt( cur );
switch( ch )
{
@@ -269,7 +273,7 @@ inline bool HandleSpace( unsigned int & cur, unsigned int one_too_much, Accessor case '\012':
cur++;
break;
-
+
default:
styler.ColourTo( cur - 1, SCE_OPAL_SPACE );
styler.StartSegment( cur );
@@ -314,7 +318,7 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor !( isascii( ch ) && ( islower( ch ) || isupper( ch ) || isdigit( ch ) ) ) ) break;
cur++;
- if( cur >= one_too_much )
+ if( cur >= one_too_much )
{
break;
}
@@ -323,7 +327,7 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor const int ide_len = cur - beg + 1;
char * ide = new char[ ide_len ];
getRange( beg, cur, styler, ide, ide_len );
-
+
WordList & keywords = *keywordlists[ 0 ];
WordList & classwords = *keywordlists[ 1 ];
@@ -338,8 +342,8 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor }
else
{
- styler.StartSegment( cur );
- return true;
+ styler.StartSegment( cur );
+ return true;
}
}
else if( classwords.InList( ide ) ) // Sort
@@ -353,8 +357,8 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor }
else
{
- styler.StartSegment( cur );
- return true;
+ styler.StartSegment( cur );
+ return true;
}
}
else if( !strcmp( ide, "true" ) || !strcmp( ide, "false" ) ) // Bool const
@@ -368,8 +372,8 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor }
else
{
- styler.StartSegment( cur );
- return true;
+ styler.StartSegment( cur );
+ return true;
}
}
else // Unknown keyword
@@ -384,7 +388,7 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor else
{
styler.StartSegment( cur );
- return true;
+ return true;
}
}
@@ -400,7 +404,7 @@ inline bool HandleSkip( unsigned int & cur, unsigned int one_too_much, Accessor }
else
{
- styler.StartSegment( cur );
+ styler.StartSegment( cur );
return true;
}
}
@@ -444,11 +448,11 @@ static void ColouriseOpalDoc( unsigned int startPos, int length, int initStyle, if( !HandleString( cur, one_too_much, styler ) ) return;
state = SCE_OPAL_DEFAULT;
break;
-
+
default: // SCE_OPAL_DEFAULT:
{
char ch = styler.SafeGetCharAt( cur );
-
+
switch( ch )
{
// String
@@ -483,7 +487,7 @@ static void ColouriseOpalDoc( unsigned int startPos, int length, int initStyle, case '\012':
if( !HandleSpace( cur, one_too_much, styler ) ) return;
break;
-
+
default:
{
// Integer
@@ -496,7 +500,7 @@ static void ColouriseOpalDoc( unsigned int startPos, int length, int initStyle, else if( isascii( ch ) && ( islower( ch ) || isupper( ch ) ) )
{
if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return;
-
+
}
// Skip
diff --git a/scintilla/src/LexOthers.cxx b/scintilla/lexers/LexOthers.cxx index c5c6ef2..a6834da 100644 --- a/scintilla/src/LexOthers.cxx +++ b/scintilla/lexers/LexOthers.cxx @@ -8,19 +8,23 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "CharClassify.h"
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
@@ -1166,7 +1170,7 @@ static int isTag(int start, Accessor &styler) { while (i < 5 && e) {
s[i] = styler[start + i];
i++;
- e = styler[start + i] != '{';
+ e = (strchr("{ \t", styler[start + i]) == NULL);
}
s[i] = '\0';
return (strcmp(s, "begin") == 0) || (strcmp(s, "end") == 0);
diff --git a/scintilla/src/LexPB.cxx b/scintilla/lexers/LexPB.cxx index 1e39961..24e3ad8 100644 --- a/scintilla/src/LexPB.cxx +++ b/scintilla/lexers/LexPB.cxx @@ -35,18 +35,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexPLM.cxx b/scintilla/lexers/LexPLM.cxx index de73f25..db2db88 100644 --- a/scintilla/src/LexPLM.cxx +++ b/scintilla/lexers/LexPLM.cxx @@ -4,18 +4,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexPOV.cxx b/scintilla/lexers/LexPOV.cxx index 33be6fe..0e911b1 100644 --- a/scintilla/src/LexPOV.cxx +++ b/scintilla/lexers/LexPOV.cxx @@ -16,18 +16,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexPS.cxx b/scintilla/lexers/LexPS.cxx index 7b236b0..715a90c 100644 --- a/scintilla/src/LexPS.cxx +++ b/scintilla/lexers/LexPS.cxx @@ -8,18 +8,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
-#include <stdarg.h>
#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexPascal.cxx b/scintilla/lexers/LexPascal.cxx index 545eaef..1fdcf6e 100644 --- a/scintilla/src/LexPascal.cxx +++ b/scintilla/lexers/LexPascal.cxx @@ -11,20 +11,20 @@ A few words about features of the new completely rewritten LexPascal...
-Generally speaking LexPascal tries to support all available Delphi features (up
+Generally speaking LexPascal tries to support all available Delphi features (up
to Delphi 2009 at this time), including .NET specific features.
~ HIGHLIGHTING:
-If you enable "lexer.pascal.smart.highlighting" property, some keywords will
-only be highlighted in appropriate context. As implemented those are keywords
-related to property and DLL exports declarations (similar to how Delphi IDE
-works).
+If you enable "lexer.pascal.smart.highlighting" property, some keywords will
+only be highlighted in appropriate context. As implemented those are keywords
+related to property and DLL exports declarations (similar to how Delphi IDE
+works).
-For example, keywords "read" and "write" will only be highlighted if they are in
+For example, keywords "read" and "write" will only be highlighted if they are in
property declaration:
-property MyProperty: boolean read FMyProperty write FMyProperty;
+property MyProperty: boolean read FMyProperty write FMyProperty;
~ FOLDING:
@@ -32,34 +32,34 @@ Folding is supported in the following cases: - Folding of stream-like comments
- Folding of groups of consecutive line comments
-- Folding of preprocessor blocks (the following preprocessor blocks are
-supported: IF / IFEND; IFDEF, IFNDEF, IFOPT / ENDIF and REGION / ENDREGION
+- Folding of preprocessor blocks (the following preprocessor blocks are
+supported: IF / IFEND; IFDEF, IFNDEF, IFOPT / ENDIF and REGION / ENDREGION
blocks), including nesting of preprocessor blocks up to 255 levels
-- Folding of code blocks on appropriate keywords (the following code blocks are
-supported: "begin, asm, record, try, case / end" blocks, class & object
+- Folding of code blocks on appropriate keywords (the following code blocks are
+supported: "begin, asm, record, try, case / end" blocks, class & object
declarations and interface declarations)
Remarks:
-- Folding of code blocks tries to handle all special cases in which folding
+- Folding of code blocks tries to handle all special cases in which folding
should not occur. As implemented those are:
-1. Structure "record case / end" (there's only one "end" statement and "case" is
+1. Structure "record case / end" (there's only one "end" statement and "case" is
ignored as fold point)
-2. Forward class declarations ("type TMyClass = class;") and object method
-declarations ("TNotifyEvent = procedure(Sender: TObject) of object;") are
+2. Forward class declarations ("type TMyClass = class;") and object method
+declarations ("TNotifyEvent = procedure(Sender: TObject) of object;") are
ignored as fold points
-3. Simplified complete class declarations ("type TMyClass = class(TObject);")
+3. Simplified complete class declarations ("type TMyClass = class(TObject);")
are ignored as fold points
-4. Every other situation when class keyword doesn't actually start class
-declaration ("class procedure", "class function", "class of", "class var",
+4. Every other situation when class keyword doesn't actually start class
+declaration ("class procedure", "class function", "class of", "class var",
"class property" and "class operator")
-- Folding of code blocks inside preprocessor blocks is disabled (any comments
-inside them will be folded fine) because there is no guarantee that complete
-code block will be contained inside folded preprocessor block in which case
-folded code block could end prematurely at the end of preprocessor block if
-there is no closing statement inside. This was done in order to properly process
+- Folding of code blocks inside preprocessor blocks is disabled (any comments
+inside them will be folded fine) because there is no guarantee that complete
+code block will be contained inside folded preprocessor block in which case
+folded code block could end prematurely at the end of preprocessor block if
+there is no closing statement inside. This was done in order to properly process
document that may contain something like this:
type
@@ -76,52 +76,55 @@ type ...
end;
-If class declarations were folded, then the second class declaration would end
-at "$ENDIF" statement, first class statement would end at "end;" statement and
-preprocessor "$IFDEF" block would go all the way to the end of document.
-However, having in mind all this, if you want to enable folding of code blocks
-inside preprocessor blocks, you can disable folding of preprocessor blocks by
-changing "fold.preprocessor" property, in which case everything inside them
+If class declarations were folded, then the second class declaration would end
+at "$ENDIF" statement, first class statement would end at "end;" statement and
+preprocessor "$IFDEF" block would go all the way to the end of document.
+However, having in mind all this, if you want to enable folding of code blocks
+inside preprocessor blocks, you can disable folding of preprocessor blocks by
+changing "fold.preprocessor" property, in which case everything inside them
would be folded.
~ KEYWORDS:
-The list of keywords that can be used in pascal.properties file (up to Delphi
+The list of keywords that can be used in pascal.properties file (up to Delphi
2009):
-- Keywords: absolute abstract and array as asm assembler automated begin case
-cdecl class const constructor deprecated destructor dispid dispinterface div do
-downto dynamic else end except export exports external far file final
-finalization finally for forward function goto if implementation in inherited
-initialization inline interface is label library message mod near nil not object
-of on or out overload override packed pascal platform private procedure program
-property protected public published raise record register reintroduce repeat
-resourcestring safecall sealed set shl shr static stdcall strict string then
+- Keywords: absolute abstract and array as asm assembler automated begin case
+cdecl class const constructor deprecated destructor dispid dispinterface div do
+downto dynamic else end except export exports external far file final
+finalization finally for forward function goto if implementation in inherited
+initialization inline interface is label library message mod near nil not object
+of on or out overload override packed pascal platform private procedure program
+property protected public published raise record register reintroduce repeat
+resourcestring safecall sealed set shl shr static stdcall strict string then
threadvar to try type unit unsafe until uses var varargs virtual while with xor
-- Keywords related to the "smart highlithing" feature: add default implements
+- Keywords related to the "smart highlithing" feature: add default implements
index name nodefault read readonly remove stored write writeonly
-- Keywords related to Delphi packages (in addition to all above): package
+- Keywords related to Delphi packages (in addition to all above): package
contains requires
*/
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -155,12 +158,12 @@ static void GetForwardRangeLowered(unsigned int start, }
enum {
- stateInAsm = 0x1000,
- stateInProperty = 0x2000,
- stateInExport = 0x4000,
- stateFoldInPreprocessor = 0x0100,
- stateFoldInRecord = 0x0200,
- stateFoldInPreprocessorLevelMask = 0x00FF,
+ stateInAsm = 0x1000,
+ stateInProperty = 0x2000,
+ stateInExport = 0x4000,
+ stateFoldInPreprocessor = 0x0100,
+ stateFoldInRecord = 0x0200,
+ stateFoldInPreprocessorLevelMask = 0x00FF,
stateFoldMaskAll = 0x0FFF
};
@@ -190,11 +193,11 @@ static void ClassifyPascalWord(WordList *keywordlists[], StyleContext &sc, int & ignoreKeyword = true;
} else if (!(curLineState & stateInExport) && strcmp(s, "name") == 0) {
ignoreKeyword = true;
- } else if (!(curLineState & stateInProperty) &&
- (strcmp(s, "read") == 0 || strcmp(s, "write") == 0 ||
- strcmp(s, "default") == 0 || strcmp(s, "nodefault") == 0 ||
- strcmp(s, "stored") == 0 || strcmp(s, "implements") == 0 ||
- strcmp(s, "readonly") == 0 || strcmp(s, "writeonly") == 0 ||
+ } else if (!(curLineState & stateInProperty) &&
+ (strcmp(s, "read") == 0 || strcmp(s, "write") == 0 ||
+ strcmp(s, "default") == 0 || strcmp(s, "nodefault") == 0 ||
+ strcmp(s, "stored") == 0 || strcmp(s, "implements") == 0 ||
+ strcmp(s, "readonly") == 0 || strcmp(s, "writeonly") == 0 ||
strcmp(s, "add") == 0 || strcmp(s, "remove") == 0)) {
ignoreKeyword = true;
}
@@ -367,7 +370,7 @@ static void SetFoldInPreprocessorLevelFlag(int &lineFoldStateCurrent, unsigned i lineFoldStateCurrent |= nestLevel & stateFoldInPreprocessorLevelMask;
}
-static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,
+static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,
unsigned int startPos, Accessor &styler) {
CharacterSet setWord(CharacterSet::setAlpha);
@@ -376,17 +379,17 @@ static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFold unsigned int nestLevel = GetFoldInPreprocessorLevelFlag(lineFoldStateCurrent);
- if (strcmp(s, "if") == 0 ||
- strcmp(s, "ifdef") == 0 ||
- strcmp(s, "ifndef") == 0 ||
- strcmp(s, "ifopt") == 0 ||
+ if (strcmp(s, "if") == 0 ||
+ strcmp(s, "ifdef") == 0 ||
+ strcmp(s, "ifndef") == 0 ||
+ strcmp(s, "ifopt") == 0 ||
strcmp(s, "region") == 0) {
nestLevel++;
SetFoldInPreprocessorLevelFlag(lineFoldStateCurrent, nestLevel);
lineFoldStateCurrent |= stateFoldInPreprocessor;
levelCurrent++;
- } else if (strcmp(s, "endif") == 0 ||
- strcmp(s, "ifend") == 0 ||
+ } else if (strcmp(s, "endif") == 0 ||
+ strcmp(s, "ifend") == 0 ||
strcmp(s, "endregion") == 0) {
nestLevel--;
SetFoldInPreprocessorLevelFlag(lineFoldStateCurrent, nestLevel);
@@ -400,12 +403,12 @@ static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFold }
}
-static unsigned int SkipWhiteSpace(unsigned int currentPos, unsigned int endPos,
+static unsigned int SkipWhiteSpace(unsigned int currentPos, unsigned int endPos,
Accessor &styler, bool includeChars = false) {
CharacterSet setWord(CharacterSet::setAlphaNum, "_");
unsigned int j = currentPos + 1;
char ch = styler.SafeGetCharAt(j);
- while ((j < endPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' ||
+ while ((j < endPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' ||
IsStreamCommentStyle(styler.StyleAt(j)) || (includeChars && setWord.Contains(ch)))) {
j++;
ch = styler.SafeGetCharAt(j);
@@ -413,8 +416,8 @@ static unsigned int SkipWhiteSpace(unsigned int currentPos, unsigned int endPos, return j;
}
-static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,
- int startPos, unsigned int endPos,
+static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,
+ int startPos, unsigned int endPos,
unsigned int lastStart, unsigned int currentPos, Accessor &styler) {
char s[100];
GetRangeLowered(lastStart, currentPos, styler, s, sizeof(s));
@@ -422,9 +425,9 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur if (strcmp(s, "record") == 0) {
lineFoldStateCurrent |= stateFoldInRecord;
levelCurrent++;
- } else if (strcmp(s, "begin") == 0 ||
- strcmp(s, "asm") == 0 ||
- strcmp(s, "try") == 0 ||
+ } else if (strcmp(s, "begin") == 0 ||
+ strcmp(s, "asm") == 0 ||
+ strcmp(s, "try") == 0 ||
(strcmp(s, "case") == 0 && !(lineFoldStateCurrent & stateFoldInRecord))) {
levelCurrent++;
} else if (strcmp(s, "class") == 0 || strcmp(s, "object") == 0) {
@@ -436,13 +439,13 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur CharacterSet setWord(CharacterSet::setAlphaNum, "_");
if (styler.SafeGetCharAt(j) == ';') {
- // Handle forward class declarations ("type TMyClass = class;")
+ // Handle forward class declarations ("type TMyClass = class;")
// and object method declarations ("TNotifyEvent = procedure(Sender: TObject) of object;")
ignoreKeyword = true;
} else if (strcmp(s, "class") == 0) {
// "class" keyword has a few more special cases...
if (styler.SafeGetCharAt(j) == '(') {
- // Handle simplified complete class declarations ("type TMyClass = class(TObject);")
+ // Handle simplified complete class declarations ("type TMyClass = class(TObject);")
j = SkipWhiteSpace(j, endPos, styler, true);
if (j < endPos && styler.SafeGetCharAt(j) == ')') {
j = SkipWhiteSpace(j, endPos, styler);
@@ -454,11 +457,11 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur char s2[11]; // Size of the longest possible keyword + one additional character + null
GetForwardRangeLowered(j, setWord, styler, s2, sizeof(s2));
- if (strcmp(s2, "procedure") == 0 ||
- strcmp(s2, "function") == 0 ||
- strcmp(s2, "of") == 0 ||
- strcmp(s2, "var") == 0 ||
- strcmp(s2, "property") == 0 ||
+ if (strcmp(s2, "procedure") == 0 ||
+ strcmp(s2, "function") == 0 ||
+ strcmp(s2, "of") == 0 ||
+ strcmp(s2, "var") == 0 ||
+ strcmp(s2, "property") == 0 ||
strcmp(s2, "operator") == 0) {
ignoreKeyword = true;
}
@@ -473,7 +476,7 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur bool ignoreKeyword = true;
int j = lastStart - 1;
char ch = styler.SafeGetCharAt(j);
- while ((j >= startPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' ||
+ while ((j >= startPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' ||
IsStreamCommentStyle(styler.StyleAt(j)))) {
j--;
ch = styler.SafeGetCharAt(j);
@@ -539,7 +542,7 @@ static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, Word if (foldPreprocessor) {
if (style == SCE_PAS_PREPROCESSOR && ch == '{' && chNext == '$') {
ClassifyPascalPreprocessorFoldPoint(levelCurrent, lineFoldStateCurrent, i + 2, styler);
- } else if (style == SCE_PAS_PREPROCESSOR2 && ch == '(' && chNext == '*'
+ } else if (style == SCE_PAS_PREPROCESSOR2 && ch == '(' && chNext == '*'
&& styler.SafeGetCharAt(i + 2) == '$') {
ClassifyPascalPreprocessorFoldPoint(levelCurrent, lineFoldStateCurrent, i + 3, styler);
}
diff --git a/scintilla/src/LexPerl.cxx b/scintilla/lexers/LexPerl.cxx index 66bf34a..a3003e7 100644 --- a/scintilla/src/LexPerl.cxx +++ b/scintilla/lexers/LexPerl.cxx @@ -8,19 +8,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -1165,6 +1168,12 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, }
}
sc.Complete();
+ if (sc.state == SCE_PL_HERE_Q
+ || sc.state == SCE_PL_HERE_QQ
+ || sc.state == SCE_PL_HERE_QX
+ || sc.state == SCE_PL_FORMAT) {
+ styler.ChangeLexerState(sc.currentPos, styler.Length());
+ }
}
static bool IsCommentLine(int line, Accessor &styler) {
@@ -1181,18 +1190,38 @@ static bool IsCommentLine(int line, Accessor &styler) { return false;
}
+static bool IsPackageLine(int line, Accessor &styler) {
+ int pos = styler.LineStart(line);
+ int style = styler.StyleAt(pos);
+ if (style == SCE_PL_WORD && styler.Match(pos, "package")) {
+ return true;
+ }
+ return false;
+}
+
+static int PodHeadingLevel(int pos, Accessor &styler) {
+ int lvl = static_cast<unsigned char>(styler.SafeGetCharAt(pos + 5));
+ if (lvl >= '1' && lvl <= '4') {
+ return lvl - '0';
+ }
+ return 0;
+}
+
+#define PERL_HEADFOLD_SHIFT 4
+#define PERL_HEADFOLD_MASK 0xF0
+
static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
// Custom folding of POD and packages
- // property fold.perl.pod
- // Enable folding Pod blocks when using the Perl lexer.
+ // property fold.perl.pod
+ // Enable folding Pod blocks when using the Perl lexer.
bool foldPOD = styler.GetPropertyInt("fold.perl.pod", 1) != 0;
- // property fold.perl.package
- // Enable folding packages when using the Perl lexer.
+ // property fold.perl.package
+ // Enable folding packages when using the Perl lexer.
bool foldPackage = styler.GetPropertyInt("fold.perl.package", 1) != 0;
unsigned int endPos = startPos + length;
@@ -1207,7 +1236,7 @@ static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[], int styleNext = styler.StyleAt(startPos);
// Used at end of line to determine if the line was a package definition
bool isPackageLine = false;
- bool isPodHeading = false;
+ int podHeading = 0;
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
@@ -1222,52 +1251,61 @@ static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[], && IsCommentLine(lineCurrent + 1, styler))
levelCurrent++;
else if (IsCommentLine(lineCurrent - 1, styler)
- && !IsCommentLine(lineCurrent+1, styler))
+ && !IsCommentLine(lineCurrent + 1, styler))
levelCurrent--;
}
+ // {} [] block folding
if (style == SCE_PL_OPERATOR) {
if (ch == '{') {
levelCurrent++;
} else if (ch == '}') {
levelCurrent--;
}
+ if (ch == '[') {
+ levelCurrent++;
+ } else if (ch == ']') {
+ levelCurrent--;
+ }
}
- // Custom POD folding
+ // POD folding
if (foldPOD && atLineStart) {
int stylePrevCh = (i) ? styler.StyleAt(i - 1):SCE_PL_DEFAULT;
if (style == SCE_PL_POD) {
if (stylePrevCh != SCE_PL_POD && stylePrevCh != SCE_PL_POD_VERB)
levelCurrent++;
else if (styler.Match(i, "=cut"))
- levelCurrent--;
+ levelCurrent = (levelCurrent & ~PERL_HEADFOLD_MASK) - 1;
else if (styler.Match(i, "=head"))
- isPodHeading = true;
+ podHeading = PodHeadingLevel(i, styler);
} else if (style == SCE_PL_DATASECTION) {
if (ch == '=' && isascii(chNext) && isalpha(chNext) && levelCurrent == SC_FOLDLEVELBASE)
levelCurrent++;
else if (styler.Match(i, "=cut") && levelCurrent > SC_FOLDLEVELBASE)
- levelCurrent--;
+ levelCurrent = (levelCurrent & ~PERL_HEADFOLD_MASK) - 1;
else if (styler.Match(i, "=head"))
- isPodHeading = true;
+ podHeading = PodHeadingLevel(i, styler);
// if package used or unclosed brace, level > SC_FOLDLEVELBASE!
// reset needed as level test is vs. SC_FOLDLEVELBASE
- else if (styler.Match(i, "__END__"))
+ else if (stylePrevCh != SCE_PL_DATASECTION)
levelCurrent = SC_FOLDLEVELBASE;
}
}
- // Custom package folding
+ // package folding
if (foldPackage && atLineStart) {
- if (style == SCE_PL_WORD && styler.Match(i, "package")) {
+ if (IsPackageLine(lineCurrent, styler)
+ && !IsPackageLine(lineCurrent + 1, styler))
isPackageLine = true;
- }
}
if (atEOL) {
int lev = levelPrev;
- if (isPodHeading) {
- lev = levelPrev - 1;
+ // POD headings occupy bits 7-4, leaving some breathing room for
+ // non-standard practice -- POD sections stuck in blocks, etc.
+ if (podHeading > 0) {
+ levelCurrent = (lev & ~PERL_HEADFOLD_MASK) | (podHeading << PERL_HEADFOLD_SHIFT);
+ lev = levelCurrent - 1;
lev |= SC_FOLDLEVELHEADERFLAG;
- isPodHeading = false;
+ podHeading = 0;
}
// Check if line was a package declaration
// because packages need "special" treatment
diff --git a/scintilla/src/LexPowerPro.cxx b/scintilla/lexers/LexPowerPro.cxx index 641cd5f..3912395 100644 --- a/scintilla/src/LexPowerPro.cxx +++ b/scintilla/lexers/LexPowerPro.cxx @@ -3,42 +3,45 @@ // PowerPro utility, written by Bruce Switzer, is available from http://powerpro.webeddie.com
// PowerPro lexer is written by Christopher Bean (cbean@cb-software.net)
//
-// Lexer code heavily borrowed from:
+// Lexer code heavily borrowed from:
// LexAU3.cxx by Jos van der Zande
// LexCPP.cxx by Neil Hodgson
// LexVB.cxx by Neil Hodgson
//
// Changes:
// 2008-10-25 - Initial release
-// 2008-10-26 - Changed how <name> is hilighted in 'function <name>' so that
+// 2008-10-26 - Changed how <name> is hilighted in 'function <name>' so that
// local isFunction = "" and local functions = "" don't get falsely highlighted
-// 2008-12-14 - Added bounds checking for szKeyword and szDo
+// 2008-12-14 - Added bounds checking for szFirstWord and szDo
// - Replaced SetOfCharacters with CharacterSet
// - Made sure that CharacterSet::Contains is passed only positive values
-// - Made sure that the return value of Accessor::SafeGetCharAt is positive before
-// passsing to functions that require positive values like isspacechar()
+// - Made sure that the return value of Accessor::SafeGetCharAt is positive before
+// passing to functions that require positive values like isspacechar()
// - Removed unused visibleChars processing from ColourisePowerProDoc()
-// - Fixed bug with folding logic where line continuations didn't end where
+// - Fixed bug with folding logic where line continuations didn't end where
// they were supposed to
// - Moved all helper functions to the top of the file
-//
+// 2010-06-03 - Added onlySpaces variable to allow the @function and ;comment styles to be indented
+// - Modified HasFunction function to be a bit more robust
+// - Renamed HasFunction function to IsFunction
+// - Cleanup
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
-#include <ctype.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-#include "PropSet.h"
-#include "Accessor.h"
-#include "StyleContext.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -48,65 +51,81 @@ static inline bool IsStreamCommentStyle(int style) { return style == SCE_POWERPRO_COMMENTBLOCK;
}
+static inline bool IsLineEndChar(unsigned char ch) {
+ return ch == 0x0a //LF
+ || ch == 0x0c //FF
+ || ch == 0x0d; //CR
+}
+
static bool IsContinuationLine(unsigned int szLine, Accessor &styler)
{
- int nsPos = styler.LineStart(szLine);
- int nePos = styler.LineStart(szLine + 1) - 2;
- while (nsPos < nePos)
+ int startPos = styler.LineStart(szLine);
+ int endPos = styler.LineStart(szLine + 1) - 2;
+ while (startPos < endPos)
{
- int stylech = styler.StyleAt(nsPos);
+ char stylech = styler.StyleAt(startPos);
if (!(stylech == SCE_POWERPRO_COMMENTBLOCK)) {
- char ch = styler.SafeGetCharAt(nePos);
- char chPrev = styler.SafeGetCharAt(nePos-1);
- char chPrevPrev = styler.SafeGetCharAt(nePos-2);
- if (ch > 0 && chPrev > 0 && chPrevPrev > 0 && !isspacechar(ch) && !isspacechar(chPrev) && !isspacechar(chPrevPrev) ) {
- if (chPrevPrev == ';' && chPrev == ';' && ch == '+')
- return true;
- else
- return false;
+ char ch = styler.SafeGetCharAt(endPos);
+ char chPrev = styler.SafeGetCharAt(endPos - 1);
+ char chPrevPrev = styler.SafeGetCharAt(endPos - 2);
+ if (ch > 0 && chPrev > 0 && chPrevPrev > 0 && !isspacechar(ch) && !isspacechar(chPrev) && !isspacechar(chPrevPrev) )
+ return (chPrevPrev == ';' && chPrev == ';' && ch == '+');
}
- }
- nePos--; // skip to next char
+ endPos--; // skip to next char
}
return false;
}
// Routine to find first none space on the current line and return its Style
-// needed for comment lines not starting on pos 1
-static int GetStyleFirstWord(unsigned int szLine, Accessor &styler)
+// needed for comment lines not starting on pos 1
+static int GetStyleFirstWord(int szLine, Accessor &styler)
{
- int nsPos = styler.LineStart(szLine);
- int nePos = styler.LineStart(szLine+1) - 1;
- char ch = styler.SafeGetCharAt(nsPos);
-
- while (ch > 0 && isspacechar(ch) && nsPos < nePos)
- {
- nsPos++; // skip to next char
- ch = styler.SafeGetCharAt(nsPos);
+ int startPos = styler.LineStart(szLine);
+ int endPos = styler.LineStart(szLine + 1) - 1;
+ char ch = styler.SafeGetCharAt(startPos);
+ while (ch > 0 && isspacechar(ch) && startPos < endPos)
+ {
+ startPos++; // skip to next char
+ ch = styler.SafeGetCharAt(startPos);
}
- return styler.StyleAt(nsPos);
+ return styler.StyleAt(startPos);
}
//returns true if there is a function to highlight
//used to highlight <name> in 'function <name>'
-static bool HasFunction(Accessor &styler, unsigned int currentPos) {
-
- //check for presence of 'function '
- return (styler.SafeGetCharAt(currentPos) == ' '
- && tolower(styler.SafeGetCharAt(currentPos-1)) == 'n'
- && tolower(styler.SafeGetCharAt(currentPos-2)) == 'o'
- && tolower(styler.SafeGetCharAt(currentPos-3)) == 'i'
- && tolower(styler.SafeGetCharAt(currentPos-4)) == 't'
- && tolower(styler.SafeGetCharAt(currentPos-5)) == 'c'
- && tolower(styler.SafeGetCharAt(currentPos-6)) == 'n'
- && tolower(styler.SafeGetCharAt(currentPos-7)) == 'u'
- && tolower(styler.SafeGetCharAt(currentPos-8)) == 'f'
- //only allow 'function ' to appear at the beginning of a line
- && (styler.SafeGetCharAt(currentPos-9) == '\n'
- || styler.SafeGetCharAt(currentPos-9) == '\r'
- || (styler.SafeGetCharAt(currentPos -9, '\0')) == '\0') //is the first line
- );
+//note:
+// sample line (without quotes): "\tfunction asdf()
+// currentPos will be the position of 'a'
+static bool IsFunction(Accessor &styler, unsigned int currentPos) {
+
+ const char function[10] = "function "; //10 includes \0
+ unsigned int numberOfCharacters = sizeof(function) - 1;
+ unsigned int position = currentPos - numberOfCharacters;
+
+ //compare each character with the letters in the function array
+ //return false if ALL don't match
+ for (unsigned int i = 0; i < numberOfCharacters; i++) {
+ char c = styler.SafeGetCharAt(position++);
+ if (c != function[i])
+ return false;
+ }
+
+ //make sure that there are only spaces (or tabs) between the beginning
+ //of the line and the function declaration
+ position = currentPos - numberOfCharacters - 1; //-1 to move to char before 'function'
+ for (unsigned int j = 0; j < 16; j++) { //check up to 16 preceeding characters
+ char c = styler.SafeGetCharAt(position--, '\0'); //if can't read char, return NUL (past beginning of document)
+ if (c <= 0) //reached beginning of document
+ return true;
+ if (c > 0 && IsLineEndChar(c))
+ return true;
+ else if (c > 0 && !IsASpaceOrTab(c))
+ return false;
+ }
+
+ //fall-through
+ return false;
}
static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
@@ -116,22 +135,24 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3];
-
- //define the character sets
+
+ //define the character sets
CharacterSet setWordStart(CharacterSet::setAlpha, "_@", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
StyleContext sc(startPos, length, initStyle, styler);
char s_save[100]; //for last line highlighting
-
+
+ //are there only spaces between the first letter of the line and the beginning of the line
+ bool onlySpaces = true;
+
for (; sc.More(); sc.Forward()) {
-
- // **********************************************
+
// save the total current word for eof processing
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
-
- if ((sc.ch > 0) && setWord.Contains(sc.ch))
+
+ if ((sc.ch > 0) && setWord.Contains(sc.ch))
{
strcpy(s_save,s);
int tp = strlen(s_save);
@@ -140,8 +161,6 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl s_save[tp+1] = '\0';
}
}
- // **********************************************
- //
if (sc.atLineStart) {
if (sc.state == SCE_POWERPRO_DOUBLEQUOTEDSTRING) {
@@ -156,12 +175,12 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl case SCE_POWERPRO_OPERATOR:
sc.SetState(SCE_POWERPRO_DEFAULT);
break;
-
+
case SCE_POWERPRO_NUMBER:
if (!IsADigit(sc.ch))
sc.SetState(SCE_POWERPRO_DEFAULT);
-
+
break;
case SCE_POWERPRO_IDENTIFIER:
@@ -173,6 +192,7 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl } else {
sc.GetCurrentLowered(s, sizeof(s));
}
+
if (keywords.InList(s)) {
sc.ChangeState(SCE_POWERPRO_WORD);
} else if (keywords2.InList(s)) {
@@ -256,9 +276,9 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl }
}
break;
-
+
case SCE_POWERPRO_FUNCTION:
- if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ' ' || sc.ch == '(') {
+ if (isspacechar(sc.ch) || sc.ch == '(') {
sc.SetState(SCE_POWERPRO_DEFAULT);
}
break;
@@ -276,20 +296,20 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl sc.SetState(SCE_POWERPRO_ALTQUOTE);
sc.Forward();
}
- } else if (HasFunction(styler, sc.currentPos)) { //highlight <name> in 'function <name>'
- sc.SetState(SCE_POWERPRO_FUNCTION);
- } else if (sc.ch == '@' && sc.atLineStart) { //alternate function definition [label]
+ } else if (IsFunction(styler, sc.currentPos)) { //highlight <name> in 'function <name>'
+ sc.SetState(SCE_POWERPRO_FUNCTION);
+ } else if (onlySpaces && sc.ch == '@') { //alternate function definition [label]
sc.SetState(SCE_POWERPRO_FUNCTION);
} else if ((sc.ch > 0) && (setWordStart.Contains(sc.ch) || (sc.ch == '?'))) {
sc.SetState(SCE_POWERPRO_IDENTIFIER);
- } else if (sc.Match(";;+")) {
+ } else if (sc.Match(";;+")) {
sc.SetState(SCE_POWERPRO_LINECONTINUE);
} else if (sc.Match('/', '*')) {
sc.SetState(SCE_POWERPRO_COMMENTBLOCK);
sc.Forward(); // Eat the * so it isn't used for the end of the comment
} else if (sc.Match('/', '/')) {
sc.SetState(SCE_POWERPRO_COMMENTLINE);
- } else if (sc.atLineStart && sc.ch == ';') { //legacy comment that can only appear at the beginning of a line
+ } else if (onlySpaces && sc.ch == ';') { //legacy comment that can only have blank space in front of it
sc.SetState(SCE_POWERPRO_COMMENTLINE);
} else if (sc.Match(";;")) {
sc.SetState(SCE_POWERPRO_COMMENTLINE);
@@ -301,10 +321,19 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl sc.SetState(SCE_POWERPRO_OPERATOR);
}
}
+
+ //maintain a record of whether or not all the preceding characters on
+ //a line are space characters
+ if (onlySpaces && !IsASpaceOrTab(sc.ch))
+ onlySpaces = false;
+
+ //reset when starting a new line
+ if (sc.atLineEnd)
+ onlySpaces = true;
}
//*************************************
- // Colourize the last word correctly
+ // Colourize the last word correctly
//*************************************
if (sc.state == SCE_POWERPRO_IDENTIFIER)
{
@@ -337,7 +366,9 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[] CharacterSet setWordStart(CharacterSet::setAlpha, "_@", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
- bool isFoldingAll = true; //used to tell if we're recursively folding the whole document, or just a small piece (ie: if statement or 1 function)
+ //used to tell if we're recursively folding the whole document, or just a small piece (ie: if statement or 1 function)
+ bool isFoldingAll = true;
+
int endPos = startPos + length;
int lastLine = styler.GetLine(styler.Length()); //used to help fold the last line correctly
@@ -345,7 +376,7 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[] bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldInComment = styler.GetPropertyInt("fold.comment") == 2;
bool foldCompact = true;
-
+
// Backtrack to previous line in case need to fix its fold status
int lineCurrent = styler.GetLine(startPos);
if (startPos > 0) {
@@ -355,153 +386,156 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[] startPos = styler.LineStart(lineCurrent);
}
}
- // vars for style of previous/current/next lines
+ // vars for style of previous/current/next lines
int style = GetStyleFirstWord(lineCurrent,styler);
int stylePrev = 0;
-
+
// find the first previous line without continuation character at the end
- while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) ||
- (lineCurrent > 1 && IsContinuationLine(lineCurrent-1,styler))) {
+ while ((lineCurrent > 0 && IsContinuationLine(lineCurrent, styler))
+ || (lineCurrent > 1 && IsContinuationLine(lineCurrent - 1, styler))) {
lineCurrent--;
startPos = styler.LineStart(lineCurrent);
}
+
if (lineCurrent > 0) {
stylePrev = GetStyleFirstWord(lineCurrent-1,styler);
}
+
// vars for getting first word to check for keywords
- bool FirstWordStart = false;
- bool FirstWordEnd = false;
-
- const unsigned int KEYWORD_MAX = 10;
- char szKeyword[KEYWORD_MAX]="";
- unsigned int szKeywordlen = 0;
-
+ bool isFirstWordStarted = false;
+ bool isFirstWordEnded = false;
+
+ const unsigned int FIRST_WORD_MAX_LEN = 10;
+ char szFirstWord[FIRST_WORD_MAX_LEN] = "";
+ unsigned int firstWordLen = 0;
+
char szDo[3]="";
int szDolen = 0;
- bool DoFoundLast = false;
-
+ bool isDoLastWord = false;
+
// var for indentlevel
int levelCurrent = SC_FOLDLEVELBASE;
- if (lineCurrent > 0) {
+ if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
- }
int levelNext = levelCurrent;
-
+
int visibleChars = 0;
int functionCount = 0;
-
+
char chNext = styler.SafeGetCharAt(startPos);
char chPrev = '\0';
char chPrevPrev = '\0';
char chPrevPrevPrev = '\0';
-
+
for (int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
-
- if ((ch > 0) && setWord.Contains(ch)) {
+
+ if ((ch > 0) && setWord.Contains(ch))
visibleChars++;
- }
-
+
// get the syle for the current character neede to check in comment
int stylech = styler.StyleAt(i);
-
- // get first word for the line for indent check max 9 characters
- if (FirstWordStart && (!(FirstWordEnd))) {
- if ((ch > 0) && !setWord.Contains(ch)) {
- FirstWordEnd = true;
+
+ // start the capture of the first word
+ if (!isFirstWordStarted && (ch > 0)) {
+ if (setWord.Contains(ch) || setWordStart.Contains(ch) || ch == ';' || ch == '/') {
+ isFirstWordStarted = true;
+ if (firstWordLen < FIRST_WORD_MAX_LEN - 1) {
+ szFirstWord[firstWordLen++] = static_cast<char>(tolower(ch));
+ szFirstWord[firstWordLen] = '\0';
+ }
}
- else if (szKeywordlen < KEYWORD_MAX - 1) {
- szKeyword[szKeywordlen++] = static_cast<char>(tolower(ch));
- szKeyword[szKeywordlen] = '\0';
+ } // continue capture of the first word on the line
+ else if (isFirstWordStarted && !isFirstWordEnded && (ch > 0)) {
+ if (!setWord.Contains(ch)) {
+ isFirstWordEnded = true;
}
- }
-
- // start the capture of the first word
- if (!(FirstWordStart)) {
- if ((ch > 0) && (setWord.Contains(ch) || setWordStart.Contains(ch) || ch == ';' || ch == '/')) {
- FirstWordStart = true;
- if (szKeywordlen < KEYWORD_MAX - 1) {
- szKeyword[szKeywordlen++] = static_cast<char>(tolower(ch));
- szKeyword[szKeywordlen] = '\0';
- }
+ else if (firstWordLen < (FIRST_WORD_MAX_LEN - 1)) {
+ szFirstWord[firstWordLen++] = static_cast<char>(tolower(ch));
+ szFirstWord[firstWordLen] = '\0';
}
}
- // only process this logic when not in comment section
+
if (stylech != SCE_POWERPRO_COMMENTLINE) {
- if (DoFoundLast) {
- if (DoFoundLast && (ch > 0) && setWord.Contains(ch)) {
- DoFoundLast = false;
- }
- }
- // find out if the word "do" is the last on a "if" line
- if (FirstWordEnd && strcmp(szKeyword,"if") == 0) {
+
+ //reset isDoLastWord if we find a character(ignoring spaces) after 'do'
+ if (isDoLastWord && (ch > 0) && setWord.Contains(ch))
+ isDoLastWord = false;
+
+ // --find out if the word "do" is the last on a "if" line--
+ // collect each letter and put it into a buffer 2 chars long
+ // if we end up with "do" in the buffer when we reach the end of
+ // the line, "do" was the last word on the line
+ if ((ch > 0) && isFirstWordEnded && strcmp(szFirstWord, "if") == 0) {
if (szDolen == 2) {
szDo[0] = szDo[1];
szDo[1] = static_cast<char>(tolower(ch));
szDo[2] = '\0';
- if (strcmp(szDo,"do") == 0 ) {
- DoFoundLast = true;
- }
- }
- else if (szDolen < 2) {
+
+ if (strcmp(szDo, "do") == 0)
+ isDoLastWord = true;
+
+ } else if (szDolen < 2) {
szDo[szDolen++] = static_cast<char>(tolower(ch));
szDo[szDolen] = '\0';
}
}
}
- // End of Line found so process the information
- if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) {
-
+ // End of Line found so process the information
+ if ((ch == '\r' && chNext != '\n') // \r\n
+ || ch == '\n' // \n
+ || i == endPos) { // end of selection
+
// **************************
// Folding logic for Keywords
// **************************
-
+
// if a keyword is found on the current line and the line doesn't end with ;;+ (continuation)
// and we are not inside a commentblock.
- if (szKeywordlen > 0 &&
- (!(chPrev == '+' && chPrevPrev == ';' && chPrevPrevPrev ==';')) &&
- ((!(IsStreamCommentStyle(style)) || foldInComment)) ) {
-
+ if (firstWordLen > 0
+ && chPrev != '+' && chPrevPrev != ';' && chPrevPrevPrev !=';'
+ && (!IsStreamCommentStyle(style) || foldInComment) ) {
+
// only fold "if" last keyword is "then" (else its a one line if)
- if (strcmp(szKeyword,"if") == 0 && DoFoundLast) {
+ if (strcmp(szFirstWord, "if") == 0 && isDoLastWord)
levelNext++;
- }
- // create new fold for these words
- if (strcmp(szKeyword,"for") == 0) {
+
+ // create new fold for these words
+ if (strcmp(szFirstWord, "for") == 0)
levelNext++;
- }
-
+
//handle folding for functions/labels
//Note: Functions and labels don't have an explicit end like [end function]
// 1. functions/labels end at the start of another function
// 2. functions/labels end at the end of the file
- if ((strcmp(szKeyword,"function") == 0) || (szKeywordlen > 0 && szKeyword[0] == '@')) {
+ if ((strcmp(szFirstWord, "function") == 0) || (firstWordLen > 0 && szFirstWord[0] == '@')) {
if (isFoldingAll) { //if we're folding the whole document (recursivly by lua script)
-
+
if (functionCount > 0) {
levelCurrent--;
} else {
levelNext++;
}
- functionCount++;
-
+ functionCount++;
+
} else { //if just folding a small piece (by clicking on the minus sign next to the word)
levelCurrent--;
}
}
-
+
// end the fold for these words before the current line
- if (strcmp(szKeyword,"endif") == 0 || strcmp(szKeyword,"endfor") == 0) {
+ if (strcmp(szFirstWord, "endif") == 0 || strcmp(szFirstWord, "endfor") == 0) {
levelNext--;
levelCurrent--;
}
- // end the fold for these words before the current line and Start new fold
- if (strcmp(szKeyword,"else") == 0 || strcmp(szKeyword,"elseif") == 0 ) {
+
+ // end the fold for these words before the current line and Start new fold
+ if (strcmp(szFirstWord, "else") == 0 || strcmp(szFirstWord, "elseif") == 0 )
levelCurrent--;
- }
+
}
// Preprocessor and Comment folding
int styleNext = GetStyleFirstWord(lineCurrent + 1,styler);
@@ -510,20 +544,19 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[] // Folding logic for Comment blocks
// *********************************
if (foldComment && IsStreamCommentStyle(style)) {
+
// Start of a comment block
- if (!(stylePrev==style) && IsStreamCommentStyle(styleNext) && styleNext==style) {
+ if (stylePrev != style && IsStreamCommentStyle(styleNext) && styleNext == style) {
levelNext++;
- }
- // fold till the last line for normal comment lines
- else if (IsStreamCommentStyle(stylePrev)
- && !(styleNext == SCE_POWERPRO_COMMENTLINE)
- && stylePrev == SCE_POWERPRO_COMMENTLINE
+ } // fold till the last line for normal comment lines
+ else if (IsStreamCommentStyle(stylePrev)
+ && styleNext != SCE_POWERPRO_COMMENTLINE
+ && stylePrev == SCE_POWERPRO_COMMENTLINE
&& style == SCE_POWERPRO_COMMENTLINE) {
levelNext--;
- }
- // fold till the one but last line for Blockcomment lines
- else if (IsStreamCommentStyle(stylePrev)
- && !(styleNext == SCE_POWERPRO_COMMENTBLOCK)
+ } // fold till the one but last line for Blockcomment lines
+ else if (IsStreamCommentStyle(stylePrev)
+ && styleNext != SCE_POWERPRO_COMMENTBLOCK
&& style == SCE_POWERPRO_COMMENTBLOCK) {
levelNext--;
levelCurrent--;
@@ -534,12 +567,10 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[] int lev = levelUse | levelNext << 16;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
- if (levelUse < levelNext) {
+ if (levelUse < levelNext)
lev |= SC_FOLDLEVELHEADERFLAG;
- }
- if (lev != styler.LevelAt(lineCurrent)) {
+ if (lev != styler.LevelAt(lineCurrent))
styler.SetLevel(lineCurrent, lev);
- }
// reset values for the next line
lineCurrent++;
@@ -547,20 +578,18 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[] style = styleNext;
levelCurrent = levelNext;
visibleChars = 0;
-
+
// if the last characters are ;;+ then don't reset since the line continues on the next line.
- if (chPrev == '+' && chPrevPrev == ';' && chPrevPrevPrev == ';') {
- //do nothing
- } else {
- szKeywordlen = 0;
+ if (chPrev != '+' && chPrevPrev != ';' && chPrevPrevPrev != ';') {
+ firstWordLen = 0;
szDolen = 0;
- FirstWordStart = false;
- FirstWordEnd = false;
- DoFoundLast = false;
- //blank out keyword
- for (unsigned int i = 0; i < KEYWORD_MAX; i++) {
- szKeyword[i] = '\0';
- }
+ isFirstWordStarted = false;
+ isFirstWordEnded = false;
+ isDoLastWord = false;
+
+ //blank out first word
+ for (unsigned int i = 0; i < FIRST_WORD_MAX_LEN; i++)
+ szFirstWord[i] = '\0';
}
}
@@ -569,11 +598,10 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[] chPrevPrevPrev = chPrevPrev;
chPrevPrev = chPrev;
chPrev = ch;
- visibleChars++;
}
}
- //close folds on the last line - without this a 'phantom'
+ //close folds on the last line - without this a 'phantom'
//fold can appear when an open fold is on the last line
//this can occur because functions and labels don't have an explicit end
if (lineCurrent >= lastLine) {
@@ -598,3 +626,5 @@ static void ColourisePowerProDocWrapper(unsigned int startPos, int length, int i }
LexerModule lmPowerPro(SCLEX_POWERPRO, ColourisePowerProDocWrapper, "powerpro", FoldPowerProDoc, powerProWordLists);
+
+
diff --git a/scintilla/src/LexPowerShell.cxx b/scintilla/lexers/LexPowerShell.cxx index 32a3772..b5fc8c5 100644 --- a/scintilla/src/LexPowerShell.cxx +++ b/scintilla/lexers/LexPowerShell.cxx @@ -7,18 +7,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -26,7 +30,7 @@ using namespace Scintilla; // Extended to accept accented characters
static inline bool IsAWordChar(int ch) {
- return ch >= 0x80 || isalnum(ch) || ch == '-';
+ return ch >= 0x80 || isalnum(ch) || ch == '-' || ch == '_';
}
static void ColourisePowerShellDoc(unsigned int startPos, int length, int initStyle,
@@ -35,6 +39,8 @@ static void ColourisePowerShellDoc(unsigned int startPos, int length, int initSt WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
+ WordList &keywords4 = *keywordlists[3];
+ WordList &keywords5 = *keywordlists[4];
styler.StartAt(startPos);
@@ -46,6 +52,10 @@ static void ColourisePowerShellDoc(unsigned int startPos, int length, int initSt if (sc.atLineEnd) {
sc.SetState(SCE_POWERSHELL_DEFAULT);
}
+ } else if (sc.state == SCE_POWERSHELL_COMMENTSTREAM) {
+ if (sc.ch == '>' && sc.chPrev == '#') {
+ sc.ForwardSetState(SCE_POWERSHELL_DEFAULT);
+ }
} else if (sc.state == SCE_POWERSHELL_STRING) {
// This is a doubles quotes string
if (sc.ch == '\"') {
@@ -79,6 +89,10 @@ static void ColourisePowerShellDoc(unsigned int startPos, int length, int initSt sc.ChangeState(SCE_POWERSHELL_CMDLET);
} else if (keywords3.InList(s)) {
sc.ChangeState(SCE_POWERSHELL_ALIAS);
+ } else if (keywords4.InList(s)) {
+ sc.ChangeState(SCE_POWERSHELL_FUNCTION);
+ } else if (keywords5.InList(s)) {
+ sc.ChangeState(SCE_POWERSHELL_USER1);
}
sc.SetState(SCE_POWERSHELL_DEFAULT);
}
@@ -88,6 +102,8 @@ static void ColourisePowerShellDoc(unsigned int startPos, int length, int initSt if (sc.state == SCE_POWERSHELL_DEFAULT) {
if (sc.ch == '#') {
sc.SetState(SCE_POWERSHELL_COMMENT);
+ } else if (sc.ch == '<' && sc.chNext == '#') {
+ sc.SetState(SCE_POWERSHELL_COMMENTSTREAM);
} else if (sc.ch == '\"') {
sc.SetState(SCE_POWERSHELL_STRING);
} else if (sc.ch == '\'') {
@@ -109,8 +125,9 @@ static void ColourisePowerShellDoc(unsigned int startPos, int length, int initSt // Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
-static void FoldPowerShellDoc(unsigned int startPos, int length, int,
+static void FoldPowerShellDoc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) {
+ bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
unsigned int endPos = startPos + length;
@@ -123,10 +140,12 @@ static void FoldPowerShellDoc(unsigned int startPos, int length, int, int levelNext = levelCurrent;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
+ int style = initStyle;
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
- int style = styleNext;
+ int stylePrev = style;
+ style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_POWERSHELL_OPERATOR) {
@@ -140,6 +159,12 @@ static void FoldPowerShellDoc(unsigned int startPos, int length, int, } else if (ch == '}') {
levelNext--;
}
+ } else if (foldComment && style == SCE_POWERSHELL_COMMENTSTREAM) {
+ if (stylePrev != SCE_POWERSHELL_COMMENTSTREAM) {
+ levelNext++;
+ } else if (styleNext != SCE_POWERSHELL_COMMENTSTREAM) {
+ levelNext--;
+ }
}
if (!IsASpace(ch))
visibleChars++;
@@ -168,6 +193,8 @@ static const char * const powershellWordLists[] = { "Commands",
"Cmdlets",
"Aliases",
+ "Functions",
+ "User1",
0
};
diff --git a/scintilla/src/LexProgress.cxx b/scintilla/lexers/LexProgress.cxx index 9a804c4..4d15cf7 100644 --- a/scintilla/src/LexProgress.cxx +++ b/scintilla/lexers/LexProgress.cxx @@ -13,18 +13,22 @@ Support more than 6 comments levels **/
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -47,7 +51,7 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo WordList &keywords2 = *keywordlists[1]; // block opening keywords, only when SentenceStart
WordList &keywords3 = *keywordlists[2]; // block opening keywords
//WordList &keywords4 = *keywordlists[3]; // preprocessor keywords. Not implemented
-
+
int visibleChars = 0;
int mask;
@@ -180,7 +184,7 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo } else if (isoperator(static_cast<char>(sc.ch))) {
/* This code allows highlight of handles. Alas, it would cause the phrase "last-event:function"
to be recognized as a BlockBegin */
-
+
if (sc.ch == ':')
sc.SetState(SCE_4GL_OPERATOR & SetSentenceStart);
/* else */
diff --git a/scintilla/src/LexPython.cxx b/scintilla/lexers/LexPython.cxx index 815eeae..32e8248 100644 --- a/scintilla/src/LexPython.cxx +++ b/scintilla/lexers/LexPython.cxx @@ -7,18 +7,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -507,7 +511,7 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse }
const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK;
- const int levelBeforeComments = Platform::Maximum(indentCurrentLevel,levelAfterComments);
+ const int levelBeforeComments = Maximum(indentCurrentLevel,levelAfterComments);
// Now set all the indent levels on the lines we skipped
// Do this from end to start. Once we encounter one line
diff --git a/scintilla/src/LexR.cxx b/scintilla/lexers/LexR.cxx index 06c4dcd..e722d3d 100644 --- a/scintilla/src/LexR.cxx +++ b/scintilla/lexers/LexR.cxx @@ -8,18 +8,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexRebol.cxx b/scintilla/lexers/LexRebol.cxx index adbabe8..5f539ca 100644 --- a/scintilla/src/LexRebol.cxx +++ b/scintilla/lexers/LexRebol.cxx @@ -13,18 +13,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexRuby.cxx b/scintilla/lexers/LexRuby.cxx index afe350d..f090cdc 100644 --- a/scintilla/src/LexRuby.cxx +++ b/scintilla/lexers/LexRuby.cxx @@ -7,18 +7,23 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
@@ -78,7 +83,7 @@ static bool followsDot(unsigned int pos, Accessor &styler) { return false;
}
break;
-
+
case SCE_RB_OPERATOR:
return styler[pos] == '.';
@@ -118,7 +123,7 @@ static int ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywor else if (keywords.InList(s) && !followsDot(start - 1, styler)) {
if (keywordIsAmbiguous(s)
&& keywordIsModifier(s, start, styler)) {
-
+
// Demoted keywords are colored as keywords,
// but do not affect changes in indentation.
//
@@ -127,7 +132,7 @@ static int ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywor // 2. <<stmt if test>> : demoted
// 3. <<lhs = if ...>> : normal: start a new indent level
// 4. <<obj.if = 10>> : color as identifer, since it follows '.'
-
+
chAttr = SCE_RB_WORD_DEMOTED;
} else {
chAttr = SCE_RB_WORD;
@@ -224,7 +229,7 @@ static bool currLineContainsHereDelims(int& startPos, // Leave the pointers where they are -- there are no
// here doc delims on the current line, even if
// the EOL isn't default style
-
+
return false;
} else {
styler.Flush();
@@ -276,7 +281,7 @@ class QuoteCls { }
return *this;
}
-
+
};
@@ -352,7 +357,7 @@ static int skipWhitespace(int startPos, }
return endPos;
}
-
+
// This routine looks for false positives like
// undef foo, <<
// There aren't too many.
@@ -362,7 +367,7 @@ static int skipWhitespace(int startPos, static bool sureThisIsHeredoc(int iPrev,
Accessor &styler,
char *prevWord) {
-
+
// Not so fast, since Ruby's so dynamic. Check the context
// to make sure we're OK.
int prevStyle;
@@ -453,7 +458,7 @@ static bool sureThisIsNotHeredoc(int lt2StartPos, styler.Flush();
const bool definitely_not_a_here_doc = true;
const bool looks_like_a_here_doc = false;
-
+
// Find the first word after some whitespace
int firstWordPosn = skipWhitespace(lineStartPosn, lt2StartPos, styler);
if (firstWordPosn >= lt2StartPos) {
@@ -531,7 +536,7 @@ static bool sureThisIsNotHeredoc(int lt2StartPos, target_quote = styler[j];
j += 1;
}
-
+
if (isSafeAlnum(styler[j])) {
// Init target_end because some compilers think it won't
// be initialized by the time it's used
@@ -549,7 +554,7 @@ static bool sureThisIsNotHeredoc(int lt2StartPos, // And for now make sure that it's a newline
// don't handle arbitrary expressions yet
-
+
target_end = j;
if (target_quote) {
// Now we can move to the character after the string delimiter.
@@ -592,7 +597,7 @@ static bool sureThisIsNotHeredoc(int lt2StartPos, }
//todo: if we aren't looking at a stdio character,
-// move to the start of the first line that is not in a
+// move to the start of the first line that is not in a
// multi-line construct
static void synchronizeDocStart(unsigned int& startPos,
@@ -610,7 +615,7 @@ static void synchronizeDocStart(unsigned int& startPos, // Don't do anything else with these.
return;
}
-
+
int pos = startPos;
// Quick way to characterize each line
int lineStart;
@@ -651,7 +656,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, // Lexer for Ruby often has to backtrack to start of current style to determine
// which characters are being used as quotes, how deeply nested is the
// start position and what the termination string is for here documents
-
+
WordList &keywords = *keywordlists[0];
class HereDocCls {
@@ -674,7 +679,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, CanBeIndented = false;
}
};
- HereDocCls HereDoc;
+ HereDocCls HereDoc;
QuoteCls Quote;
@@ -750,7 +755,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, i += 1;
continue;
}
-
+
// skip on DOS/Windows
//No, don't, because some things will get tagged on,
// so we won't recognize keywords, for example
@@ -759,7 +764,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, continue;
}
#endif
-
+
if (HereDoc.State == 1 && isEOLChar(ch)) {
// Begin of here-doc (the line after the here-doc delimiter):
HereDoc.State = 2;
@@ -973,6 +978,15 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, } else if (preferRE && !isSafeWordcharOrHigh(chNext)) {
// Ruby doesn't allow high bit chars here,
// but the editor host might
+ Quote.New();
+ state = SCE_RB_STRING_QQ;
+ Quote.Open(chNext);
+ advance_char(i, ch, chNext, chNext2); // pass by ref
+ have_string = true;
+ } else if (!isSafeWordcharOrHigh(chNext) && !iswhitespace(chNext) && !isEOLChar(chNext)) {
+ // Ruby doesn't allow high bit chars here,
+ // but the editor host might
+ Quote.New();
state = SCE_RB_STRING_QQ;
Quote.Open(chNext);
advance_char(i, ch, chNext, chNext2); // pass by ref
@@ -1003,7 +1017,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, // So if we don't have one of these chars,
// we aren't ending an object exp'n, and ops
// like : << / are unary operators.
-
+
if (ch == '{') {
++brace_counts;
preferRE = true;
@@ -1035,7 +1049,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, // Default accessor treats '.' as word-chars,
// but we don't for now.
-
+
if (ch == '='
&& isSafeWordcharOrHigh(chPrev)
&& (chNext == '('
@@ -1066,11 +1080,11 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, case SCE_RB_WORD:
preferRE = RE_CanFollowKeyword(prevWord);
break;
-
+
case SCE_RB_WORD_DEMOTED:
preferRE = true;
break;
-
+
case SCE_RB_IDENTIFIER:
if (isMatch(styler, lengthDoc, wordStartPos, "print")) {
preferRE = true;
@@ -1087,7 +1101,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, // We might be redefining an operator-method
preferRE = false;
}
- // And if it's the first
+ // And if it's the first
redo_char(i, ch, chNext, chNext2, state); // pass by ref
}
}
@@ -1124,6 +1138,10 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, }
} else if (isSafeAlnumOrHigh(ch) || ch == '_') {
// Keep going
+ } else if (ch == '.' && chNext == '.') {
+ ++numDots;
+ styler.ColourTo(i - 1, state);
+ redo_char(i, ch, chNext, chNext2, state); // pass by ref
} else if (ch == '.' && ++numDots == 1) {
// Keep going
} else {
@@ -1141,7 +1159,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, // See the comment for SCE_RB_HERE_DELIM in LexPerl.cxx
// Slightly different: if we find an immediate '-',
// the target can appear indented.
-
+
if (HereDoc.State == 0) { // '<<' encountered
HereDoc.State = 1;
HereDoc.DelimiterLength = 0;
@@ -1157,7 +1175,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, preferRE = false;
} else {
HereDoc.Quote = ch;
-
+
if (ch == '\'' || ch == '"' || ch == '`') {
HereDoc.Quoted = true;
HereDoc.Delimiter[0] = '\0';
@@ -1291,7 +1309,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, } else if (ch == Quote.Up) {
// Only if close quoter != open quoter
Quote.Count++;
-
+
} else if (ch == '#' ) {
if (chNext == '{'
&& inner_string_count < INNER_STRINGS_MAX_COUNT) {
@@ -1336,7 +1354,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, }
}
// Quotes of all kinds...
- } else if (state == SCE_RB_STRING_Q || state == SCE_RB_STRING_QQ ||
+ } else if (state == SCE_RB_STRING_Q || state == SCE_RB_STRING_QQ ||
state == SCE_RB_STRING_QX || state == SCE_RB_STRING_QW ||
state == SCE_RB_STRING || state == SCE_RB_CHARACTER ||
state == SCE_RB_BACKTICKS) {
@@ -1373,7 +1391,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, advance_char(i, ch, chNext, chNext2);
}
}
-
+
if (state == SCE_RB_ERROR) {
break;
}
@@ -1389,7 +1407,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, }
// Helper functions for folding, disambiguation keywords
-// Assert that there are no high-bit chars
+// Assert that there are no high-bit chars
static void getPrevWord(int pos,
char *prevWord,
@@ -1430,7 +1448,7 @@ static bool keywordIsAmbiguous(const char *prevWord) // Demote keywords in the following conditions:
// if, while, unless, until modify a statement
-// do after a while or until, as a noise word (like then after if)
+// do after a while or until, as a noise word (like then after if)
static bool keywordIsModifier(const char *word,
int pos,
@@ -1439,10 +1457,32 @@ static bool keywordIsModifier(const char *word, if (word[0] == 'd' && word[1] == 'o' && !word[2]) {
return keywordDoStartsLoop(pos, styler);
}
- char ch;
+ char ch, chPrev, chPrev2;
int style = SCE_RB_DEFAULT;
int lineStart = styler.GetLine(pos);
int lineStartPosn = styler.LineStart(lineStart);
+ // We want to step backwards until we don't care about the current
+ // position. But first move lineStartPosn back behind any
+ // continuations immediately above word.
+ while (lineStartPosn > 0) {
+ ch = styler[lineStartPosn-1];
+ if (ch == '\n' || ch == '\r') {
+ chPrev = styler.SafeGetCharAt(lineStartPosn-2);
+ chPrev2 = styler.SafeGetCharAt(lineStartPosn-3);
+ lineStart = styler.GetLine(lineStartPosn-1);
+ // If we find a continuation line, include it in our analysis.
+ if (chPrev == '\\') {
+ lineStartPosn = styler.LineStart(lineStart);
+ } else if (ch == '\n' && chPrev == '\r' && chPrev2 == '\\') {
+ lineStartPosn = styler.LineStart(lineStart);
+ } else {
+ break;
+ }
+ } else {
+ break;
+ }
+ }
+
styler.Flush();
while (--pos >= lineStartPosn) {
style = actual_style(styler.StyleAt(pos));
@@ -1453,14 +1493,27 @@ static bool keywordIsModifier(const char *word, // Scintilla's LineStart() and GetLine() routines aren't
// platform-independent, so if we have text prepared with
// a different system we can't rely on it.
- return false;
+
+ // Also, lineStartPosn may have been moved to more than one
+ // line above word's line while pushing past continuations.
+ chPrev = styler.SafeGetCharAt(pos - 1);
+ chPrev2 = styler.SafeGetCharAt(pos - 2);
+ if (chPrev == '\\') {
+ pos-=1; // gloss over the "\\"
+ //continue
+ } else if (ch == '\n' && chPrev == '\r' && chPrev2 == '\\') {
+ pos-=2; // gloss over the "\\\r"
+ //continue
+ } else {
+ return false;
+ }
}
} else {
break;
}
}
if (pos < lineStartPosn) {
- return false; //XXX not quite right if the prev line is a continuation
+ return false;
}
// First things where the action is unambiguous
switch (style) {
@@ -1490,7 +1543,7 @@ static bool keywordIsModifier(const char *word, // Assume that if the keyword follows an operator,
// usually it's a block assignment, like
// a << if x then y else z
-
+
ch = styler[pos];
switch (ch) {
case ')':
@@ -1561,25 +1614,25 @@ static bool keywordDoStartsLoop(int pos, /*
* Folding Ruby
- *
+ *
* The language is quite complex to analyze without a full parse.
* For example, this line shouldn't affect fold level:
- *
+ *
* print "hello" if feeling_friendly?
- *
+ *
* Neither should this:
- *
+ *
* print "hello" \
* if feeling_friendly?
- *
- *
+ *
+ *
* But this should:
- *
+ *
* if feeling_friendly? #++
* print "hello" \
* print "goodbye"
* end #--
- *
+ *
* So we cheat, by actually looking at the existing indentation
* levels for each line, and just echoing it back. Like Python.
* Then if we get better at it, we'll take braces into consideration,
@@ -1587,29 +1640,29 @@ static bool keywordDoStartsLoop(int pos, * How the keywords should work:
* No effect:
- * __FILE__ __LINE__ BEGIN END alias and
+ * __FILE__ __LINE__ BEGIN END alias and
* defined? false in nil not or self super then
* true undef
* Always increment:
* begin class def do for module when {
- *
+ *
* Always decrement:
* end }
- *
+ *
* Increment if these start a statement
* if unless until while -- do nothing if they're modifiers
* These end a block if there's no modifier, but don't bother
* break next redo retry return yield
- *
+ *
* These temporarily de-indent, but re-indent
* case else elsif ensure rescue
- *
+ *
* This means that the folder reflects indentation rather
* than setting it. The language-service updates indentation
* when users type return and finishes entering de-denters.
- *
+ *
* Later offer to fold POD, here-docs, strings, and blocks of comments
*/
@@ -1617,7 +1670,7 @@ static void FoldRbDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) {
const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
-
+
synchronizeDocStart(startPos, length, initStyle, styler, // ref args
false);
unsigned int endPos = startPos + length;
diff --git a/scintilla/src/LexSML.cxx b/scintilla/lexers/LexSML.cxx index 5f039fe..3567da5 100644 --- a/scintilla/src/LexSML.cxx +++ b/scintilla/lexers/LexSML.cxx @@ -6,21 +6,24 @@ // Modified from LexCaml.cxx by Robert Roessler <robertr@rftp.com> Copyright 2005
// The License.txt file describes the conditions under which this software may be distributed.
-
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
inline int issml(int c) {return isalnum(c) || c == '_';}
inline int issmlf(int c) {return isalpha(c) || c == '_';}
@@ -67,7 +70,7 @@ void ColouriseSMLDoc( else if (sc.Match('#','\"')){
state2 = SCE_SML_CHAR,chLit = 0;
sc.Forward();
-
+
}
else if (isdigit(sc.ch)) {
state2 = SCE_SML_NUMBER, chBase = 10;
@@ -218,4 +221,4 @@ static const char * const SMLWordListDesc[] = { };
LexerModule lmSML(SCLEX_SML, ColouriseSMLDoc, "SML", FoldSMLDoc, SMLWordListDesc);
-
+
diff --git a/scintilla/src/LexSQL.cxx b/scintilla/lexers/LexSQL.cxx index 9414537..86c463c 100644 --- a/scintilla/src/LexSQL.cxx +++ b/scintilla/lexers/LexSQL.cxx @@ -7,18 +7,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -61,8 +65,8 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, Wo StyleContext sc(startPos, length, initStyle, styler);
- // property sql.backslash.escapes
- // Enables backslash as an escape character in SQL.
+ // property sql.backslash.escapes
+ // Enables backslash as an escape character in SQL.
bool sqlBackslashEscapes = styler.GetPropertyInt("sql.backslash.escapes", 0) != 0;
bool sqlBackticksIdentifier = styler.GetPropertyInt("lexer.sql.backticks.identifier", 0) != 0;
@@ -231,8 +235,8 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle, bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0;
- // property fold.sql.exists
- // Enables "EXISTS" to end a fold as is started by "IF" in "DROP TABLE IF EXISTS".
+ // property fold.sql.exists
+ // Enables "EXISTS" to end a fold as is started by "IF" in "DROP TABLE IF EXISTS".
bool foldSqlExists = styler.GetPropertyInt("fold.sql.exists", 1) != 0;
unsigned int endPos = startPos + length;
@@ -313,7 +317,7 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle, // // DROP TABLE IF EXISTS or CREATE TABLE IF NOT EXISTS
(foldSqlExists && (strcmp(s, "exists") == 0)) ||
// // SQL Anywhere permits IF ... ELSE ... ENDIF
-// // will only be active if "endif" appears in the
+// // will only be active if "endif" appears in the
// // keyword list.
(strcmp(s, "endif") == 0)) {
endFound = true;
diff --git a/scintilla/src/LexScriptol.cxx b/scintilla/lexers/LexScriptol.cxx index f459920..8663f09 100644 --- a/scintilla/src/LexScriptol.cxx +++ b/scintilla/lexers/LexScriptol.cxx @@ -5,18 +5,23 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
@@ -48,10 +53,9 @@ static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keyw static bool IsSolComment(Accessor &styler, int pos, int len)
{
- char c;
if(len > 0)
{
- c = styler[pos];
+ char c = styler[pos];
if(c == '`') return true;
if(len > 1)
{
@@ -328,7 +332,7 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle, state = SCE_SCRIPTOL_DEFAULT;
}
}
-
+
}
chPrev2 = chPrev;
chPrev = ch;
diff --git a/scintilla/src/LexSmalltalk.cxx b/scintilla/lexers/LexSmalltalk.cxx index 2fe96f3..a17bdaa 100644 --- a/scintilla/src/LexSmalltalk.cxx +++ b/scintilla/lexers/LexSmalltalk.cxx @@ -8,16 +8,22 @@ #include <stdlib.h>
#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -39,7 +45,7 @@ classificationBlock value: #BinSel value: '~@%&*-+=|\/,<>?!';
value: #Upper value: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
-((String new: 500) streamContents: [ :stream |
+((String new: 500) streamContents: [ :stream |
stream crLf; nextPutAll: 'static int ClassificationTable[256] = {'.
lexTable keysAndValuesDo: [ :index :value |
((index - 1) rem: 16) == 0 ifTrue: [
@@ -50,7 +56,7 @@ classificationBlock index ~= 256 ifTrue: [
stream nextPut: $,]].
stream crLf; nextPutAll: '};'; crLf.
-
+
charClasses keysAndValuesDo: [ :index :name |
stream
crLf;
@@ -95,7 +101,7 @@ static inline bool isDigitOfRadix(int ch, int radix) }
static inline void skipComment(StyleContext& sc)
-{
+{
while (sc.More() && sc.ch != '\"')
sc.Forward();
}
@@ -118,7 +124,7 @@ static void handleHash(StyleContext& sc) sc.SetState(SCE_ST_SPECIAL);
return;
}
-
+
sc.SetState(SCE_ST_SYMBOL);
sc.Forward();
if (sc.ch == '\'') {
@@ -162,7 +168,7 @@ static void handleNumeric(StyleContext& sc) char num[256];
int nl;
int radix;
-
+
sc.SetState(SCE_ST_NUMBER);
num[0] = static_cast<char>(sc.ch);
nl = 1;
@@ -217,7 +223,7 @@ static void handleLetter(StyleContext& sc, WordList* specialSelectorList) int il;
int state;
bool doubleColonPresent;
-
+
sc.SetState(SCE_ST_DEFAULT);
ident[0] = static_cast<char>(sc.ch);
@@ -237,7 +243,7 @@ static void handleLetter(StyleContext& sc, WordList* specialSelectorList) else
doubleColonPresent = false;
ident[il] = 0;
-
+
if (specialSelectorList->InList(ident))
state = SCE_ST_SPEC_SEL;
else if (doubleColonPresent)
@@ -256,7 +262,7 @@ static void handleLetter(StyleContext& sc, WordList* specialSelectorList) else
state = SCE_ST_DEFAULT;
}
-
+
sc.ChangeState(state);
}
@@ -277,7 +283,7 @@ static void colorizeSmalltalkDoc(unsigned int startPos, int length, int initStyl for (; sc.More(); sc.Forward()) {
int ch;
-
+
ch = sc.ch;
if (ch == '\"') {
sc.SetState(SCE_ST_COMMENT);
diff --git a/scintilla/src/LexSorcus.cxx b/scintilla/lexers/LexSorcus.cxx index 35bbaed..010e0b3 100644 --- a/scintilla/src/LexSorcus.cxx +++ b/scintilla/lexers/LexSorcus.cxx @@ -9,18 +9,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -29,7 +33,7 @@ using namespace Scintilla; //each character a..z and A..Z + '_' can be part of a keyword
//additionally numbers that follow 'M' can be contained in a keyword
-static inline bool IsSWordStart(const int ch, const int prev_ch)
+static inline bool IsSWordStart(const int ch, const int prev_ch)
{
if (isalpha(ch) || (ch == '_') || ((isdigit(ch)) && (prev_ch == 'M')))
return true;
@@ -39,7 +43,7 @@ static inline bool IsSWordStart(const int ch, const int prev_ch) //only digits that are not preceded by 'M' count as a number
-static inline bool IsSorcusNumber(const int ch, const int prev_ch)
+static inline bool IsSorcusNumber(const int ch, const int prev_ch)
{
if ((isdigit(ch)) && (prev_ch != 'M'))
return true;
@@ -49,46 +53,46 @@ static inline bool IsSorcusNumber(const int ch, const int prev_ch) //only = is a valid operator
-static inline bool IsSorcusOperator(const int ch)
+static inline bool IsSorcusOperator(const int ch)
{
if (ch == '=')
return true;
-
+
return false;
}
static void ColouriseSorcusDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
- Accessor &styler)
+ Accessor &styler)
{
-
+
WordList &Command = *keywordlists[0];
WordList &Parameter = *keywordlists[1];
WordList &Constant = *keywordlists[2];
-
+
// Do not leak onto next line
- if (initStyle == SCE_SORCUS_STRINGEOL)
+ if (initStyle == SCE_SORCUS_STRINGEOL)
initStyle = SCE_SORCUS_DEFAULT;
-
+
StyleContext sc(startPos, length, initStyle, styler);
-
+
for (; sc.More(); sc.Forward())
{
-
+
// Prevent SCE_SORCUS_STRINGEOL from leaking back to previous line
if (sc.atLineStart && (sc.state == SCE_SORCUS_STRING))
{
- sc.SetState(SCE_SORCUS_STRING);
- }
-
+ sc.SetState(SCE_SORCUS_STRING);
+ }
+
// Determine if the current state should terminate.
if (sc.state == SCE_SORCUS_OPERATOR)
{
- if (!IsSorcusOperator(sc.ch))
+ if (!IsSorcusOperator(sc.ch))
{
sc.SetState(SCE_SORCUS_DEFAULT);
}
- }
+ }
else if(sc.state == SCE_SORCUS_NUMBER)
{
if(!IsSorcusNumber(sc.ch, sc.chPrev))
@@ -101,25 +105,25 @@ static void ColouriseSorcusDoc(unsigned int startPos, int length, int initStyle, if (!IsSWordStart(sc.ch, sc.chPrev))
{
char s[100];
-
+
sc.GetCurrent(s, sizeof(s));
-
+
if (Command.InList(s))
- {
- sc.ChangeState(SCE_SORCUS_COMMAND);
+ {
+ sc.ChangeState(SCE_SORCUS_COMMAND);
}
else if (Parameter.InList(s))
- {
+ {
sc.ChangeState(SCE_SORCUS_PARAMETER);
}
else if (Constant.InList(s))
- {
+ {
sc.ChangeState(SCE_SORCUS_CONSTANT);
}
-
+
sc.SetState(SCE_SORCUS_DEFAULT);
}
- }
+ }
else if (sc.state == SCE_SORCUS_COMMENTLINE )
{
if (sc.atLineEnd)
@@ -133,24 +137,24 @@ static void ColouriseSorcusDoc(unsigned int startPos, int length, int initStyle, {
sc.ForwardSetState(SCE_SORCUS_DEFAULT);
}
- else if (sc.atLineEnd)
+ else if (sc.atLineEnd)
{
sc.ChangeState(SCE_SORCUS_STRINGEOL);
sc.ForwardSetState(SCE_SORCUS_DEFAULT);
}
}
-
+
// Determine if a new state should be entered.
if (sc.state == SCE_SORCUS_DEFAULT)
{
if ((sc.ch == ';') || (sc.ch == '\''))
{
sc.SetState(SCE_SORCUS_COMMENTLINE);
- }
+ }
else if (IsSWordStart(sc.ch, sc.chPrev))
{
sc.SetState(SCE_SORCUS_IDENTIFIER);
- }
+ }
else if (sc.ch == '\"')
{
sc.SetState(SCE_SORCUS_STRING);
@@ -164,42 +168,42 @@ static void ColouriseSorcusDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_SORCUS_NUMBER);
}
}
-
+
}
sc.Complete();
}
static const char* const SorcusWordListDesc[] = {"Command","Parameter", "Constant", 0};
-
+
LexerModule lmSorc(SCLEX_SORCUS, ColouriseSorcusDoc, "sorcins", 0, SorcusWordListDesc);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scintilla/src/LexSpecman.cxx b/scintilla/lexers/LexSpecman.cxx index 4a7f4dd..090c332 100644 --- a/scintilla/src/LexSpecman.cxx +++ b/scintilla/lexers/LexSpecman.cxx @@ -11,15 +11,19 @@ #include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexSpice.cxx b/scintilla/lexers/LexSpice.cxx index 7a9d5bb..a4e81b9 100644 --- a/scintilla/src/LexSpice.cxx +++ b/scintilla/lexers/LexSpice.cxx @@ -6,19 +6,24 @@ // The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
-#include <ctype.h>
#include <string.h>
#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
#include <string>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "PropSet.h"
-#include "KeyWords.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexTACL.cxx b/scintilla/lexers/LexTACL.cxx index 8bcd889..a5af888 100644 --- a/scintilla/src/LexTACL.cxx +++ b/scintilla/lexers/LexTACL.cxx @@ -10,18 +10,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexTADS3.cxx b/scintilla/lexers/LexTADS3.cxx index d1c3a4f..880b061 100644 --- a/scintilla/src/LexTADS3.cxx +++ b/scintilla/lexers/LexTADS3.cxx @@ -33,18 +33,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -70,7 +74,7 @@ static inline bool IsEOL(const int ch, const int chNext) { * - it doesn't want to admit that there's a newline until reaching the END
* of the sequence. We meet both needs by saying that there's a newline
* when we see the CR in a CR-LF, but skipping the CR before returning so
- * that the caller's caller will see that we've stopped at the LF.
+ * that the caller's caller will see that we've stopped at the LF.
*/
static inline bool IsEOLSkip(StyleContext &sc)
{
@@ -82,17 +86,13 @@ static inline bool IsEOLSkip(StyleContext &sc) return true;
}
- /*
+ /*
* in other cases, we have at most a 1-character newline, so do the
- * normal IsEOL test
+ * normal IsEOL test
*/
return IsEOL(sc.ch, sc.chNext);
}
-static inline bool IsASpaceOrTab(const int ch) {
- return ch == ' ' || ch == '\t';
-}
-
static inline bool IsATADS3Operator(const int ch) {
return ch == '=' || ch == '{' || ch == '}' || ch == '(' || ch == ')'
|| ch == '[' || ch == ']' || ch == ',' || ch == ':' || ch == ';'
@@ -156,7 +156,7 @@ static void ColouriseTADSHTMLString(StyleContext &sc, int &lineState) { sc.Forward();
}
if (chQuote == '"')
- lineState &= ~T3_HTML_SQUOTE;
+ lineState &= ~T3_HTML_SQUOTE;
else
lineState |= T3_HTML_SQUOTE;
diff --git a/scintilla/src/LexTAL.cxx b/scintilla/lexers/LexTAL.cxx index c4dfa8e..a3809cf 100644 --- a/scintilla/src/LexTAL.cxx +++ b/scintilla/lexers/LexTAL.cxx @@ -10,18 +10,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -94,7 +98,7 @@ static int classifyWordTAL(unsigned int start, unsigned int end, /*WordList &key else if (strcmp(s, "end") == 0) {
ret = -1;
}
- }
+ }
else if (s[0] == '$' || builtins.InList(s)) {
chAttr = SCE_C_WORD2;
}
diff --git a/scintilla/src/LexTCL.cxx b/scintilla/lexers/LexTCL.cxx index 916890d..eb04048 100644 --- a/scintilla/src/LexTCL.cxx +++ b/scintilla/lexers/LexTCL.cxx @@ -7,18 +7,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
-#include <stdarg.h>
#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -47,7 +51,7 @@ static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *k bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool commentLevel = false;
bool subBrace = false; // substitution begin with a brace ${.....}
- enum tLineState {LS_DEFAULT, LS_OPEN_COMMENT, LS_OPEN_DOUBLE_QUOTE, LS_COMMENT_BOX, LS_MASK_STATE = 0xf,
+ enum tLineState {LS_DEFAULT, LS_OPEN_COMMENT, LS_OPEN_DOUBLE_QUOTE, LS_COMMENT_BOX, LS_MASK_STATE = 0xf,
LS_COMMAND_EXPECTED = 16, LS_BRACE_ONLY = 32 } lineState = LS_DEFAULT;
bool prevSlash = false;
int currentLevel = 0;
@@ -86,7 +90,7 @@ static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *k StyleContext sc(startPos, length, SCE_TCL_DEFAULT, styler);
for (; ; sc.Forward()) {
next:
- if (sc.ch=='\r' && sc.chNext == '\n') // only ignore \r on PC process on the mac
+ if (sc.ch=='\r' && sc.chNext == '\n') // only ignore \r on PC process on the mac
continue;
bool atEnd = !sc.More(); // make sure we coloured the last word
if (lineState != LS_DEFAULT) {
@@ -170,7 +174,7 @@ next: sc.ChangeState(SCE_TCL_WORD7);
} else if (keywords9.InList(s)) {
sc.ChangeState(SCE_TCL_WORD8);
- }
+ }
}
expected = false;
sc.SetState(quote ? SCE_TCL_IN_QUOTE : SCE_TCL_DEFAULT);
@@ -212,7 +216,7 @@ next: } else if (sc.state == SCE_TCL_COMMENT_BOX)
lineState = LS_COMMENT_BOX;
}
- styler.SetLineState(currentLine,
+ styler.SetLineState(currentLine,
(subBrace ? LS_BRACE_ONLY : 0) |
(expected ? LS_COMMAND_EXPECTED : 0) | lineState);
if (lineState == LS_COMMENT_BOX)
@@ -285,7 +289,7 @@ next: if (sc.ch == '\\') {
prevSlash = true;
- continue;
+ continue;
}
// Determine if a new state should be entered.
@@ -322,7 +326,7 @@ next: subParen = 0;
if (sc.chNext != '{') {
sc.SetState(SCE_TCL_SUBSTITUTION);
- }
+ }
else {
sc.SetState(SCE_TCL_OPERATOR); // $
sc.Forward(); // {
diff --git a/scintilla/src/LexTeX.cxx b/scintilla/lexers/LexTeX.cxx index 220cbc6..a7aa53d 100644 --- a/scintilla/src/LexTeX.cxx +++ b/scintilla/lexers/LexTeX.cxx @@ -18,18 +18,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -285,8 +289,8 @@ static void ColouriseTeXDoc( static inline bool isNumber(int ch) {
return
- (ch == '0') || (ch == '1') || (ch == '2') ||
- (ch == '3') || (ch == '4') || (ch == '5') ||
+ (ch == '0') || (ch == '1') || (ch == '2') ||
+ (ch == '3') || (ch == '4') || (ch == '5') ||
(ch == '6') || (ch == '7') || (ch == '8') || (ch == '9');
}
@@ -298,7 +302,7 @@ static int ParseTeXCommand(unsigned int pos, Accessor &styler, char *command) {
int length=0;
char ch=styler.SafeGetCharAt(pos+1);
-
+
if(ch==',' || ch==':' || ch==';' || ch=='%'){
command[0]=ch;
command[1]=0;
@@ -311,14 +315,14 @@ static int ParseTeXCommand(unsigned int pos, Accessor &styler, char *command) length++;
ch=styler.SafeGetCharAt(pos+length+1);
}
-
- command[length]='\0';
+
+ command[length]='\0';
if(!length) return 0;
return length+1;
}
static int classifyFoldPointTeXPaired(const char* s) {
- int lev=0;
+ int lev=0;
if (!(isdigit(s[0]) || (s[0] == '.'))){
if (strcmp(s, "begin")==0||strcmp(s,"FoldStart")==0||
strcmp(s,"abstract")==0||strcmp(s,"unprotect")==0||
@@ -330,14 +334,14 @@ static int classifyFoldPointTeXPaired(const char* s) { strcmp(s,"maketitle")==0||strcmp(s,"protect")==0||
strncmp(s,"stop",4)==0||strncmp(s,"Stop",4)==0||
strcmp(s,"fi")==0
- )
+ )
lev=-1;
}
return lev;
}
static int classifyFoldPointTeXUnpaired(const char* s) {
- int lev=0;
+ int lev=0;
if (!(isdigit(s[0]) || (s[0] == '.'))){
if (strcmp(s,"part")==0||
strcmp(s,"chapter")==0||
@@ -362,7 +366,7 @@ static int classifyFoldPointTeXUnpaired(const char* s) { static bool IsTeXCommentLine(int line, Accessor &styler) {
int pos = styler.LineStart(line);
int eol_pos = styler.LineStart(line + 1) - 1;
-
+
int startpos = pos;
while (startpos<eol_pos){
@@ -370,14 +374,14 @@ static bool IsTeXCommentLine(int line, Accessor &styler) { if (ch!='%' && ch!=' ') return false;
else if (ch=='%') return true;
startpos++;
- }
+ }
return false;
}
// FoldTeXDoc: borrowed from VisualTeX with modifications
-static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
+static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
{
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos+length;
@@ -387,7 +391,7 @@ static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Acc int levelCurrent=levelPrev;
char chNext=styler[startPos];
char buffer[100]="";
-
+
for (unsigned int i=startPos; i < endPos; i++) {
char ch=chNext;
chNext=styler.SafeGetCharAt(i+1);
@@ -412,12 +416,12 @@ static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Acc chNext4=styler.SafeGetCharAt(i+4);
chNext5=styler.SafeGetCharAt(i+5);
- bool atEOfold = (ch == '%') &&
- (chNext == '%') && (chNext2=='}') &&
+ bool atEOfold = (ch == '%') &&
+ (chNext == '%') && (chNext2=='}') &&
(chNext3=='}')&& (chNext4=='-')&& (chNext5=='-');
- bool atBOfold = (ch == '%') &&
- (chNext == '%') && (chNext2=='-') &&
+ bool atBOfold = (ch == '%') &&
+ (chNext == '%') && (chNext2=='-') &&
(chNext3=='-')&& (chNext4=='{')&& (chNext5=='{');
if(atBOfold){
@@ -427,11 +431,11 @@ static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Acc if(atEOfold){
levelCurrent-=1;
}
-
+
if(ch=='\\' && chNext=='['){
levelCurrent+=1;
}
-
+
if(ch=='\\' && chNext==']'){
levelCurrent-=1;
}
@@ -452,8 +456,8 @@ static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Acc levelCurrent--;
}
-//---------------------------------------------------------------------------------------------
-
+//---------------------------------------------------------------------------------------------
+
if (atEOL) {
int lev = levelPrev;
if (visibleChars == 0 && foldCompact)
diff --git a/scintilla/lexers/LexTxt2tags.cxx b/scintilla/lexers/LexTxt2tags.cxx new file mode 100644 index 0000000..aa42995 --- /dev/null +++ b/scintilla/lexers/LexTxt2tags.cxx @@ -0,0 +1,481 @@ +/******************************************************************
+ * LexTxt2tags.cxx
+ *
+ * A simple Txt2tags lexer for scintilla.
+ *
+ *
+ * Adapted by Eric Forgeot
+ * Based on the LexMarkdown.cxx by Jon Strait - jstrait@moonloop.net
+ *
+ * What could be improved:
+ * - Verbatim lines could be like for raw lines : when there is no space between the ``` and the following text, the first letter should be colored so the user would understand there must be a space for a valid tag.
+ * - marks such as bold, italic, strikeout, underline should begin to be highlighted only when they are closed and valid.
+ * - verbatim and raw area should be highlighted too.
+ *
+ * The License.txt file describes the conditions under which this
+ * software may be distributed.
+ *
+ *****************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+
+
+static inline bool IsNewline(const int ch) {
+ return (ch == '\n' || ch == '\r');
+}
+
+// True if can follow ch down to the end with possibly trailing whitespace
+static bool FollowToLineEnd(const int ch, const int state, const unsigned int endPos, StyleContext &sc) {
+ unsigned int i = 0;
+ while (sc.GetRelative(++i) == ch)
+ ;
+ // Skip over whitespace
+ while (IsASpaceOrTab(sc.GetRelative(i)) && sc.currentPos + i < endPos)
+ ++i;
+ if (IsNewline(sc.GetRelative(i)) || sc.currentPos + i == endPos) {
+ sc.Forward(i);
+ sc.ChangeState(state);
+ sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+ return true;
+ }
+ else return false;
+}
+
+// Does the previous line have more than spaces and tabs?
+static bool HasPrevLineContent(StyleContext &sc) {
+ int i = 0;
+ // Go back to the previous newline
+ while ((--i + sc.currentPos) && !IsNewline(sc.GetRelative(i)))
+ ;
+ while (--i + sc.currentPos) {
+ if (IsNewline(sc.GetRelative(i)))
+ break;
+ if (!IsASpaceOrTab(sc.GetRelative(i)))
+ return true;
+ }
+ return false;
+}
+
+// Separator line
+static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {
+ int c, count = 1;
+ unsigned int i = 0;
+ while (++i) {
+ c = sc.GetRelative(i);
+ if (c == sc.ch)
+ ++count;
+ // hit a terminating character
+ else if (!IsASpaceOrTab(c) || sc.currentPos + i == endPos) {
+ // Are we a valid HRULE
+ if ((IsNewline(c) || sc.currentPos + i == endPos) &&
+ count >= 20 && !HasPrevLineContent(sc)) {
+ sc.SetState(SCE_TXT2TAGS_HRULE);
+ sc.Forward(i);
+ sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+ return true;
+ }
+ else {
+ sc.SetState(SCE_TXT2TAGS_DEFAULT);
+ return false;
+ }
+ }
+ }
+ return false;
+}
+
+static void ColorizeTxt2tagsDoc(unsigned int startPos, int length, int initStyle,
+ WordList **, Accessor &styler) {
+ unsigned int endPos = startPos + length;
+ int precharCount = 0;
+ // Don't advance on a new loop iteration and retry at the same position.
+ // Useful in the corner case of having to start at the beginning file position
+ // in the default state.
+ bool freezeCursor = false;
+
+ StyleContext sc(startPos, length, initStyle, styler);
+
+ while (sc.More()) {
+ // Skip past escaped characters
+ if (sc.ch == '\\') {
+ sc.Forward();
+ continue;
+ }
+
+ // A blockquotes resets the line semantics
+ if (sc.state == SCE_TXT2TAGS_BLOCKQUOTE){
+ sc.Forward(2);
+ sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+ }
+ // An option colors the whole line
+ if (sc.state == SCE_TXT2TAGS_OPTION){
+ FollowToLineEnd('%', SCE_TXT2TAGS_OPTION, endPos, sc);
+ }
+ if (sc.state == SCE_TXT2TAGS_POSTPROC){
+ FollowToLineEnd('%', SCE_TXT2TAGS_POSTPROC, endPos, sc);
+ }
+ if (sc.state == SCE_TXT2TAGS_PREPROC){
+ FollowToLineEnd('%', SCE_TXT2TAGS_PREPROC, endPos, sc);
+ }
+ // A comment colors the whole line
+ if (sc.state == SCE_TXT2TAGS_COMMENT){
+ FollowToLineEnd('%', SCE_TXT2TAGS_COMMENT, endPos, sc);
+ }
+ // Conditional state-based actions
+ if (sc.state == SCE_TXT2TAGS_CODE2) {
+ if (IsNewline(sc.ch))
+ sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+ if (sc.Match("``") && sc.GetRelative(-2) != ' ') {
+ sc.Forward(2);
+ sc.SetState(SCE_TXT2TAGS_DEFAULT);
+ }
+ }
+ // Table
+ else if (sc.state == SCE_TXT2TAGS_CODE) {
+ if (IsNewline(sc.ch))
+ sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+ if (sc.ch == '|' && sc.chPrev != ' ')
+ sc.ForwardSetState(SCE_TXT2TAGS_DEFAULT);
+ }
+ // Strong
+ else if (sc.state == SCE_TXT2TAGS_STRONG1) {
+ if (IsNewline(sc.ch))
+ sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+ if (sc.Match("**") && sc.chPrev != ' ') {
+ sc.Forward(2);
+ sc.SetState(SCE_TXT2TAGS_DEFAULT);
+ }
+ }
+ // Emphasis
+ else if (sc.state == SCE_TXT2TAGS_EM1) {
+ if (IsNewline(sc.ch))
+ sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+ if (sc.Match("//") && sc.chPrev != ' ') {
+ sc.Forward(2);
+ sc.ForwardSetState(SCE_TXT2TAGS_DEFAULT);
+ }
+ }
+ // Underline
+ else if (sc.state == SCE_TXT2TAGS_EM2) {
+ if (IsNewline(sc.ch))
+ sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+ if (sc.Match("__") && sc.chPrev != ' ') {
+ sc.Forward(2);
+ sc.ForwardSetState(SCE_TXT2TAGS_DEFAULT);
+ }
+ }
+ // codeblock
+ else if (sc.state == SCE_TXT2TAGS_CODEBK) {
+ if (IsNewline(sc.ch))
+ sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+ if (sc.atLineStart && sc.Match("```")) {
+ int i = 1;
+ while (!IsNewline(sc.GetRelative(i)) && sc.currentPos + i < endPos)
+ i++;
+ sc.Forward(i);
+ sc.SetState(SCE_TXT2TAGS_DEFAULT);
+ }
+ }
+ // strikeout
+ else if (sc.state == SCE_TXT2TAGS_STRIKEOUT) {
+ if (IsNewline(sc.ch))
+ sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+ if (sc.Match("--") && sc.chPrev != ' ') {
+ sc.Forward(2);
+ sc.SetState(SCE_TXT2TAGS_DEFAULT);
+ }
+ }
+ // Headers
+ else if (sc.state == SCE_TXT2TAGS_LINE_BEGIN) {
+ if (sc.Match("======"))
+ {
+ sc.SetState(SCE_TXT2TAGS_HEADER6);
+ sc.Forward();
+ }
+ else if (sc.Match("====="))
+ {
+ sc.SetState(SCE_TXT2TAGS_HEADER5);
+ sc.Forward();
+ }
+ else if (sc.Match("===="))
+ {
+ sc.SetState(SCE_TXT2TAGS_HEADER4);
+ sc.Forward();
+ }
+ else if (sc.Match("==="))
+ {
+ sc.SetState(SCE_TXT2TAGS_HEADER3);
+ sc.Forward();
+ }
+ //SetStateAndZoom(SCE_TXT2TAGS_HEADER3, 3, '=', sc);
+ else if (sc.Match("==")) {
+ sc.SetState(SCE_TXT2TAGS_HEADER2);
+ sc.Forward();
+ }
+ //SetStateAndZoom(SCE_TXT2TAGS_HEADER2, 2, '=', sc);
+ else if (sc.Match("=")) {
+ // Catch the special case of an unordered list
+ if (sc.chNext == '.' && IsASpaceOrTab(sc.GetRelative(2))) {
+ precharCount = 0;
+ sc.SetState(SCE_TXT2TAGS_PRECHAR);
+ }
+ else
+ {
+ sc.SetState(SCE_TXT2TAGS_HEADER1);
+ sc.Forward();
+ }
+ //SetStateAndZoom(SCE_TXT2TAGS_HEADER1, 1, '=', sc);
+ }
+
+ // Numbered title
+ else if (sc.Match("++++++"))
+ {
+ sc.SetState(SCE_TXT2TAGS_HEADER6);
+ sc.Forward();
+ }
+ else if (sc.Match("+++++"))
+ {
+ sc.SetState(SCE_TXT2TAGS_HEADER5);
+ sc.Forward();
+ }
+ else if (sc.Match("++++"))
+ {
+ sc.SetState(SCE_TXT2TAGS_HEADER4);
+ sc.Forward();
+ }
+ else if (sc.Match("+++"))
+ {
+ sc.SetState(SCE_TXT2TAGS_HEADER3);
+ sc.Forward();
+ }
+ //SetStateAndZoom(SCE_TXT2TAGS_HEADER3, 3, '+', sc);
+ else if (sc.Match("++")) {
+ sc.SetState(SCE_TXT2TAGS_HEADER2);
+ sc.Forward();
+ }
+ //SetStateAndZoom(SCE_TXT2TAGS_HEADER2, 2, '+', sc);
+ else if (sc.Match("+")) {
+ // Catch the special case of an unordered list
+ if (sc.chNext == ' ' && IsASpaceOrTab(sc.GetRelative(1))) {
+ // if (IsNewline(sc.ch)) {
+ //precharCount = 0;
+ // sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+ //sc.SetState(SCE_TXT2TAGS_PRECHAR);
+ // }
+ // else {
+ // precharCount = 0;
+ sc.SetState(SCE_TXT2TAGS_OLIST_ITEM);
+ sc.Forward(2);
+ sc.SetState(SCE_TXT2TAGS_DEFAULT);
+ // sc.SetState(SCE_TXT2TAGS_PRECHAR);
+ // }
+ }
+ else
+ {
+ sc.SetState(SCE_TXT2TAGS_HEADER1);
+ sc.Forward();
+ }
+ }
+
+
+ // Codeblock
+ else if (sc.Match("```")) {
+ if (!HasPrevLineContent(sc))
+ // if (!FollowToLineEnd(sc))
+ sc.SetState(SCE_TXT2TAGS_CODEBK);
+ else
+ sc.SetState(SCE_TXT2TAGS_DEFAULT);
+ }
+
+ // Preproc
+ else if (sc.Match("%!preproc")) {
+ sc.SetState(SCE_TXT2TAGS_PREPROC);
+ }
+ // Postproc
+ else if (sc.Match("%!postproc")) {
+ sc.SetState(SCE_TXT2TAGS_POSTPROC);
+ }
+ // Option
+ else if (sc.Match("%!")) {
+ sc.SetState(SCE_TXT2TAGS_OPTION);
+ }
+
+ // Comment
+ else if (sc.ch == '%') {
+ sc.SetState(SCE_TXT2TAGS_COMMENT);
+ }
+ // list
+ else if (sc.ch == '-') {
+ precharCount = 0;
+ sc.SetState(SCE_TXT2TAGS_PRECHAR);
+ }
+ // def list
+ else if (sc.ch == ':') {
+ precharCount = 0;
+ sc.SetState(SCE_TXT2TAGS_OLIST_ITEM);
+ sc.Forward(1);
+ sc.SetState(SCE_TXT2TAGS_PRECHAR);
+ }
+ else if (IsNewline(sc.ch))
+ sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+ else {
+ precharCount = 0;
+ sc.SetState(SCE_TXT2TAGS_PRECHAR);
+ }
+ }
+
+ // The header lasts until the newline
+ else if (sc.state == SCE_TXT2TAGS_HEADER1 || sc.state == SCE_TXT2TAGS_HEADER2 ||
+ sc.state == SCE_TXT2TAGS_HEADER3 || sc.state == SCE_TXT2TAGS_HEADER4 ||
+ sc.state == SCE_TXT2TAGS_HEADER5 || sc.state == SCE_TXT2TAGS_HEADER6) {
+ if (IsNewline(sc.ch))
+ sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+ }
+
+ // New state only within the initial whitespace
+ if (sc.state == SCE_TXT2TAGS_PRECHAR) {
+ // Blockquote
+ if (sc.Match("\"\"\"") && precharCount < 5){
+
+ sc.SetState(SCE_TXT2TAGS_BLOCKQUOTE);
+ sc.Forward(1);
+ }
+ /*
+ // Begin of code block
+ else if (!HasPrevLineContent(sc) && (sc.chPrev == '\t' || precharCount >= 4))
+ sc.SetState(SCE_TXT2TAGS_CODEBK);
+ */
+ // HRule - Total of 20 or more hyphens, asterisks, or underscores
+ // on a line by themselves
+ else if ((sc.ch == '-' ) && IsValidHrule(endPos, sc))
+ ;
+ // Unordered list
+ else if ((sc.ch == '-') && IsASpaceOrTab(sc.chNext)) {
+ sc.SetState(SCE_TXT2TAGS_ULIST_ITEM);
+ sc.ForwardSetState(SCE_TXT2TAGS_DEFAULT);
+ }
+ // Ordered list
+ else if (IsADigit(sc.ch)) {
+ int digitCount = 0;
+ while (IsADigit(sc.GetRelative(++digitCount)))
+ ;
+ if (sc.GetRelative(digitCount) == '.' &&
+ IsASpaceOrTab(sc.GetRelative(digitCount + 1))) {
+ sc.SetState(SCE_TXT2TAGS_OLIST_ITEM);
+ sc.Forward(digitCount + 1);
+ sc.SetState(SCE_TXT2TAGS_DEFAULT);
+ }
+ }
+ // Alternate Ordered list
+ else if (sc.ch == '+' && sc.chNext == ' ' && IsASpaceOrTab(sc.GetRelative(2))) {
+ // sc.SetState(SCE_TXT2TAGS_OLIST_ITEM);
+ // sc.Forward(2);
+ // sc.SetState(SCE_TXT2TAGS_DEFAULT);
+ }
+ else if (sc.ch != ' ' || precharCount > 2)
+ sc.SetState(SCE_TXT2TAGS_DEFAULT);
+ else
+ ++precharCount;
+ }
+
+ // New state anywhere in doc
+ if (sc.state == SCE_TXT2TAGS_DEFAULT) {
+ // if (sc.atLineStart && sc.ch == '#') {
+ // sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+ // freezeCursor = true;
+ // }
+ // Links and Images
+ if (sc.Match("![") || sc.ch == '[') {
+ int i = 0, j = 0, k = 0;
+ int len = endPos - sc.currentPos;
+ while (i < len && (sc.GetRelative(++i) != ']' || sc.GetRelative(i - 1) == '\\'))
+ ;
+ if (sc.GetRelative(i) == ']') {
+ j = i;
+ if (sc.GetRelative(++i) == '(') {
+ while (i < len && (sc.GetRelative(++i) != '(' || sc.GetRelative(i - 1) == '\\'))
+ ;
+ if (sc.GetRelative(i) == '(')
+ k = i;
+ }
+
+ else if (sc.GetRelative(i) == '[' || sc.GetRelative(++i) == '[') {
+ while (i < len && (sc.GetRelative(++i) != ']' || sc.GetRelative(i - 1) == '\\'))
+ ;
+ if (sc.GetRelative(i) == ']')
+ k = i;
+ }
+ }
+ // At least a link text
+ if (j) {
+ sc.SetState(SCE_TXT2TAGS_LINK);
+ sc.Forward(j);
+ // Also has a URL or reference portion
+ if (k)
+ sc.Forward(k - j);
+ sc.ForwardSetState(SCE_TXT2TAGS_DEFAULT);
+ }
+ }
+ // Code - also a special case for alternate inside spacing
+ if (sc.Match("``") && sc.GetRelative(3) != ' ') {
+ sc.SetState(SCE_TXT2TAGS_CODE2);
+ sc.Forward();
+ }
+ else if (sc.ch == '|' && sc.GetRelative(3) != ' ') {
+ sc.SetState(SCE_TXT2TAGS_CODE);
+ }
+ // Strong
+ else if (sc.Match("**") && sc.GetRelative(2) != ' ') {
+ sc.SetState(SCE_TXT2TAGS_STRONG1);
+ sc.Forward();
+ }
+ // Emphasis
+ else if (sc.Match("//") && sc.GetRelative(2) != ' ') {
+ sc.SetState(SCE_TXT2TAGS_EM1);
+ sc.Forward();
+ }
+ else if (sc.Match("__") && sc.GetRelative(2) != ' ') {
+ sc.SetState(SCE_TXT2TAGS_EM2);
+ sc.Forward();
+ }
+ // Strikeout
+ else if (sc.Match("--") && sc.GetRelative(2) != ' ') {
+ sc.SetState(SCE_TXT2TAGS_STRIKEOUT);
+ sc.Forward();
+ }
+
+ // Beginning of line
+ else if (IsNewline(sc.ch))
+ sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+ }
+ // Advance if not holding back the cursor for this iteration.
+ if (!freezeCursor)
+ sc.Forward();
+ freezeCursor = false;
+ }
+ sc.Complete();
+}
+
+LexerModule lmTxt2tags(SCLEX_TXT2TAGS, ColorizeTxt2tagsDoc, "txt2tags");
+
+
diff --git a/scintilla/src/LexVB.cxx b/scintilla/lexers/LexVB.cxx index 511d244..5bb69ae 100644 --- a/scintilla/src/LexVB.cxx +++ b/scintilla/lexers/LexVB.cxx @@ -7,18 +7,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexVHDL.cxx b/scintilla/lexers/LexVHDL.cxx index ff13857..4a2ffea 100644 --- a/scintilla/src/LexVHDL.cxx +++ b/scintilla/lexers/LexVHDL.cxx @@ -15,15 +15,19 @@ #include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -101,7 +105,7 @@ static void ColouriseVHDLDoc( }
sc.SetState(SCE_VHDL_DEFAULT);
}
- } else if (sc.state == SCE_VHDL_COMMENT || sc.state == SCE_V_COMMENTLINEBANG) {
+ } else if (sc.state == SCE_VHDL_COMMENT || sc.state == SCE_VHDL_COMMENTLINEBANG) {
if (sc.atLineEnd) {
sc.SetState(SCE_VHDL_DEFAULT);
}
@@ -113,7 +117,7 @@ static void ColouriseVHDLDoc( } else if (sc.ch == '\"') {
sc.ForwardSetState(SCE_VHDL_DEFAULT);
} else if (sc.atLineEnd) {
- sc.ChangeState(SCE_V_STRINGEOL);
+ sc.ChangeState(SCE_VHDL_STRINGEOL);
sc.ForwardSetState(SCE_VHDL_DEFAULT);
}
}
diff --git a/scintilla/src/LexVerilog.cxx b/scintilla/lexers/LexVerilog.cxx index 4a94acc..77f4fd0 100644 --- a/scintilla/src/LexVerilog.cxx +++ b/scintilla/lexers/LexVerilog.cxx @@ -8,18 +8,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
diff --git a/scintilla/src/LexYAML.cxx b/scintilla/lexers/LexYAML.cxx index 9f1e746..75d3d02 100644 --- a/scintilla/src/LexYAML.cxx +++ b/scintilla/lexers/LexYAML.cxx @@ -7,18 +7,22 @@ #include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
-#include "Platform.h"
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
-#include "PropSet.h"
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -270,7 +274,7 @@ static void FoldYAMLDoc(unsigned int startPos, int length, int /*initStyle - unu }
const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK;
- const int levelBeforeComments = Platform::Maximum(indentCurrentLevel,levelAfterComments);
+ const int levelBeforeComments = Maximum(indentCurrentLevel,levelAfterComments);
// Now set all the indent levels on the lines we skipped
// Do this from end to start. Once we encounter one line
diff --git a/scintilla/lexlib/Accessor.cxx b/scintilla/lexlib/Accessor.cxx new file mode 100644 index 0000000..c180665 --- /dev/null +++ b/scintilla/lexlib/Accessor.cxx @@ -0,0 +1,79 @@ +// Scintilla source code edit control
+/** @file KeyWords.cxx
+ ** Colourise for particular languages.
+ **/
+// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
+
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+Accessor::Accessor(IDocument *pAccess_, PropSetSimple *pprops_) : LexAccessor(pAccess_), pprops(pprops_) {
+}
+
+int Accessor::GetPropertyInt(const char *key, int defaultValue) {
+ return pprops->GetInt(key, defaultValue);
+}
+
+int Accessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) {
+ int end = Length();
+ int spaceFlags = 0;
+
+ // Determines the indentation level of the current line and also checks for consistent
+ // indentation compared to the previous line.
+ // Indentation is judged consistent when the indentation whitespace of each line lines
+ // the same or the indentation of one line is a prefix of the other.
+
+ int pos = LineStart(line);
+ char ch = (*this)[pos];
+ int indent = 0;
+ bool inPrevPrefix = line > 0;
+ int posPrev = inPrevPrefix ? LineStart(line-1) : 0;
+ while ((ch == ' ' || ch == '\t') && (pos < end)) {
+ if (inPrevPrefix) {
+ char chPrev = (*this)[posPrev++];
+ if (chPrev == ' ' || chPrev == '\t') {
+ if (chPrev != ch)
+ spaceFlags |= wsInconsistent;
+ } else {
+ inPrevPrefix = false;
+ }
+ }
+ if (ch == ' ') {
+ spaceFlags |= wsSpace;
+ indent++;
+ } else { // Tab
+ spaceFlags |= wsTab;
+ if (spaceFlags & wsSpace)
+ spaceFlags |= wsSpaceTab;
+ indent = (indent / 8 + 1) * 8;
+ }
+ ch = (*this)[++pos];
+ }
+
+ *flags = spaceFlags;
+ indent += SC_FOLDLEVELBASE;
+ // if completely empty line or the start of a comment...
+ if ((ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') ||
+ (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)))
+ return indent | SC_FOLDLEVELWHITEFLAG;
+ else
+ return indent;
+}
diff --git a/scintilla/lexlib/Accessor.h b/scintilla/lexlib/Accessor.h new file mode 100644 index 0000000..74d42e0 --- /dev/null +++ b/scintilla/lexlib/Accessor.h @@ -0,0 +1,35 @@ +// Scintilla source code edit control
+/** @file Accessor.h
+ ** Interfaces between Scintilla and lexers.
+ **/
+// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef ACCESSOR_H
+#define ACCESSOR_H
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8};
+
+class Accessor;
+class WordList;
+class PropSetSimple;
+
+typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len);
+
+class Accessor : public LexAccessor {
+public:
+ PropSetSimple *pprops;
+ Accessor(IDocument *pAccess_, PropSetSimple *pprops_);
+ int GetPropertyInt(const char *, int defaultValue=0);
+ int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
+};
+
+#ifdef SCI_NAMESPACE
+}
+#endif
+
+#endif
diff --git a/scintilla/lexlib/CharacterSet.cxx b/scintilla/lexlib/CharacterSet.cxx new file mode 100644 index 0000000..86e08a1 --- /dev/null +++ b/scintilla/lexlib/CharacterSet.cxx @@ -0,0 +1,61 @@ +// Scintilla source code edit control
+/** @file CharacterSet.cxx
+ ** Simple case functions for ASCII.
+ ** Lexer infrastructure.
+ **/
+// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <assert.h>
+
+#include "CharacterSet.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+int CompareCaseInsensitive(const char *a, const char *b) {
+ while (*a && *b) {
+ if (*a != *b) {
+ char upperA = MakeUpperCase(*a);
+ char upperB = MakeUpperCase(*b);
+ if (upperA != upperB)
+ return upperA - upperB;
+ }
+ a++;
+ b++;
+ }
+ // Either *a or *b is nul
+ return *a - *b;
+}
+
+int CompareNCaseInsensitive(const char *a, const char *b, size_t len) {
+ while (*a && *b && len) {
+ if (*a != *b) {
+ char upperA = MakeUpperCase(*a);
+ char upperB = MakeUpperCase(*b);
+ if (upperA != upperB)
+ return upperA - upperB;
+ }
+ a++;
+ b++;
+ len--;
+ }
+ if (len == 0)
+ return 0;
+ else
+ // Either *a or *b is nul
+ return *a - *b;
+}
+
+#ifdef SCI_NAMESPACE
+}
+#endif
diff --git a/scintilla/lexlib/CharacterSet.h b/scintilla/lexlib/CharacterSet.h new file mode 100644 index 0000000..2ac21c5 --- /dev/null +++ b/scintilla/lexlib/CharacterSet.h @@ -0,0 +1,149 @@ +// Scintilla source code edit control
+/** @file CharacterSet.h
+ ** Encapsulates a set of characters. Used to test if a character is within a set.
+ **/
+// Copyright 2007 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef CHARACTERSET_H
+#define CHARACTERSET_H
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+class CharacterSet {
+ int size;
+ bool valueAfter;
+ bool *bset;
+public:
+ enum setBase {
+ setNone=0,
+ setLower=1,
+ setUpper=2,
+ setDigits=4,
+ setAlpha=setLower|setUpper,
+ setAlphaNum=setAlpha|setDigits
+ };
+ CharacterSet(setBase base=setNone, const char *initialSet="", int size_=0x80, bool valueAfter_=false) {
+ size = size_;
+ valueAfter = valueAfter_;
+ bset = new bool[size];
+ for (int i=0; i < size; i++) {
+ bset[i] = false;
+ }
+ AddString(initialSet);
+ if (base & setLower)
+ AddString("abcdefghijklmnopqrstuvwxyz");
+ if (base & setUpper)
+ AddString("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ if (base & setDigits)
+ AddString("0123456789");
+ }
+ ~CharacterSet() {
+ delete []bset;
+ bset = 0;
+ size = 0;
+ }
+ void Add(int val) {
+ assert(val >= 0);
+ assert(val < size);
+ bset[val] = true;
+ }
+ void AddString(const char *CharacterSet) {
+ for (const char *cp=CharacterSet; *cp; cp++) {
+ int val = static_cast<unsigned char>(*cp);
+ assert(val >= 0);
+ assert(val < size);
+ bset[val] = true;
+ }
+ }
+ bool Contains(int val) const {
+ assert(val >= 0);
+ if (val < 0) return false;
+ return (val < size) ? bset[val] : valueAfter;
+ }
+};
+
+// Functions for classifying characters
+
+inline bool IsASpace(int ch) {
+ return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
+}
+
+inline bool IsASpaceOrTab(int ch) {
+ return (ch == ' ') || (ch == '\t');
+}
+
+inline bool IsADigit(int ch) {
+ return (ch >= '0') && (ch <= '9');
+}
+
+inline bool IsADigit(int ch, int base) {
+ if (base <= 10) {
+ return (ch >= '0') && (ch < '0' + base);
+ } else {
+ return ((ch >= '0') && (ch <= '9')) ||
+ ((ch >= 'A') && (ch < 'A' + base - 10)) ||
+ ((ch >= 'a') && (ch < 'a' + base - 10));
+ }
+}
+
+inline bool IsASCII(int ch) {
+ return ch < 0x80;
+}
+
+inline bool IsAlphaNumeric(int ch) {
+ return
+ ((ch >= '0') && (ch <= '9')) ||
+ ((ch >= 'a') && (ch <= 'z')) ||
+ ((ch >= 'A') && (ch <= 'Z'));
+}
+
+/**
+ * Check if a character is a space.
+ * This is ASCII specific but is safe with chars >= 0x80.
+ */
+inline bool isspacechar(int ch) {
+ return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
+}
+
+inline bool iswordchar(int ch) {
+ return IsASCII(ch) && (IsAlphaNumeric(ch) || ch == '.' || ch == '_');
+}
+
+inline bool iswordstart(int ch) {
+ return IsASCII(ch) && (IsAlphaNumeric(ch) || ch == '_');
+}
+
+inline bool isoperator(int ch) {
+ if (IsASCII(ch) && IsAlphaNumeric(ch))
+ return false;
+ // '.' left out as it is used to make up numbers
+ if (ch == '%' || ch == '^' || ch == '&' || ch == '*' ||
+ ch == '(' || ch == ')' || ch == '-' || ch == '+' ||
+ ch == '=' || ch == '|' || ch == '{' || ch == '}' ||
+ ch == '[' || ch == ']' || ch == ':' || ch == ';' ||
+ ch == '<' || ch == '>' || ch == ',' || ch == '/' ||
+ ch == '?' || ch == '!' || ch == '.' || ch == '~')
+ return true;
+ return false;
+}
+
+// Simple case functions for ASCII.
+
+inline char MakeUpperCase(char ch) {
+ if (ch < 'a' || ch > 'z')
+ return ch;
+ else
+ return static_cast<char>(ch - 'a' + 'A');
+}
+
+int CompareCaseInsensitive(const char *a, const char *b);
+int CompareNCaseInsensitive(const char *a, const char *b, size_t len);
+
+#ifdef SCI_NAMESPACE
+}
+#endif
+
+#endif
diff --git a/scintilla/lexlib/LexAccessor.h b/scintilla/lexlib/LexAccessor.h new file mode 100644 index 0000000..0ad7bc1 --- /dev/null +++ b/scintilla/lexlib/LexAccessor.h @@ -0,0 +1,175 @@ +// Scintilla source code edit control
+/** @file LexAccessor.h
+ ** Interfaces between Scintilla and lexers.
+ **/
+// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef LEXACCESSOR_H
+#define LEXACCESSOR_H
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+class LexAccessor {
+private:
+ IDocument *pAccess;
+ enum {extremePosition=0x7FFFFFFF};
+ /** @a bufferSize is a trade off between time taken to copy the characters
+ * and retrieval overhead.
+ * @a slopSize positions the buffer before the desired position
+ * in case there is some backtracking. */
+ enum {bufferSize=4000, slopSize=bufferSize/8};
+ char buf[bufferSize+1];
+ int startPos;
+ int endPos;
+ int codePage;
+ int lenDoc;
+ int mask;
+ char styleBuf[bufferSize];
+ int validLen;
+ char chFlags;
+ char chWhile;
+ unsigned int startSeg;
+ int startPosStyling;
+
+ void Fill(int position) {
+ startPos = position - slopSize;
+ if (startPos + bufferSize > lenDoc)
+ startPos = lenDoc - bufferSize;
+ if (startPos < 0)
+ startPos = 0;
+ endPos = startPos + bufferSize;
+ if (endPos > lenDoc)
+ endPos = lenDoc;
+
+ pAccess->GetCharRange(buf, startPos, endPos-startPos);
+ buf[endPos-startPos] = '\0';
+ }
+
+public:
+ LexAccessor(IDocument *pAccess_) :
+ pAccess(pAccess_), startPos(extremePosition), endPos(0),
+ codePage(pAccess->CodePage()), lenDoc(pAccess->Length()),
+ mask(127), validLen(0), chFlags(0), chWhile(0),
+ startSeg(0), startPosStyling(0) {
+ }
+ char operator[](int position) {
+ if (position < startPos || position >= endPos) {
+ Fill(position);
+ }
+ return buf[position - startPos];
+ }
+ /** Safe version of operator[], returning a defined value for invalid position. */
+ char SafeGetCharAt(int position, char chDefault=' ') {
+ if (position < startPos || position >= endPos) {
+ Fill(position);
+ if (position < startPos || position >= endPos) {
+ // Position is outside range of document
+ return chDefault;
+ }
+ }
+ return buf[position - startPos];
+ }
+ bool IsLeadByte(char ch) {
+ return pAccess->IsDBCSLeadByte(ch);
+ }
+
+ bool Match(int pos, const char *s) {
+ for (int i=0; *s; i++) {
+ if (*s != SafeGetCharAt(pos+i))
+ return false;
+ s++;
+ }
+ return true;
+ }
+ char StyleAt(int position) {
+ return static_cast<char>(pAccess->StyleAt(position) & mask);
+ }
+ int GetLine(int position) {
+ return pAccess->LineFromPosition(position);
+ }
+ int LineStart(int line) {
+ return pAccess->LineStart(line);
+ }
+ int LevelAt(int line) {
+ return pAccess->GetLevel(line);
+ }
+ int Length() const {
+ return lenDoc;
+ }
+ void Flush() {
+ startPos = extremePosition;
+ if (validLen > 0) {
+ pAccess->SetStyles(validLen, styleBuf);
+ startPosStyling += validLen;
+ validLen = 0;
+ }
+ }
+ int GetLineState(int line) {
+ return pAccess->GetLineState(line);
+ }
+ int SetLineState(int line, int state) {
+ return pAccess->SetLineState(line, state);
+ }
+ // Style setting
+ void StartAt(unsigned int start, char chMask=31) {
+ // Store the mask specified for use with StyleAt.
+ mask = chMask;
+ pAccess->StartStyling(start, chMask);
+ startPosStyling = start;
+ }
+ void SetFlags(char chFlags_, char chWhile_) {
+ chFlags = chFlags_;
+ chWhile = chWhile_;
+ }
+ unsigned int GetStartSegment() const {
+ return startSeg;
+ }
+ void StartSegment(unsigned int pos) {
+ startSeg = pos;
+ }
+ void ColourTo(unsigned int pos, int chAttr) {
+ // Only perform styling if non empty range
+ if (pos != startSeg - 1) {
+ assert(pos >= startSeg);
+ if (pos < startSeg) {
+ return;
+ }
+
+ if (validLen + (pos - startSeg + 1) >= bufferSize)
+ Flush();
+ if (validLen + (pos - startSeg + 1) >= bufferSize) {
+ // Too big for buffer so send directly
+ pAccess->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr));
+ } else {
+ if (chAttr != chWhile)
+ chFlags = 0;
+ chAttr |= chFlags;
+ for (unsigned int i = startSeg; i <= pos; i++) {
+ assert((startPosStyling + validLen) < Length());
+ styleBuf[validLen++] = static_cast<char>(chAttr);
+ }
+ }
+ }
+ startSeg = pos+1;
+ }
+ void SetLevel(int line, int level) {
+ pAccess->SetLevel(line, level);
+ }
+ void IndicatorFill(int start, int end, int indicator, int value) {
+ pAccess->DecorationSetCurrentIndicator(indicator);
+ pAccess->DecorationFillRange(start, value, end - start);
+ }
+
+ void ChangeLexerState(int start, int end) {
+ pAccess->ChangeLexerState(start, end);
+ }
+};
+
+#ifdef SCI_NAMESPACE
+}
+#endif
+
+#endif
diff --git a/scintilla/lexlib/LexerBase.cxx b/scintilla/lexlib/LexerBase.cxx new file mode 100644 index 0000000..e2791ec --- /dev/null +++ b/scintilla/lexlib/LexerBase.cxx @@ -0,0 +1,92 @@ +// Scintilla source code edit control
+/** @file LexerSimple.cxx
+ ** A simple lexer with no state.
+ **/
+// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
+
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "LexerModule.h"
+#include "LexerBase.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+LexerBase::LexerBase() {
+ for (int wl = 0; wl < numWordLists; wl++)
+ keyWordLists[wl] = new WordList;
+ keyWordLists[numWordLists] = 0;
+}
+
+LexerBase::~LexerBase() {
+ for (int wl = 0; wl < numWordLists; wl++) {
+ delete keyWordLists[wl];
+ keyWordLists[wl] = 0;
+ }
+ keyWordLists[numWordLists] = 0;
+}
+
+void SCI_METHOD LexerBase::Release() {
+ delete this;
+}
+
+int SCI_METHOD LexerBase::Version() const {
+ return lvOriginal;
+}
+
+const char * SCI_METHOD LexerBase::PropertyNames() {
+ return "";
+}
+
+int SCI_METHOD LexerBase::PropertyType(const char *) {
+ return SC_TYPE_BOOLEAN;
+}
+
+const char * SCI_METHOD LexerBase::DescribeProperty(const char *) {
+ return "";
+}
+
+int SCI_METHOD LexerBase::PropertySet(const char *key, const char *val) {
+ const char *valOld = props.Get(key);
+ if (strcmp(val, valOld) != 0) {
+ props.Set(key, val);
+ return 0;
+ } else {
+ return -1;
+ }
+}
+
+const char * SCI_METHOD LexerBase::DescribeWordListSets() {
+ return "";
+}
+
+int SCI_METHOD LexerBase::WordListSet(int n, const char *wl) {
+ if (n < numWordLists) {
+ WordList wlNew;
+ wlNew.Set(wl);
+ if (*keyWordLists[n] != wlNew) {
+ keyWordLists[n]->Set(wl);
+ return 0;
+ }
+ }
+ return -1;
+}
+
+void * SCI_METHOD LexerBase::PrivateCall(int, void *) {
+ return 0;
+}
diff --git a/scintilla/lexlib/LexerBase.h b/scintilla/lexlib/LexerBase.h new file mode 100644 index 0000000..0d38bc4 --- /dev/null +++ b/scintilla/lexlib/LexerBase.h @@ -0,0 +1,41 @@ +// Scintilla source code edit control
+/** @file LexerBase.h
+ ** A simple lexer with no state.
+ **/
+// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef LEXERBASE_H
+#define LEXERBASE_H
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+// A simple lexer with no state
+class LexerBase : public ILexer {
+protected:
+ PropSetSimple props;
+ enum {numWordLists=KEYWORDSET_MAX+1};
+ WordList *keyWordLists[numWordLists+1];
+public:
+ LexerBase();
+ ~LexerBase();
+ void SCI_METHOD Release();
+ int SCI_METHOD Version() const;
+ const char * SCI_METHOD PropertyNames();
+ int SCI_METHOD PropertyType(const char *name);
+ const char * SCI_METHOD DescribeProperty(const char *name);
+ int SCI_METHOD PropertySet(const char *key, const char *val);
+ const char * SCI_METHOD DescribeWordListSets();
+ int SCI_METHOD WordListSet(int n, const char *wl);
+ void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0;
+ void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0;
+ void * SCI_METHOD PrivateCall(int operation, void *pointer);
+};
+
+#ifdef SCI_NAMESPACE
+}
+#endif
+
+#endif
diff --git a/scintilla/lexlib/LexerModule.cxx b/scintilla/lexlib/LexerModule.cxx new file mode 100644 index 0000000..4b1aa6d --- /dev/null +++ b/scintilla/lexlib/LexerModule.cxx @@ -0,0 +1,121 @@ +// Scintilla source code edit control
+/** @file LexerModule.cxx
+ ** Colourise for particular languages.
+ **/
+// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
+
+#include <string>
+
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "LexerModule.h"
+#include "LexerBase.h"
+#include "LexerSimple.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+LexerModule::LexerModule(int language_,
+ LexerFunction fnLexer_,
+ const char *languageName_,
+ LexerFunction fnFolder_,
+ const char *const wordListDescriptions_[],
+ int styleBits_) :
+ language(language_),
+ fnLexer(fnLexer_),
+ fnFolder(fnFolder_),
+ fnFactory(0),
+ wordListDescriptions(wordListDescriptions_),
+ styleBits(styleBits_),
+ languageName(languageName_) {
+}
+
+LexerModule::LexerModule(int language_,
+ LexerFactoryFunction fnFactory_,
+ const char *languageName_,
+ const char * const wordListDescriptions_[],
+ int styleBits_) :
+ language(language_),
+ fnLexer(0),
+ fnFolder(0),
+ fnFactory(fnFactory_),
+ wordListDescriptions(wordListDescriptions_),
+ styleBits(styleBits_),
+ languageName(languageName_) {
+}
+
+int LexerModule::GetNumWordLists() const {
+ if (wordListDescriptions == NULL) {
+ return -1;
+ } else {
+ int numWordLists = 0;
+
+ while (wordListDescriptions[numWordLists]) {
+ ++numWordLists;
+ }
+
+ return numWordLists;
+ }
+}
+
+const char *LexerModule::GetWordListDescription(int index) const {
+ static const char *emptyStr = "";
+
+ assert(index < GetNumWordLists());
+ if (index >= GetNumWordLists()) {
+ return emptyStr;
+ } else {
+ return wordListDescriptions[index];
+ }
+}
+
+int LexerModule::GetStyleBitsNeeded() const {
+ return styleBits;
+}
+
+ILexer *LexerModule::Create() const {
+ if (fnFactory)
+ return fnFactory();
+ else
+ return new LexerSimple(this);
+}
+
+void LexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle,
+ WordList *keywordlists[], Accessor &styler) const {
+ if (fnLexer)
+ fnLexer(startPos, lengthDoc, initStyle, keywordlists, styler);
+}
+
+void LexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle,
+ WordList *keywordlists[], Accessor &styler) const {
+ if (fnFolder) {
+ int lineCurrent = styler.GetLine(startPos);
+ // Move back one line in case deletion wrecked current line fold state
+ if (lineCurrent > 0) {
+ lineCurrent--;
+ int newStartPos = styler.LineStart(lineCurrent);
+ lengthDoc += startPos - newStartPos;
+ startPos = newStartPos;
+ initStyle = 0;
+ if (startPos > 0) {
+ initStyle = styler.StyleAt(startPos - 1);
+ }
+ }
+ fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler);
+ }
+}
diff --git a/scintilla/lexlib/LexerModule.h b/scintilla/lexlib/LexerModule.h new file mode 100644 index 0000000..22f4a60 --- /dev/null +++ b/scintilla/lexlib/LexerModule.h @@ -0,0 +1,82 @@ +// Scintilla source code edit control
+/** @file LexerModule.h
+ ** Colourise for particular languages.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef LEXERMODULE_H
+#define LEXERMODULE_H
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+class Accessor;
+class WordList;
+
+typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
+ WordList *keywordlists[], Accessor &styler);
+typedef ILexer *(*LexerFactoryFunction)();
+
+/**
+ * A LexerModule is responsible for lexing and folding a particular language.
+ * The class maintains a list of LexerModules which can be searched to find a
+ * module appropriate to a particular language.
+ */
+class LexerModule {
+protected:
+ int language;
+ LexerFunction fnLexer;
+ LexerFunction fnFolder;
+ LexerFactoryFunction fnFactory;
+ const char * const * wordListDescriptions;
+ int styleBits;
+
+public:
+ const char *languageName;
+ LexerModule(int language_,
+ LexerFunction fnLexer_,
+ const char *languageName_=0,
+ LexerFunction fnFolder_=0,
+ const char * const wordListDescriptions_[] = NULL,
+ int styleBits_=5);
+ LexerModule(int language_,
+ LexerFactoryFunction fnFactory_,
+ const char *languageName_,
+ const char * const wordListDescriptions_[] = NULL,
+ int styleBits_=8);
+ virtual ~LexerModule() {
+ }
+ int GetLanguage() const { return language; }
+
+ // -1 is returned if no WordList information is available
+ int GetNumWordLists() const;
+ const char *GetWordListDescription(int index) const;
+
+ int GetStyleBitsNeeded() const;
+
+ ILexer *Create() const;
+
+ virtual void Lex(unsigned int startPos, int length, int initStyle,
+ WordList *keywordlists[], Accessor &styler) const;
+ virtual void Fold(unsigned int startPos, int length, int initStyle,
+ WordList *keywordlists[], Accessor &styler) const;
+
+ friend class Catalogue;
+};
+
+inline int Maximum(int a, int b) {
+ return (a > b) ? a : b;
+}
+
+// Shut up annoying Visual C++ warnings:
+#ifdef _MSC_VER
+#pragma warning(disable: 4244 4309 4514 4710)
+#endif
+
+#ifdef SCI_NAMESPACE
+}
+#endif
+
+#endif
diff --git a/scintilla/lexlib/LexerNoExceptions.cxx b/scintilla/lexlib/LexerNoExceptions.cxx new file mode 100644 index 0000000..e179a74 --- /dev/null +++ b/scintilla/lexlib/LexerNoExceptions.cxx @@ -0,0 +1,68 @@ +// Scintilla source code edit control
+/** @file LexerNoExceptions.cxx
+ ** A simple lexer with no state which does not throw exceptions so can be used in an external lexer.
+ **/
+// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
+
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "LexerModule.h"
+#include "LexerBase.h"
+#include "LexerNoExceptions.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+int SCI_METHOD LexerNoExceptions::PropertySet(const char *key, const char *val) {
+ try {
+ return LexerBase::PropertySet(key, val);
+ } catch (...) {
+ // Should not throw into caller as may be compiled with different compiler or options
+ }
+ return -1;
+}
+
+int SCI_METHOD LexerNoExceptions::WordListSet(int n, const char *wl) {
+ try {
+ return LexerBase::WordListSet(n, wl);
+ } catch (...) {
+ // Should not throw into caller as may be compiled with different compiler or options
+ }
+ return -1;
+}
+
+void SCI_METHOD LexerNoExceptions::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+ try {
+ Accessor astyler(pAccess, &props);
+ Lexer(startPos, length, initStyle, pAccess, astyler);
+ astyler.Flush();
+ } catch (...) {
+ // Should not throw into caller as may be compiled with different compiler or options
+ pAccess->SetErrorStatus(SC_STATUS_FAILURE);
+ }
+}
+void SCI_METHOD LexerNoExceptions::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+ try {
+ Accessor astyler(pAccess, &props);
+ Folder(startPos, length, initStyle, pAccess, astyler);
+ astyler.Flush();
+ } catch (...) {
+ // Should not throw into caller as may be compiled with different compiler or options
+ pAccess->SetErrorStatus(SC_STATUS_FAILURE);
+ }
+}
diff --git a/scintilla/lexlib/LexerNoExceptions.h b/scintilla/lexlib/LexerNoExceptions.h new file mode 100644 index 0000000..90219c8 --- /dev/null +++ b/scintilla/lexlib/LexerNoExceptions.h @@ -0,0 +1,32 @@ +// Scintilla source code edit control
+/** @file LexerNoExceptions.h
+ ** A simple lexer with no state.
+ **/
+// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef LexerNoExceptions_H
+#define LexerNoExceptions_H
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+// A simple lexer with no state
+class LexerNoExceptions : public LexerBase {
+public:
+ // TODO Also need to prevent exceptions in constructor and destructor
+ int SCI_METHOD PropertySet(const char *key, const char *val);
+ int SCI_METHOD WordListSet(int n, const char *wl);
+ void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *);
+
+ virtual void Lexer(unsigned int startPos, int length, int initStyle, IDocument *pAccess, Accessor &styler) = 0;
+ virtual void Folder(unsigned int startPos, int length, int initStyle, IDocument *pAccess, Accessor &styler) = 0;
+};
+
+#ifdef SCI_NAMESPACE
+}
+#endif
+
+#endif
diff --git a/scintilla/lexlib/LexerSimple.cxx b/scintilla/lexlib/LexerSimple.cxx new file mode 100644 index 0000000..f1b5362 --- /dev/null +++ b/scintilla/lexlib/LexerSimple.cxx @@ -0,0 +1,57 @@ +// Scintilla source code edit control
+/** @file LexerSimple.cxx
+ ** A simple lexer with no state.
+ **/
+// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
+
+#include <string>
+
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+#include "PropSetSimple.h"
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "LexerModule.h"
+#include "LexerBase.h"
+#include "LexerSimple.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+LexerSimple::LexerSimple(const LexerModule *module_) : module(module_) {
+ for (int wl = 0; wl < module->GetNumWordLists(); wl++) {
+ if (!wordLists.empty())
+ wordLists += "\n";
+ wordLists += module->GetWordListDescription(wl);
+ }
+}
+
+const char * SCI_METHOD LexerSimple::DescribeWordListSets() {
+ return wordLists.c_str();
+}
+
+void SCI_METHOD LexerSimple::Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) {
+ Accessor astyler(pAccess, &props);
+ module->Lex(startPos, lengthDoc, initStyle, keyWordLists, astyler);
+ astyler.Flush();
+}
+
+void SCI_METHOD LexerSimple::Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) {
+ if (props.GetInt("fold")) {
+ Accessor astyler(pAccess, &props);
+ module->Fold(startPos, lengthDoc, initStyle, keyWordLists, astyler);
+ astyler.Flush();
+ }
+}
diff --git a/scintilla/lexlib/LexerSimple.h b/scintilla/lexlib/LexerSimple.h new file mode 100644 index 0000000..6c79db4 --- /dev/null +++ b/scintilla/lexlib/LexerSimple.h @@ -0,0 +1,30 @@ +// Scintilla source code edit control
+/** @file LexerSimple.h
+ ** A simple lexer with no state.
+ **/
+// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef LEXERSIMPLE_H
+#define LEXERSIMPLE_H
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+// A simple lexer with no state
+class LexerSimple : public LexerBase {
+ const LexerModule *module;
+ std::string wordLists;
+public:
+ LexerSimple(const LexerModule *module_);
+ const char * SCI_METHOD DescribeWordListSets();
+ void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
+};
+
+#ifdef SCI_NAMESPACE
+}
+#endif
+
+#endif
diff --git a/scintilla/lexlib/OptionSet.h b/scintilla/lexlib/OptionSet.h new file mode 100644 index 0000000..1969173 --- /dev/null +++ b/scintilla/lexlib/OptionSet.h @@ -0,0 +1,140 @@ +// Scintilla source code edit control
+/** @file OptionSet.h
+ ** Manage descriptive information about an options struct for a lexer.
+ ** Hold the names, positions, and descriptions of boolean, integer and string options and
+ ** allow setting options and retrieving metadata about the options.
+ **/
+// Copyright 2010 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef OPTIONSET_H
+#define OPTIONSET_H
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+template <typename T>
+class OptionSet {
+ typedef T Target;
+ typedef bool T::*plcob;
+ typedef int T::*plcoi;
+ typedef std::string T::*plcos;
+ struct Option {
+ int opType;
+ union {
+ plcob pb;
+ plcoi pi;
+ plcos ps;
+ };
+ std::string description;
+ Option() :
+ opType(SC_TYPE_BOOLEAN), pb(0), description("") {
+ }
+ Option(plcob pb_, std::string description_="") :
+ opType(SC_TYPE_BOOLEAN), pb(pb_), description(description_) {
+ }
+ Option(plcoi pi_, std::string description_) :
+ opType(SC_TYPE_INTEGER), pi(pi_), description(description_) {
+ }
+ Option(plcos ps_, std::string description_) :
+ opType(SC_TYPE_STRING), ps(ps_), description(description_) {
+ }
+ bool Set(T *base, const char *val) {
+ switch (opType) {
+ case SC_TYPE_BOOLEAN: {
+ bool option = atoi(val) != 0;
+ if ((*base).*pb != option) {
+ (*base).*pb = option;
+ return true;
+ }
+ break;
+ }
+ case SC_TYPE_INTEGER: {
+ int option = atoi(val);
+ if ((*base).*pi != option) {
+ (*base).*pi = option;
+ return true;
+ }
+ break;
+ }
+ case SC_TYPE_STRING: {
+ if ((*base).*ps != val) {
+ (*base).*ps = val;
+ return true;
+ }
+ break;
+ }
+ }
+ return false;
+ }
+ };
+ typedef std::map<std::string, Option> OptionMap;
+ OptionMap nameToDef;
+ std::string names;
+ std::string wordLists;
+
+ void AppendName(const char *name) {
+ if (!names.empty())
+ names += "\n";
+ names += name;
+ }
+public:
+ void DefineProperty(const char *name, plcob pb, std::string description="") {
+ nameToDef[name] = Option(pb, description);
+ AppendName(name);
+ }
+ void DefineProperty(const char *name, plcoi pi, std::string description="") {
+ nameToDef[name] = Option(pi, description);
+ AppendName(name);
+ }
+ void DefineProperty(const char *name, plcos ps, std::string description="") {
+ nameToDef[name] = Option(ps, description);
+ AppendName(name);
+ }
+ const char *PropertyNames() {
+ return names.c_str();
+ }
+ int PropertyType(const char *name) {
+ typename OptionMap::iterator it = nameToDef.find(name);
+ if (it != nameToDef.end()) {
+ return it->second.opType;
+ }
+ return SC_TYPE_BOOLEAN;
+ }
+ const char *DescribeProperty(const char *name) {
+ typename OptionMap::iterator it = nameToDef.find(name);
+ if (it != nameToDef.end()) {
+ return it->second.description.c_str();
+ }
+ return "";
+ }
+
+ bool PropertySet(T *base, const char *name, const char *val) {
+ typename OptionMap::iterator it = nameToDef.find(name);
+ if (it != nameToDef.end()) {
+ return it->second.Set(base, val);
+ }
+ return false;
+ }
+
+ void DefineWordListSets(const char * const wordListDescriptions[]) {
+ if (wordListDescriptions) {
+ for (size_t wl = 0; wordListDescriptions[wl]; wl++) {
+ if (!wordLists.empty())
+ wordLists += "\n";
+ wordLists += wordListDescriptions[wl];
+ }
+ }
+ }
+
+ const char *DescribeWordListSets() {
+ return wordLists.c_str();
+ }
+};
+
+#ifdef SCI_NAMESPACE
+}
+#endif
+
+#endif
diff --git a/scintilla/src/PropSet.cxx b/scintilla/lexlib/PropSetSimple.cxx index 709cbd4..9bd4e5c 100644 --- a/scintilla/src/PropSet.cxx +++ b/scintilla/lexlib/PropSetSimple.cxx @@ -1,8 +1,8 @@ // SciTE - Scintilla based Text Editor
-/** @file PropSet.cxx
+/** @file PropSetSimple.cxx
** A Java style properties file module.
**/
-// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
+// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
// Maintain a dictionary of properties
@@ -19,9 +19,6 @@ #include <string>
#include <map>
-#include "Platform.h"
-
-#include "PropSet.h"
#include "PropSetSimple.h"
#ifdef SCI_NAMESPACE
@@ -151,18 +148,14 @@ char *PropSetSimple::Expanded(const char *key) const { return ret;
}
-char *PropSetSimple::ToString() const {
- mapss *props = static_cast<mapss *>(impl);
- std::string sval;
- for (mapss::const_iterator it=props->begin(); it != props->end(); it++) {
- sval += it->first;
- sval += "=";
- sval += it->second;
- sval += "\n";
+int PropSetSimple::GetExpanded(const char *key, char *result) const {
+ char *val = Expanded(key);
+ const int n = strlen(val);
+ if (result) {
+ strcpy(result, val);
}
- char *ret = new char [sval.size() + 1];
- strcpy(ret, sval.c_str());
- return ret;
+ delete []val;
+ return n; // Not including NUL
}
int PropSetSimple::GetInt(const char *key, int defaultValue) const {
diff --git a/scintilla/src/PropSetSimple.h b/scintilla/lexlib/PropSetSimple.h index 057e7e6..ca91b63 100644 --- a/scintilla/src/PropSetSimple.h +++ b/scintilla/lexlib/PropSetSimple.h @@ -12,7 +12,7 @@ namespace Scintilla {
#endif
-class PropSetSimple : public PropertyGet {
+class PropSetSimple {
void *impl;
void Set(const char *keyVal);
public:
@@ -22,7 +22,7 @@ public: void SetMultiple(const char *);
const char *Get(const char *key) const;
char *Expanded(const char *key) const;
- char *ToString() const;
+ int GetExpanded(const char *key, char *result) const;
int GetInt(const char *key, int defaultValue=0) const;
};
diff --git a/scintilla/src/StyleContext.cxx b/scintilla/lexlib/StyleContext.cxx index 6c99dbd..3db04e3 100644 --- a/scintilla/src/StyleContext.cxx +++ b/scintilla/lexlib/StyleContext.cxx @@ -9,10 +9,11 @@ #include <string.h>
#include <ctype.h>
#include <stdio.h>
+#include <assert.h>
-#include "Platform.h"
+#include "ILexer.h"
-#include "PropSet.h"
+#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
@@ -22,7 +23,7 @@ using namespace Scintilla; static void getRange(unsigned int start,
unsigned int end,
- Accessor &styler,
+ LexAccessor &styler,
char *s,
unsigned int len) {
unsigned int i = 0;
@@ -39,7 +40,7 @@ void StyleContext::GetCurrent(char *s, unsigned int len) { static void getRangeLowered(unsigned int start,
unsigned int end,
- Accessor &styler,
+ LexAccessor &styler,
char *s,
unsigned int len) {
unsigned int i = 0;
diff --git a/scintilla/src/StyleContext.h b/scintilla/lexlib/StyleContext.h index 0bb89d0..c3f85e3 100644 --- a/scintilla/src/StyleContext.h +++ b/scintilla/lexlib/StyleContext.h @@ -5,16 +5,26 @@ // Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
// This file is in the public domain.
+#ifndef STYLECONTEXT_H
+#define STYLECONTEXT_H
+
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
+static inline int MakeLowerCase(int ch) {
+ if (ch < 'A' || ch > 'Z')
+ return ch;
+ else
+ return ch - 'A' + 'a';
+}
+
// All languages handled so far can treat all characters >= 0x80 as one class
// which just continues the current token or starts an identifier if in default.
// DBCS treated specially as the second character can be < 0x80 and hence
// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80
class StyleContext {
- Accessor &styler;
+ LexAccessor &styler;
unsigned int endPos;
StyleContext &operator=(const StyleContext &);
void GetNextChar(unsigned int pos) {
@@ -41,7 +51,7 @@ public: int chNext;
StyleContext(unsigned int startPos, unsigned int length,
- int initStyle, Accessor &styler_, char chMask=31) :
+ int initStyle, LexAccessor &styler_, char chMask=31) :
styler(styler_),
endPos(startPos + length),
currentPos(startPos),
@@ -64,6 +74,7 @@ public: }
void Complete() {
styler.ColourTo(currentPos - 1, state);
+ styler.Flush();
}
bool More() const {
return currentPos < endPos;
@@ -131,15 +142,15 @@ public: return true;
}
bool MatchIgnoreCase(const char *s) {
- if (tolower(ch) != static_cast<unsigned char>(*s))
+ if (MakeLowerCase(ch) != static_cast<unsigned char>(*s))
return false;
s++;
- if (tolower(chNext) != static_cast<unsigned char>(*s))
+ if (MakeLowerCase(chNext) != static_cast<unsigned char>(*s))
return false;
s++;
for (int n=2; *s; n++) {
if (static_cast<unsigned char>(*s) !=
- tolower(static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n))))
+ MakeLowerCase(static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n))))
return false;
s++;
}
@@ -154,24 +165,4 @@ public: }
#endif
-inline bool IsASpace(unsigned int ch) {
- return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
-}
-
-inline bool IsASpaceOrTab(unsigned int ch) {
- return (ch == ' ') || (ch == '\t');
-}
-
-inline bool IsADigit(unsigned int ch) {
- return (ch >= '0') && (ch <= '9');
-}
-
-inline bool IsADigit(unsigned int ch, unsigned int base) {
- if (base <= 10) {
- return (ch >= '0') && (ch < '0' + base);
- } else {
- return ((ch >= '0') && (ch <= '9')) ||
- ((ch >= 'A') && (ch < 'A' + base - 10)) ||
- ((ch >= 'a') && (ch < 'a' + base - 10));
- }
-}
+#endif
diff --git a/scintilla/lexlib/WordList.cxx b/scintilla/lexlib/WordList.cxx new file mode 100644 index 0000000..585cda9 --- /dev/null +++ b/scintilla/lexlib/WordList.cxx @@ -0,0 +1,200 @@ +// Scintilla source code edit control
+/** @file KeyWords.cxx
+ ** Colourise for particular languages.
+ **/
+// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "WordList.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+/**
+ * Creates an array that points into each word in the string and puts \0 terminators
+ * after each word.
+ */
+static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = false) {
+ int prev = '\n';
+ int words = 0;
+ // For rapid determination of whether a character is a separator, build
+ // a look up table.
+ bool wordSeparator[256];
+ for (int i=0; i<256; i++) {
+ wordSeparator[i] = false;
+ }
+ wordSeparator['\r'] = true;
+ wordSeparator['\n'] = true;
+ if (!onlyLineEnds) {
+ wordSeparator[' '] = true;
+ wordSeparator['\t'] = true;
+ }
+ for (int j = 0; wordlist[j]; j++) {
+ int curr = static_cast<unsigned char>(wordlist[j]);
+ if (!wordSeparator[curr] && wordSeparator[prev])
+ words++;
+ prev = curr;
+ }
+ char **keywords = new char *[words + 1];
+ if (keywords) {
+ words = 0;
+ prev = '\0';
+ size_t slen = strlen(wordlist);
+ for (size_t k = 0; k < slen; k++) {
+ if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) {
+ if (!prev) {
+ keywords[words] = &wordlist[k];
+ words++;
+ }
+ } else {
+ wordlist[k] = '\0';
+ }
+ prev = wordlist[k];
+ }
+ keywords[words] = &wordlist[slen];
+ *len = words;
+ } else {
+ *len = 0;
+ }
+ return keywords;
+}
+
+bool WordList::operator!=(const WordList &other) const {
+ if (len != other.len)
+ return true;
+ for (int i=0; i<len; i++) {
+ if (strcmp(words[i], other.words[i]) != 0)
+ return true;
+ }
+ return false;
+}
+
+void WordList::Clear() {
+ if (words) {
+ delete []list;
+ delete []words;
+ }
+ words = 0;
+ list = 0;
+ len = 0;
+}
+
+extern "C" int cmpString(const void *a1, const void *a2) {
+ // Can't work out the correct incantation to use modern casts here
+ return strcmp(*(char **)(a1), *(char **)(a2));
+}
+
+static void SortWordList(char **words, unsigned int len) {
+ qsort(reinterpret_cast<void *>(words), len, sizeof(*words),
+ cmpString);
+}
+
+void WordList::Set(const char *s) {
+ Clear();
+ list = new char[strlen(s) + 1];
+ strcpy(list, s);
+ words = ArrayFromWordList(list, &len, onlyLineEnds);
+ SortWordList(words, len);
+ for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
+ starts[k] = -1;
+ for (int l = len - 1; l >= 0; l--) {
+ unsigned char indexChar = words[l][0];
+ starts[indexChar] = l;
+ }
+}
+
+bool WordList::InList(const char *s) const {
+ if (0 == words)
+ return false;
+ unsigned char firstChar = s[0];
+ int j = starts[firstChar];
+ if (j >= 0) {
+ while ((unsigned char)words[j][0] == firstChar) {
+ if (s[1] == words[j][1]) {
+ const char *a = words[j] + 1;
+ const char *b = s + 1;
+ while (*a && *a == *b) {
+ a++;
+ b++;
+ }
+ if (!*a && !*b)
+ return true;
+ }
+ j++;
+ }
+ }
+ j = starts['^'];
+ if (j >= 0) {
+ while (words[j][0] == '^') {
+ const char *a = words[j] + 1;
+ const char *b = s;
+ while (*a && *a == *b) {
+ a++;
+ b++;
+ }
+ if (!*a)
+ return true;
+ j++;
+ }
+ }
+ return false;
+}
+
+/** similar to InList, but word s can be a substring of keyword.
+ * eg. the keyword define is defined as def~ine. This means the word must start
+ * with def to be a keyword, but also defi, defin and define are valid.
+ * The marker is ~ in this case.
+ */
+bool WordList::InListAbbreviated(const char *s, const char marker) const {
+ if (0 == words)
+ return false;
+ unsigned char firstChar = s[0];
+ int j = starts[firstChar];
+ if (j >= 0) {
+ while (words[j][0] == firstChar) {
+ bool isSubword = false;
+ int start = 1;
+ if (words[j][1] == marker) {
+ isSubword = true;
+ start++;
+ }
+ if (s[1] == words[j][start]) {
+ const char *a = words[j] + start;
+ const char *b = s + 1;
+ while (*a && *a == *b) {
+ a++;
+ if (*a == marker) {
+ isSubword = true;
+ a++;
+ }
+ b++;
+ }
+ if ((!*a || isSubword) && !*b)
+ return true;
+ }
+ j++;
+ }
+ }
+ j = starts['^'];
+ if (j >= 0) {
+ while (words[j][0] == '^') {
+ const char *a = words[j] + 1;
+ const char *b = s;
+ while (*a && *a == *b) {
+ a++;
+ b++;
+ }
+ if (!*a)
+ return true;
+ j++;
+ }
+ }
+ return false;
+}
diff --git a/scintilla/lexlib/WordList.h b/scintilla/lexlib/WordList.h new file mode 100644 index 0000000..4ce0246 --- /dev/null +++ b/scintilla/lexlib/WordList.h @@ -0,0 +1,41 @@ +// Scintilla source code edit control
+/** @file WordList.h
+ ** Hold a list of words.
+ **/
+// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef WORDLIST_H
+#define WORDLIST_H
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+/**
+ */
+class WordList {
+public:
+ // Each word contains at least one character - a empty word acts as sentinel at the end.
+ char **words;
+ char *list;
+ int len;
+ bool onlyLineEnds; ///< Delimited by any white space or only line ends
+ int starts[256];
+ WordList(bool onlyLineEnds_ = false) :
+ words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_)
+ {}
+ ~WordList() { Clear(); }
+ operator bool() const { return len ? true : false; }
+ bool operator!=(const WordList &other) const;
+ void Clear();
+ void Set(const char *s);
+ bool InList(const char *s) const;
+ bool InListAbbreviated(const char *s, const char marker) const;
+};
+
+#ifdef SCI_NAMESPACE
+}
+#endif
+
+#endif
diff --git a/scintilla/src/AutoComplete.cxx b/scintilla/src/AutoComplete.cxx index e7d6164..0156230 100644 --- a/scintilla/src/AutoComplete.cxx +++ b/scintilla/src/AutoComplete.cxx @@ -8,10 +8,11 @@ #include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <assert.h>
#include "Platform.h"
-#include "CharClassify.h"
+#include "CharacterSet.h"
#include "AutoComplete.h"
#ifdef SCI_NAMESPACE
diff --git a/scintilla/src/Catalogue.cxx b/scintilla/src/Catalogue.cxx new file mode 100644 index 0000000..892ab41 --- /dev/null +++ b/scintilla/src/Catalogue.cxx @@ -0,0 +1,184 @@ +// Scintilla source code edit control
+/** @file KeyWords.cxx
+ ** Colourise for particular languages.
+ **/
+// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+
+#include <vector>
+
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+#include "LexerModule.h"
+#include "Catalogue.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+static std::vector<LexerModule *> lexerCatalogue;
+static int nextLanguage = SCLEX_AUTOMATIC+1;
+
+const LexerModule *Catalogue::Find(int language) {
+ Scintilla_LinkLexers();
+ for (std::vector<LexerModule *>::iterator it=lexerCatalogue.begin();
+ it != lexerCatalogue.end(); ++it) {
+ if ((*it)->GetLanguage() == language) {
+ return *it;
+ }
+ }
+ return 0;
+}
+
+const LexerModule *Catalogue::Find(const char *languageName) {
+ Scintilla_LinkLexers();
+ if (languageName) {
+ for (std::vector<LexerModule *>::iterator it=lexerCatalogue.begin();
+ it != lexerCatalogue.end(); ++it) {
+ if ((*it)->languageName && (0 == strcmp((*it)->languageName, languageName))) {
+ return *it;
+ }
+ }
+ }
+ return 0;
+}
+
+void Catalogue::AddLexerModule(LexerModule *plm) {
+ if (plm->GetLanguage() == SCLEX_AUTOMATIC) {
+ plm->language = nextLanguage;
+ nextLanguage++;
+ }
+ lexerCatalogue.push_back(plm);
+}
+
+// Alternative historical name for Scintilla_LinkLexers
+int wxForceScintillaLexers(void) {
+ return Scintilla_LinkLexers();
+}
+
+// To add or remove a lexer, add or remove its file and run LexGen.py.
+
+// Force a reference to all of the Scintilla lexers so that the linker will
+// not remove the code of the lexers.
+int Scintilla_LinkLexers() {
+
+ static int initialised = 0;
+ if (initialised)
+ return 0;
+ initialised = 1;
+
+// Shorten the code that declares a lexer and ensures it is linked in by calling a method.
+#define LINK_LEXER(lexer) extern LexerModule lexer; Catalogue::AddLexerModule(&lexer);
+
+//++Autogenerated -- run src/LexGen.py to regenerate
+//**\(\tLINK_LEXER(\*);\n\)
+// LINK_LEXER(lmAbaqus);
+// LINK_LEXER(lmAda);
+// LINK_LEXER(lmAns1);
+// LINK_LEXER(lmAPDL);
+ LINK_LEXER(lmAsm);
+// LINK_LEXER(lmASY);
+ LINK_LEXER(lmAU3);
+// LINK_LEXER(lmAVE);
+// LINK_LEXER(lmBaan);
+ LINK_LEXER(lmBash);
+ LINK_LEXER(lmBatch);
+// LINK_LEXER(lmBlitzBasic);
+// LINK_LEXER(lmBullant);
+// LINK_LEXER(lmCaml);
+// LINK_LEXER(lmClw);
+// LINK_LEXER(lmClwNoCase);
+// LINK_LEXER(lmCmake);
+// LINK_LEXER(lmCOBOL);
+ LINK_LEXER(lmConf);
+ LINK_LEXER(lmCPP);
+// LINK_LEXER(lmCPPNoCase);
+// LINK_LEXER(lmCsound);
+ LINK_LEXER(lmCss);
+// LINK_LEXER(lmD);
+ LINK_LEXER(lmDiff);
+// LINK_LEXER(lmEiffel);
+// LINK_LEXER(lmEiffelkw);
+// LINK_LEXER(lmErlang);
+// LINK_LEXER(lmErrorList);
+// LINK_LEXER(lmESCRIPT);
+// LINK_LEXER(lmF77);
+// LINK_LEXER(lmFlagShip);
+// LINK_LEXER(lmForth);
+// LINK_LEXER(lmFortran);
+// LINK_LEXER(lmFreeBasic);
+// LINK_LEXER(lmGAP);
+// LINK_LEXER(lmGui4Cli);
+// LINK_LEXER(lmHaskell);
+ LINK_LEXER(lmHTML);
+ LINK_LEXER(lmInno);
+// LINK_LEXER(lmKix);
+ LINK_LEXER(lmLatex);
+// LINK_LEXER(lmLISP);
+// LINK_LEXER(lmLot);
+// LINK_LEXER(lmLout);
+ LINK_LEXER(lmLua);
+// LINK_LEXER(lmMagikSF);
+ LINK_LEXER(lmMake);
+// LINK_LEXER(lmMarkdown);
+// LINK_LEXER(lmMatlab);
+// LINK_LEXER(lmMETAPOST);
+// LINK_LEXER(lmMMIXAL);
+// LINK_LEXER(lmMSSQL);
+// LINK_LEXER(lmMySQL);
+// LINK_LEXER(lmNimrod);
+// LINK_LEXER(lmNncrontab);
+ LINK_LEXER(lmNsis);
+// LINK_LEXER(lmNull);
+// LINK_LEXER(lmOctave);
+// LINK_LEXER(lmOpal);
+ LINK_LEXER(lmPascal);
+// LINK_LEXER(lmPB);
+ LINK_LEXER(lmPerl);
+// LINK_LEXER(lmPHPSCRIPT);
+// LINK_LEXER(lmPLM);
+// LINK_LEXER(lmPo);
+// LINK_LEXER(lmPOV);
+// LINK_LEXER(lmPowerPro);
+ LINK_LEXER(lmPowerShell);
+// LINK_LEXER(lmProgress);
+ LINK_LEXER(lmProps);
+// LINK_LEXER(lmPS);
+// LINK_LEXER(lmPureBasic);
+ LINK_LEXER(lmPython);
+// LINK_LEXER(lmR);
+// LINK_LEXER(lmREBOL);
+ LINK_LEXER(lmRuby);
+// LINK_LEXER(lmScriptol);
+// LINK_LEXER(lmSmalltalk);
+// LINK_LEXER(lmSML);
+// LINK_LEXER(lmSorc);
+// LINK_LEXER(lmSpecman);
+// LINK_LEXER(lmSpice);
+ LINK_LEXER(lmSQL);
+// LINK_LEXER(lmTACL);
+// LINK_LEXER(lmTADS3);
+// LINK_LEXER(lmTAL);
+ LINK_LEXER(lmTCL);
+// LINK_LEXER(lmTeX);
+// LINK_LEXER(lmTxt2tags);
+ LINK_LEXER(lmVB);
+ LINK_LEXER(lmVBScript);
+// LINK_LEXER(lmVerilog);
+// LINK_LEXER(lmVHDL);
+ LINK_LEXER(lmXML);
+// LINK_LEXER(lmYAML);
+
+//--Autogenerated -- end of automatically generated section
+
+ return 1;
+}
diff --git a/scintilla/src/Catalogue.h b/scintilla/src/Catalogue.h new file mode 100644 index 0000000..b9e068e --- /dev/null +++ b/scintilla/src/Catalogue.h @@ -0,0 +1,26 @@ +// Scintilla source code edit control
+/** @file Catalogue.h
+ ** Lexer infrastructure.
+ **/
+// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef CATALOGUE_H
+#define CATALOGUE_H
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+class Catalogue {
+public:
+ static const LexerModule *Find(int language);
+ static const LexerModule *Find(const char *languageName);
+ static void AddLexerModule(LexerModule *plm);
+};
+
+#ifdef SCI_NAMESPACE
+}
+#endif
+
+#endif
diff --git a/scintilla/src/CellBuffer.cxx b/scintilla/src/CellBuffer.cxx index 079d00a..9fb25c2 100644 --- a/scintilla/src/CellBuffer.cxx +++ b/scintilla/src/CellBuffer.cxx @@ -351,16 +351,26 @@ void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) co lengthRetrieve, substance.Length());
return;
}
-
- for (int i=0; i<lengthRetrieve; i++) {
- *buffer++ = substance.ValueAt(position + i);
- }
+ substance.GetRange(buffer, position, lengthRetrieve);
}
char CellBuffer::StyleAt(int position) const {
return style.ValueAt(position);
}
+void CellBuffer::GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const {
+ if (lengthRetrieve < 0)
+ return;
+ if (position < 0)
+ return;
+ if ((position + lengthRetrieve) > style.Length()) {
+ Platform::DebugPrintf("Bad GetStyleRange %d for %d of %d\n", position,
+ lengthRetrieve, style.Length());
+ return;
+ }
+ style.GetRange(reinterpret_cast<char *>(buffer), position, lengthRetrieve);
+}
+
const char *CellBuffer::BufferPointer() {
return substance.BufferPointer();
}
diff --git a/scintilla/src/CellBuffer.h b/scintilla/src/CellBuffer.h index 3e5da88..37bc58c 100644 --- a/scintilla/src/CellBuffer.h +++ b/scintilla/src/CellBuffer.h @@ -142,6 +142,10 @@ private: LineVector lv;
+ /// Actions without undo
+ void BasicInsertString(int position, const char *s, int insertLength);
+ void BasicDeleteChars(int position, int deleteLength);
+
public:
CellBuffer();
@@ -151,6 +155,7 @@ public: char CharAt(int position) const;
void GetCharRange(char *buffer, int position, int lengthRetrieve) const;
char StyleAt(int position) const;
+ void GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const;
const char *BufferPointer();
int Length() const;
@@ -178,10 +183,6 @@ public: void SetSavePoint();
bool IsSavePoint();
- /// Actions without undo
- void BasicInsertString(int position, const char *s, int insertLength);
- void BasicDeleteChars(int position, int deleteLength);
-
bool SetUndoCollection(bool collectUndo);
bool IsCollectingUndo() const;
void BeginUndoAction();
diff --git a/scintilla/src/CharClassify.cxx b/scintilla/src/CharClassify.cxx index c2857b7..89e690d 100644 --- a/scintilla/src/CharClassify.cxx +++ b/scintilla/src/CharClassify.cxx @@ -10,6 +10,10 @@ #include "CharClassify.h"
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
// Shut up annoying Visual C++ warnings:
#ifdef _MSC_VER
#pragma warning(disable: 4514)
@@ -42,37 +46,3 @@ void CharClassify::SetCharClasses(const unsigned char *chars, cc newCharClass) { }
}
}
-
-int CompareCaseInsensitive(const char *a, const char *b) {
- while (*a && *b) {
- if (*a != *b) {
- char upperA = MakeUpperCase(*a);
- char upperB = MakeUpperCase(*b);
- if (upperA != upperB)
- return upperA - upperB;
- }
- a++;
- b++;
- }
- // Either *a or *b is nul
- return *a - *b;
-}
-
-int CompareNCaseInsensitive(const char *a, const char *b, size_t len) {
- while (*a && *b && len) {
- if (*a != *b) {
- char upperA = MakeUpperCase(*a);
- char upperB = MakeUpperCase(*b);
- if (upperA != upperB)
- return upperA - upperB;
- }
- a++;
- b++;
- len--;
- }
- if (len == 0)
- return 0;
- else
- // Either *a or *b is nul
- return *a - *b;
-}
diff --git a/scintilla/src/CharClassify.h b/scintilla/src/CharClassify.h index 947b1a3..f4b5aef 100644 --- a/scintilla/src/CharClassify.h +++ b/scintilla/src/CharClassify.h @@ -8,6 +8,10 @@ #ifndef CHARCLASSIFY_H
#define CHARCLASSIFY_H
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
class CharClassify {
public:
CharClassify();
@@ -23,15 +27,8 @@ private: unsigned char charClass[maxChar]; // not type cc to save space
};
-// These functions are implemented because each platform calls them something different.
-int CompareCaseInsensitive(const char *a, const char *b);
-int CompareNCaseInsensitive(const char *a, const char *b, size_t len);
-
-inline char MakeUpperCase(char ch) {
- if (ch < 'a' || ch > 'z')
- return ch;
- else
- return static_cast<char>(ch - 'a' + 'A');
+#ifdef SCI_NAMESPACE
}
+#endif
#endif
diff --git a/scintilla/src/CharacterSet.h b/scintilla/src/CharacterSet.h deleted file mode 100644 index 761b644..0000000 --- a/scintilla/src/CharacterSet.h +++ /dev/null @@ -1,59 +0,0 @@ -// Scintilla source code edit control
-/** @file CharacterSet.h
- ** Encapsulates a set of characters. Used to test if a character is within a set.
- **/
-// Copyright 2007 by Neil Hodgson <neilh@scintilla.org>
-// The License.txt file describes the conditions under which this software may be distributed.
-
-class CharacterSet {
- int size;
- bool valueAfter;
- bool *bset;
-public:
- enum setBase {
- setNone=0,
- setLower=1,
- setUpper=2,
- setDigits=4,
- setAlpha=setLower|setUpper,
- setAlphaNum=setAlpha|setDigits
- };
- CharacterSet(setBase base=setNone, const char *initialSet="", int size_=0x80, bool valueAfter_=false) {
- size = size_;
- valueAfter = valueAfter_;
- bset = new bool[size];
- for (int i=0; i < size; i++) {
- bset[i] = false;
- }
- AddString(initialSet);
- if (base & setLower)
- AddString("abcdefghijklmnopqrstuvwxyz");
- if (base & setUpper)
- AddString("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
- if (base & setDigits)
- AddString("0123456789");
- }
- ~CharacterSet() {
- delete []bset;
- bset = 0;
- size = 0;
- }
- void Add(int val) {
- PLATFORM_ASSERT(val >= 0);
- PLATFORM_ASSERT(val < size);
- bset[val] = true;
- }
- void AddString(const char *CharacterSet) {
- for (const char *cp=CharacterSet; *cp; cp++) {
- int val = static_cast<unsigned char>(*cp);
- PLATFORM_ASSERT(val >= 0);
- PLATFORM_ASSERT(val < size);
- bset[val] = true;
- }
- }
- bool Contains(int val) const {
- PLATFORM_ASSERT(val >= 0);
- if (val < 0) return false;
- return (val < size) ? bset[val] : valueAfter;
- }
-};
diff --git a/scintilla/src/ContractionState.cxx b/scintilla/src/ContractionState.cxx index 5782182..9be9c50 100644 --- a/scintilla/src/ContractionState.cxx +++ b/scintilla/src/ContractionState.cxx @@ -193,6 +193,23 @@ bool ContractionState::SetExpanded(int lineDoc, bool expanded_) { }
}
+int ContractionState::ContractedNext(int lineDocStart) const {
+ if (OneToOne()) {
+ return -1;
+ } else {
+ Check();
+ if (!expanded->ValueAt(lineDocStart)) {
+ return lineDocStart;
+ } else {
+ int lineDocNextChange = expanded->EndRun(lineDocStart);
+ if (lineDocNextChange < LinesInDoc())
+ return lineDocNextChange;
+ else
+ return -1;
+ }
+ }
+}
+
int ContractionState::GetHeight(int lineDoc) const {
if (OneToOne()) {
return 1;
diff --git a/scintilla/src/ContractionState.h b/scintilla/src/ContractionState.h index 20a9856..fa1ab6b 100644 --- a/scintilla/src/ContractionState.h +++ b/scintilla/src/ContractionState.h @@ -51,6 +51,7 @@ public: bool GetExpanded(int lineDoc) const;
bool SetExpanded(int lineDoc, bool expanded);
+ int ContractedNext(int lineDocStart) const;
int GetHeight(int lineDoc) const;
bool SetHeight(int lineDoc, int height);
diff --git a/scintilla/src/Document.cxx b/scintilla/src/Document.cxx index 4ed22d4..4423f5e 100644 --- a/scintilla/src/Document.cxx +++ b/scintilla/src/Document.cxx @@ -9,6 +9,7 @@ #include <string.h>
#include <stdio.h>
#include <ctype.h>
+#include <assert.h>
#include <string>
#include <vector>
@@ -23,13 +24,16 @@ #include "Platform.h"
+#include "ILexer.h"
#include "Scintilla.h"
+
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "CellBuffer.h"
#include "PerLine.h"
#include "CharClassify.h"
+#include "CharacterSet.h"
#include "Decoration.h"
#include "Document.h"
#include "RESearch.h"
@@ -60,6 +64,35 @@ static inline bool IsUpperCase(char ch) { return isascii(ch) && isupper(ch);
}
+void LexInterface::Colourise(int start, int end) {
+ ElapsedTime et;
+ if (pdoc && instance && !performingStyle) {
+ // Protect against reentrance, which may occur, for example, when
+ // fold points are discovered while performing styling and the folding
+ // code looks for child lines which may trigger styling.
+ performingStyle = true;
+
+ int lengthDoc = pdoc->Length();
+ if (end == -1)
+ end = lengthDoc;
+ int len = end - start;
+
+ PLATFORM_ASSERT(len >= 0);
+ PLATFORM_ASSERT(start + len <= lengthDoc);
+
+ int styleStart = 0;
+ if (start > 0)
+ styleStart = pdoc->StyleAt(start - 1) & pdoc->stylingBitsMask;
+
+ if (len > 0) {
+ instance->Lex(start, len, styleStart, pdoc);
+ instance->Fold(start, len, styleStart, pdoc);
+ }
+
+ performingStyle = false;
+ }
+}
+
Document::Document() {
refCount = 0;
#ifdef unix
@@ -95,6 +128,8 @@ Document::Document() { perLineData[ldAnnotation] = new LineAnnotation();
cb.SetPerLine(this);
+
+ pli = 0;
}
Document::~Document() {
@@ -110,6 +145,8 @@ Document::~Document() { lenWatchers = 0;
delete regex;
regex = 0;
+ delete pli;
+ pli = 0;
}
void Document::Init() {
@@ -157,7 +194,7 @@ int Document::GetMark(int line) { }
int Document::AddMark(int line, int markerNum) {
- if (line <= LinesTotal()) {
+ if (line >= 0 && line <= LinesTotal()) {
int prev = static_cast<LineMarkers *>(perLineData[ldMarkers])->
AddMark(line, markerNum, LinesTotal());
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
@@ -169,6 +206,9 @@ int Document::AddMark(int line, int markerNum) { }
void Document::AddMarkSet(int line, int valueSet) {
+ if (line < 0 || line > LinesTotal()) {
+ return;
+ }
unsigned int m = valueSet;
for (int i = 0; m; i++, m >>= 1)
if (m & 1)
@@ -192,19 +232,23 @@ void Document::DeleteMarkFromHandle(int markerHandle) { }
void Document::DeleteAllMarks(int markerNum) {
+ bool someChanges = false;
for (int line = 0; line < LinesTotal(); line++) {
- static_cast<LineMarkers *>(perLineData[ldMarkers])->DeleteMark(line, markerNum, true);
+ if (static_cast<LineMarkers *>(perLineData[ldMarkers])->DeleteMark(line, markerNum, true))
+ someChanges = true;
+ }
+ if (someChanges) {
+ DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
+ mh.line = -1;
+ NotifyModified(mh);
}
- DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
- mh.line = -1;
- NotifyModified(mh);
}
int Document::LineFromHandle(int markerHandle) {
return static_cast<LineMarkers *>(perLineData[ldMarkers])->LineFromHandle(markerHandle);
}
-int Document::LineStart(int line) const {
+int SCI_METHOD Document::LineStart(int line) const {
return cb.LineStart(line);
}
@@ -221,7 +265,14 @@ int Document::LineEnd(int line) const { }
}
-int Document::LineFromPosition(int pos) const {
+void SCI_METHOD Document::SetErrorStatus(int status) {
+ // Tell the watchers the lexer has changed.
+ for (int i = 0; i < lenWatchers; i++) {
+ watchers[i].watcher->NotifyErrorOccurred(this, watchers[i].userData, status);
+ }
+}
+
+int SCI_METHOD Document::LineFromPosition(int pos) const {
return cb.LineFromPosition(pos);
}
@@ -246,7 +297,7 @@ int Document::VCHomePosition(int position) const { return startText;
}
-int Document::SetLevel(int line, int level) {
+int SCI_METHOD Document::SetLevel(int line, int level) {
int prev = static_cast<LineLevels *>(perLineData[ldLevels])->SetLevel(line, level, LinesTotal());
if (prev != level) {
DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER,
@@ -258,7 +309,7 @@ int Document::SetLevel(int line, int level) { return prev;
}
-int Document::GetLevel(int line) const {
+int SCI_METHOD Document::GetLevel(int line) const {
return static_cast<LineLevels *>(perLineData[ldLevels])->GetLevel(line);
}
@@ -324,8 +375,6 @@ bool Document::IsCrLf(int pos) { return (cb.CharAt(pos) == '\r') && (cb.CharAt(pos + 1) == '\n');
}
-static const int maxBytesInDBCSCharacter=5;
-
int Document::LenChar(int pos) {
if (pos < 0) {
return 1;
@@ -346,13 +395,7 @@ int Document::LenChar(int pos) { else
return len;
} else if (dbcsCodePage) {
- char mbstr[maxBytesInDBCSCharacter+1];
- int i;
- for (i=0; i<Platform::DBCSCharMaxLength(); i++) {
- mbstr[i] = cb.CharAt(pos+i);
- }
- mbstr[i] = '\0';
- return Platform::DBCSCharLength(dbcsCodePage, mbstr);
+ return IsDBCSLeadByte(cb.CharAt(pos)) ? 2 : 1;
} else {
return 1;
}
@@ -376,7 +419,7 @@ static int BytesFromLead(int leadByte) { return 0;
}
-bool Document::InGoodUTF8(int pos, int &start, int &end) {
+bool Document::InGoodUTF8(int pos, int &start, int &end) const {
int lead = pos;
while ((lead>0) && (pos-lead < 4) && IsTrailByte(static_cast<unsigned char>(cb.CharAt(lead-1))))
lead--;
@@ -428,8 +471,6 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { return pos - 1;
}
- // Not between CR and LF
-
if (dbcsCodePage) {
if (SC_CP_UTF8 == dbcsCodePage) {
unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos));
@@ -445,16 +486,18 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { } else {
// Anchor DBCS calculations at start of line because start of line can
// not be a DBCS trail byte.
- int posCheck = LineStart(LineFromPosition(pos));
- while (posCheck < pos) {
- char mbstr[maxBytesInDBCSCharacter+1];
- int i;
- for (i=0; i<Platform::DBCSCharMaxLength(); i++) {
- mbstr[i] = cb.CharAt(posCheck+i);
- }
- mbstr[i] = '\0';
+ int posStartLine = LineStart(LineFromPosition(pos));
+ if (pos == posStartLine)
+ return pos;
+
+ // Step back until a non-lead-byte is found.
+ int posCheck = pos;
+ while ((posCheck > posStartLine) && IsDBCSLeadByte(cb.CharAt(posCheck-1)))
+ posCheck--;
- int mbsize = Platform::DBCSCharLength(dbcsCodePage, mbstr);
+ // Check from known start of character.
+ while (posCheck < pos) {
+ int mbsize = IsDBCSLeadByte(cb.CharAt(posCheck)) ? 2 : 1;
if (posCheck + mbsize == pos) {
return pos;
} else if (posCheck + mbsize > pos) {
@@ -472,6 +515,108 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { return pos;
}
+// NextPosition moves between valid positions - it can not handle a position in the middle of a
+// multi-byte character. It is used to iterate through text more efficiently than MovePositionOutsideChar.
+// A \r\n pair is treated as two characters.
+int Document::NextPosition(int pos, int moveDir) const {
+ // If out of range, just return minimum/maximum value.
+ int increment = (moveDir > 0) ? 1 : -1;
+ if (pos + increment <= 0)
+ return 0;
+ if (pos + increment >= Length())
+ return Length();
+
+ if (dbcsCodePage) {
+ if (SC_CP_UTF8 == dbcsCodePage) {
+ pos += increment;
+ unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos));
+ int startUTF = pos;
+ int endUTF = pos;
+ if (IsTrailByte(ch) && InGoodUTF8(pos, startUTF, endUTF)) {
+ // ch is a trail byte within a UTF-8 character
+ if (moveDir > 0)
+ pos = endUTF;
+ else
+ pos = startUTF;
+ }
+ } else {
+ if (moveDir > 0) {
+ int mbsize = IsDBCSLeadByte(cb.CharAt(pos)) ? 2 : 1;
+ pos += mbsize;
+ if (pos > Length())
+ pos = Length();
+ } else {
+ // Anchor DBCS calculations at start of line because start of line can
+ // not be a DBCS trail byte.
+ int posStartLine = LineStart(LineFromPosition(pos));
+ // See http://msdn.microsoft.com/en-us/library/cc194792%28v=MSDN.10%29.aspx
+ // http://msdn.microsoft.com/en-us/library/cc194790.aspx
+ if ((pos - 1) <= posStartLine) {
+ return posStartLine - 1;
+ } else if (IsDBCSLeadByte(cb.CharAt(pos - 1))) {
+ // Must actually be trail byte
+ return pos - 2;
+ } else {
+ // Otherwise, step back until a non-lead-byte is found.
+ int posTemp = pos - 1;
+ while (posStartLine <= --posTemp && IsDBCSLeadByte(cb.CharAt(posTemp)))
+ ;
+ // Now posTemp+1 must point to the beginning of a character,
+ // so figure out whether we went back an even or an odd
+ // number of bytes and go back 1 or 2 bytes, respectively.
+ return (pos - 1 - ((pos - posTemp) & 1));
+ }
+ }
+ }
+ } else {
+ pos += increment;
+ }
+
+ return pos;
+}
+
+bool Document::NextCharacter(int &pos, int moveDir) {
+ // Returns true if pos changed
+ int posNext = NextPosition(pos, moveDir);
+ if (posNext == pos) {
+ return false;
+ } else {
+ pos = posNext;
+ return true;
+ }
+}
+
+int SCI_METHOD Document::CodePage() const {
+ return dbcsCodePage;
+}
+
+bool SCI_METHOD Document::IsDBCSLeadByte(char ch) const {
+ // Byte ranges found in Wikipedia articles with relevant search strings in each case
+ unsigned char uch = static_cast<unsigned char>(ch);
+ switch (dbcsCodePage) {
+ case 932:
+ // Shift_jis
+ return ((uch >= 0x81) && (uch <= 0x9F)) ||
+ ((uch >= 0xE0) && (uch <= 0xEF));
+ case 936:
+ // GBK
+ return (uch >= 0x81) && (uch <= 0xFE);
+ case 949:
+ // Korean Wansung KS C-5601-1987
+ return (uch >= 0x81) && (uch <= 0xFE);
+ case 950:
+ // Big5
+ return (uch >= 0x81) && (uch <= 0xFE);
+ case 1361:
+ // Korean Johab KS C-5601-1992
+ return
+ ((uch >= 0x84) && (uch <= 0xD3)) ||
+ ((uch >= 0xD8) && (uch <= 0xDE)) ||
+ ((uch >= 0xE0) && (uch <= 0xF9));
+ }
+ return false;
+}
+
void Document::ModifiedAt(int pos) {
if (endStyled > pos)
endStyled = pos;
@@ -714,7 +859,7 @@ void Document::DelCharBack(int pos) { } else if (IsCrLf(pos - 2)) {
DeleteChars(pos - 2, 2);
} else if (dbcsCodePage) {
- int startChar = MovePositionOutsideChar(pos - 1, -1, false);
+ int startChar = NextPosition(pos, -1);
DeleteChars(startChar, pos - startChar);
} else {
DeleteChars(pos - 1, 1);
@@ -746,7 +891,7 @@ static void CreateIndentation(char *linebuf, int length, int indent, int tabSize *linebuf = '\0';
}
-int Document::GetLineIndentation(int line) {
+int SCI_METHOD Document::GetLineIndentation(int line) {
int indent = 0;
if ((line >= 0) && (line < LinesTotal())) {
int lineStart = LineStart(line);
@@ -807,7 +952,7 @@ int Document::GetColumn(int pos) { return column;
} else {
column++;
- i = MovePositionOutsideChar(i + 1, 1, false);
+ i = NextPosition(i, 1);
}
}
}
@@ -829,7 +974,7 @@ int Document::FindColumn(int line, int column) { return position;
} else {
columnCurrent++;
- position = MovePositionOutsideChar(position + 1, 1, false);
+ position = NextPosition(position, 1);
}
}
}
@@ -1151,6 +1296,8 @@ bool Document::MatchesWordOptions(bool word, bool wordStart, int pos, int length long Document::FindText(int minPos, int maxPos, const char *search,
bool caseSensitive, bool word, bool wordStart, bool regExp, int flags,
int *length, CaseFolder *pcf) {
+ if (*length <= 0)
+ return minPos;
if (regExp) {
if (!regex)
regex = CreateRegexSearch(&charClass);
@@ -1180,13 +1327,8 @@ long Document::FindText(int minPos, int maxPos, const char *search, if (found && MatchesWordOptions(word, wordStart, pos, lengthFind)) {
return pos;
}
- pos += increment;
- if (dbcsCodePage && (pos >= 0)) {
- // Have to use >= 0 as otherwise next statement would change
- // -1 to 0 and make loop infinite.
- // Ensure trying to match from start of character
- pos = MovePositionOutsideChar(pos, increment, false);
- }
+ if (!NextCharacter(pos, increment))
+ break;
}
} else if (SC_CP_UTF8 == dbcsCodePage) {
const size_t maxBytesCharacter = 4;
@@ -1198,8 +1340,8 @@ long Document::FindText(int minPos, int maxPos, const char *search, int indexDocument = 0;
int indexSearch = 0;
bool characterMatches = true;
- while (characterMatches &&
- ((pos + indexDocument) < limitPos) &&
+ while (characterMatches &&
+ ((pos + indexDocument) < limitPos) &&
(indexSearch < lenSearch)) {
char bytes[maxBytesCharacter + 1];
bytes[maxBytesCharacter] = 0;
@@ -1223,12 +1365,43 @@ long Document::FindText(int minPos, int maxPos, const char *search, if (forward) {
pos += widthFirstCharacter;
} else {
- pos--;
- if (pos > 0) {
- // Ensure trying to match from start of character
- pos = MovePositionOutsideChar(pos, increment, false);
+ if (!NextCharacter(pos, increment))
+ break;
+ }
+ }
+ } else if (dbcsCodePage) {
+ const size_t maxBytesCharacter = 2;
+ const size_t maxFoldingExpansion = 4;
+ std::vector<char> searchThing(lengthFind * maxBytesCharacter * maxFoldingExpansion + 1);
+ const int lenSearch = pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind);
+ while (forward ? (pos < endSearch) : (pos >= endSearch)) {
+ int indexDocument = 0;
+ int indexSearch = 0;
+ bool characterMatches = true;
+ while (characterMatches &&
+ ((pos + indexDocument) < limitPos) &&
+ (indexSearch < lenSearch)) {
+ char bytes[maxBytesCharacter + 1];
+ bytes[0] = cb.CharAt(pos + indexDocument);
+ const int widthChar = IsDBCSLeadByte(bytes[0]) ? 2 : 1;
+ if (widthChar == 2)
+ bytes[1] = cb.CharAt(pos + indexDocument + 1);
+ char folded[maxBytesCharacter * maxFoldingExpansion + 1];
+ const int lenFlat = pcf->Fold(folded, sizeof(folded), bytes, widthChar);
+ folded[lenFlat] = 0;
+ // Does folded match the buffer
+ characterMatches = 0 == memcmp(folded, &searchThing[0] + indexSearch, lenFlat);
+ indexDocument += widthChar;
+ indexSearch += lenFlat;
+ }
+ if (characterMatches && (indexSearch == static_cast<int>(lenSearch))) {
+ if (MatchesWordOptions(word, wordStart, pos, indexDocument)) {
+ *length = indexDocument;
+ return pos;
}
}
+ if (!NextCharacter(pos, increment))
+ break;
}
} else {
CaseFolderTable caseFolder;
@@ -1245,11 +1418,8 @@ long Document::FindText(int minPos, int maxPos, const char *search, if (found && MatchesWordOptions(word, wordStart, pos, lengthFind)) {
return pos;
}
- pos += increment;
- if (dbcsCodePage && (pos >= 0)) {
- // Ensure trying to match from start of character
- pos = MovePositionOutsideChar(pos, increment, false);
- }
+ if (!NextCharacter(pos, increment))
+ break;
}
}
}
@@ -1258,7 +1428,10 @@ long Document::FindText(int minPos, int maxPos, const char *search, }
const char *Document::SubstituteByPosition(const char *text, int *length) {
- return regex->SubstituteByPosition(this, text, length);
+ if (regex)
+ return regex->SubstituteByPosition(this, text, length);
+ else
+ return 0;
}
int Document::LinesTotal() const {
@@ -1297,12 +1470,12 @@ void Document::SetStylingBits(int bits) { stylingBitsMask = (1 << stylingBits) - 1;
}
-void Document::StartStyling(int position, char mask) {
+void SCI_METHOD Document::StartStyling(int position, char mask) {
stylingMask = mask;
endStyled = position;
}
-bool Document::SetStyleFor(int length, char style) {
+bool SCI_METHOD Document::SetStyleFor(int length, char style) {
if (enteredStyling != 0) {
return false;
} else {
@@ -1320,7 +1493,7 @@ bool Document::SetStyleFor(int length, char style) { }
}
-bool Document::SetStyles(int length, const char *styles) {
+bool SCI_METHOD Document::SetStyles(int length, const char *styles) {
if (enteredStyling != 0) {
return false;
} else {
@@ -1351,23 +1524,36 @@ bool Document::SetStyles(int length, const char *styles) { void Document::EnsureStyledTo(int pos) {
if ((enteredStyling == 0) && (pos > GetEndStyled())) {
IncrementStyleClock();
- // Ask the watchers to style, and stop as soon as one responds.
- for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++) {
- watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos);
+ if (pli && !pli->UseContainerLexing()) {
+ int lineEndStyled = LineFromPosition(GetEndStyled());
+ int endStyled = LineStart(lineEndStyled);
+ pli->Colourise(endStyled, pos);
+ } else {
+ // Ask the watchers to style, and stop as soon as one responds.
+ for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++) {
+ watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos);
+ }
}
}
}
-int Document::SetLineState(int line, int state) {
+void Document::LexerChanged() {
+ // Tell the watchers the lexer has changed.
+ for (int i = 0; i < lenWatchers; i++) {
+ watchers[i].watcher->NotifyLexerChanged(this, watchers[i].userData);
+ }
+}
+
+int SCI_METHOD Document::SetLineState(int line, int state) {
int statePrevious = static_cast<LineState *>(perLineData[ldState])->SetLineState(line, state);
if (state != statePrevious) {
- DocModification mh(SC_MOD_CHANGELINESTATE, 0, 0, 0, 0, line);
+ DocModification mh(SC_MOD_CHANGELINESTATE, LineStart(line), 0, 0, 0, line);
NotifyModified(mh);
}
return statePrevious;
}
-int Document::GetLineState(int line) const {
+int SCI_METHOD Document::GetLineState(int line) const {
return static_cast<LineState *>(perLineData[ldState])->GetLineState(line);
}
@@ -1375,6 +1561,11 @@ int Document::GetMaxLineState() { return static_cast<LineState *>(perLineData[ldState])->GetMaxLineState();
}
+void SCI_METHOD Document::ChangeLexerState(int start, int end) {
+ DocModification mh(SC_MOD_LEXERSTATE, start, end-start, 0, 0, 0);
+ NotifyModified(mh);
+}
+
StyledText Document::MarginStyledText(int line) {
LineAnnotation *pla = static_cast<LineAnnotation *>(perLineData[ldMargin]);
return StyledText(pla->Length(line), pla->Text(line),
@@ -1428,6 +1619,8 @@ void Document::AnnotationSetText(int line, const char *text) { void Document::AnnotationSetStyle(int line, int style) {
static_cast<LineAnnotation *>(perLineData[ldAnnotation])->SetStyle(line, style);
+ DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line), 0, 0, 0, line);
+ NotifyModified(mh);
}
void Document::AnnotationSetStyles(int line, const unsigned char *styles) {
@@ -1454,7 +1647,7 @@ void Document::IncrementStyleClock() { styleClock = (styleClock + 1) % 0x100000;
}
-void Document::DecorationFillRange(int position, int value, int fillLength) {
+void SCI_METHOD Document::DecorationFillRange(int position, int value, int fillLength) {
if (decorations.FillRange(position, value, fillLength)) {
DocModification mh(SC_MOD_CHANGEINDICATOR | SC_PERFORMED_USER,
position, fillLength);
@@ -1670,9 +1863,8 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) { if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<')
direction = 1;
int depth = 1;
- position = position + direction;
+ position = NextPosition(position, direction);
while ((position >= 0) && (position < Length())) {
- position = MovePositionOutsideChar(position, direction, true);
char chAtPos = CharAt(position);
char styAtPos = static_cast<char>(StyleAt(position) & stylingBitsMask);
if ((position > GetEndStyled()) || (styAtPos == styBrace)) {
@@ -1683,7 +1875,10 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) { if (depth == 0)
return position;
}
- position = position + direction;
+ int positionBeforeMove = position;
+ position = NextPosition(position, direction);
+ if (position == positionBeforeMove)
+ break;
}
return - 1;
}
diff --git a/scintilla/src/Document.h b/scintilla/src/Document.h index ceb2c6d..a3d404c 100644 --- a/scintilla/src/Document.h +++ b/scintilla/src/Document.h @@ -133,9 +133,27 @@ public: void StandardASCII();
};
+class Document;
+
+class LexInterface {
+protected:
+ Document *pdoc;
+ ILexer *instance;
+ bool performingStyle; ///< Prevent reentrance
+public:
+ LexInterface(Document *pdoc_) : pdoc(pdoc_), instance(0), performingStyle(false) {
+ }
+ virtual ~LexInterface() {
+ }
+ void Colourise(int start, int end);
+ bool UseContainerLexing() const {
+ return instance == 0;
+ }
+};
+
/**
*/
-class Document : PerLine {
+class Document : PerLine, public IDocument {
public:
/** Used to pair watcher pointer with user data. */
@@ -172,6 +190,9 @@ private: RegexSearchBase *regex;
public:
+
+ LexInterface *pli;
+
int stylingBits;
int stylingBitsMask;
@@ -197,12 +218,22 @@ public: virtual void InsertLine(int line);
virtual void RemoveLine(int line);
- int LineFromPosition(int pos) const;
+ int SCI_METHOD Version() const {
+ return dvOriginal;
+ }
+
+ void SCI_METHOD SetErrorStatus(int status);
+
+ int SCI_METHOD LineFromPosition(int pos) const;
int ClampPositionIntoDocument(int pos);
bool IsCrLf(int pos);
int LenChar(int pos);
- bool InGoodUTF8(int pos, int &start, int &end);
+ bool InGoodUTF8(int pos, int &start, int &end) const;
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
+ int NextPosition(int pos, int moveDir) const;
+ bool NextCharacter(int &pos, int moveDir); // Returns true if pos changed
+ int SCI_METHOD CodePage() const;
+ bool SCI_METHOD IsDBCSLeadByte(char ch) const;
// Gateways to modifying document
void ModifiedAt(int pos);
@@ -223,9 +254,9 @@ public: void AddUndoAction(int token, bool mayCoalesce) { cb.AddUndoAction(token, mayCoalesce); }
void SetSavePoint();
bool IsSavePoint() { return cb.IsSavePoint(); }
- const char *BufferPointer() { return cb.BufferPointer(); }
+ const char * SCI_METHOD BufferPointer() { return cb.BufferPointer(); }
- int GetLineIndentation(int line);
+ int SCI_METHOD GetLineIndentation(int line);
void SetLineIndentation(int line, int indent);
int GetLineIndentPosition(int line) const;
int GetColumn(int position);
@@ -243,10 +274,13 @@ public: void DelCharBack(int pos);
char CharAt(int position) { return cb.CharAt(position); }
- void GetCharRange(char *buffer, int position, int lengthRetrieve) const {
+ void SCI_METHOD GetCharRange(char *buffer, int position, int lengthRetrieve) const {
cb.GetCharRange(buffer, position, lengthRetrieve);
}
- char StyleAt(int position) const { return cb.StyleAt(position); }
+ char SCI_METHOD StyleAt(int position) const { return cb.StyleAt(position); }
+ void GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const {
+ cb.GetStyleRange(buffer, position, lengthRetrieve);
+ }
int GetMark(int line);
int AddMark(int line, int markerNum);
void AddMarkSet(int line, int valueSet);
@@ -254,14 +288,14 @@ public: void DeleteMarkFromHandle(int markerHandle);
void DeleteAllMarks(int markerNum);
int LineFromHandle(int markerHandle);
- int LineStart(int line) const;
+ int SCI_METHOD LineStart(int line) const;
int LineEnd(int line) const;
int LineEndPosition(int position) const;
bool IsLineEndPosition(int position) const;
int VCHomePosition(int position) const;
- int SetLevel(int line, int level);
- int GetLevel(int line) const;
+ int SCI_METHOD SetLevel(int line, int level);
+ int SCI_METHOD GetLevel(int line) const;
void ClearLevels();
int GetLastChild(int lineParent, int level=-1);
int GetFoldParent(int line);
@@ -270,7 +304,7 @@ public: int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false);
int NextWordStart(int pos, int delta);
int NextWordEnd(int pos, int delta);
- int Length() const { return cb.Length(); }
+ int SCI_METHOD Length() const { return cb.Length(); }
void Allocate(int newSize) { cb.Allocate(newSize); }
size_t ExtractChar(int pos, char *bytes);
bool MatchesWordOptions(bool word, bool wordStart, int pos, int length);
@@ -284,18 +318,23 @@ public: void SetDefaultCharClasses(bool includeWordClass);
void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass);
void SetStylingBits(int bits);
- void StartStyling(int position, char mask);
- bool SetStyleFor(int length, char style);
- bool SetStyles(int length, const char *styles);
+ void SCI_METHOD StartStyling(int position, char mask);
+ bool SCI_METHOD SetStyleFor(int length, char style);
+ bool SCI_METHOD SetStyles(int length, const char *styles);
int GetEndStyled() { return endStyled; }
void EnsureStyledTo(int pos);
+ void LexerChanged();
int GetStyleClock() { return styleClock; }
void IncrementStyleClock();
- void DecorationFillRange(int position, int value, int fillLength);
+ void SCI_METHOD DecorationSetCurrentIndicator(int indicator) {
+ decorations.SetCurrentIndicator(indicator);
+ }
+ void SCI_METHOD DecorationFillRange(int position, int value, int fillLength);
- int SetLineState(int line, int state);
- int GetLineState(int line) const;
+ int SCI_METHOD SetLineState(int line, int state);
+ int SCI_METHOD GetLineState(int line) const;
int GetMaxLineState();
+ void SCI_METHOD ChangeLexerState(int start, int end);
StyledText MarginStyledText(int line);
void MarginSetStyle(int line, int style);
@@ -417,6 +456,8 @@ public: virtual void NotifyModified(Document *doc, DocModification mh, void *userData) = 0;
virtual void NotifyDeleted(Document *doc, void *userData) = 0;
virtual void NotifyStyleNeeded(Document *doc, void *userData, int endPos) = 0;
+ virtual void NotifyLexerChanged(Document *doc, void *userData) = 0;
+ virtual void NotifyErrorOccurred(Document *doc, void *userData, int status) = 0;
};
#ifdef SCI_NAMESPACE
diff --git a/scintilla/src/DocumentAccessor.cxx b/scintilla/src/DocumentAccessor.cxx deleted file mode 100644 index 6c59002..0000000 --- a/scintilla/src/DocumentAccessor.cxx +++ /dev/null @@ -1,199 +0,0 @@ -// Scintilla source code edit control
-/** @file DocumentAccessor.cxx
- ** Rapid easy access to contents of a Scintilla.
- **/
-// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
-// The License.txt file describes the conditions under which this software may be distributed.
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "DocumentAccessor.h"
-#include "SplitVector.h"
-#include "Partitioning.h"
-#include "RunStyles.h"
-#include "CellBuffer.h"
-#include "Scintilla.h"
-#include "CharClassify.h"
-#include "Decoration.h"
-#include "Document.h"
-
-#ifdef SCI_NAMESPACE
-using namespace Scintilla;
-#endif
-
-DocumentAccessor::~DocumentAccessor() {
-}
-
-bool DocumentAccessor::InternalIsLeadByte(char ch) {
- if (SC_CP_UTF8 == codePage)
- // For lexing, all characters >= 0x80 are treated the
- // same so none is considered a lead byte.
- return false;
- else
- return Platform::IsDBCSLeadByte(codePage, ch);
-}
-
-void DocumentAccessor::Fill(int position) {
- if (lenDoc == -1)
- lenDoc = pdoc->Length();
- startPos = position - slopSize;
- if (startPos + bufferSize > lenDoc)
- startPos = lenDoc - bufferSize;
- if (startPos < 0)
- startPos = 0;
- endPos = startPos + bufferSize;
- if (endPos > lenDoc)
- endPos = lenDoc;
-
- pdoc->GetCharRange(buf, startPos, endPos-startPos);
- buf[endPos-startPos] = '\0';
-}
-
-bool DocumentAccessor::Match(int pos, const char *s) {
- for (int i=0; *s; i++) {
- if (*s != SafeGetCharAt(pos+i))
- return false;
- s++;
- }
- return true;
-}
-
-char DocumentAccessor::StyleAt(int position) {
- // Mask off all bits which aren't in the 'mask'.
- return static_cast<char>(pdoc->StyleAt(position) & mask);
-}
-
-int DocumentAccessor::GetLine(int position) {
- return pdoc->LineFromPosition(position);
-}
-
-int DocumentAccessor::LineStart(int line) {
- return pdoc->LineStart(line);
-}
-
-int DocumentAccessor::LevelAt(int line) {
- return pdoc->GetLevel(line);
-}
-
-int DocumentAccessor::Length() {
- if (lenDoc == -1)
- lenDoc = pdoc->Length();
- return lenDoc;
-}
-
-int DocumentAccessor::GetLineState(int line) {
- return pdoc->GetLineState(line);
-}
-
-int DocumentAccessor::SetLineState(int line, int state) {
- return pdoc->SetLineState(line, state);
-}
-
-void DocumentAccessor::StartAt(unsigned int start, char chMask) {
- // Store the mask specified for use with StyleAt.
- mask = chMask;
- pdoc->StartStyling(start, chMask);
- startPosStyling = start;
-}
-
-void DocumentAccessor::StartSegment(unsigned int pos) {
- startSeg = pos;
-}
-
-void DocumentAccessor::ColourTo(unsigned int pos, int chAttr) {
- // Only perform styling if non empty range
- if (pos != startSeg - 1) {
- PLATFORM_ASSERT(pos >= startSeg);
- if (pos < startSeg) {
- return;
- }
-
- if (validLen + (pos - startSeg + 1) >= bufferSize)
- Flush();
- if (validLen + (pos - startSeg + 1) >= bufferSize) {
- // Too big for buffer so send directly
- pdoc->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr));
- } else {
- if (chAttr != chWhile)
- chFlags = 0;
- chAttr |= chFlags;
- for (unsigned int i = startSeg; i <= pos; i++) {
- PLATFORM_ASSERT((startPosStyling + validLen) < Length());
- styleBuf[validLen++] = static_cast<char>(chAttr);
- }
- }
- }
- startSeg = pos+1;
-}
-
-void DocumentAccessor::SetLevel(int line, int level) {
- pdoc->SetLevel(line, level);
-}
-
-void DocumentAccessor::Flush() {
- startPos = extremePosition;
- lenDoc = -1;
- if (validLen > 0) {
- pdoc->SetStyles(validLen, styleBuf);
- startPosStyling += validLen;
- validLen = 0;
- }
-}
-
-int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) {
- int end = Length();
- int spaceFlags = 0;
-
- // Determines the indentation level of the current line and also checks for consistent
- // indentation compared to the previous line.
- // Indentation is judged consistent when the indentation whitespace of each line lines
- // the same or the indentation of one line is a prefix of the other.
-
- int pos = LineStart(line);
- char ch = (*this)[pos];
- int indent = 0;
- bool inPrevPrefix = line > 0;
- int posPrev = inPrevPrefix ? LineStart(line-1) : 0;
- while ((ch == ' ' || ch == '\t') && (pos < end)) {
- if (inPrevPrefix) {
- char chPrev = (*this)[posPrev++];
- if (chPrev == ' ' || chPrev == '\t') {
- if (chPrev != ch)
- spaceFlags |= wsInconsistent;
- } else {
- inPrevPrefix = false;
- }
- }
- if (ch == ' ') {
- spaceFlags |= wsSpace;
- indent++;
- } else { // Tab
- spaceFlags |= wsTab;
- if (spaceFlags & wsSpace)
- spaceFlags |= wsSpaceTab;
- indent = (indent / 8 + 1) * 8;
- }
- ch = (*this)[++pos];
- }
-
- *flags = spaceFlags;
- indent += SC_FOLDLEVELBASE;
- // if completely empty line or the start of a comment...
- if ((ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') ||
- (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)))
- return indent | SC_FOLDLEVELWHITEFLAG;
- else
- return indent;
-}
-
-void DocumentAccessor::IndicatorFill(int start, int end, int indicator, int value) {
- pdoc->decorations.SetCurrentIndicator(indicator);
- pdoc->DecorationFillRange(start, value, end - start);
-}
diff --git a/scintilla/src/DocumentAccessor.h b/scintilla/src/DocumentAccessor.h deleted file mode 100644 index 5e1f434..0000000 --- a/scintilla/src/DocumentAccessor.h +++ /dev/null @@ -1,77 +0,0 @@ -// Scintilla source code edit control
-/** @file DocumentAccessor.h
- ** Implementation of BufferAccess and StylingAccess on a Scintilla
- ** rapid easy access to contents of a Scintilla.
- **/
-// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
-// The License.txt file describes the conditions under which this software may be distributed.
-
-#ifdef SCI_NAMESPACE
-namespace Scintilla {
-#endif
-
-class Document;
-
-/**
- */
-
-class DocumentAccessor : public Accessor {
- // Private so DocumentAccessor objects can not be copied
- DocumentAccessor(const DocumentAccessor &source);
- DocumentAccessor &operator=(const DocumentAccessor &);
-
-protected:
- Document *pdoc;
- PropertyGet &props;
- WindowID id;
- int lenDoc;
-
- char styleBuf[bufferSize];
- int validLen;
- char chFlags;
- char chWhile;
- unsigned int startSeg;
- int startPosStyling;
- int mask;
-
- bool InternalIsLeadByte(char ch);
- void Fill(int position);
-
-public:
- DocumentAccessor(Document *pdoc_, PropertyGet &props_, WindowID id_=0) :
- Accessor(), pdoc(pdoc_), props(props_), id(id_),
- lenDoc(-1), validLen(0), chFlags(0), chWhile(0),
- startSeg(0), startPosStyling(0),
- mask(127) { // Initialize the mask to be big enough for any lexer.
- }
- ~DocumentAccessor();
- bool Match(int pos, const char *s);
- char StyleAt(int position);
- int GetLine(int position);
- int LineStart(int line);
- int LevelAt(int line);
- int Length();
- void Flush();
- int GetLineState(int line);
- int SetLineState(int line, int state);
- int GetPropertyInt(const char *key, int defaultValue=0) {
- return props.GetInt(key, defaultValue);
- }
- char *GetProperties() {
- return props.ToString();
- }
- WindowID GetWindow() { return id; }
-
- void StartAt(unsigned int start, char chMask=31);
- void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }
- unsigned int GetStartSegment() { return startSeg; }
- void StartSegment(unsigned int pos);
- void ColourTo(unsigned int pos, int chAttr);
- void SetLevel(int line, int level);
- int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
- void IndicatorFill(int start, int end, int indicator, int value);
-};
-
-#ifdef SCI_NAMESPACE
-}
-#endif
diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index f25534b..15253df 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -9,6 +9,7 @@ #include <string.h>
#include <stdio.h>
#include <ctype.h>
+#include <assert.h>
#include <string>
#include <vector>
@@ -25,6 +26,7 @@ #include "Platform.h"
+#include "ILexer.h"
#include "Scintilla.h"
#include "SplitVector.h"
@@ -94,6 +96,15 @@ static inline bool IsControlCharacter(int ch) { return ch >= 0 && ch < ' ';
}
+static inline bool IsAllSpacesOrTabs(char *s, unsigned int len) {
+ for (unsigned int i = 0; i < len; i++) {
+ // This is safe because IsSpaceOrTab() will return false for null terminators
+ if (!IsSpaceOrTab(s[i]))
+ return false;
+ }
+ return true;
+}
+
Editor::Editor() {
ctrlID = 0;
@@ -124,6 +135,7 @@ Editor::Editor() { dropWentOutside = false;
posDrag = SelectionPosition(invalidPosition);
posDrop = SelectionPosition(invalidPosition);
+ hotSpotClickPos = INVALID_POSITION;
selectionType = selChar;
lastXChosen = 0;
@@ -148,7 +160,7 @@ Editor::Editor() { lineWidthMaxSeen = 0;
verticalScrollBarVisible = true;
endAtLastLine = true;
- caretSticky = false;
+ caretSticky = SC_CARETSTICKY_OFF;
multipleSelection = false;
additionalSelectionTyping = false;
multiPasteMode = SC_MULTIPASTE_ONCE;
@@ -742,8 +754,20 @@ void Editor::InvalidateSelection(SelectionRange newMain, bool invalidateWholeSel }
void Editor::SetSelection(SelectionPosition currentPos_, SelectionPosition anchor_) {
- SelectionRange rangeNew(ClampPositionIntoDocument(currentPos_),
- ClampPositionIntoDocument(anchor_));
+ currentPos_ = ClampPositionIntoDocument(currentPos_);
+ anchor_ = ClampPositionIntoDocument(anchor_);
+ /* For Line selection - ensure the anchor and caret are always
+ at the beginning and end of the region lines. */
+ if (sel.selType == Selection::selLines) {
+ if (currentPos_ > anchor_) {
+ anchor_ = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(anchor_.Position())));
+ currentPos_ = SelectionPosition(pdoc->LineEnd(pdoc->LineFromPosition(currentPos_.Position())));
+ } else {
+ currentPos_ = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(currentPos_.Position())));
+ anchor_ = SelectionPosition(pdoc->LineEnd(pdoc->LineFromPosition(anchor_.Position())));
+ }
+ }
+ SelectionRange rangeNew(currentPos_, anchor_);
if (sel.Count() > 1 || !(sel.RangeMain() == rangeNew)) {
InvalidateSelection(rangeNew);
}
@@ -971,6 +995,16 @@ void Editor::HorizontalScrollTo(int xPos) { }
}
+void Editor::VerticalCentreCaret() {
+ int lineDoc = pdoc->LineFromPosition(sel.IsRectangular() ? sel.Rectangular().caret.Position() : sel.MainCaret());
+ int lineDisplay = cs.DisplayFromDoc(lineDoc);
+ int newTop = lineDisplay - (LinesOnScreen() / 2);
+ if (topLine != newTop) {
+ SetTopLine(newTop > 0 ? newTop : 0);
+ RedrawRect(GetClientRectangle());
+ }
+}
+
void Editor::MoveCaretInsideView(bool ensureVisible) {
PRectangle rcClient = GetTextRectangle();
Point pt = PointMainCaret();
@@ -1061,7 +1095,7 @@ Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const bool useMargin, con XYScrollPosition newXY(xOffset, topLine);
// Vertical positioning
- if (vert && (pt.y < rcClient.top || ptBottomCaret.y > rcClient.bottom || (caretYPolicy & CARET_STRICT) != 0)) {
+ if (vert && (pt.y < rcClient.top || ptBottomCaret.y >= rcClient.bottom || (caretYPolicy & CARET_STRICT) != 0)) {
const int linesOnScreen = LinesOnScreen();
const int halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2;
const bool bSlop = (caretYPolicy & CARET_SLOP) != 0;
@@ -1394,8 +1428,6 @@ bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) { rcTextArea.left = vs.fixedColumnWidth;
rcTextArea.right -= vs.rightMarginWidth;
wrapWidth = rcTextArea.Width();
- // Ensure all of the document is styled.
- pdoc->EnsureStyledTo(pdoc->Length());
RefreshStyleData();
AutoSurface surface(this);
if (surface) {
@@ -1416,6 +1448,9 @@ bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) { lastLineToWrap = wrapEnd;
} // else do a fullWrap.
+ // Ensure all lines being wrapped are styled.
+ pdoc->EnsureStyledTo(pdoc->LineEnd(lastLineToWrap));
+
// Platform::DebugPrintf("Wraplines: full = %d, priorityStart = %d (wrapping: %d to %d)\n", fullWrap, priorityWrapLineStart, lineToWrap, lastLineToWrap);
// Platform::DebugPrintf("Pending wraps: %d to %d\n", wrapStart, wrapEnd);
while (lineToWrap < lastLineToWrap) {
@@ -1998,8 +2033,6 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou if (ll->validity == LineLayout::llInvalid) {
ll->widthLine = LineLayout::wrapWidthInfinite;
ll->lines = 1;
- int numCharsInLine = 0;
- int numCharsBeforeEOL = 0;
if (vstyle.edgeState == EDGE_BACKGROUND) {
ll->edgeColumn = pdoc->FindColumn(line, theEdge);
if (ll->edgeColumn >= posLineStart) {
@@ -2010,24 +2043,31 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou }
char styleByte = 0;
- int styleMask = pdoc->stylingBitsMask;
+ const int styleMask = pdoc->stylingBitsMask;
ll->styleBitsSet = 0;
// Fill base line layout
- for (int charInDoc = posLineStart; charInDoc < posLineEnd; charInDoc++) {
- char chDoc = pdoc->CharAt(charInDoc);
- styleByte = pdoc->StyleAt(charInDoc);
+ const int lineLength = posLineEnd - posLineStart;
+ pdoc->GetCharRange(ll->chars, posLineStart, lineLength);
+ pdoc->GetStyleRange(ll->styles, posLineStart, lineLength);
+ int numCharsBeforeEOL = lineLength;
+ while ((numCharsBeforeEOL > 0) && IsEOLChar(ll->chars[numCharsBeforeEOL-1])) {
+ numCharsBeforeEOL--;
+ }
+ const int numCharsInLine = (vstyle.viewEOL) ? lineLength : numCharsBeforeEOL;
+ for (int styleInLine = 0; styleInLine < numCharsInLine; styleInLine++) {
+ styleByte = ll->styles[styleInLine];
ll->styleBitsSet |= styleByte;
- if (vstyle.viewEOL || (!IsEOLChar(chDoc))) {
- ll->chars[numCharsInLine] = chDoc;
- ll->styles[numCharsInLine] = static_cast<char>(styleByte & styleMask);
- ll->indicators[numCharsInLine] = static_cast<char>(styleByte & ~styleMask);
- if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseUpper)
- ll->chars[numCharsInLine] = static_cast<char>(toupper(chDoc));
- else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower)
- ll->chars[numCharsInLine] = static_cast<char>(tolower(chDoc));
- numCharsInLine++;
- if (!IsEOLChar(chDoc))
- numCharsBeforeEOL++;
+ ll->styles[styleInLine] = static_cast<char>(styleByte & styleMask);
+ ll->indicators[styleInLine] = static_cast<char>(styleByte & ~styleMask);
+ }
+ styleByte = static_cast<char>(((lineLength > 0) ? ll->styles[lineLength-1] : 0) & styleMask);
+ if (vstyle.someStylesForceCase) {
+ for (int charInLine = 0; charInLine<lineLength; charInLine++) {
+ char chDoc = ll->chars[charInLine];
+ if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseUpper)
+ ll->chars[charInLine] = static_cast<char>(toupper(chDoc));
+ else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseLower)
+ ll->chars[charInLine] = static_cast<char>(tolower(chDoc));
}
}
ll->xHighlightGuide = 0;
@@ -2401,6 +2441,8 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin // Fill the remainder of the line
rcSegment.left = xEol + xStart + virtualSpace + blobsWidth + vsDraw.aveCharWidth;
+ if (rcSegment.left < rcLine.left)
+ rcSegment.left = rcLine.left;
rcSegment.right = rcLine.right;
if (!hideSelection && vsDraw.selEOLFilled && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) {
@@ -3800,7 +3842,8 @@ void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { EnsureCaretVisible();
// Avoid blinking during rapid typing:
ShowCaretAtCurrentPosition();
- if (!caretSticky) {
+ if ((caretSticky == SC_CARETSTICKY_OFF) ||
+ ((caretSticky == SC_CARETSTICKY_WHITESPACE) && !IsAllSpacesOrTabs(s, len))) {
SetLastXChosen();
}
@@ -4109,6 +4152,13 @@ void Editor::NotifyStyleNeeded(Document *, void *, int endStyleNeeded) { NotifyStyleToNeeded(endStyleNeeded);
}
+void Editor::NotifyLexerChanged(Document *, void *) {
+}
+
+void Editor::NotifyErrorOccurred(Document *, void *, int status) {
+ errorStatus = status;
+}
+
void Editor::NotifyChar(int ch) {
SCNotification scn = {0};
scn.nmhdr.code = SCN_CHARADDED;
@@ -4160,6 +4210,15 @@ void Editor::NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt) NotifyParent(scn);
}
+void Editor::NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool alt) {
+ SCNotification scn = {0};
+ scn.nmhdr.code = SCN_HOTSPOTRELEASECLICK;
+ scn.position = position;
+ scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) |
+ (alt ? SCI_ALT : 0);
+ NotifyParent(scn);
+}
+
void Editor::NotifyUpdateUI() {
SCNotification scn = {0};
scn.nmhdr.code = SCN_UPDATEUI;
@@ -4292,6 +4351,14 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { Redraw();
}
}
+ if (mh.modificationType & SC_MOD_LEXERSTATE) {
+ if (paintState == painting) {
+ CheckForChangeOutsidePaint(
+ Range(mh.position, mh.position + mh.length));
+ } else {
+ Redraw();
+ }
+ }
if (mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) {
if (mh.modificationType & SC_MOD_CHANGESTYLE) {
pdoc->IncrementStyleClock();
@@ -4322,7 +4389,16 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { // Some lines are hidden so may need shown.
// TODO: check if the modified area is hidden.
if (mh.modificationType & SC_MOD_BEFOREINSERT) {
- NotifyNeedShown(mh.position, 0);
+ int lineOfPos = pdoc->LineFromPosition(mh.position);
+ bool insertingNewLine = false;
+ for (int i=0; i < mh.length; i++) {
+ if ((mh.text[i] == '\n') || (mh.text[i] == '\r'))
+ insertingNewLine = true;
+ }
+ if (insertingNewLine && (mh.position != pdoc->LineStart(lineOfPos)))
+ NotifyNeedShown(mh.position, pdoc->LineStart(lineOfPos+1) - mh.position);
+ else
+ NotifyNeedShown(mh.position, 0);
} else if (mh.modificationType & SC_MOD_BEFOREDELETE) {
NotifyNeedShown(mh.position, mh.length);
}
@@ -4341,6 +4417,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { int lineDoc = pdoc->LineFromPosition(mh.position);
if (vs.annotationVisible) {
cs.SetHeight(lineDoc, cs.GetHeight(lineDoc) + mh.annotationLinesAdded);
+ Redraw();
}
}
CheckModificationForWrap(mh);
@@ -4523,6 +4600,7 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lPar case SCI_PAGEDOWNRECTEXTEND:
case SCI_SELECTIONDUPLICATE:
case SCI_COPYALLOWLINE:
+ case SCI_VERTICALCENTRECARET:
break;
// Filter out all others like display changes. Also, newlines are redundant
@@ -4549,9 +4627,9 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lPar * If stuttered = true and already at first/last row, scroll as normal.
*/
void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) {
- int topLineNew, newPos;
+ int topLineNew;
+ SelectionPosition newPos;
- // I consider only the caretYSlop, and ignore the caretYPolicy-- is that a problem?
int currentLine = pdoc->LineFromPosition(sel.MainCaret());
int topStutterLine = topLine + caretYSlop;
int bottomStutterLine =
@@ -4561,28 +4639,31 @@ void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) { if (stuttered && (direction < 0 && currentLine > topStutterLine)) {
topLineNew = topLine;
- newPos = PositionFromLocation(Point(lastXChosen - xOffset, vs.lineHeight * caretYSlop));
+ newPos = SPositionFromLocation(Point(lastXChosen - xOffset, vs.lineHeight * caretYSlop),
+ false, false, UserVirtualSpace());
} else if (stuttered && (direction > 0 && currentLine < bottomStutterLine)) {
topLineNew = topLine;
- newPos = PositionFromLocation(Point(lastXChosen - xOffset, vs.lineHeight * (LinesToScroll() - caretYSlop)));
+ newPos = SPositionFromLocation(Point(lastXChosen - xOffset, vs.lineHeight * (LinesToScroll() - caretYSlop)),
+ false, false, UserVirtualSpace());
} else {
Point pt = LocationFromPosition(sel.MainCaret());
topLineNew = Platform::Clamp(
topLine + direction * LinesToScroll(), 0, MaxScrollPos());
- newPos = PositionFromLocation(
- Point(lastXChosen - xOffset, pt.y + direction * (vs.lineHeight * LinesToScroll())));
+ newPos = SPositionFromLocation(
+ Point(lastXChosen - xOffset, pt.y + direction * (vs.lineHeight * LinesToScroll())),
+ false, false, UserVirtualSpace());
}
if (topLineNew != topLine) {
SetTopLine(topLineNew);
- MovePositionTo(SelectionPosition(newPos), selt);
+ MovePositionTo(newPos, selt);
Redraw();
SetVerticalScrollPos();
} else {
- MovePositionTo(SelectionPosition(newPos), selt);
+ MovePositionTo(newPos, selt);
}
}
@@ -5058,21 +5139,21 @@ int Editor::KeyCommand(unsigned int iMessage) { break;
case SCI_DELETEBACK:
DelCharBack(true);
- if (!caretSticky) {
+ if ((caretSticky == SC_CARETSTICKY_OFF) || (caretSticky == SC_CARETSTICKY_WHITESPACE)) {
SetLastXChosen();
}
EnsureCaretVisible();
break;
case SCI_DELETEBACKNOTLINE:
DelCharBack(false);
- if (!caretSticky) {
+ if ((caretSticky == SC_CARETSTICKY_OFF) || (caretSticky == SC_CARETSTICKY_WHITESPACE)) {
SetLastXChosen();
}
EnsureCaretVisible();
break;
case SCI_TAB:
Indent(true);
- if (!caretSticky) {
+ if (caretSticky == SC_CARETSTICKY_OFF) {
SetLastXChosen();
}
EnsureCaretVisible();
@@ -5080,7 +5161,7 @@ int Editor::KeyCommand(unsigned int iMessage) { break;
case SCI_BACKTAB:
Indent(false);
- if (!caretSticky) {
+ if ((caretSticky == SC_CARETSTICKY_OFF) || (caretSticky == SC_CARETSTICKY_WHITESPACE)) {
SetLastXChosen();
}
EnsureCaretVisible();
@@ -5796,6 +5877,10 @@ void Editor::DwellEnd(bool mouseMoved) { void Editor::MouseLeave() {
SetHotSpotRange(NULL);
+ if (!HaveMouseCapture()) {
+ ptMouseLast = Point(-1,-1);
+ DwellEnd(true);
+ }
}
static bool AllowVirtualSpace(int virtualSpaceOptions, bool rectangular) {
@@ -5891,6 +5976,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b } else {
if (PointIsHotspot(pt)) {
NotifyHotSpotClicked(newPos.Position(), shift, ctrl, alt);
+ hotSpotClickPos = PositionFromLocation(pt,true,false);
}
if (!shift) {
if (PointInSelection(pt) && !SelectionEmpty())
@@ -6070,6 +6156,13 @@ void Editor::ButtonMove(Point pt) { if (hsStart != -1 && !PositionIsHotspot(movePos.Position()))
SetHotSpotRange(NULL);
+ if (hotSpotClickPos != INVALID_POSITION && PositionFromLocation(pt,true,false) != hotSpotClickPos ) {
+ if (inDragDrop == ddNone) {
+ DisplayCursor(Window::cursorText);
+ }
+ hotSpotClickPos = INVALID_POSITION;
+ }
+
} else {
if (vs.fixedColumnWidth > 0) { // There is a margin
if (PointInSelMargin(pt)) {
@@ -6100,6 +6193,10 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { inDragDrop = ddNone;
SetEmptySelection(newPos.Position());
}
+ if (hotSpotClickPos != INVALID_POSITION && PointIsHotspot(pt)) {
+ hotSpotClickPos = INVALID_POSITION;
+ NotifyHotSpotReleaseClick(newPos.Position(), false, ctrl, false);
+ }
if (HaveMouseCapture()) {
if (PointInSelMargin(pt)) {
DisplayCursor(Window::cursorReverseArrow);
@@ -6184,7 +6281,8 @@ void Editor::Tick() { }
if ((dwellDelay < SC_TIME_FOREVER) &&
(ticksToDwell > 0) &&
- (!HaveMouseCapture())) {
+ (!HaveMouseCapture()) &&
+ (ptMouseLast.y >= 0)) {
ticksToDwell -= timer.tickSize;
if (ticksToDwell <= 0) {
dwelling = true;
@@ -6248,7 +6346,7 @@ void Editor::StyleToPositionInView(Position pos) { int styleAtEnd = pdoc->StyleAt(pos-1);
pdoc->EnsureStyledTo(pos);
if ((endWindow > pos) && (styleAtEnd != pdoc->StyleAt(pos-1))) {
- // Style at end of line changed so is multi-line change like starting a comment
+ // Style at end of line changed so is multi-line change like starting a comment
// so require rest of window to be styled.
pdoc->EnsureStyledTo(endWindow);
}
@@ -6376,6 +6474,7 @@ void Editor::SetAnnotationVisible(int visible) { }
}
}
+ Redraw();
}
}
@@ -6438,6 +6537,18 @@ void Editor::ToggleContraction(int line) { }
}
+int Editor::ContractedFoldNext(int lineStart) {
+ for (int line = lineStart; line<pdoc->LinesTotal(); ) {
+ if (!cs.GetExpanded(line) && (pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG))
+ return line;
+ line = cs.ContractedNext(line+1);
+ if (line < 0)
+ return -1;
+ }
+
+ return -1;
+}
+
/**
* Recurse up from this line to find any folds that prevent this line from being visible
* and unfold them all.
@@ -6710,6 +6821,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { CopyAllowLine();
break;
+ case SCI_VERTICALCENTRECARET:
+ VerticalCentreCaret();
+ break;
+
case SCI_COPYRANGE:
CopyRangeToClipboard(wParam, lParam);
break;
@@ -6720,7 +6835,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_PASTE:
Paste();
- if (!caretSticky) {
+ if ((caretSticky == SC_CARETSTICKY_OFF) || (caretSticky == SC_CARETSTICKY_WHITESPACE)) {
SetLastXChosen();
}
EnsureCaretVisible();
@@ -7475,9 +7590,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return endAtLastLine;
case SCI_SETCARETSTICKY:
- PLATFORM_ASSERT((wParam == 0) || (wParam == 1));
- if (caretSticky != (wParam != 0)) {
- caretSticky = wParam != 0;
+ PLATFORM_ASSERT((wParam >= SC_CARETSTICKY_OFF) && (wParam <= SC_CARETSTICKY_WHITESPACE));
+ if ((wParam >= SC_CARETSTICKY_OFF) && (wParam <= SC_CARETSTICKY_WHITESPACE)) {
+ caretSticky = wParam;
}
break;
@@ -7823,6 +7938,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { ToggleContraction(wParam);
break;
+ case SCI_CONTRACTEDFOLDNEXT:
+ return ContractedFoldNext(wParam);
+
case SCI_ENSUREVISIBLE:
EnsureLineVisible(wParam, false);
break;
@@ -7978,7 +8096,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return (wParam <= INDIC_MAX) ? vs.indicators[wParam].under : 0;
case SCI_INDICSETALPHA:
- if (wParam <= INDIC_MAX && lParam >=0 && lParam <= 100) {
+ if (wParam <= INDIC_MAX && lParam >=0 && lParam <= 255) {
vs.indicators[wParam].fillAlpha = lParam;
InvalidateStyleRedraw();
}
@@ -8701,6 +8819,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { sel.RangeMain() = SelectionRange(sel.RangeMain().anchor, sel.RangeMain().caret);
break;
+ case SCI_CHANGELEXERSTATE:
+ pdoc->ChangeLexerState(wParam, lParam);
+ break;
+
default:
return DefWndProc(iMessage, wParam, lParam);
}
diff --git a/scintilla/src/Editor.h b/scintilla/src/Editor.h index b5acc00..50cce72 100644 --- a/scintilla/src/Editor.h +++ b/scintilla/src/Editor.h @@ -159,7 +159,7 @@ protected: // ScintillaBase subclass needs access to much of Editor int lineWidthMaxSeen;
bool verticalScrollBarVisible;
bool endAtLastLine;
- bool caretSticky;
+ int caretSticky;
bool multipleSelection;
bool additionalSelectionTyping;
int multiPasteMode;
@@ -197,6 +197,7 @@ protected: // ScintillaBase subclass needs access to much of Editor bool dropWentOutside;
SelectionPosition posDrag;
SelectionPosition posDrop;
+ int hotSpotClickPos;
int lastXChosen;
int lineAnchor;
int originalAnchorPos;
@@ -218,7 +219,7 @@ protected: // ScintillaBase subclass needs access to much of Editor PRectangle rcPaint;
bool paintingAllText;
StyleNeeded styleNeeded;
-
+
int modEventMask;
SelectionText drag;
@@ -327,6 +328,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void ScrollTo(int line, bool moveThumb=true);
virtual void ScrollText(int linesToMove);
void HorizontalScrollTo(int xPos);
+ void VerticalCentreCaret();
void MoveCaretInsideView(bool ensureVisible=true);
int DisplayFromPosition(int pos);
@@ -417,6 +419,7 @@ protected: // ScintillaBase subclass needs access to much of Editor virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt);
void NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt);
void NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt);
+ void NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool alt);
void NotifyUpdateUI();
void NotifyPainted();
void NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt);
@@ -431,6 +434,8 @@ protected: // ScintillaBase subclass needs access to much of Editor void NotifyModified(Document *document, DocModification mh, void *userData);
void NotifyDeleted(Document *document, void *userData);
void NotifyStyleNeeded(Document *doc, void *userData, int endPos);
+ void NotifyLexerChanged(Document *doc, void *userData);
+ void NotifyErrorOccurred(Document *doc, void *userData, int status);
void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
void PageMove(int direction, Selection::selTypes sel=Selection::noSel, bool stuttered = false);
@@ -506,6 +511,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void Expand(int &line, bool doExpand);
void ToggleContraction(int line);
+ int ContractedFoldNext(int lineStart);
void EnsureLineVisible(int lineDoc, bool enforcePolicy);
int GetTag(char *tagValue, int tagNumber);
int ReplaceTarget(bool replacePatterns, const char *text, int length=-1);
diff --git a/scintilla/src/ExternalLexer.cxx b/scintilla/src/ExternalLexer.cxx index 586a3fb..9af0dec 100644 --- a/scintilla/src/ExternalLexer.cxx +++ b/scintilla/src/ExternalLexer.cxx @@ -9,18 +9,18 @@ #include <stdio.h>
#include <string.h>
#include <ctype.h>
+#include <assert.h>
#include <string>
#include "Platform.h"
+#include "ILexer.h"
#include "Scintilla.h"
-
#include "SciLexer.h"
-#include "PropSet.h"
-#include "Accessor.h"
-#include "DocumentAccessor.h"
-#include "KeyWords.h"
+
+#include "LexerModule.h"
+#include "Catalogue.h"
#include "ExternalLexer.h"
#ifdef SCI_NAMESPACE
@@ -35,76 +35,9 @@ LexerManager *LexerManager::theInstance = NULL; //
//------------------------------------------
-char **WordListsToStrings(WordList *val[]) {
- int dim = 0;
- while (val[dim])
- dim++;
- char **wls = new char * [dim + 1];
- for (int i = 0; i < dim; i++) {
- std::string words;
- words = "";
- for (int n = 0; n < val[i]->len; n++) {
- words += val[i]->words[n];
- if (n != val[i]->len - 1)
- words += " ";
- }
- wls[i] = new char[words.length() + 1];
- strcpy(wls[i], words.c_str());
- }
- wls[dim] = 0;
- return wls;
-}
-
-void DeleteWLStrings(char *strs[]) {
- int dim = 0;
- while (strs[dim]) {
- delete strs[dim];
- dim++;
- }
- delete [] strs;
-}
-
-void ExternalLexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle,
- WordList *keywordlists[], Accessor &styler) const {
- if (!fneLexer)
- return ;
-
- char **kwds = WordListsToStrings(keywordlists);
- char *ps = styler.GetProperties();
-
- // The accessor passed in is always a DocumentAccessor so this cast and the subsequent
- // access will work. Can not use the stricter dynamic_cast as that requires RTTI.
- DocumentAccessor &da = static_cast<DocumentAccessor &>(styler);
- WindowID wID = da.GetWindow();
-
- fneLexer(externalLanguage, startPos, lengthDoc, initStyle, kwds, wID, ps);
-
- delete ps;
- DeleteWLStrings(kwds);
-}
-
-void ExternalLexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle,
- WordList *keywordlists[], Accessor &styler) const {
- if (!fneFolder)
- return ;
-
- char **kwds = WordListsToStrings(keywordlists);
- char *ps = styler.GetProperties();
-
- // The accessor passed in is always a DocumentAccessor so this cast and the subsequent
- // access will work. Can not use the stricter dynamic_cast as that requires RTTI.
- DocumentAccessor &da = static_cast<DocumentAccessor &>(styler);
- WindowID wID = da.GetWindow();
-
- fneFolder(externalLanguage, startPos, lengthDoc, initStyle, kwds, wID, ps);
-
- delete ps;
- DeleteWLStrings(kwds);
-}
-
-void ExternalLexerModule::SetExternal(ExtLexerFunction fLexer, ExtFoldFunction fFolder, int index) {
- fneLexer = fLexer;
- fneFolder = fFolder;
+void ExternalLexerModule::SetExternal(GetLexerFactoryFunction fFactory, int index) {
+ fneFactory = fFactory;
+ fnFactory = fFactory(index);
externalLanguage = index;
}
@@ -132,8 +65,7 @@ LexerLibrary::LexerLibrary(const char *ModuleName) { // Find functions in the DLL
GetLexerNameFn GetLexerName = (GetLexerNameFn)(sptr_t)lib->FindFunction("GetLexerName");
- ExtLexerFunction Lexer = (ExtLexerFunction)(sptr_t)lib->FindFunction("Lex");
- ExtFoldFunction Folder = (ExtFoldFunction)(sptr_t)lib->FindFunction("Fold");
+ GetLexerFactoryFunction fnFactory = (GetLexerFactoryFunction)(sptr_t)lib->FindFunction("GetLexerFactory");
// Assign a buffer for the lexer name.
char lexname[100];
@@ -144,6 +76,7 @@ LexerLibrary::LexerLibrary(const char *ModuleName) { for (int i = 0; i < nl; i++) {
GetLexerName(i, lexname, 100);
lex = new ExternalLexerModule(SCLEX_AUTOMATIC, NULL, lexname, NULL);
+ Catalogue::AddLexerModule(lex);
// Create a LexerMinder so we don't leak the ExternalLexerModule...
lm = new LexerMinder;
@@ -158,8 +91,8 @@ LexerLibrary::LexerLibrary(const char *ModuleName) { }
// The external lexer needs to know how to call into its DLL to
- // do its lexing and folding, we tell it here. Folder may be null.
- lex->SetExternal(Lexer, Folder, i);
+ // do its lexing and folding, we tell it here.
+ lex->SetExternal(fnFactory, i);
}
}
}
@@ -172,7 +105,6 @@ LexerLibrary::~LexerLibrary() { }
void LexerLibrary::Release() {
- //TODO maintain a list of lexers created, and delete them!
LexerMinder *lm;
LexerMinder *lmNext;
lm = first;
diff --git a/scintilla/src/ExternalLexer.h b/scintilla/src/ExternalLexer.h index 60ad4a8..dd21914 100644 --- a/scintilla/src/ExternalLexer.h +++ b/scintilla/src/ExternalLexer.h @@ -18,22 +18,15 @@ namespace Scintilla {
#endif
-// External Lexer function definitions...
-typedef void (EXT_LEXER_DECL *ExtLexerFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle,
- char *words[], WindowID window, char *props);
-typedef void (EXT_LEXER_DECL *ExtFoldFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle,
- char *words[], WindowID window, char *props);
typedef void*(EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index);
typedef int (EXT_LEXER_DECL *GetLexerCountFn)();
typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength);
-
-//class DynamicLibrary;
+typedef LexerFactoryFunction(EXT_LEXER_DECL *GetLexerFactoryFunction)(unsigned int Index);
/// Sub-class of LexerModule to use an external lexer.
-class ExternalLexerModule : protected LexerModule {
+class ExternalLexerModule : public LexerModule {
protected:
- ExtLexerFunction fneLexer;
- ExtFoldFunction fneFolder;
+ GetLexerFactoryFunction fneFactory;
int externalLanguage;
char name[100];
public:
@@ -43,11 +36,7 @@ public: name[sizeof(name)-1] = '\0';
languageName = name;
}
- virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
- WordList *keywordlists[], Accessor &styler) const;
- virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,
- WordList *keywordlists[], Accessor &styler) const;
- virtual void SetExternal(ExtLexerFunction fLexer, ExtFoldFunction fFolder, int index);
+ virtual void SetExternal(GetLexerFactoryFunction fFactory, int index);
};
/// LexerMinder points to an ExternalLexerModule - so we don't leak them.
diff --git a/scintilla/src/KeyWords.cxx b/scintilla/src/KeyWords.cxx deleted file mode 100644 index 793bec4..0000000 --- a/scintilla/src/KeyWords.cxx +++ /dev/null @@ -1,429 +0,0 @@ -// Scintilla source code edit control
-/** @file KeyWords.cxx
- ** Colourise for particular languages.
- **/
-// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
-// The License.txt file describes the conditions under which this software may be distributed.
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdarg.h>
-
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
-
-#ifdef SCI_NAMESPACE
-using namespace Scintilla;
-#endif
-
-/**
- * Creates an array that points into each word in the string and puts \0 terminators
- * after each word.
- */
-static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = false) {
- int prev = '\n';
- int words = 0;
- // For rapid determination of whether a character is a separator, build
- // a look up table.
- bool wordSeparator[256];
- for (int i=0; i<256; i++) {
- wordSeparator[i] = false;
- }
- wordSeparator['\r'] = true;
- wordSeparator['\n'] = true;
- if (!onlyLineEnds) {
- wordSeparator[' '] = true;
- wordSeparator['\t'] = true;
- }
- for (int j = 0; wordlist[j]; j++) {
- int curr = static_cast<unsigned char>(wordlist[j]);
- if (!wordSeparator[curr] && wordSeparator[prev])
- words++;
- prev = curr;
- }
- char **keywords = new char *[words + 1];
- if (keywords) {
- words = 0;
- prev = '\0';
- size_t slen = strlen(wordlist);
- for (size_t k = 0; k < slen; k++) {
- if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) {
- if (!prev) {
- keywords[words] = &wordlist[k];
- words++;
- }
- } else {
- wordlist[k] = '\0';
- }
- prev = wordlist[k];
- }
- keywords[words] = &wordlist[slen];
- *len = words;
- } else {
- *len = 0;
- }
- return keywords;
-}
-
-void WordList::Clear() {
- if (words) {
- delete []list;
- delete []words;
- }
- words = 0;
- list = 0;
- len = 0;
- sorted = false;
-}
-
-void WordList::Set(const char *s) {
- list = new char[strlen(s) + 1];
- strcpy(list, s);
- sorted = false;
- words = ArrayFromWordList(list, &len, onlyLineEnds);
-}
-
-extern "C" int cmpString(const void *a1, const void *a2) {
- // Can't work out the correct incantation to use modern casts here
- return strcmp(*(char **)(a1), *(char **)(a2));
-}
-
-static void SortWordList(char **words, unsigned int len) {
- qsort(reinterpret_cast<void *>(words), len, sizeof(*words),
- cmpString);
-}
-
-bool WordList::InList(const char *s) {
- if (0 == words)
- return false;
- if (!sorted) {
- sorted = true;
- SortWordList(words, len);
- for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
- starts[k] = -1;
- for (int l = len - 1; l >= 0; l--) {
- unsigned char indexChar = words[l][0];
- starts[indexChar] = l;
- }
- }
- unsigned char firstChar = s[0];
- int j = starts[firstChar];
- if (j >= 0) {
- while ((unsigned char)words[j][0] == firstChar) {
- if (s[1] == words[j][1]) {
- const char *a = words[j] + 1;
- const char *b = s + 1;
- while (*a && *a == *b) {
- a++;
- b++;
- }
- if (!*a && !*b)
- return true;
- }
- j++;
- }
- }
- j = starts['^'];
- if (j >= 0) {
- while (words[j][0] == '^') {
- const char *a = words[j] + 1;
- const char *b = s;
- while (*a && *a == *b) {
- a++;
- b++;
- }
- if (!*a)
- return true;
- j++;
- }
- }
- return false;
-}
-
-/** similar to InList, but word s can be a substring of keyword.
- * eg. the keyword define is defined as def~ine. This means the word must start
- * with def to be a keyword, but also defi, defin and define are valid.
- * The marker is ~ in this case.
- */
-bool WordList::InListAbbreviated(const char *s, const char marker) {
- if (0 == words)
- return false;
- if (!sorted) {
- sorted = true;
- SortWordList(words, len);
- for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
- starts[k] = -1;
- for (int l = len - 1; l >= 0; l--) {
- unsigned char indexChar = words[l][0];
- starts[indexChar] = l;
- }
- }
- unsigned char firstChar = s[0];
- int j = starts[firstChar];
- if (j >= 0) {
- while (words[j][0] == firstChar) {
- bool isSubword = false;
- int start = 1;
- if (words[j][1] == marker) {
- isSubword = true;
- start++;
- }
- if (s[1] == words[j][start]) {
- const char *a = words[j] + start;
- const char *b = s + 1;
- while (*a && *a == *b) {
- a++;
- if (*a == marker) {
- isSubword = true;
- a++;
- }
- b++;
- }
- if ((!*a || isSubword) && !*b)
- return true;
- }
- j++;
- }
- }
- j = starts['^'];
- if (j >= 0) {
- while (words[j][0] == '^') {
- const char *a = words[j] + 1;
- const char *b = s;
- while (*a && *a == *b) {
- a++;
- b++;
- }
- if (!*a)
- return true;
- j++;
- }
- }
- return false;
-}
-
-const LexerModule *LexerModule::base = 0;
-int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1;
-
-LexerModule::LexerModule(int language_,
- LexerFunction fnLexer_,
- const char *languageName_,
- LexerFunction fnFolder_,
- const char *const wordListDescriptions_[],
- int styleBits_) :
- language(language_),
- fnLexer(fnLexer_),
- fnFolder(fnFolder_),
- wordListDescriptions(wordListDescriptions_),
- styleBits(styleBits_),
- languageName(languageName_) {
- next = base;
- base = this;
- if (language == SCLEX_AUTOMATIC) {
- language = nextLanguage;
- nextLanguage++;
- }
-}
-
-int LexerModule::GetNumWordLists() const {
- if (wordListDescriptions == NULL) {
- return -1;
- } else {
- int numWordLists = 0;
-
- while (wordListDescriptions[numWordLists]) {
- ++numWordLists;
- }
-
- return numWordLists;
- }
-}
-
-const char *LexerModule::GetWordListDescription(int index) const {
- static const char *emptyStr = "";
-
- PLATFORM_ASSERT(index < GetNumWordLists());
- if (index >= GetNumWordLists()) {
- return emptyStr;
- } else {
- return wordListDescriptions[index];
- }
-}
-
-int LexerModule::GetStyleBitsNeeded() const {
- return styleBits;
-}
-
-const LexerModule *LexerModule::Find(int language) {
- const LexerModule *lm = base;
- while (lm) {
- if (lm->language == language) {
- return lm;
- }
- lm = lm->next;
- }
- return 0;
-}
-
-const LexerModule *LexerModule::Find(const char *languageName) {
- if (languageName) {
- const LexerModule *lm = base;
- while (lm) {
- if (lm->languageName && 0 == strcmp(lm->languageName, languageName)) {
- return lm;
- }
- lm = lm->next;
- }
- }
- return 0;
-}
-
-void LexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle,
- WordList *keywordlists[], Accessor &styler) const {
- if (fnLexer)
- fnLexer(startPos, lengthDoc, initStyle, keywordlists, styler);
-}
-
-void LexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle,
- WordList *keywordlists[], Accessor &styler) const {
- if (fnFolder) {
- int lineCurrent = styler.GetLine(startPos);
- // Move back one line in case deletion wrecked current line fold state
- if (lineCurrent > 0) {
- lineCurrent--;
- int newStartPos = styler.LineStart(lineCurrent);
- lengthDoc += startPos - newStartPos;
- startPos = newStartPos;
- initStyle = 0;
- if (startPos > 0) {
- initStyle = styler.StyleAt(startPos - 1);
- }
- }
- fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler);
- }
-}
-
-// Alternative historical name for Scintilla_LinkLexers
-int wxForceScintillaLexers(void) {
- return Scintilla_LinkLexers();
-}
-
-// To add or remove a lexer, add or remove its file and run LexGen.py.
-
-// Force a reference to all of the Scintilla lexers so that the linker will
-// not remove the code of the lexers.
-int Scintilla_LinkLexers() {
- static int forcer = 0;
-
-// Shorten the code that declares a lexer and ensures it is linked in by calling a method.
-#define LINK_LEXER(lexer) void(0)
-
-//++Autogenerated -- run src/LexGen.py to regenerate
-//**\(\tLINK_LEXER(\*);\n\)
- LINK_LEXER(lmAbaqus);
- LINK_LEXER(lmAda);
- LINK_LEXER(lmAns1);
- LINK_LEXER(lmAPDL);
- LINK_LEXER(lmAsm);
- LINK_LEXER(lmASY);
- LINK_LEXER(lmAU3);
- LINK_LEXER(lmAVE);
- LINK_LEXER(lmBaan);
- LINK_LEXER(lmBash);
- LINK_LEXER(lmBatch);
- LINK_LEXER(lmBlitzBasic);
- LINK_LEXER(lmBullant);
- LINK_LEXER(lmCaml);
- LINK_LEXER(lmClw);
- LINK_LEXER(lmClwNoCase);
- LINK_LEXER(lmCmake);
- LINK_LEXER(lmCOBOL);
- LINK_LEXER(lmConf);
- LINK_LEXER(lmCPP);
- LINK_LEXER(lmCPPNoCase);
- LINK_LEXER(lmCsound);
- LINK_LEXER(lmCss);
- LINK_LEXER(lmD);
- LINK_LEXER(lmDiff);
- LINK_LEXER(lmEiffel);
- LINK_LEXER(lmEiffelkw);
- LINK_LEXER(lmErlang);
- LINK_LEXER(lmErrorList);
- LINK_LEXER(lmESCRIPT);
- LINK_LEXER(lmF77);
- LINK_LEXER(lmFlagShip);
- LINK_LEXER(lmForth);
- LINK_LEXER(lmFortran);
- LINK_LEXER(lmFreeBasic);
- LINK_LEXER(lmGAP);
- LINK_LEXER(lmGui4Cli);
- LINK_LEXER(lmHaskell);
- LINK_LEXER(lmHTML);
- LINK_LEXER(lmInno);
- LINK_LEXER(lmKix);
- LINK_LEXER(lmLatex);
- LINK_LEXER(lmLISP);
- LINK_LEXER(lmLot);
- LINK_LEXER(lmLout);
- LINK_LEXER(lmLua);
- LINK_LEXER(lmMagikSF);
- LINK_LEXER(lmMake);
- LINK_LEXER(lmMarkdown);
- LINK_LEXER(lmMatlab);
- LINK_LEXER(lmMETAPOST);
- LINK_LEXER(lmMMIXAL);
- LINK_LEXER(lmMSSQL);
- LINK_LEXER(lmMySQL);
- LINK_LEXER(lmNimrod);
- LINK_LEXER(lmNncrontab);
- LINK_LEXER(lmNsis);
- LINK_LEXER(lmNull);
- LINK_LEXER(lmOctave);
- LINK_LEXER(lmOpal);
- LINK_LEXER(lmPascal);
- LINK_LEXER(lmPB);
- LINK_LEXER(lmPerl);
- LINK_LEXER(lmPHPSCRIPT);
- LINK_LEXER(lmPLM);
- LINK_LEXER(lmPo);
- LINK_LEXER(lmPOV);
- LINK_LEXER(lmPowerPro);
- LINK_LEXER(lmPowerShell);
- LINK_LEXER(lmProgress);
- LINK_LEXER(lmProps);
- LINK_LEXER(lmPS);
- LINK_LEXER(lmPureBasic);
- LINK_LEXER(lmPython);
- LINK_LEXER(lmR);
- LINK_LEXER(lmREBOL);
- LINK_LEXER(lmRuby);
- LINK_LEXER(lmScriptol);
- LINK_LEXER(lmSmalltalk);
- LINK_LEXER(lmSML);
- LINK_LEXER(lmSorc);
- LINK_LEXER(lmSpecman);
- LINK_LEXER(lmSpice);
- LINK_LEXER(lmSQL);
- LINK_LEXER(lmTACL);
- LINK_LEXER(lmTADS3);
- LINK_LEXER(lmTAL);
- LINK_LEXER(lmTCL);
- LINK_LEXER(lmTeX);
- LINK_LEXER(lmVB);
- LINK_LEXER(lmVBScript);
- LINK_LEXER(lmVerilog);
- LINK_LEXER(lmVHDL);
- LINK_LEXER(lmXML);
- LINK_LEXER(lmYAML);
-
-//--Autogenerated -- end of automatically generated section
-
- return 1;
-}
diff --git a/scintilla/src/LexCPP.cxx b/scintilla/src/LexCPP.cxx deleted file mode 100644 index dfa0754..0000000 --- a/scintilla/src/LexCPP.cxx +++ /dev/null @@ -1,508 +0,0 @@ -// Scintilla source code edit control
-/** @file LexCPP.cxx
- ** Lexer for C++, C, Java, and JavaScript.
- **/
-// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
-// The License.txt file describes the conditions under which this software may be distributed.
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdarg.h>
-
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
-#include "CharacterSet.h"
-
-#ifdef SCI_NAMESPACE
-using namespace Scintilla;
-#endif
-
-static bool IsSpaceEquiv(int state) {
- return (state <= SCE_C_COMMENTDOC) ||
- // including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE
- (state == SCE_C_COMMENTLINEDOC) || (state == SCE_C_COMMENTDOCKEYWORD) ||
- (state == SCE_C_COMMENTDOCKEYWORDERROR);
-}
-
-// Preconditions: sc.currentPos points to a character after '+' or '-'.
-// The test for pos reaching 0 should be redundant,
-// and is in only for safety measures.
-// Limitation: this code will give the incorrect answer for code like
-// a = b+++/ptn/...
-// Putting a space between the '++' post-inc operator and the '+' binary op
-// fixes this, and is highly recommended for readability anyway.
-static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) {
- int pos = (int) sc.currentPos;
- while (--pos > 0) {
- char ch = styler[pos];
- if (ch == '+' || ch == '-') {
- return styler[pos - 1] == ch;
- }
- }
- return false;
-}
-
-static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
- Accessor &styler, bool caseSensitive) {
-
- WordList &keywords = *keywordlists[0];
- WordList &keywords2 = *keywordlists[1];
- WordList &keywords3 = *keywordlists[2];
- WordList &keywords4 = *keywordlists[3];
-
- // property styling.within.preprocessor
- // For C++ code, determines whether all preprocessor code is styled in the preprocessor style (0, the default)
- // or only from the initial # to the end of the command word(1).
- bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0;
-
- CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-");
- CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-");
-
- CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]");
-
- CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
- CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
-
- // property lexer.cpp.allow.dollars
- // Set to 0 to disallow the '$' character in identifiers with the cpp lexer.
- if (styler.GetPropertyInt("lexer.cpp.allow.dollars", 1) != 0) {
- setWordStart.Add('$');
- setWord.Add('$');
- }
-
- int chPrevNonWhite = ' ';
- int visibleChars = 0;
- bool lastWordWasUUID = false;
- int styleBeforeDCKeyword = SCE_C_DEFAULT;
- bool continuationLine = false;
- bool isIncludePreprocessor = false;
-
- if (initStyle == SCE_C_PREPROCESSOR) {
- // Set continuationLine if last character of previous line is '\'
- int lineCurrent = styler.GetLine(startPos);
- if (lineCurrent > 0) {
- int chBack = styler.SafeGetCharAt(startPos-1, 0);
- int chBack2 = styler.SafeGetCharAt(startPos-2, 0);
- int lineEndChar = '!';
- if (chBack2 == '\r' && chBack == '\n') {
- lineEndChar = styler.SafeGetCharAt(startPos-3, 0);
- } else if (chBack == '\n' || chBack == '\r') {
- lineEndChar = chBack2;
- }
- continuationLine = lineEndChar == '\\';
- }
- }
-
- // look back to set chPrevNonWhite properly for better regex colouring
- if (startPos > 0) {
- int back = startPos;
- while (--back && IsSpaceEquiv(styler.StyleAt(back)))
- ;
- if (styler.StyleAt(back) == SCE_C_OPERATOR) {
- chPrevNonWhite = styler.SafeGetCharAt(back);
- }
- }
-
- StyleContext sc(startPos, length, initStyle, styler);
-
- for (; sc.More(); sc.Forward()) {
-
- if (sc.atLineStart) {
- if (sc.state == SCE_C_STRING) {
- // Prevent SCE_C_STRINGEOL from leaking back to previous line which
- // ends with a line continuation by locking in the state upto this position.
- sc.SetState(SCE_C_STRING);
- }
- // Reset states to begining of colourise so no surprises
- // if different sets of lines lexed.
- visibleChars = 0;
- lastWordWasUUID = false;
- isIncludePreprocessor = false;
- }
-
- // Handle line continuation generically.
- if (sc.ch == '\\') {
- if (sc.chNext == '\n' || sc.chNext == '\r') {
- sc.Forward();
- if (sc.ch == '\r' && sc.chNext == '\n') {
- sc.Forward();
- }
- continuationLine = true;
- continue;
- }
- }
-
- // Determine if the current state should terminate.
- switch (sc.state) {
- case SCE_C_OPERATOR:
- sc.SetState(SCE_C_DEFAULT);
- break;
- case SCE_C_NUMBER:
- // We accept almost anything because of hex. and number suffixes
- if (!setWord.Contains(sc.ch)) {
- sc.SetState(SCE_C_DEFAULT);
- }
- break;
- case SCE_C_IDENTIFIER:
- if (!setWord.Contains(sc.ch) || (sc.ch == '.')) {
- char s[1000];
- if (caseSensitive) {
- sc.GetCurrent(s, sizeof(s));
- } else {
- sc.GetCurrentLowered(s, sizeof(s));
- }
- if (keywords.InList(s)) {
- lastWordWasUUID = strcmp(s, "uuid") == 0;
- sc.ChangeState(SCE_C_WORD);
- } else if (keywords2.InList(s)) {
- sc.ChangeState(SCE_C_WORD2);
- } else if (keywords4.InList(s)) {
- sc.ChangeState(SCE_C_GLOBALCLASS);
- }
- sc.SetState(SCE_C_DEFAULT);
- }
- break;
- case SCE_C_PREPROCESSOR:
- if (sc.atLineStart && !continuationLine) {
- sc.SetState(SCE_C_DEFAULT);
- } else if (stylingWithinPreprocessor) {
- if (IsASpace(sc.ch)) {
- sc.SetState(SCE_C_DEFAULT);
- }
- } else {
- if (sc.Match('/', '*') || sc.Match('/', '/')) {
- sc.SetState(SCE_C_DEFAULT);
- }
- }
- break;
- case SCE_C_COMMENT:
- if (sc.Match('*', '/')) {
- sc.Forward();
- sc.ForwardSetState(SCE_C_DEFAULT);
- }
- break;
- case SCE_C_COMMENTDOC:
- if (sc.Match('*', '/')) {
- sc.Forward();
- sc.ForwardSetState(SCE_C_DEFAULT);
- } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support
- // Verify that we have the conditions to mark a comment-doc-keyword
- if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) {
- styleBeforeDCKeyword = SCE_C_COMMENTDOC;
- sc.SetState(SCE_C_COMMENTDOCKEYWORD);
- }
- }
- break;
- case SCE_C_COMMENTLINE:
- if (sc.atLineStart) {
- sc.SetState(SCE_C_DEFAULT);
- }
- break;
- case SCE_C_COMMENTLINEDOC:
- if (sc.atLineStart) {
- sc.SetState(SCE_C_DEFAULT);
- } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support
- // Verify that we have the conditions to mark a comment-doc-keyword
- if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) {
- styleBeforeDCKeyword = SCE_C_COMMENTLINEDOC;
- sc.SetState(SCE_C_COMMENTDOCKEYWORD);
- }
- }
- break;
- case SCE_C_COMMENTDOCKEYWORD:
- if ((styleBeforeDCKeyword == SCE_C_COMMENTDOC) && sc.Match('*', '/')) {
- sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
- sc.Forward();
- sc.ForwardSetState(SCE_C_DEFAULT);
- } else if (!setDoxygen.Contains(sc.ch)) {
- char s[100];
- if (caseSensitive) {
- sc.GetCurrent(s, sizeof(s));
- } else {
- sc.GetCurrentLowered(s, sizeof(s));
- }
- if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) {
- sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
- }
- sc.SetState(styleBeforeDCKeyword);
- }
- break;
- case SCE_C_STRING:
- if (sc.atLineEnd) {
- sc.ChangeState(SCE_C_STRINGEOL);
- } else if (isIncludePreprocessor) {
- if (sc.ch == '>') {
- sc.ForwardSetState(SCE_C_DEFAULT);
- isIncludePreprocessor = false;
- }
- } else if (sc.ch == '\\') {
- if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
- sc.Forward();
- }
- } else if (sc.ch == '\"') {
- sc.ForwardSetState(SCE_C_DEFAULT);
- }
- break;
- case SCE_C_CHARACTER:
- if (sc.atLineEnd) {
- sc.ChangeState(SCE_C_STRINGEOL);
- } else if (sc.ch == '\\') {
- if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
- sc.Forward();
- }
- } else if (sc.ch == '\'') {
- sc.ForwardSetState(SCE_C_DEFAULT);
- }
- break;
- case SCE_C_REGEX:
- if (sc.atLineStart) {
- sc.SetState(SCE_C_DEFAULT);
- } else if (sc.ch == '/') {
- sc.Forward();
- while ((sc.ch < 0x80) && islower(sc.ch))
- sc.Forward(); // gobble regex flags
- sc.SetState(SCE_C_DEFAULT);
- } else if (sc.ch == '\\') {
- // Gobble up the quoted character
- if (sc.chNext == '\\' || sc.chNext == '/') {
- sc.Forward();
- }
- }
- break;
- case SCE_C_STRINGEOL:
- if (sc.atLineStart) {
- sc.SetState(SCE_C_DEFAULT);
- }
- break;
- case SCE_C_VERBATIM:
- if (sc.ch == '\"') {
- if (sc.chNext == '\"') {
- sc.Forward();
- } else {
- sc.ForwardSetState(SCE_C_DEFAULT);
- }
- }
- break;
- case SCE_C_UUID:
- if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') {
- sc.SetState(SCE_C_DEFAULT);
- }
- }
-
- // Determine if a new state should be entered.
- if (sc.state == SCE_C_DEFAULT) {
- if (sc.Match('@', '\"')) {
- sc.SetState(SCE_C_VERBATIM);
- sc.Forward();
- } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
- if (lastWordWasUUID) {
- sc.SetState(SCE_C_UUID);
- lastWordWasUUID = false;
- } else {
- sc.SetState(SCE_C_NUMBER);
- }
- } else if (setWordStart.Contains(sc.ch) || (sc.ch == '@')) {
- if (lastWordWasUUID) {
- sc.SetState(SCE_C_UUID);
- lastWordWasUUID = false;
- } else {
- sc.SetState(SCE_C_IDENTIFIER);
- }
- } else if (sc.Match('/', '*')) {
- if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style
- sc.SetState(SCE_C_COMMENTDOC);
- } else {
- sc.SetState(SCE_C_COMMENT);
- }
- sc.Forward(); // Eat the * so it isn't used for the end of the comment
- } else if (sc.Match('/', '/')) {
- if ((sc.Match("///") && !sc.Match("////")) || sc.Match("//!"))
- // Support of Qt/Doxygen doc. style
- sc.SetState(SCE_C_COMMENTLINEDOC);
- else
- sc.SetState(SCE_C_COMMENTLINE);
- } else if (sc.ch == '/' && setOKBeforeRE.Contains(chPrevNonWhite) &&
- (!setCouldBePostOp.Contains(chPrevNonWhite) || !FollowsPostfixOperator(sc, styler))) {
- sc.SetState(SCE_C_REGEX); // JavaScript's RegEx
- } else if (sc.ch == '\"') {
- sc.SetState(SCE_C_STRING);
- isIncludePreprocessor = false; // ensure that '>' won't end the string
- } else if (isIncludePreprocessor && sc.ch == '<') {
- sc.SetState(SCE_C_STRING);
- } else if (sc.ch == '\'') {
- sc.SetState(SCE_C_CHARACTER);
- } else if (sc.ch == '#' && visibleChars == 0) {
- // Preprocessor commands are alone on their line
- sc.SetState(SCE_C_PREPROCESSOR);
- // Skip whitespace between # and preprocessor word
- do {
- sc.Forward();
- } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More());
- if (sc.atLineEnd) {
- sc.SetState(SCE_C_DEFAULT);
- } else if (sc.Match("include")) {
- isIncludePreprocessor = true;
- }
- } else if (isoperator(static_cast<char>(sc.ch))) {
- sc.SetState(SCE_C_OPERATOR);
- }
- }
-
- if (!IsASpace(sc.ch) && !IsSpaceEquiv(sc.state)) {
- chPrevNonWhite = sc.ch;
- visibleChars++;
- }
- continuationLine = false;
- }
- sc.Complete();
-}
-
-static bool IsStreamCommentStyle(int style) {
- return style == SCE_C_COMMENT ||
- style == SCE_C_COMMENTDOC ||
- style == SCE_C_COMMENTDOCKEYWORD ||
- style == SCE_C_COMMENTDOCKEYWORDERROR;
-}
-
-// Store both the current line's fold level and the next lines in the
-// level store to make it easy to pick up with each increment
-// and to make it possible to fiddle the current level for "} else {".
-static void FoldCppDoc(unsigned int startPos, int length, int initStyle,
- WordList *[], Accessor &styler) {
-
- // property fold.comment
- // This option enables folding multi-line comments and explicit fold points when using the C++ lexer.
- // Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //}
- // at the end of a section that should fold.
- bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
-
- // property fold.preprocessor
- // This option enables folding preprocessor directives when using the C++ lexer.
- // Includes C#'s explicit #region and #endregion folding directives.
- bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
-
- bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
-
- // property fold.at.else
- // This option enables C++ folding on a "} else {" line of an if statement.
- bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
-
- unsigned int endPos = startPos + length;
- int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
- int levelCurrent = SC_FOLDLEVELBASE;
- if (lineCurrent > 0)
- levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
- int levelMinCurrent = levelCurrent;
- int levelNext = levelCurrent;
- char chNext = styler[startPos];
- int styleNext = styler.StyleAt(startPos);
- int style = initStyle;
- for (unsigned int i = startPos; i < endPos; i++) {
- char ch = chNext;
- chNext = styler.SafeGetCharAt(i + 1);
- int stylePrev = style;
- style = styleNext;
- styleNext = styler.StyleAt(i + 1);
- bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
- if (foldComment && IsStreamCommentStyle(style)) {
- if (!IsStreamCommentStyle(stylePrev) && (stylePrev != SCE_C_COMMENTLINEDOC)) {
- levelNext++;
- } else if (!IsStreamCommentStyle(styleNext) && (styleNext != SCE_C_COMMENTLINEDOC) && !atEOL) {
- // Comments don't end at end of line and the next character may be unstyled.
- levelNext--;
- }
- }
- /* Disable explicit folding; it can often cause problems with non-aware code
- if (foldComment && (style == SCE_C_COMMENTLINE)) {
- if ((ch == '/') && (chNext == '/')) {
- char chNext2 = styler.SafeGetCharAt(i + 2);
- if (chNext2 == '{') {
- levelNext++;
- } else if (chNext2 == '}') {
- levelNext--;
- }
- }
- }
- */
- if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
- if (ch == '#') {
- unsigned int j = i + 1;
- while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
- j++;
- }
- if (styler.Match(j, "region") || styler.Match(j, "if")) {
- levelNext++;
- } else if (styler.Match(j, "end")) {
- levelNext--;
- }
- }
- }
- if (style == SCE_C_OPERATOR) {
- if (ch == '{') {
- // Measure the minimum before a '{' to allow
- // folding on "} else {"
- if (levelMinCurrent > levelNext) {
- levelMinCurrent = levelNext;
- }
- levelNext++;
- } else if (ch == '}') {
- levelNext--;
- }
- }
- if (!IsASpace(ch))
- visibleChars++;
- if (atEOL || (i == endPos-1)) {
- int levelUse = levelCurrent;
- if (foldAtElse) {
- levelUse = levelMinCurrent;
- }
- int lev = levelUse | levelNext << 16;
- if (visibleChars == 0 && foldCompact)
- lev |= SC_FOLDLEVELWHITEFLAG;
- if (levelUse < levelNext)
- lev |= SC_FOLDLEVELHEADERFLAG;
- if (lev != styler.LevelAt(lineCurrent)) {
- styler.SetLevel(lineCurrent, lev);
- }
- lineCurrent++;
- levelCurrent = levelNext;
- levelMinCurrent = levelCurrent;
- if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) {
- // There is an empty line at end of file so give it same level and empty
- styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG);
- }
- visibleChars = 0;
- }
- }
-}
-
-static const char *const cppWordLists[] = {
- "Primary keywords and identifiers",
- "Secondary keywords and identifiers",
- "Documentation comment keywords",
- "Unused",
- "Global classes and typedefs",
- 0,
-};
-
-static void ColouriseCppDocSensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
- Accessor &styler) {
- ColouriseCppDoc(startPos, length, initStyle, keywordlists, styler, true);
-}
-
-static void ColouriseCppDocInsensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
- Accessor &styler) {
- ColouriseCppDoc(startPos, length, initStyle, keywordlists, styler, false);
-}
-
-LexerModule lmCPP(SCLEX_CPP, ColouriseCppDocSensitive, "cpp", FoldCppDoc, cppWordLists);
-LexerModule lmCPPNoCase(SCLEX_CPPNOCASE, ColouriseCppDocInsensitive, "cppnocase", FoldCppDoc, cppWordLists);
diff --git a/scintilla/src/LexHaskell.cxx b/scintilla/src/LexHaskell.cxx deleted file mode 100644 index f2d5432..0000000 --- a/scintilla/src/LexHaskell.cxx +++ /dev/null @@ -1,275 +0,0 @@ -/******************************************************************
- * LexHaskell.cxx
- *
- * A haskell lexer for the scintilla code control.
- * Some stuff "lended" from LexPython.cxx and LexCPP.cxx.
- * External lexer stuff inspired from the caml external lexer.
- *
- * Written by Tobias Engvall - tumm at dtek dot chalmers dot se
- *
- *
- * TODO:
- * * Implement a folder :)
- * * Nice Character-lexing (stuff inside '\''), LexPython has
- * this.
- *
- *
- *****************************************************************/
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdarg.h>
-
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "PropSetSimple.h"
-#include "Accessor.h"
-#include "StyleContext.h"
-#include "KeyWords.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
-
-#ifdef SCI_NAMESPACE
-using namespace Scintilla;
-#endif
-
-#ifdef BUILD_AS_EXTERNAL_LEXER
-
-#include "ExternalLexer.h"
-#include "WindowAccessor.h"
-
-#define BUILD_EXTERNAL_LEXER 0
-
-#endif
-
-// Max level of nested comments
-#define SCE_HA_COMMENTMAX SCE_HA_COMMENTBLOCK3
-
-
-enum kwType { kwOther, kwClass, kwData, kwInstance, kwImport, kwModule, kwType};
-
-static inline bool IsNewline(const int ch) {
- return (ch == '\n' || ch == '\r');
-}
-
-static inline bool IsWhitespace(const int ch) {
- return ( ch == ' '
- || ch == '\t'
- || IsNewline(ch) );
-}
-
-static inline bool IsAWordStart(const int ch) {
- return (ch < 0x80) && (isalnum(ch) || ch == '_');
-}
-
-static inline bool IsAWordChar(const int ch) {
- return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '\'');
-}
-
-static void ColorizeHaskellDoc(unsigned int startPos, int length, int initStyle,
- WordList *keywordlists[], Accessor &styler) {
-
- WordList &keywords = *keywordlists[0];
-
- int kwLast = kwOther;
-
- StyleContext sc(startPos, length, initStyle, styler);
-
- for (; sc.More(); sc.Forward()) {
-
- // Check for state end
- // Operator
- if (sc.state == SCE_HA_OPERATOR) {
- kwLast = kwOther;
- sc.SetState(SCE_HA_DEFAULT);
- }
- // String
- else if (sc.state == SCE_HA_STRING) {
- if (sc.ch == '\"') {
- sc.ForwardSetState(SCE_HA_DEFAULT);
- } else if (sc.ch == '\\') {
- sc.Forward();
- }
- }
- // Char
- else if (sc.state == SCE_HA_CHARACTER) {
- if (sc.ch == '\'') {
- sc.ForwardSetState(SCE_HA_DEFAULT);
- } else if (sc.ch == '\\') {
- sc.Forward();
- }
- }
- // Number
- else if (sc.state == SCE_HA_NUMBER) {
- if (!IsADigit(sc.ch)) {
- sc.SetState(SCE_HA_DEFAULT);
- }
- }
- // Types, constructors, etc.
- else if (sc.state == SCE_HA_CAPITAL) {
- if (!IsAWordChar(sc.ch) || sc.ch == '.') {
- sc.SetState(SCE_HA_DEFAULT);
- }
- }
- // Identifier
- else if (sc.state == SCE_HA_IDENTIFIER) {
- if (!IsAWordChar(sc.ch)) {
- char s[100];
- sc.GetCurrent(s, sizeof(s));
- int style = SCE_HA_IDENTIFIER;
- if ((kwLast == kwImport) || (strcmp(s,"qualified") == 0) || (strcmp(s,"as") == 0)) {
- style = SCE_HA_IMPORT;
- } else if (keywords.InList(s)) {
- style = SCE_HA_KEYWORD;
- } else if (kwLast == kwData) {
- style = SCE_HA_DATA;
- } else if (kwLast == kwClass) {
- style = SCE_HA_CLASS;
- } else if (kwLast == kwModule) {
- style = SCE_HA_MODULE;
- } else if (isupper(s[0])) {
- style = SCE_HA_CAPITAL;
- }
- sc.ChangeState(style);
- sc.SetState(SCE_HA_DEFAULT);
- if (style == SCE_HA_KEYWORD) {
- if (0 == strcmp(s, "class"))
- kwLast = kwClass;
- else if (0 == strcmp(s, "data"))
- kwLast = kwData;
- else if (0 == strcmp(s, "instance"))
- kwLast = kwInstance;
- else if (0 == strcmp(s, "import"))
- kwLast = kwImport;
- else if (0 == strcmp(s, "module"))
- kwLast = kwModule;
- else
- kwLast = kwOther;
- } else if (style == SCE_HA_CLASS || style == SCE_HA_IMPORT ||
- style == SCE_HA_MODULE || style == SCE_HA_CAPITAL ||
- style == SCE_HA_DATA || style == SCE_HA_INSTANCE) {
- kwLast = kwOther;
- }
- }
- }
- // Comments
- // Oneliner
- else if (sc.state == SCE_HA_COMMENTLINE) {
- if (IsNewline(sc.ch))
- sc.SetState(SCE_HA_DEFAULT);
- }
- // Nested
- else if (sc.state >= SCE_HA_COMMENTBLOCK) {
- if (sc.Match("{-")) {
- if (sc.state < SCE_HA_COMMENTMAX)
- sc.SetState(sc.state + 1);
- }
- else if (sc.Match("-}")) {
- sc.Forward();
- if (sc.state == SCE_HA_COMMENTBLOCK)
- sc.ForwardSetState(SCE_HA_DEFAULT);
- else
- sc.ForwardSetState(sc.state - 1);
- }
- }
- // New state?
- if (sc.state == SCE_HA_DEFAULT) {
- // Digit
- if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
- sc.SetState(SCE_HA_NUMBER);
- if (sc.ch == '0' && (sc.chNext == 'X' || sc.chNext == 'x')) { // Match anything starting with "0x" or "0X", too
- sc.Forward(1);
- }
- }
- // Comment line
- else if (sc.Match("--")) {
- sc.SetState(SCE_HA_COMMENTLINE);
- // Comment block
- }
- else if (sc.Match("{-")) {
- sc.SetState(SCE_HA_COMMENTBLOCK);
- }
- // String
- else if (sc.Match('\"')) {
- sc.SetState(SCE_HA_STRING);
- }
- // Character
- else if (sc.Match('\'')) {
- sc.SetState(SCE_HA_CHARACTER);
- }
- // Stringstart
- else if (sc.Match('\"')) {
- sc.SetState(SCE_HA_STRING);
- }
- // Operator
- else if (isascii(sc.ch) && isoperator(static_cast<char>(sc.ch))) {
- sc.SetState(SCE_HA_OPERATOR);
- }
- // Keyword
- else if (IsAWordStart(sc.ch)) {
- sc.SetState(SCE_HA_IDENTIFIER);
- }
-
- }
- }
- sc.Complete();
-}
-
-// External stuff - used for dynamic-loading, not implemented in wxStyledTextCtrl yet.
-// Inspired by the caml external lexer - Credits to Robert Roessler - http://www.rftp.com
-#ifdef BUILD_EXTERNAL_LEXER
-static const char* LexerName = "haskell";
-
-void EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length, int initStyle,
- char *words[], WindowID window, char *props)
-{
- PropSetSimple ps;
- ps.SetMultiple(props);
- WindowAccessor wa(window, ps);
-
- int nWL = 0;
- for (; words[nWL]; nWL++) ;
- WordList** wl = new WordList* [nWL + 1];
- int i = 0;
- for (; i<nWL; i++)
- {
- wl[i] = new WordList();
- wl[i]->Set(words[i]);
- }
- wl[i] = 0;
-
- ColorizeHaskellDoc(startPos, length, initStyle, wl, wa);
- wa.Flush();
- for (i=nWL-1;i>=0;i--)
- delete wl[i];
- delete [] wl;
-}
-
-void EXT_LEXER_DECL Fold (unsigned int lexer, unsigned int startPos, int length, int initStyle,
- char *words[], WindowID window, char *props)
-{
-
-}
-
-int EXT_LEXER_DECL GetLexerCount()
-{
- return 1;
-}
-
-void EXT_LEXER_DECL GetLexerName(unsigned int Index, char *name, int buflength)
-{
- if (buflength > 0) {
- buflength--;
- int n = strlen(LexerName);
- if (n > buflength)
- n = buflength;
- memcpy(name, LexerName, n), name[n] = '\0';
- }
-}
-#endif
-
-LexerModule lmHaskell(SCLEX_HASKELL, ColorizeHaskellDoc, "haskell");
-
diff --git a/scintilla/src/PerLine.cxx b/scintilla/src/PerLine.cxx index 1de3245..ef6b9b7 100644 --- a/scintilla/src/PerLine.cxx +++ b/scintilla/src/PerLine.cxx @@ -202,15 +202,19 @@ int LineMarkers::AddMark(int line, int markerNum, int lines) { return handleCurrent;
}
-void LineMarkers::DeleteMark(int line, int markerNum, bool all) {
+bool LineMarkers::DeleteMark(int line, int markerNum, bool all) {
+ bool someChanges = false;
if (markers.Length() && (line >= 0) && (line < markers.Length()) && markers[line]) {
if (markerNum == -1) {
+ someChanges = true;
delete markers[line];
markers[line] = NULL;
} else {
bool performedDeletion = markers[line]->RemoveNumber(markerNum);
+ someChanges = someChanges || performedDeletion;
while (all && performedDeletion) {
performedDeletion = markers[line]->RemoveNumber(markerNum);
+ someChanges = someChanges || performedDeletion;
}
if (markers[line]->Length() == 0) {
delete markers[line];
@@ -218,6 +222,7 @@ void LineMarkers::DeleteMark(int line, int markerNum, bool all) { }
}
}
+ return someChanges;
}
void LineMarkers::DeleteMarkFromHandle(int markerHandle) {
@@ -240,10 +245,7 @@ void LineLevels::Init() { void LineLevels::InsertLine(int line) {
if (levels.Length()) {
- int level = SC_FOLDLEVELBASE;
- if ((line > 0) && (line < levels.Length())) {
- level = levels[line-1] & ~SC_FOLDLEVELWHITEFLAG;
- }
+ int level = (line < levels.Length()) ? levels[line] : SC_FOLDLEVELBASE;
levels.InsertValue(line, 1, level);
}
}
@@ -301,7 +303,8 @@ void LineState::Init() { void LineState::InsertLine(int line) {
if (lineStates.Length()) {
lineStates.EnsureLength(line);
- lineStates.Insert(line, 0);
+ int val = (line < lineStates.Length()) ? lineStates[line] : 0;
+ lineStates.Insert(line, val);
}
}
@@ -319,6 +322,8 @@ int LineState::SetLineState(int line, int state) { }
int LineState::GetLineState(int line) {
+ if (line < 0)
+ return 0;
lineStates.EnsureLength(line + 1);
return lineStates[line];
}
diff --git a/scintilla/src/PerLine.h b/scintilla/src/PerLine.h index f189508..42081a8 100644 --- a/scintilla/src/PerLine.h +++ b/scintilla/src/PerLine.h @@ -56,7 +56,7 @@ public: int MarkValue(int line);
int AddMark(int line, int marker, int lines);
void MergeMarkers(int pos);
- void DeleteMark(int line, int markerNum, bool all);
+ bool DeleteMark(int line, int markerNum, bool all);
void DeleteMarkFromHandle(int markerHandle);
int LineFromHandle(int markerHandle);
};
diff --git a/scintilla/src/PositionCache.cxx b/scintilla/src/PositionCache.cxx index 1aa6654..f12c244 100644 --- a/scintilla/src/PositionCache.cxx +++ b/scintilla/src/PositionCache.cxx @@ -30,6 +30,7 @@ #include "ViewStyle.h"
#include "CharClassify.h"
#include "Decoration.h"
+#include "ILexer.h"
#include "Document.h"
#include "Selection.h"
#include "PositionCache.h"
diff --git a/scintilla/src/RESearch.cxx b/scintilla/src/RESearch.cxx index e00cdfe..c685bdb 100644 --- a/scintilla/src/RESearch.cxx +++ b/scintilla/src/RESearch.cxx @@ -17,6 +17,7 @@ * Put all global/static variables into an object so this code can be
* used from multiple threads, etc.
* Some extensions by Philippe Lhoste PhiLho(a)GMX.net
+ * '?' extensions by Michael Mullin masmullin@gmail.com
*
* These routines are the PUBLIC DOMAIN equivalents of regex
* routines as found in 4.nBSD UN*X, with minor extensions.
@@ -53,7 +54,7 @@ * Regular Expressions:
*
* [1] char matches itself, unless it is a special
- * character (metachar): . \ [ ] * + ^ $
+ * character (metachar): . \ [ ] * + ? ^ $
* and ( ) if posix option.
*
* [2] . matches any character.
@@ -65,12 +66,12 @@ * regex searches are made line per line
* (stripped of end-of-line chars).
* - if not in posix mode, when followed by a
- * left or right round bracket (see [7]);
- * - when followed by a digit 1 to 9 (see [8]);
+ * left or right round bracket (see [8]);
+ * - when followed by a digit 1 to 9 (see [9]);
* - when followed by a left or right angle bracket
- * (see [9]);
- * - when followed by d, D, s, S, w or W (see [10]);
- * - when followed by x and two hexa digits (see [11].
+ * (see [10]);
+ * - when followed by d, D, s, S, w or W (see [11]);
+ * - when followed by x and two hexa digits (see [12].
* Backslash is used as an escape character for all
* other meta-characters, and itself.
*
@@ -101,23 +102,28 @@ * [a-zA-Z] any alpha
*
* [5] * any regular expression form [1] to [4]
- * (except [7], [8] and [9] forms of [3]),
+ * (except [8], [9] and [10] forms of [3]),
* followed by closure char (*)
* matches zero or more matches of that form.
*
* [6] + same as [5], except it matches one or more.
- * Both [5] and [6] are greedy (they match as much as possible).
*
- * [7] a regular expression in the form [1] to [12], enclosed
+ * [5-6] Both [5] and [6] are greedy (they match as much as possible).
+ * Unless they are followed by the 'lazy' quantifier (?)
+ * In which case both [5] and [6] try to match as little as possible
+ *
+ * [7] ? same as [5] except it matches zero or one.
+ *
+ * [8] a regular expression in the form [1] to [13], enclosed
* as \(form\) (or (form) with posix flag) matches what
* form matches. The enclosure creates a set of tags,
- * used for [8] and for pattern substitution.
+ * used for [9] and for pattern substitution.
* The tagged forms are numbered starting from 1.
*
- * [8] a \ followed by a digit 1 to 9 matches whatever a
- * previously tagged regular expression ([7]) matched.
+ * [9] a \ followed by a digit 1 to 9 matches whatever a
+ * previously tagged regular expression ([8]) matched.
*
- * [9] \< a regular expression starting with a \< construct
+ * [10] \< a regular expression starting with a \< construct
* \> and/or ending with a \> construct, restricts the
* pattern matching to the beginning of a word, and/or
* the end of a word. A word is defined to be a character
@@ -126,7 +132,7 @@ * by user setting. The word must also be preceded and/or
* followed by any character outside those mentioned.
*
- * [10] \l a backslash followed by d, D, s, S, w or W,
+ * [11] \l a backslash followed by d, D, s, S, w or W,
* becomes a character class (both inside and
* outside sets []).
* d: decimal digits
@@ -136,16 +142,16 @@ * w: alphanumeric & underscore (changed by user setting)
* W: any char except alphanumeric & underscore (see above)
*
- * [11] \xHH a backslash followed by x and two hexa digits,
+ * [12] \xHH a backslash followed by x and two hexa digits,
* becomes the character whose Ascii code is equal
* to these digits. If not followed by two digits,
* it is 'x' char itself.
*
- * [12] a composite regular expression xy where x and y
- * are in the form [1] to [11] matches the longest
+ * [13] a composite regular expression xy where x and y
+ * are in the form [1] to [12] matches the longest
* match of x followed by a match for y.
*
- * [13] ^ a regular expression starting with a ^ character
+ * [14] ^ a regular expression starting with a ^ character
* $ and/or ending with a $ character, restricts the
* pattern matching to the beginning of the line,
* or the end of line. [anchors] Elsewhere in the
@@ -226,6 +232,8 @@ using namespace Scintilla; #define EOW 9
#define REF 10
#define CLO 11
+#define CLQ 12 /* 0 to 1 closure */
+#define LCLO 13 /* lazy closure */
#define END 0
@@ -356,8 +364,8 @@ static int GetHexaChar(unsigned char hd1, unsigned char hd2) { * or -1 for a char class. In this case, bittab is changed.
*/
int RESearch::GetBackslashExpression(
- const char *pattern,
- int &incr) {
+ const char *pattern,
+ int &incr) {
// Since error reporting is primitive and messages are not used anyway,
// I choose to interpret unexpected syntax in a logical way instead
// of reporting errors. Otherwise, we can stick on, eg., PCRE behavior.
@@ -522,7 +530,7 @@ const char *RESearch::Compile(const char *pattern, int length, bool caseSensitiv if (*(p+1) != ']') {
c1 = prevChar + 1;
i++;
- c2 = *++p;
+ c2 = static_cast<unsigned char>(*++p);
if (c2 == '\\') {
if (!*(p+1)) // End of RE
return badpat("Missing ]");
@@ -577,7 +585,7 @@ const char *RESearch::Compile(const char *pattern, int length, bool caseSensitiv prevChar = -1;
}
} else {
- prevChar = *p;
+ prevChar = static_cast<unsigned char>(*p);
ChSetWithCase(*p, caseSensitive);
}
i++;
@@ -593,10 +601,11 @@ const char *RESearch::Compile(const char *pattern, int length, bool caseSensitiv case '*': /* match 0 or more... */
case '+': /* match 1 or more... */
+ case '?':
if (p == pattern)
return badpat("Empty closure");
lp = sp; /* previous opcode */
- if (*lp == CLO) /* equivalence... */
+ if (*lp == CLO || *lp == LCLO) /* equivalence... */
break;
switch (*lp) {
@@ -618,9 +627,13 @@ const char *RESearch::Compile(const char *pattern, int length, bool caseSensitiv *mp++ = END;
*mp++ = END;
sp = mp;
+
while (--mp > lp)
*mp = mp[-1];
- *mp = CLO;
+ if (*p == '?') *mp = CLQ;
+ else if (*(p+1) == '?') *mp = LCLO;
+ else *mp = CLO;
+
mp = sp;
break;
@@ -845,6 +858,7 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) { int bp; /* beginning of subpat... */
int ep; /* ending of subpat... */
int are; /* to save the line ptr. */
+ int llp; /* lazy lp for LCLO */
while ((op = *ap++) != END)
switch (op) {
@@ -879,7 +893,7 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) { case EOT:
eopat[*ap++] = lp;
break;
- case BOW:
+ case BOW:
if ((lp!=bol && iswordc(ci.CharAt(lp-1))) || !iswordc(ci.CharAt(lp)))
return NOTFOUND;
break;
@@ -895,18 +909,27 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) { if (ci.CharAt(bp++) != ci.CharAt(lp++))
return NOTFOUND;
break;
+ case LCLO:
+ case CLQ:
case CLO:
are = lp;
switch (*ap) {
case ANY:
- while (lp < endp)
+ if (op == CLO || op == LCLO)
+ while (lp < endp)
+ lp++;
+ else if (lp < endp)
lp++;
+
n = ANYSKIP;
break;
case CHR:
c = *(ap+1);
- while ((lp < endp) && (c == ci.CharAt(lp)))
+ if (op == CLO || op == LCLO)
+ while ((lp < endp) && (c == ci.CharAt(lp)))
+ lp++;
+ else if ((lp < endp) && (c == ci.CharAt(lp)))
lp++;
n = CHRSKIP;
break;
@@ -920,15 +943,23 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) { //re_fail("closure: bad nfa.", *ap);
return NOTFOUND;
}
-
ap += n;
- while (lp >= are) {
- if ((e = PMatch(ci, lp, endp, ap)) != NOTFOUND)
- return e;
- --lp;
+ llp = lp;
+ e = NOTFOUND;
+ while (llp >= are) {
+ int q;
+ if ((q = PMatch(ci, llp, endp, ap)) != NOTFOUND) {
+ e = q;
+ lp = llp;
+ if (op != LCLO) return e;
+ }
+ if (*ap == END) return e;
+ --llp;
}
- return NOTFOUND;
+ if (*ap == EOT)
+ PMatch(ci, lp, endp, ap);
+ return e;
default:
//re_fail("RESearch::Execute: bad nfa.", static_cast<char>(op));
return NOTFOUND;
diff --git a/scintilla/src/ScintillaBase.cxx b/scintilla/src/ScintillaBase.cxx index 890d2b1..73ca90d 100644 --- a/scintilla/src/ScintillaBase.cxx +++ b/scintilla/src/ScintillaBase.cxx @@ -9,20 +9,21 @@ #include <string.h>
#include <stdio.h>
#include <ctype.h>
+#include <assert.h>
#include <string>
#include <vector>
#include "Platform.h"
+#include "ILexer.h"
#include "Scintilla.h"
-#include "PropSet.h"
+
#include "PropSetSimple.h"
#ifdef SCI_LEXER
#include "SciLexer.h"
-#include "Accessor.h"
-#include "DocumentAccessor.h"
-#include "KeyWords.h"
+#include "LexerModule.h"
+#include "Catalogue.h"
#endif
#include "SplitVector.h"
#include "Partitioning.h"
@@ -53,21 +54,9 @@ ScintillaBase::ScintillaBase() { displayPopupMenu = true;
listType = 0;
maxListWidth = 0;
-#ifdef SCI_LEXER
- lexLanguage = SCLEX_CONTAINER;
- performingStyle = false;
- lexCurrent = 0;
- for (int wl = 0; wl < numWordLists; wl++)
- keyWordLists[wl] = new WordList;
- keyWordLists[numWordLists] = 0;
-#endif
}
ScintillaBase::~ScintillaBase() {
-#ifdef SCI_LEXER
- for (int wl = 0; wl < numWordLists; wl++)
- delete keyWordLists[wl];
-#endif
}
void ScintillaBase::Finalise() {
@@ -385,6 +374,7 @@ void ScintillaBase::AutoCompleteCompleted() { pdoc->InsertCString(firstPos, selected);
SetEmptySelection(firstPos + static_cast<int>(strlen(selected)));
}
+ SetLastXChosen();
}
int ScintillaBase::AutoCompleteGetCurrent() {
@@ -477,76 +467,194 @@ void ScintillaBase::ButtonDown(Point pt, unsigned int curTime, bool shift, bool }
#ifdef SCI_LEXER
-void ScintillaBase::SetLexer(uptr_t wParam) {
- lexLanguage = wParam;
- lexCurrent = LexerModule::Find(lexLanguage);
- if (!lexCurrent)
- lexCurrent = LexerModule::Find(SCLEX_NULL);
- int bits = lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5;
- vs.EnsureStyle((1 << bits) - 1);
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+class LexState : public LexInterface {
+ const LexerModule *lexCurrent;
+ void SetLexerModule(const LexerModule *lex);
+ PropSetSimple props;
+public:
+ int lexLanguage;
+
+ LexState(Document *pdoc_);
+ virtual ~LexState();
+ void SetLexer(uptr_t wParam);
+ void SetLexerLanguage(const char *languageName);
+ const char *DescribeWordListSets();
+ void SetWordList(int n, const char *wl);
+ int GetStyleBitsNeeded() const;
+ const char *GetName() const;
+ void *PrivateCall(int operation, void *pointer);
+ const char *PropertyNames();
+ int PropertyType(const char *name);
+ const char *DescribeProperty(const char *name);
+ void PropSet(const char *key, const char *val);
+ const char *PropGet(const char *key) const;
+ int PropGetInt(const char *key, int defaultValue=0) const;
+ int PropGetExpanded(const char *key, char *result) const;
+};
+
+#ifdef SCI_NAMESPACE
}
+#endif
-void ScintillaBase::SetLexerLanguage(const char *languageName) {
+LexState::LexState(Document *pdoc_) : LexInterface(pdoc_) {
+ lexCurrent = 0;
+ performingStyle = false;
lexLanguage = SCLEX_CONTAINER;
- lexCurrent = LexerModule::Find(languageName);
- if (!lexCurrent)
- lexCurrent = LexerModule::Find(SCLEX_NULL);
- if (lexCurrent)
- lexLanguage = lexCurrent->GetLanguage();
- int bits = lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5;
- vs.EnsureStyle((1 << bits) - 1);
}
-void ScintillaBase::Colourise(int start, int end) {
- if (!performingStyle) {
- // Protect against reentrance, which may occur, for example, when
- // fold points are discovered while performing styling and the folding
- // code looks for child lines which may trigger styling.
- performingStyle = true;
+LexState::~LexState() {
+ if (instance) {
+ instance->Release();
+ instance = 0;
+ }
+}
- int lengthDoc = pdoc->Length();
- if (end == -1)
- end = lengthDoc;
- int len = end - start;
+LexState *ScintillaBase::DocumentLexState() {
+ if (!pdoc->pli) {
+ pdoc->pli = new LexState(pdoc);
+ }
+ return static_cast<LexState *>(pdoc->pli);
+}
+
+void LexState::SetLexerModule(const LexerModule *lex) {
+ if (lex != lexCurrent) {
+ if (instance) {
+ instance->Release();
+ instance = 0;
+ }
+ lexCurrent = lex;
+ if (lexCurrent)
+ instance = lexCurrent->Create();
+ pdoc->LexerChanged();
+ }
+}
- PLATFORM_ASSERT(len >= 0);
- PLATFORM_ASSERT(start + len <= lengthDoc);
+void LexState::SetLexer(uptr_t wParam) {
+ lexLanguage = wParam;
+ if (lexLanguage == SCLEX_CONTAINER) {
+ SetLexerModule(0);
+ } else {
+ const LexerModule *lex = Catalogue::Find(lexLanguage);
+ if (!lex)
+ lex = Catalogue::Find(SCLEX_NULL);
+ SetLexerModule(lex);
+ }
+}
- //WindowAccessor styler(wMain.GetID(), props);
- DocumentAccessor styler(pdoc, props, wMain.GetID());
+void LexState::SetLexerLanguage(const char *languageName) {
+ const LexerModule *lex = Catalogue::Find(languageName);
+ if (!lex)
+ lex = Catalogue::Find(SCLEX_NULL);
+ if (lex)
+ lexLanguage = lex->GetLanguage();
+ SetLexerModule(lex);
+}
- int styleStart = 0;
- if (start > 0)
- styleStart = styler.StyleAt(start - 1) & pdoc->stylingBitsMask;
- styler.SetCodePage(pdoc->dbcsCodePage);
+const char *LexState::DescribeWordListSets() {
+ if (instance) {
+ return instance->DescribeWordListSets();
+ } else {
+ return 0;
+ }
+}
- if (lexCurrent && (len > 0)) { // Should always succeed as null lexer should always be available
- lexCurrent->Lex(start, len, styleStart, keyWordLists, styler);
- styler.Flush();
- if (styler.GetPropertyInt("fold")) {
- lexCurrent->Fold(start, len, styleStart, keyWordLists, styler);
- styler.Flush();
- }
+void LexState::SetWordList(int n, const char *wl) {
+ if (instance) {
+ int firstModification = instance->WordListSet(n, wl);
+ if (firstModification >= 0) {
+ pdoc->ModifiedAt(firstModification);
}
+ }
+}
+
+int LexState::GetStyleBitsNeeded() const {
+ return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5;
+}
- performingStyle = false;
+const char *LexState::GetName() const {
+ return lexCurrent ? lexCurrent->languageName : "";
+}
+
+void *LexState::PrivateCall(int operation, void *pointer) {
+ if (pdoc && instance) {
+ return instance->PrivateCall(operation, pointer);
+ } else {
+ return 0;
+ }
+}
+
+const char *LexState::PropertyNames() {
+ if (instance) {
+ return instance->PropertyNames();
+ } else {
+ return 0;
+ }
+}
+
+int LexState::PropertyType(const char *name) {
+ if (instance) {
+ return instance->PropertyType(name);
+ } else {
+ return SC_TYPE_BOOLEAN;
+ }
+}
+
+const char *LexState::DescribeProperty(const char *name) {
+ if (instance) {
+ return instance->DescribeProperty(name);
+ } else {
+ return 0;
}
}
+
+void LexState::PropSet(const char *key, const char *val) {
+ props.Set(key, val);
+ if (instance) {
+ int firstModification = instance->PropertySet(key, val);
+ if (firstModification >= 0) {
+ pdoc->ModifiedAt(firstModification);
+ }
+ }
+}
+
+const char *LexState::PropGet(const char *key) const {
+ return props.Get(key);
+}
+
+int LexState::PropGetInt(const char *key, int defaultValue) const {
+ return props.GetInt(key, defaultValue);
+}
+
+int LexState::PropGetExpanded(const char *key, char *result) const {
+ return props.GetExpanded(key, result);
+}
+
#endif
void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) {
#ifdef SCI_LEXER
- if (lexLanguage != SCLEX_CONTAINER) {
- int endStyled = WndProc(SCI_GETENDSTYLED, 0, 0);
- int lineEndStyled = WndProc(SCI_LINEFROMPOSITION, endStyled, 0);
- endStyled = WndProc(SCI_POSITIONFROMLINE, lineEndStyled, 0);
- Colourise(endStyled, endStyleNeeded);
+ if (DocumentLexState()->lexLanguage != SCLEX_CONTAINER) {
+ int lineEndStyled = pdoc->LineFromPosition(pdoc->GetEndStyled());
+ int endStyled = pdoc->LineStart(lineEndStyled);
+ DocumentLexState()->Colourise(endStyled, endStyleNeeded);
return;
}
#endif
Editor::NotifyStyleToNeeded(endStyleNeeded);
}
+void ScintillaBase::NotifyLexerChanged(Document *, void *) {
+#ifdef SCI_LEXER
+ int bits = DocumentLexState()->GetStyleBitsNeeded();
+ vs.EnsureStyle((1 << bits) - 1);
+#endif
+}
+
sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
switch (iMessage) {
case SCI_AUTOCSHOW:
@@ -709,61 +817,66 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara #ifdef SCI_LEXER
case SCI_SETLEXER:
- SetLexer(wParam);
- lexLanguage = wParam;
+ DocumentLexState()->SetLexer(wParam);
break;
case SCI_GETLEXER:
- return lexLanguage;
+ return DocumentLexState()->lexLanguage;
case SCI_COLOURISE:
- if (lexLanguage == SCLEX_CONTAINER) {
+ if (DocumentLexState()->lexLanguage == SCLEX_CONTAINER) {
pdoc->ModifiedAt(wParam);
NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : lParam);
} else {
- Colourise(wParam, lParam);
+ DocumentLexState()->Colourise(wParam, lParam);
}
Redraw();
break;
case SCI_SETPROPERTY:
- props.Set(reinterpret_cast<const char *>(wParam),
+ DocumentLexState()->PropSet(reinterpret_cast<const char *>(wParam),
reinterpret_cast<const char *>(lParam));
break;
case SCI_GETPROPERTY:
- return StringResult(lParam, props.Get(reinterpret_cast<const char *>(wParam)));
-
- case SCI_GETPROPERTYEXPANDED: {
- char *val = props.Expanded(reinterpret_cast<const char *>(wParam));
- const int n = strlen(val);
- if (lParam != 0) {
- char *ptr = reinterpret_cast<char *>(lParam);
- strcpy(ptr, val);
- }
- delete []val;
- return n; // Not including NUL
- }
+ return StringResult(lParam, DocumentLexState()->PropGet(reinterpret_cast<const char *>(wParam)));
+
+ case SCI_GETPROPERTYEXPANDED:
+ return DocumentLexState()->PropGetExpanded(reinterpret_cast<const char *>(wParam),
+ reinterpret_cast<char *>(lParam));
case SCI_GETPROPERTYINT:
- return props.GetInt(reinterpret_cast<const char *>(wParam), lParam);
+ return DocumentLexState()->PropGetInt(reinterpret_cast<const char *>(wParam), lParam);
case SCI_SETKEYWORDS:
- if (wParam < numWordLists) {
- keyWordLists[wParam]->Clear();
- keyWordLists[wParam]->Set(reinterpret_cast<const char *>(lParam));
- }
+ DocumentLexState()->SetWordList(wParam, reinterpret_cast<const char *>(lParam));
break;
case SCI_SETLEXERLANGUAGE:
- SetLexerLanguage(reinterpret_cast<const char *>(lParam));
+ DocumentLexState()->SetLexerLanguage(reinterpret_cast<const char *>(lParam));
break;
case SCI_GETLEXERLANGUAGE:
- return StringResult(lParam, lexCurrent ? lexCurrent->languageName : "");
+ return StringResult(lParam, DocumentLexState()->GetName());
+
+ case SCI_PRIVATELEXERCALL:
+ return reinterpret_cast<sptr_t>(
+ DocumentLexState()->PrivateCall(wParam, reinterpret_cast<void *>(lParam)));
case SCI_GETSTYLEBITSNEEDED:
- return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5;
+ return DocumentLexState()->GetStyleBitsNeeded();
+
+ case SCI_PROPERTYNAMES:
+ return StringResult(lParam, DocumentLexState()->PropertyNames());
+
+ case SCI_PROPERTYTYPE:
+ return DocumentLexState()->PropertyType(reinterpret_cast<const char *>(wParam));
+
+ case SCI_DESCRIBEPROPERTY:
+ return StringResult(lParam, DocumentLexState()->DescribeProperty(reinterpret_cast<const char *>(wParam)));
+
+ case SCI_DESCRIBEKEYWORDSETS:
+ return StringResult(lParam, DocumentLexState()->DescribeWordListSets());
#endif
diff --git a/scintilla/src/ScintillaBase.h b/scintilla/src/ScintillaBase.h index 9355a08..2d743e3 100644 --- a/scintilla/src/ScintillaBase.h +++ b/scintilla/src/ScintillaBase.h @@ -12,6 +12,10 @@ namespace Scintilla {
#endif
+#ifdef SCI_LEXER
+class LexState;
+#endif
+
/**
*/
class ScintillaBase : public Editor {
@@ -44,12 +48,7 @@ protected: int maxListWidth; /// Maximum width of list, in average character widths
#ifdef SCI_LEXER
- bool performingStyle; ///< Prevent reentrance
- int lexLanguage;
- const LexerModule *lexCurrent;
- PropSetSimple props;
- enum {numWordLists=KEYWORDSET_MAX+1};
- WordList *keyWordLists[numWordLists+1];
+ LexState *DocumentLexState();
void SetLexer(uptr_t wParam);
void SetLexerLanguage(const char *languageName);
void Colourise(int start, int end);
@@ -87,7 +86,9 @@ protected: virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
- virtual void NotifyStyleToNeeded(int endStyleNeeded);
+ void NotifyStyleToNeeded(int endStyleNeeded);
+ void NotifyLexerChanged(Document *doc, void *userData);
+
public:
// Public so scintilla_send_message can use it
virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
diff --git a/scintilla/src/SplitVector.h b/scintilla/src/SplitVector.h index 306d03e..004e814 100644 --- a/scintilla/src/SplitVector.h +++ b/scintilla/src/SplitVector.h @@ -238,6 +238,23 @@ public: DeleteRange(0, lengthBody);
}
+ // Retrieve a range of elemetns into an array
+ void GetRange(T *buffer, int position, int retrieveLength) const {
+ // Split into up to 2 ranges, before and after the split then use memcpy on each.
+ int range1Length = 0;
+ if (position < part1Length) {
+ int part1AfterPosition = part1Length - position;
+ range1Length = retrieveLength;
+ if (range1Length > part1AfterPosition)
+ range1Length = part1AfterPosition;
+ }
+ memcpy(buffer, body + position, range1Length * sizeof(T));
+ buffer += range1Length;
+ position = position + range1Length + gapLength;
+ int range2Length = retrieveLength - range1Length;
+ memcpy(buffer, body + position, range2Length * sizeof(T));
+ }
+
T *BufferPointer() {
RoomFor(1);
GapTo(lengthBody);
diff --git a/scintilla/src/ViewStyle.cxx b/scintilla/src/ViewStyle.cxx index bdeac90..055f6ee 100644 --- a/scintilla/src/ViewStyle.cxx +++ b/scintilla/src/ViewStyle.cxx @@ -129,6 +129,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) { caretStyle = source.caretStyle;
caretWidth = source.caretWidth;
someStylesProtected = false;
+ someStylesForceCase = false;
leftMarginWidth = source.leftMarginWidth;
rightMarginWidth = source.rightMarginWidth;
for (int i=0; i < margins; i++) {
@@ -213,6 +214,7 @@ void ViewStyle::Init(size_t stylesSize_) { caretStyle = CARETSTYLE_LINE;
caretWidth = 1;
someStylesProtected = false;
+ someStylesForceCase = false;
hotspotForegroundSet = false;
hotspotForeground.desired = ColourDesired(0, 0, 0xff);
@@ -295,6 +297,7 @@ void ViewStyle::Refresh(Surface &surface) { maxAscent = styles[STYLE_DEFAULT].ascent;
maxDescent = styles[STYLE_DEFAULT].descent;
someStylesProtected = false;
+ someStylesForceCase = false;
for (unsigned int i=0; i<stylesSize; i++) {
if (i != STYLE_DEFAULT) {
styles[i].Realise(surface, zoomLevel, &styles[STYLE_DEFAULT], extraFontFlag);
@@ -306,6 +309,9 @@ void ViewStyle::Refresh(Surface &surface) { if (styles[i].IsProtected()) {
someStylesProtected = true;
}
+ if (styles[i].caseForce != Style::caseMixed) {
+ someStylesForceCase = true;
+ }
}
maxAscent += extraAscent;
maxDescent += extraDescent;
diff --git a/scintilla/src/ViewStyle.h b/scintilla/src/ViewStyle.h index 1282c44..70b1d4a 100644 --- a/scintilla/src/ViewStyle.h +++ b/scintilla/src/ViewStyle.h @@ -106,6 +106,7 @@ public: int caretStyle;
int caretWidth;
bool someStylesProtected;
+ bool someStylesForceCase;
int extraFontFlag;
int extraAscent;
int extraDescent;
diff --git a/scintilla/src/WindowAccessor.cxx b/scintilla/src/WindowAccessor.cxx deleted file mode 100644 index cfe057d..0000000 --- a/scintilla/src/WindowAccessor.cxx +++ /dev/null @@ -1,191 +0,0 @@ -// Scintilla source code edit control
-/** @file WindowAccessor.cxx
- ** Rapid easy access to contents of a Scintilla.
- **/
-// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
-// The License.txt file describes the conditions under which this software may be distributed.
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-
-#include "Platform.h"
-
-#include "PropSet.h"
-#include "Accessor.h"
-#include "WindowAccessor.h"
-#include "Scintilla.h"
-
-#ifdef SCI_NAMESPACE
-using namespace Scintilla;
-#endif
-
-WindowAccessor::~WindowAccessor() {
-}
-
-bool WindowAccessor::InternalIsLeadByte(char ch) {
- if (SC_CP_UTF8 == codePage)
- // For lexing, all characters >= 0x80 are treated the
- // same so none is considered a lead byte.
- return false;
- else
- return Platform::IsDBCSLeadByte(codePage, ch);
-}
-
-void WindowAccessor::Fill(int position) {
- if (lenDoc == -1)
- lenDoc = Platform::SendScintilla(id, SCI_GETTEXTLENGTH, 0, 0);
- startPos = position - slopSize;
- if (startPos + bufferSize > lenDoc)
- startPos = lenDoc - bufferSize;
- if (startPos < 0)
- startPos = 0;
- endPos = startPos + bufferSize;
- if (endPos > lenDoc)
- endPos = lenDoc;
-
- Sci_TextRange tr = {{startPos, endPos}, buf};
- Platform::SendScintillaPointer(id, SCI_GETTEXTRANGE, 0, &tr);
-}
-
-bool WindowAccessor::Match(int pos, const char *s) {
- for (int i=0; *s; i++) {
- if (*s != SafeGetCharAt(pos+i))
- return false;
- s++;
- }
- return true;
-}
-
-char WindowAccessor::StyleAt(int position) {
- return static_cast<char>(Platform::SendScintilla(
- id, SCI_GETSTYLEAT, position, 0));
-}
-
-int WindowAccessor::GetLine(int position) {
- return Platform::SendScintilla(id, SCI_LINEFROMPOSITION, position, 0);
-}
-
-int WindowAccessor::LineStart(int line) {
- return Platform::SendScintilla(id, SCI_POSITIONFROMLINE, line, 0);
-}
-
-int WindowAccessor::LevelAt(int line) {
- return Platform::SendScintilla(id, SCI_GETFOLDLEVEL, line, 0);
-}
-
-int WindowAccessor::Length() {
- if (lenDoc == -1)
- lenDoc = Platform::SendScintilla(id, SCI_GETTEXTLENGTH, 0, 0);
- return lenDoc;
-}
-
-int WindowAccessor::GetLineState(int line) {
- return Platform::SendScintilla(id, SCI_GETLINESTATE, line);
-}
-
-int WindowAccessor::SetLineState(int line, int state) {
- return Platform::SendScintilla(id, SCI_SETLINESTATE, line, state);
-}
-
-void WindowAccessor::StartAt(unsigned int start, char chMask) {
- Platform::SendScintilla(id, SCI_STARTSTYLING, start, chMask);
-}
-
-void WindowAccessor::StartSegment(unsigned int pos) {
- startSeg = pos;
-}
-
-void WindowAccessor::ColourTo(unsigned int pos, int chAttr) {
- // Only perform styling if non empty range
- if (pos != startSeg - 1) {
- if (pos < startSeg) {
- Platform::DebugPrintf("Bad colour positions %d - %d\n", startSeg, pos);
- }
-
- if (validLen + (pos - startSeg + 1) >= bufferSize)
- Flush();
- if (validLen + (pos - startSeg + 1) >= bufferSize) {
- // Too big for buffer so send directly
- Platform::SendScintilla(id, SCI_SETSTYLING, pos - startSeg + 1, chAttr);
- } else {
- if (chAttr != chWhile)
- chFlags = 0;
- chAttr |= chFlags;
- for (unsigned int i = startSeg; i <= pos; i++) {
- styleBuf[validLen++] = static_cast<char>(chAttr);
- }
- }
- }
- startSeg = pos+1;
-}
-
-void WindowAccessor::SetLevel(int line, int level) {
- Platform::SendScintilla(id, SCI_SETFOLDLEVEL, line, level);
-}
-
-void WindowAccessor::Flush() {
- startPos = extremePosition;
- lenDoc = -1;
- if (validLen > 0) {
- Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen,
- styleBuf);
- validLen = 0;
- }
-}
-
-int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) {
- int end = Length();
- int spaceFlags = 0;
-
- // Determines the indentation level of the current line and also checks for consistent
- // indentation compared to the previous line.
- // Indentation is judged consistent when the indentation whitespace of each line lines
- // the same or the indentation of one line is a prefix of the other.
-
- int pos = LineStart(line);
- char ch = (*this)[pos];
- int indent = 0;
- bool inPrevPrefix = line > 0;
- int posPrev = inPrevPrefix ? LineStart(line-1) : 0;
- while ((ch == ' ' || ch == '\t') && (pos < end)) {
- if (inPrevPrefix) {
- char chPrev = (*this)[posPrev++];
- if (chPrev == ' ' || chPrev == '\t') {
- if (chPrev != ch)
- spaceFlags |= wsInconsistent;
- } else {
- inPrevPrefix = false;
- }
- }
- if (ch == ' ') {
- spaceFlags |= wsSpace;
- indent++;
- } else { // Tab
- spaceFlags |= wsTab;
- if (spaceFlags & wsSpace)
- spaceFlags |= wsSpaceTab;
- indent = (indent / 8 + 1) * 8;
- }
- ch = (*this)[++pos];
- }
-
- *flags = spaceFlags;
- indent += SC_FOLDLEVELBASE;
- // if completely empty line or the start of a comment...
- if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)))
- return indent | SC_FOLDLEVELWHITEFLAG;
- else
- return indent;
-}
-
-void WindowAccessor::IndicatorFill(int start, int end, int indicator, int value) {
- Platform::SendScintilla(id, SCI_SETINDICATORCURRENT, indicator);
- if (value) {
- Platform::SendScintilla(id, SCI_SETINDICATORVALUE, value);
- Platform::SendScintilla(id, SCI_INDICATORFILLRANGE, start, end - start);
- } else {
- Platform::SendScintilla(id, SCI_INDICATORCLEARRANGE, start, end - start);
- }
-}
diff --git a/scintilla/version.txt b/scintilla/version.txt index 1762b27..569daf6 100644 --- a/scintilla/version.txt +++ b/scintilla/version.txt @@ -1 +1 @@ -212
+222
diff --git a/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx index b37064a..99b5074 100644 --- a/scintilla/win32/PlatWin.cxx +++ b/scintilla/win32/PlatWin.cxx @@ -13,7 +13,7 @@ #include <time.h>
#if !defined(_WIN32_WINNT)
-#define _WIN32_WINNT 0x0400
+#define _WIN32_WINNT 0x0500
#endif
#include <windows.h>
#include <commctrl.h>
@@ -26,6 +26,13 @@ #include "XPM.h"
#include "FontQuality.h"
+// We want to use multi monitor functions, but via LoadLibrary etc
+// Luckily microsoft has done the heavy lifting for us, so we'll just use their stub functions!
+#if (defined(_MSC_VER) && (MSC_VER > 1200)) || defined(__BORLANDC__)
+#define COMPILE_MULTIMON_STUBS
+#include "MultiMon.h"
+#endif
+
#ifndef IDC_HAND
#define IDC_HAND MAKEINTRESOURCE(32649)
#endif
@@ -213,17 +220,17 @@ static void SetLogFont(LOGFONTA &lf, const char *faceName, int characterSet, int lf.lfQuality = Win32MapFontQuality(extraFontFlag);
strncpy(lf.lfFaceName, faceName, sizeof(lf.lfFaceName));
- if ( lstrcmpiA(faceName, "Calibri") == 0 ||
- lstrcmpiA(faceName, "Cambria") == 0 ||
- lstrcmpiA(faceName, "Candara") == 0 ||
- lstrcmpiA(faceName, "Consolas") == 0 ||
- lstrcmpiA(faceName, "Constantia") == 0 ||
- lstrcmpiA(faceName, "Corbel") == 0 ||
- lstrcmpiA(faceName, "Segoe UI") == 0 )
- {
- // For ClearType-specific fonts, we should enforce ClearType
- lf.lfQuality = CLEARTYPE_QUALITY;
- }
+ if ( lstrcmpiA(faceName, "Calibri") == 0 ||
+ lstrcmpiA(faceName, "Cambria") == 0 ||
+ lstrcmpiA(faceName, "Candara") == 0 ||
+ lstrcmpiA(faceName, "Consolas") == 0 ||
+ lstrcmpiA(faceName, "Constantia") == 0 ||
+ lstrcmpiA(faceName, "Corbel") == 0 ||
+ lstrcmpiA(faceName, "Segoe UI") == 0 )
+ {
+ // For ClearType-specific fonts, we should enforce ClearType
+ lf.lfQuality = CLEARTYPE_QUALITY;
+ }
}
/**
@@ -1043,25 +1050,36 @@ void Window::SetPosition(PRectangle rc) { void Window::SetPositionRelative(PRectangle rc, Window w) {
LONG style = ::GetWindowLong(reinterpret_cast<HWND>(wid), GWL_STYLE);
if (style & WS_POPUP) {
- RECT rcOther;
- ::GetWindowRect(reinterpret_cast<HWND>(w.GetID()), &rcOther);
- rc.Move(rcOther.left, rcOther.top);
-
- // Retrieve desktop bounds and make sure window popup's origin isn't left-top of the screen.
- RECT rcDesktop = {0, 0, 0, 0};
-#ifdef SM_XVIRTUALSCREEN
- rcDesktop.left = ::GetSystemMetrics(SM_XVIRTUALSCREEN);
- rcDesktop.top = ::GetSystemMetrics(SM_YVIRTUALSCREEN);
- rcDesktop.right = rcDesktop.left + ::GetSystemMetrics(SM_CXVIRTUALSCREEN);
- rcDesktop.bottom = rcDesktop.top + ::GetSystemMetrics(SM_CYVIRTUALSCREEN);
+ POINT ptOther = {0, 0};
+ ::ClientToScreen(reinterpret_cast<HWND>(w.GetID()), &ptOther);
+ rc.Move(ptOther.x, ptOther.y);
+
+ // This #ifdef is for VC 98 which has problems with MultiMon.h under some conditions.
+#ifdef MONITOR_DEFAULTTONULL
+ // We're using the stub functionality of MultiMon.h to decay gracefully on machines
+ // (ie, pre Win2000, Win95) that do not support the newer functions.
+ RECT rcMonitor;
+ memcpy(&rcMonitor, &rc, sizeof(rcMonitor)); // RECT and Rectangle are the same really.
+ MONITORINFO mi = {0};
+ mi.cbSize = sizeof(mi);
+
+ HMONITOR hMonitor = ::MonitorFromRect(&rcMonitor, MONITOR_DEFAULTTONEAREST);
+ // If hMonitor is NULL, that's just the main screen anyways.
+ ::GetMonitorInfo(hMonitor, &mi);
+
+ // Now clamp our desired rectangle to fit inside the work area
+ // This way, the menu will fit wholly on one screen. An improvement even
+ // if you don't have a second monitor on the left... Menu's appears half on
+ // one screen and half on the other are just U.G.L.Y.!
+ if (rc.right > mi.rcWork.right)
+ rc.Move(mi.rcWork.right - rc.right, 0);
+ if (rc.bottom > mi.rcWork.bottom)
+ rc.Move(0, mi.rcWork.bottom - rc.bottom);
+ if (rc.left < mi.rcWork.left)
+ rc.Move(mi.rcWork.left - rc.left, 0);
+ if (rc.top < mi.rcWork.top)
+ rc.Move(0, mi.rcWork.top - rc.top);
#endif
-
- if (rc.left < rcDesktop.left) {
- rc.Move(rcDesktop.left - rc.left,0);
- }
- if (rc.top < rcDesktop.top) {
- rc.Move(0,rcDesktop.top - rc.top);
- }
}
SetPosition(rc);
}
@@ -1145,15 +1163,15 @@ void Window::SetTitle(const char *s) { /* Returns rectangle of monitor pt is on, both rect and pt are in Window's
coordinates */
-#ifdef MULTIPLE_MONITOR_SUPPORT
PRectangle Window::GetMonitorRect(Point pt) {
+#ifdef MONITOR_DEFAULTTONULL
// MonitorFromPoint and GetMonitorInfo are not available on Windows 95 so are not used.
// There could be conditional code and dynamic loading in a future version
// so this would work on those platforms where they are available.
PRectangle rcPosition = GetPosition();
POINT ptDesktop = {pt.x + rcPosition.left, pt.y + rcPosition.top};
HMONITOR hMonitor = ::MonitorFromPoint(ptDesktop, MONITOR_DEFAULTTONEAREST);
- MONITORINFOEX mi;
+ MONITORINFO mi = {0};
memset(&mi, 0, sizeof(mi));
mi.cbSize = sizeof(mi);
if (::GetMonitorInfo(hMonitor, &mi)) {
@@ -1163,13 +1181,13 @@ PRectangle Window::GetMonitorRect(Point pt) { mi.rcWork.right - rcPosition.left,
mi.rcWork.bottom - rcPosition.top);
return rcMonitor;
+ } else {
+ return PRectangle();
}
-}
#else
-PRectangle Window::GetMonitorRect(Point) {
return PRectangle();
-}
#endif
+}
struct ListItemData {
const char *text;
@@ -1317,7 +1335,6 @@ class ListBoxX : public ListBox { int NcHitTest(WPARAM, LPARAM) const;
void CentreItem(int);
void Paint(HDC);
- void Erase(HDC);
static LRESULT PASCAL ControlWndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam);
static const Point ItemInset; // Padding around whole item
diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx index 06147c6..bd22b0c 100644 --- a/scintilla/win32/ScintillaWin.cxx +++ b/scintilla/win32/ScintillaWin.cxx @@ -17,7 +17,7 @@ #include <vector>
#if !defined(_WIN32_WINNT)
-#define _WIN32_WINNT 0x0500
+#define _WIN32_WINNT 0x0500
#endif
#include <windows.h>
#include <commctrl.h>
@@ -26,13 +26,12 @@ #include "Platform.h"
+#include "ILexer.h"
#include "Scintilla.h"
+
#ifdef SCI_LEXER
#include "SciLexer.h"
-#include "PropSet.h"
-#include "PropSetSimple.h"
-#include "Accessor.h"
-#include "KeyWords.h"
+#include "LexerModule.h"
#endif
#include "SplitVector.h"
#include "Partitioning.h"
@@ -331,6 +330,10 @@ ScintillaWin::ScintillaWin(HWND hwnd) { keysAlwaysUnicode = false;
+ caret.period = ::GetCaretBlinkTime();
+ if (caret.period < 0)
+ caret.period = 0;
+
Initialise();
}
@@ -743,11 +746,11 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam // Platform::IsKeyDown(VK_SHIFT),
// Platform::IsKeyDown(VK_CONTROL),
// Platform::IsKeyDown(VK_MENU));
+ ::SetFocus(MainHWND());
ButtonDown(Point::FromLong(lParam), ::GetMessageTime(),
(wParam & MK_SHIFT) != 0,
(wParam & MK_CONTROL) != 0,
Platform::IsKeyDown(VK_MENU));
- ::SetFocus(MainHWND());
}
break;
@@ -1295,7 +1298,7 @@ void ScintillaWin::NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt) MAKELPARAM(pt.x, pt.y));
}
-class CaseFolderUTF8 : public CaseFolderTable {
+class CaseFolderUTF8 : public CaseFolderTable {
// Allocate the expandable storage here so that it does not need to be reallocated
// for each call to Fold.
std::vector<wchar_t> utf16Mixed;
@@ -1315,6 +1318,12 @@ public: size_t nUtf16Mixed = ::MultiByteToWideChar(65001, 0, mixed, lenMixed,
&utf16Mixed[0], utf16Mixed.size());
+ if (nUtf16Mixed == 0) {
+ // Failed to convert -> bad UTF-8
+ folded[0] = '\0';
+ return 1;
+ }
+
if (nUtf16Mixed * 4 > utf16Folded.size()) { // Maximum folding expansion factor of 4
utf16Folded.resize(nUtf16Mixed * 4 + 8);
}
@@ -1333,13 +1342,63 @@ public: }
};
+class CaseFolderDBCS : public CaseFolderTable {
+ // Allocate the expandable storage here so that it does not need to be reallocated
+ // for each call to Fold.
+ std::vector<wchar_t> utf16Mixed;
+ std::vector<wchar_t> utf16Folded;
+ UINT cp;
+public:
+ CaseFolderDBCS(UINT cp_) : cp(cp_) {
+ StandardASCII();
+ }
+ virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) {
+ if ((lenMixed == 1) && (sizeFolded > 0)) {
+ folded[0] = mapping[static_cast<unsigned char>(mixed[0])];
+ return 1;
+ } else {
+ if (lenMixed > utf16Mixed.size()) {
+ utf16Mixed.resize(lenMixed + 8);
+ }
+ size_t nUtf16Mixed = ::MultiByteToWideChar(cp, 0, mixed, lenMixed,
+ &utf16Mixed[0], utf16Mixed.size());
+
+ if (nUtf16Mixed == 0) {
+ // Failed to convert -> bad input
+ folded[0] = '\0';
+ return 1;
+ }
+
+ if (nUtf16Mixed * 4 > utf16Folded.size()) { // Maximum folding expansion factor of 4
+ utf16Folded.resize(nUtf16Mixed * 4 + 8);
+ }
+ int lenFlat = ::LCMapStringW(LOCALE_SYSTEM_DEFAULT,
+ LCMAP_LINGUISTIC_CASING | LCMAP_LOWERCASE,
+ &utf16Mixed[0], nUtf16Mixed, &utf16Folded[0], utf16Folded.size());
+
+ size_t lenOut = ::WideCharToMultiByte(cp, 0,
+ &utf16Folded[0], lenFlat,
+ NULL, 0, NULL, 0);
+
+ if (lenOut < sizeFolded) {
+ ::WideCharToMultiByte(cp, 0,
+ &utf16Folded[0], lenFlat,
+ folded, lenOut, NULL, 0);
+ return lenOut;
+ } else {
+ return 0;
+ }
+ }
+ }
+};
+
CaseFolder *ScintillaWin::CaseFolderForEncoding() {
UINT cpDest = CodePageOfDocument();
if (cpDest == SC_CP_UTF8) {
return new CaseFolderUTF8();
} else {
- CaseFolderTable *pcf = new CaseFolderTable();
if (pdoc->dbcsCodePage == 0) {
+ CaseFolderTable *pcf = new CaseFolderTable();
pcf->StandardASCII();
// Only for single byte encodings
UINT cpDoc = CodePageOfDocument();
@@ -1363,8 +1422,10 @@ CaseFolder *ScintillaWin::CaseFolderForEncoding() { }
}
}
+ return pcf;
+ } else {
+ return new CaseFolderDBCS(cpDest);
}
- return pcf;
}
}
@@ -2045,7 +2106,7 @@ void ScintillaWin::GetIntelliMouseParameters() { void ScintillaWin::CopyToClipboard(const SelectionText &selectedText) {
if (!::OpenClipboard(MainHWND()))
- return ;
+ return;
::EmptyClipboard();
GlobalMemory uniText;
diff --git a/src/Notepad2.c b/src/Notepad2.c index ba844f9..9ae6c3b 100644 --- a/src/Notepad2.c +++ b/src/Notepad2.c @@ -1499,11 +1499,6 @@ LRESULT MsgCreate(HWND hwnd,WPARAM wParam,LPARAM lParam) SciCall_SetMarginMask(MARGIN_FOLD_INDEX, SC_MASK_FOLDERS);
SciCall_SetMarginWidth(MARGIN_FOLD_INDEX, (bShowCodeFolding) ? 11 : 0);
SciCall_SetMarginSensitive(MARGIN_FOLD_INDEX, TRUE);
- SciCall_SetProperty("fold", "1");
- SciCall_SetProperty("fold.compact", "0");
- SciCall_SetProperty("fold.comment", "1");
- SciCall_SetProperty("fold.html", "1");
- SciCall_SetProperty("fold.preprocessor", "1");
SciCall_MarkerDefine(SC_MARKNUM_FOLDEROPEN, SC_MARK_BOXMINUS);
SciCall_MarkerDefine(SC_MARKNUM_FOLDER, SC_MARK_BOXPLUS);
SciCall_MarkerDefine(SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE);
diff --git a/src/Notepad2.vcxproj b/src/Notepad2.vcxproj index 322dd67..3408861 100644 --- a/src/Notepad2.vcxproj +++ b/src/Notepad2.vcxproj @@ -91,7 +91,7 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\lexers;..\scintilla\lexlib;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;STATIC_BUILD;SCI_LEXER;UNICODE;_UNICODE;_WIN32_WINNT=0x0501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -120,7 +120,7 @@ update_version.bat</Command> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\lexers;..\scintilla\lexlib;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN64;STATIC_BUILD;SCI_LEXER;UNICODE;_UNICODE;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@@ -150,7 +150,7 @@ update_version.bat</Command> <ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\lexers;..\scintilla\lexlib;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;STATIC_BUILD;SCI_LEXER;NDEBUG;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -192,7 +192,7 @@ update_version.bat</Command> <Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<OmitFramePointers>true</OmitFramePointers>
- <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\lexers;..\scintilla\lexlib;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN64;STATIC_BUILD;SCI_LEXER;NDEBUG;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -230,92 +230,94 @@ update_version.bat</Command> </PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="..\scintilla\src\LexAHK.cxx" />
- <ClCompile Include="..\scintilla\src\LexAU3.cxx" />
- <ClCompile Include="..\scintilla\src\LexBash.cxx" />
- <ClCompile Include="..\scintilla\src\LexInno.cxx" />
- <ClCompile Include="..\scintilla\src\LexLua.cxx" />
- <ClCompile Include="..\scintilla\src\LexNsis.cxx" />
- <ClCompile Include="..\scintilla\src\LexRuby.cxx" />
- <ClCompile Include="..\scintilla\src\LexTCL.cxx" />
- <ClCompile Include="Dialogs.c" />
- <ClCompile Include="Dlapi.c" />
- <ClCompile Include="Edit.c" />
- <ClCompile Include="Helpers.c" />
- <ClCompile Include="Notepad2.c" />
- <ClCompile Include="Print.cpp" />
- <ClCompile Include="Styles.c" />
+ <ClCompile Include="..\scintilla\lexers\LexAHK.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexAsm.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexAU3.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexBash.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexConf.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexCPP.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexCSS.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexHTML.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexInno.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexLua.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexNsis.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexOthers.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexPascal.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexPerl.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexPowerShell.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexPython.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexRuby.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexSQL.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexTCL.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexVB.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\Accessor.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\CharacterSet.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\LexerBase.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\LexerModule.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\LexerSimple.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\PropSetSimple.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\StyleContext.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\WordList.cxx" />
<ClCompile Include="..\scintilla\src\AutoComplete.cxx" />
<ClCompile Include="..\scintilla\src\CallTip.cxx" />
+ <ClCompile Include="..\scintilla\src\Catalogue.cxx" />
<ClCompile Include="..\scintilla\src\CellBuffer.cxx" />
<ClCompile Include="..\scintilla\src\CharClassify.cxx" />
<ClCompile Include="..\scintilla\src\ContractionState.cxx" />
<ClCompile Include="..\scintilla\src\Decoration.cxx" />
<ClCompile Include="..\scintilla\src\Document.cxx" />
- <ClCompile Include="..\scintilla\src\DocumentAccessor.cxx" />
<ClCompile Include="..\scintilla\src\Editor.cxx" />
<ClCompile Include="..\scintilla\src\ExternalLexer.cxx" />
<ClCompile Include="..\scintilla\src\Indicator.cxx" />
<ClCompile Include="..\scintilla\src\KeyMap.cxx" />
- <ClCompile Include="..\scintilla\src\KeyWords.cxx" />
- <ClCompile Include="..\scintilla\src\LexAsm.cxx" />
- <ClCompile Include="..\scintilla\src\LexCPP.cxx" />
- <ClCompile Include="..\scintilla\src\LexCSS.cxx" />
- <ClCompile Include="..\scintilla\src\LexConf.cxx" />
- <ClCompile Include="..\scintilla\src\LexHTML.cxx" />
- <ClCompile Include="..\scintilla\src\LexOthers.cxx" />
- <ClCompile Include="..\scintilla\src\LexPascal.cxx" />
- <ClCompile Include="..\scintilla\src\LexPerl.cxx" />
- <ClCompile Include="..\scintilla\src\LexPowerShell.cxx" />
- <ClCompile Include="..\scintilla\src\LexPython.cxx" />
- <ClCompile Include="..\scintilla\src\LexSQL.cxx" />
- <ClCompile Include="..\scintilla\src\LexVB.cxx" />
<ClCompile Include="..\scintilla\src\LineMarker.cxx" />
<ClCompile Include="..\scintilla\src\PerLine.cxx" />
<ClCompile Include="..\scintilla\src\PositionCache.cxx" />
- <ClCompile Include="..\scintilla\src\PropSet.cxx" />
<ClCompile Include="..\scintilla\src\RESearch.cxx" />
<ClCompile Include="..\scintilla\src\RunStyles.cxx" />
<ClCompile Include="..\scintilla\src\ScintillaBase.cxx" />
<ClCompile Include="..\scintilla\src\Selection.cxx" />
<ClCompile Include="..\scintilla\src\Style.cxx" />
- <ClCompile Include="..\scintilla\src\StyleContext.cxx" />
<ClCompile Include="..\scintilla\src\UniConversion.cxx" />
<ClCompile Include="..\scintilla\src\ViewStyle.cxx" />
- <ClCompile Include="..\scintilla\src\WindowAccessor.cxx" />
<ClCompile Include="..\scintilla\src\XPM.cxx" />
+ <ClCompile Include="Dialogs.c" />
+ <ClCompile Include="Dlapi.c" />
+ <ClCompile Include="Edit.c" />
+ <ClCompile Include="Helpers.c" />
+ <ClCompile Include="Notepad2.c" />
+ <ClCompile Include="Print.cpp" />
+ <ClCompile Include="Styles.c" />
<ClCompile Include="..\scintilla\win32\PlatWin.cxx" />
<ClCompile Include="..\scintilla\win32\ScintillaWin.cxx" />
</ItemGroup>
<ItemGroup>
- <ClInclude Include="Dialogs.h" />
- <ClInclude Include="Dlapi.h" />
- <ClInclude Include="Edit.h" />
- <ClInclude Include="Helpers.h" />
- <ClInclude Include="Notepad2.h" />
- <ClInclude Include="SciCall.h" />
- <ClInclude Include="Styles.h" />
- <ClInclude Include="resource.h" />
- <ClInclude Include="Version.h" />
- <ClInclude Include="..\scintilla\include\Accessor.h" />
- <ClInclude Include="..\scintilla\include\KeyWords.h" />
+ <ClInclude Include="..\scintilla\include\ILexer.h" />
<ClInclude Include="..\scintilla\include\Platform.h" />
- <ClInclude Include="..\scintilla\include\PropSet.h" />
<ClInclude Include="..\scintilla\include\SciLexer.h" />
<ClInclude Include="..\scintilla\include\Scintilla.h" />
<ClInclude Include="..\scintilla\include\ScintillaWidget.h" />
- <ClInclude Include="..\scintilla\include\WindowAccessor.h" />
+ <ClInclude Include="..\scintilla\lexlib\Accessor.h" />
+ <ClInclude Include="..\scintilla\lexlib\CharacterSet.h" />
+ <ClInclude Include="..\scintilla\lexlib\LexAccessor.h" />
+ <ClInclude Include="..\scintilla\lexlib\LexerBase.h" />
+ <ClInclude Include="..\scintilla\lexlib\LexerModule.h" />
+ <ClInclude Include="..\scintilla\lexlib\LexerSimple.h" />
+ <ClInclude Include="..\scintilla\lexlib\OptionSet.h" />
+ <ClInclude Include="..\scintilla\lexlib\PropSetSimple.h" />
+ <ClInclude Include="..\scintilla\lexlib\StyleContext.h" />
+ <ClInclude Include="..\scintilla\lexlib\WordList.h" />
<ClInclude Include="..\scintilla\src\AutoComplete.h" />
<ClInclude Include="..\scintilla\src\CallTip.h" />
+ <ClInclude Include="..\scintilla\src\Catalogue.h" />
<ClInclude Include="..\scintilla\src\CellBuffer.h" />
<ClInclude Include="..\scintilla\src\CharClassify.h" />
- <ClInclude Include="..\scintilla\src\CharacterSet.h" />
<ClInclude Include="..\scintilla\src\ContractionState.h" />
<ClInclude Include="..\scintilla\src\Decoration.h" />
<ClInclude Include="..\scintilla\src\Document.h" />
- <ClInclude Include="..\scintilla\src\DocumentAccessor.h" />
<ClInclude Include="..\scintilla\src\Editor.h" />
<ClInclude Include="..\scintilla\src\ExternalLexer.h" />
+ <ClInclude Include="..\scintilla\src\FontQuality.h" />
<ClInclude Include="..\scintilla\src\Indicator.h" />
<ClInclude Include="..\scintilla\src\KeyMap.h" />
<ClInclude Include="..\scintilla\src\LineMarker.h" />
@@ -324,15 +326,23 @@ update_version.bat</Command> <ClInclude Include="..\scintilla\src\PositionCache.h" />
<ClInclude Include="..\scintilla\src\RESearch.h" />
<ClInclude Include="..\scintilla\src\RunStyles.h" />
- <ClInclude Include="..\scintilla\src\SVector.h" />
<ClInclude Include="..\scintilla\src\ScintillaBase.h" />
<ClInclude Include="..\scintilla\src\Selection.h" />
<ClInclude Include="..\scintilla\src\SplitVector.h" />
<ClInclude Include="..\scintilla\src\Style.h" />
- <ClInclude Include="..\scintilla\src\StyleContext.h" />
+ <ClInclude Include="..\scintilla\src\SVector.h" />
<ClInclude Include="..\scintilla\src\UniConversion.h" />
<ClInclude Include="..\scintilla\src\ViewStyle.h" />
<ClInclude Include="..\scintilla\src\XPM.h" />
+ <ClInclude Include="Dialogs.h" />
+ <ClInclude Include="Dlapi.h" />
+ <ClInclude Include="Edit.h" />
+ <ClInclude Include="Helpers.h" />
+ <ClInclude Include="Notepad2.h" />
+ <ClInclude Include="SciCall.h" />
+ <ClInclude Include="Styles.h" />
+ <ClInclude Include="resource.h" />
+ <ClInclude Include="Version.h" />
<ClInclude Include="..\scintilla\win32\PlatformRes.h" />
</ItemGroup>
<ItemGroup>
diff --git a/src/Notepad2.vcxproj.filters b/src/Notepad2.vcxproj.filters index 9f7ba55..c35755e 100644 --- a/src/Notepad2.vcxproj.filters +++ b/src/Notepad2.vcxproj.filters @@ -19,6 +19,12 @@ <Filter Include="Scintilla\include">
<UniqueIdentifier>{52a9038d-55b6-4160-9922-006bc5b944e2}</UniqueIdentifier>
</Filter>
+ <Filter Include="Scintilla\lexers">
+ <UniqueIdentifier>{d935131a-8e0b-4edd-8e22-10accb5ffeb0}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Scintilla\lexlib">
+ <UniqueIdentifier>{fe9e2269-192b-4e55-b221-dfc50a195d93}</UniqueIdentifier>
+ </Filter>
<Filter Include="Scintilla\src">
<UniqueIdentifier>{4b9b9748-4a42-47b2-b4e6-6d5e997ae4e0}</UniqueIdentifier>
</Filter>
@@ -48,79 +54,124 @@ <ClCompile Include="Styles.c">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\AutoComplete.cxx">
- <Filter>Scintilla\src</Filter>
+ <ClCompile Include="..\scintilla\lexers\LexAHK.cxx">
+ <Filter>Scintilla\lexers</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\CallTip.cxx">
- <Filter>Scintilla\src</Filter>
+ <ClCompile Include="..\scintilla\lexers\LexAsm.cxx">
+ <Filter>Scintilla\lexers</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\CellBuffer.cxx">
- <Filter>Scintilla\src</Filter>
+ <ClCompile Include="..\scintilla\lexers\LexAU3.cxx">
+ <Filter>Scintilla\lexers</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\CharClassify.cxx">
- <Filter>Scintilla\src</Filter>
+ <ClCompile Include="..\scintilla\lexers\LexBash.cxx">
+ <Filter>Scintilla\lexers</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\ContractionState.cxx">
- <Filter>Scintilla\src</Filter>
+ <ClCompile Include="..\scintilla\lexers\LexConf.cxx">
+ <Filter>Scintilla\lexers</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\Decoration.cxx">
- <Filter>Scintilla\src</Filter>
+ <ClCompile Include="..\scintilla\lexers\LexCPP.cxx">
+ <Filter>Scintilla\lexers</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\Document.cxx">
- <Filter>Scintilla\src</Filter>
+ <ClCompile Include="..\scintilla\lexers\LexCSS.cxx">
+ <Filter>Scintilla\lexers</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\DocumentAccessor.cxx">
- <Filter>Scintilla\src</Filter>
+ <ClCompile Include="..\scintilla\lexers\LexHTML.cxx">
+ <Filter>Scintilla\lexers</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\Editor.cxx">
- <Filter>Scintilla\src</Filter>
+ <ClCompile Include="..\scintilla\lexers\LexInno.cxx">
+ <Filter>Scintilla\lexers</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\ExternalLexer.cxx">
- <Filter>Scintilla\src</Filter>
+ <ClCompile Include="..\scintilla\lexers\LexLua.cxx">
+ <Filter>Scintilla\lexers</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\Indicator.cxx">
- <Filter>Scintilla\src</Filter>
+ <ClCompile Include="..\scintilla\lexers\LexNsis.cxx">
+ <Filter>Scintilla\lexers</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\KeyMap.cxx">
- <Filter>Scintilla\src</Filter>
+ <ClCompile Include="..\scintilla\lexers\LexOthers.cxx">
+ <Filter>Scintilla\lexers</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\KeyWords.cxx">
- <Filter>Scintilla\src</Filter>
+ <ClCompile Include="..\scintilla\lexers\LexPascal.cxx">
+ <Filter>Scintilla\lexers</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\LexAsm.cxx">
+ <ClCompile Include="..\scintilla\lexers\LexPerl.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexPowerShell.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexPython.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexRuby.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexSQL.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexTCL.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexVB.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\Accessor.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\CharacterSet.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\LexerBase.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\LexerModule.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\LexerSimple.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\PropSetSimple.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\StyleContext.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\WordList.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\AutoComplete.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\LexCPP.cxx">
+ <ClCompile Include="..\scintilla\src\CallTip.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\LexCSS.cxx">
+ <ClCompile Include="..\scintilla\src\Catalogue.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\LexConf.cxx">
+ <ClCompile Include="..\scintilla\src\CellBuffer.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\LexHTML.cxx">
+ <ClCompile Include="..\scintilla\src\CharClassify.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\LexOthers.cxx">
+ <ClCompile Include="..\scintilla\src\ContractionState.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\LexPascal.cxx">
+ <ClCompile Include="..\scintilla\src\Decoration.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\LexPerl.cxx">
+ <ClCompile Include="..\scintilla\src\Document.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\LexPowerShell.cxx">
+ <ClCompile Include="..\scintilla\src\Editor.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\LexPython.cxx">
+ <ClCompile Include="..\scintilla\src\ExternalLexer.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\LexSQL.cxx">
+ <ClCompile Include="..\scintilla\src\Indicator.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\LexVB.cxx">
+ <ClCompile Include="..\scintilla\src\KeyMap.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\src\LineMarker.cxx">
@@ -132,9 +183,6 @@ <ClCompile Include="..\scintilla\src\PositionCache.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\PropSet.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
<ClCompile Include="..\scintilla\src\RESearch.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
@@ -150,18 +198,12 @@ <ClCompile Include="..\scintilla\src\Style.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\StyleContext.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
<ClCompile Include="..\scintilla\src\UniConversion.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\src\ViewStyle.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\WindowAccessor.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
<ClCompile Include="..\scintilla\src\XPM.cxx">
<Filter>Scintilla\src</Filter>
</ClCompile>
@@ -171,30 +213,6 @@ <ClCompile Include="..\scintilla\win32\ScintillaWin.cxx">
<Filter>Scintilla\win32</Filter>
</ClCompile>
- <ClCompile Include="..\scintilla\src\LexAU3.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexBash.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexTCL.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexInno.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexNsis.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexLua.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexRuby.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexAHK.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Dialogs.h">
@@ -224,18 +242,15 @@ <ClInclude Include="Version.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\include\Accessor.h">
- <Filter>Scintilla\include</Filter>
+ <ClInclude Include="..\scintilla\win32\PlatformRes.h">
+ <Filter>Scintilla\win32</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\include\KeyWords.h">
+ <ClInclude Include="..\scintilla\include\ILexer.h">
<Filter>Scintilla\include</Filter>
</ClInclude>
<ClInclude Include="..\scintilla\include\Platform.h">
<Filter>Scintilla\include</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\include\PropSet.h">
- <Filter>Scintilla\include</Filter>
- </ClInclude>
<ClInclude Include="..\scintilla\include\SciLexer.h">
<Filter>Scintilla\include</Filter>
</ClInclude>
@@ -245,22 +260,19 @@ <ClInclude Include="..\scintilla\include\ScintillaWidget.h">
<Filter>Scintilla\include</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\include\WindowAccessor.h">
- <Filter>Scintilla\include</Filter>
- </ClInclude>
<ClInclude Include="..\scintilla\src\AutoComplete.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
<ClInclude Include="..\scintilla\src\CallTip.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\src\CellBuffer.h">
+ <ClInclude Include="..\scintilla\src\Catalogue.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\src\CharClassify.h">
+ <ClInclude Include="..\scintilla\src\CellBuffer.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\src\CharacterSet.h">
+ <ClInclude Include="..\scintilla\src\CharClassify.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
<ClInclude Include="..\scintilla\src\ContractionState.h">
@@ -272,15 +284,15 @@ <ClInclude Include="..\scintilla\src\Document.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\src\DocumentAccessor.h">
- <Filter>Scintilla\src</Filter>
- </ClInclude>
<ClInclude Include="..\scintilla\src\Editor.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
<ClInclude Include="..\scintilla\src\ExternalLexer.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
+ <ClInclude Include="..\scintilla\src\FontQuality.h">
+ <Filter>Scintilla\src</Filter>
+ </ClInclude>
<ClInclude Include="..\scintilla\src\Indicator.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
@@ -305,9 +317,6 @@ <ClInclude Include="..\scintilla\src\RunStyles.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\src\SVector.h">
- <Filter>Scintilla\src</Filter>
- </ClInclude>
<ClInclude Include="..\scintilla\src\ScintillaBase.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
@@ -320,7 +329,7 @@ <ClInclude Include="..\scintilla\src\Style.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\src\StyleContext.h">
+ <ClInclude Include="..\scintilla\src\SVector.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
<ClInclude Include="..\scintilla\src\UniConversion.h">
@@ -332,8 +341,35 @@ <ClInclude Include="..\scintilla\src\XPM.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\win32\PlatformRes.h">
- <Filter>Scintilla\win32</Filter>
+ <ClInclude Include="..\scintilla\lexlib\Accessor.h">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClInclude>
+ <ClInclude Include="..\scintilla\lexlib\CharacterSet.h">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClInclude>
+ <ClInclude Include="..\scintilla\lexlib\LexAccessor.h">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClInclude>
+ <ClInclude Include="..\scintilla\lexlib\LexerBase.h">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClInclude>
+ <ClInclude Include="..\scintilla\lexlib\LexerModule.h">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClInclude>
+ <ClInclude Include="..\scintilla\lexlib\LexerSimple.h">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClInclude>
+ <ClInclude Include="..\scintilla\lexlib\OptionSet.h">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClInclude>
+ <ClInclude Include="..\scintilla\lexlib\PropSetSimple.h">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClInclude>
+ <ClInclude Include="..\scintilla\lexlib\StyleContext.h">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClInclude>
+ <ClInclude Include="..\scintilla\lexlib\WordList.h">
+ <Filter>Scintilla\lexlib</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
diff --git a/src/Notepad2_icl12.vcxproj b/src/Notepad2_icl12.vcxproj index 6c66b95..7efe490 100644 --- a/src/Notepad2_icl12.vcxproj +++ b/src/Notepad2_icl12.vcxproj @@ -97,7 +97,7 @@ update_version.bat </PreBuildEvent>
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\lexers;..\scintilla\lexlib;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;STATIC_BUILD;SCI_LEXER;NDEBUG;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -132,7 +132,7 @@ update_version.bat </Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\lexers;..\scintilla\lexlib;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN64;STATIC_BUILD;SCI_LEXER;NDEBUG;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -171,7 +171,7 @@ update_version.bat <OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<WholeProgramOptimization>true</WholeProgramOptimization>
- <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\lexers;..\scintilla\lexlib;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;STATIC_BUILD;SCI_LEXER;NDEBUG;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -221,7 +221,7 @@ update_version.bat <OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<WholeProgramOptimization>true</WholeProgramOptimization>
- <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\lexers;..\scintilla\lexlib;..\scintilla\src;..\scintilla\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN64;STATIC_BUILD;SCI_LEXER;NDEBUG;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -254,34 +254,94 @@ update_version.bat </Manifest>
</ItemDefinitionGroup>
<ItemGroup>
- <ClInclude Include="Dialogs.h" />
- <ClInclude Include="Dlapi.h" />
- <ClInclude Include="Edit.h" />
- <ClInclude Include="Helpers.h" />
- <ClInclude Include="Notepad2.h" />
- <ClInclude Include="resource.h" />
- <ClInclude Include="SciCall.h" />
- <ClInclude Include="Styles.h" />
- <ClInclude Include="Version.h" />
- <ClInclude Include="..\scintilla\include\Accessor.h" />
- <ClInclude Include="..\scintilla\include\KeyWords.h" />
+ <ClCompile Include="..\scintilla\lexers\LexAHK.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexAsm.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexAU3.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexBash.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexConf.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexCPP.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexCSS.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexHTML.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexInno.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexLua.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexNsis.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexOthers.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexPascal.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexPerl.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexPowerShell.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexPython.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexRuby.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexSQL.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexTCL.cxx" />
+ <ClCompile Include="..\scintilla\lexers\LexVB.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\Accessor.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\CharacterSet.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\LexerBase.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\LexerModule.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\LexerSimple.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\PropSetSimple.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\StyleContext.cxx" />
+ <ClCompile Include="..\scintilla\lexlib\WordList.cxx" />
+ <ClCompile Include="..\scintilla\src\AutoComplete.cxx" />
+ <ClCompile Include="..\scintilla\src\CallTip.cxx" />
+ <ClCompile Include="..\scintilla\src\Catalogue.cxx" />
+ <ClCompile Include="..\scintilla\src\CellBuffer.cxx" />
+ <ClCompile Include="..\scintilla\src\CharClassify.cxx" />
+ <ClCompile Include="..\scintilla\src\ContractionState.cxx" />
+ <ClCompile Include="..\scintilla\src\Decoration.cxx" />
+ <ClCompile Include="..\scintilla\src\Document.cxx" />
+ <ClCompile Include="..\scintilla\src\Editor.cxx" />
+ <ClCompile Include="..\scintilla\src\ExternalLexer.cxx" />
+ <ClCompile Include="..\scintilla\src\Indicator.cxx" />
+ <ClCompile Include="..\scintilla\src\KeyMap.cxx" />
+ <ClCompile Include="..\scintilla\src\LineMarker.cxx" />
+ <ClCompile Include="..\scintilla\src\PerLine.cxx" />
+ <ClCompile Include="..\scintilla\src\PositionCache.cxx" />
+ <ClCompile Include="..\scintilla\src\RESearch.cxx" />
+ <ClCompile Include="..\scintilla\src\RunStyles.cxx" />
+ <ClCompile Include="..\scintilla\src\ScintillaBase.cxx" />
+ <ClCompile Include="..\scintilla\src\Selection.cxx" />
+ <ClCompile Include="..\scintilla\src\Style.cxx" />
+ <ClCompile Include="..\scintilla\src\UniConversion.cxx" />
+ <ClCompile Include="..\scintilla\src\ViewStyle.cxx" />
+ <ClCompile Include="..\scintilla\src\XPM.cxx" />
+ <ClCompile Include="..\scintilla\win32\PlatWin.cxx" />
+ <ClCompile Include="..\scintilla\win32\ScintillaWin.cxx" />
+ <ClCompile Include="Dialogs.c" />
+ <ClCompile Include="Dlapi.c" />
+ <ClCompile Include="Edit.c" />
+ <ClCompile Include="Helpers.c" />
+ <ClCompile Include="Notepad2.c" />
+ <ClCompile Include="Print.cpp" />
+ <ClCompile Include="Styles.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\scintilla\include\ILexer.h" />
<ClInclude Include="..\scintilla\include\Platform.h" />
- <ClInclude Include="..\scintilla\include\PropSet.h" />
<ClInclude Include="..\scintilla\include\SciLexer.h" />
<ClInclude Include="..\scintilla\include\Scintilla.h" />
<ClInclude Include="..\scintilla\include\ScintillaWidget.h" />
- <ClInclude Include="..\scintilla\include\WindowAccessor.h" />
+ <ClInclude Include="..\scintilla\lexlib\Accessor.h" />
+ <ClInclude Include="..\scintilla\lexlib\CharacterSet.h" />
+ <ClInclude Include="..\scintilla\lexlib\LexAccessor.h" />
+ <ClInclude Include="..\scintilla\lexlib\LexerBase.h" />
+ <ClInclude Include="..\scintilla\lexlib\LexerModule.h" />
+ <ClInclude Include="..\scintilla\lexlib\LexerSimple.h" />
+ <ClInclude Include="..\scintilla\lexlib\OptionSet.h" />
+ <ClInclude Include="..\scintilla\lexlib\PropSetSimple.h" />
+ <ClInclude Include="..\scintilla\lexlib\StyleContext.h" />
+ <ClInclude Include="..\scintilla\lexlib\WordList.h" />
<ClInclude Include="..\scintilla\src\AutoComplete.h" />
<ClInclude Include="..\scintilla\src\CallTip.h" />
+ <ClInclude Include="..\scintilla\src\Catalogue.h" />
<ClInclude Include="..\scintilla\src\CellBuffer.h" />
- <ClInclude Include="..\scintilla\src\CharacterSet.h" />
<ClInclude Include="..\scintilla\src\CharClassify.h" />
<ClInclude Include="..\scintilla\src\ContractionState.h" />
<ClInclude Include="..\scintilla\src\Decoration.h" />
<ClInclude Include="..\scintilla\src\Document.h" />
- <ClInclude Include="..\scintilla\src\DocumentAccessor.h" />
<ClInclude Include="..\scintilla\src\Editor.h" />
<ClInclude Include="..\scintilla\src\ExternalLexer.h" />
+ <ClInclude Include="..\scintilla\src\FontQuality.h" />
<ClInclude Include="..\scintilla\src\Indicator.h" />
<ClInclude Include="..\scintilla\src\KeyMap.h" />
<ClInclude Include="..\scintilla\src\LineMarker.h" />
@@ -294,17 +354,24 @@ update_version.bat <ClInclude Include="..\scintilla\src\Selection.h" />
<ClInclude Include="..\scintilla\src\SplitVector.h" />
<ClInclude Include="..\scintilla\src\Style.h" />
- <ClInclude Include="..\scintilla\src\StyleContext.h" />
<ClInclude Include="..\scintilla\src\SVector.h" />
<ClInclude Include="..\scintilla\src\UniConversion.h" />
<ClInclude Include="..\scintilla\src\ViewStyle.h" />
<ClInclude Include="..\scintilla\src\XPM.h" />
<ClInclude Include="..\scintilla\win32\PlatformRes.h" />
+ <ClInclude Include="Dialogs.h" />
+ <ClInclude Include="Dlapi.h" />
+ <ClInclude Include="Edit.h" />
+ <ClInclude Include="Helpers.h" />
+ <ClInclude Include="Notepad2.h" />
+ <ClInclude Include="SciCall.h" />
+ <ClInclude Include="Styles.h" />
+ <ClInclude Include="resource.h" />
+ <ClInclude Include="Version.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\res\Copy.cur" />
<None Include="..\res\Encoding.bmp" />
- <None Include="..\scintilla\win32\Margin.cur" />
<None Include="..\res\Next.bmp" />
<None Include="..\res\Notepad2.ico" />
<None Include="..\res\Open.bmp" />
@@ -313,6 +380,7 @@ update_version.bat <None Include="..\res\Run.ico" />
<None Include="..\res\Styles.ico" />
<None Include="..\res\Toolbar.bmp" />
+ <None Include="..\scintilla\win32\Margin.cur" />
</ItemGroup>
<ItemGroup>
<Manifest Include="..\res\Notepad2.exe.manifest" />
@@ -320,64 +388,6 @@ update_version.bat <ItemGroup>
<ResourceCompile Include="Notepad2.rc" />
</ItemGroup>
- <ItemGroup>
- <ClCompile Include="Dialogs.c" />
- <ClCompile Include="Dlapi.c" />
- <ClCompile Include="Edit.c" />
- <ClCompile Include="Helpers.c" />
- <ClCompile Include="Notepad2.c" />
- <ClCompile Include="Print.cpp" />
- <ClCompile Include="Styles.c" />
- <ClCompile Include="..\scintilla\src\AutoComplete.cxx" />
- <ClCompile Include="..\scintilla\src\CallTip.cxx" />
- <ClCompile Include="..\scintilla\src\CellBuffer.cxx" />
- <ClCompile Include="..\scintilla\src\CharClassify.cxx" />
- <ClCompile Include="..\scintilla\src\ContractionState.cxx" />
- <ClCompile Include="..\scintilla\src\Decoration.cxx" />
- <ClCompile Include="..\scintilla\src\Document.cxx" />
- <ClCompile Include="..\scintilla\src\DocumentAccessor.cxx" />
- <ClCompile Include="..\scintilla\src\Editor.cxx" />
- <ClCompile Include="..\scintilla\src\ExternalLexer.cxx" />
- <ClCompile Include="..\scintilla\src\Indicator.cxx" />
- <ClCompile Include="..\scintilla\src\KeyMap.cxx" />
- <ClCompile Include="..\scintilla\src\KeyWords.cxx" />
- <ClCompile Include="..\scintilla\src\LexAHK.cxx" />
- <ClCompile Include="..\scintilla\src\LexAsm.cxx" />
- <ClCompile Include="..\scintilla\src\LexAU3.cxx" />
- <ClCompile Include="..\scintilla\src\LexBash.cxx" />
- <ClCompile Include="..\scintilla\src\LexConf.cxx" />
- <ClCompile Include="..\scintilla\src\LexCPP.cxx" />
- <ClCompile Include="..\scintilla\src\LexCSS.cxx" />
- <ClCompile Include="..\scintilla\src\LexHTML.cxx" />
- <ClCompile Include="..\scintilla\src\LexInno.cxx" />
- <ClCompile Include="..\scintilla\src\LexLua.cxx" />
- <ClCompile Include="..\scintilla\src\LexNsis.cxx" />
- <ClCompile Include="..\scintilla\src\LexOthers.cxx" />
- <ClCompile Include="..\scintilla\src\LexPascal.cxx" />
- <ClCompile Include="..\scintilla\src\LexPerl.cxx" />
- <ClCompile Include="..\scintilla\src\LexPowerShell.cxx" />
- <ClCompile Include="..\scintilla\src\LexPython.cxx" />
- <ClCompile Include="..\scintilla\src\LexRuby.cxx" />
- <ClCompile Include="..\scintilla\src\LexSQL.cxx" />
- <ClCompile Include="..\scintilla\src\LexTCL.cxx" />
- <ClCompile Include="..\scintilla\src\LexVB.cxx" />
- <ClCompile Include="..\scintilla\src\LineMarker.cxx" />
- <ClCompile Include="..\scintilla\src\PerLine.cxx" />
- <ClCompile Include="..\scintilla\src\PositionCache.cxx" />
- <ClCompile Include="..\scintilla\src\PropSet.cxx" />
- <ClCompile Include="..\scintilla\src\RESearch.cxx" />
- <ClCompile Include="..\scintilla\src\RunStyles.cxx" />
- <ClCompile Include="..\scintilla\src\ScintillaBase.cxx" />
- <ClCompile Include="..\scintilla\src\Selection.cxx" />
- <ClCompile Include="..\scintilla\src\Style.cxx" />
- <ClCompile Include="..\scintilla\src\StyleContext.cxx" />
- <ClCompile Include="..\scintilla\src\UniConversion.cxx" />
- <ClCompile Include="..\scintilla\src\ViewStyle.cxx" />
- <ClCompile Include="..\scintilla\src\WindowAccessor.cxx" />
- <ClCompile Include="..\scintilla\src\XPM.cxx" />
- <ClCompile Include="..\scintilla\win32\PlatWin.cxx" />
- <ClCompile Include="..\scintilla\win32\ScintillaWin.cxx" />
- </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/src/Notepad2_icl12.vcxproj.filters b/src/Notepad2_icl12.vcxproj.filters index 9275912..efed7f6 100644 --- a/src/Notepad2_icl12.vcxproj.filters +++ b/src/Notepad2_icl12.vcxproj.filters @@ -16,17 +16,205 @@ <Filter Include="Scintilla">
<UniqueIdentifier>{ed9b3c28-9a07-46c0-8a59-7d0909d41240}</UniqueIdentifier>
</Filter>
- <Filter Include="Scintilla\win32">
- <UniqueIdentifier>{a32f9603-4321-4b8e-8ccc-f9b453f4feb9}</UniqueIdentifier>
+ <Filter Include="Scintilla\include">
+ <UniqueIdentifier>{720b705e-03e3-4db1-8272-00413fd63748}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Scintilla\lexers">
+ <UniqueIdentifier>{d935131a-8e0b-4edd-8e22-10accb5ffeb0}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Scintilla\lexlib">
+ <UniqueIdentifier>{fe9e2269-192b-4e55-b221-dfc50a195d93}</UniqueIdentifier>
</Filter>
<Filter Include="Scintilla\src">
<UniqueIdentifier>{fece5d6a-3edf-4aa6-8a57-671022c06e27}</UniqueIdentifier>
</Filter>
- <Filter Include="Scintilla\include">
- <UniqueIdentifier>{720b705e-03e3-4db1-8272-00413fd63748}</UniqueIdentifier>
+ <Filter Include="Scintilla\win32">
+ <UniqueIdentifier>{a32f9603-4321-4b8e-8ccc-f9b453f4feb9}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
+ <ClCompile Include="Dialogs.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="Dlapi.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="Edit.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="Helpers.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="Notepad2.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="Print.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="Styles.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexAHK.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexAsm.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexAU3.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexConf.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexCPP.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexCSS.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexHTML.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexInno.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexLua.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexNsis.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexOthers.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexPascal.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexPerl.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexPowerShell.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexPython.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexRuby.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexSQL.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexTCL.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexVB.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexers\LexBash.cxx">
+ <Filter>Scintilla\lexers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\Accessor.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\CharacterSet.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\LexerBase.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\LexerModule.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\LexerSimple.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\PropSetSimple.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\StyleContext.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\lexlib\WordList.cxx">
+ <Filter>Scintilla\lexlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\AutoComplete.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\CallTip.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\Catalogue.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\CellBuffer.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\CharClassify.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\ContractionState.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\Decoration.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\Document.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\Editor.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\ExternalLexer.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\Indicator.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\KeyMap.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\LineMarker.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\PerLine.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\PositionCache.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\RESearch.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\RunStyles.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\ScintillaBase.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\Selection.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\Style.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\UniConversion.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\ViewStyle.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\src\XPM.cxx">
+ <Filter>Scintilla\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\win32\PlatWin.cxx">
+ <Filter>Scintilla\win32</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scintilla\win32\ScintillaWin.cxx">
+ <Filter>Scintilla\win32</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
<ClInclude Include="Dialogs.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -42,31 +230,46 @@ <ClInclude Include="Notepad2.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="resource.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="SciCall.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Styles.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="resource.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
<ClInclude Include="Version.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\scintilla\win32\PlatformRes.h">
<Filter>Scintilla\win32</Filter>
</ClInclude>
+ <ClInclude Include="..\scintilla\include\ILexer.h">
+ <Filter>Scintilla\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\scintilla\include\Platform.h">
+ <Filter>Scintilla\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\scintilla\include\SciLexer.h">
+ <Filter>Scintilla\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\scintilla\include\Scintilla.h">
+ <Filter>Scintilla\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\scintilla\include\ScintillaWidget.h">
+ <Filter>Scintilla\include</Filter>
+ </ClInclude>
<ClInclude Include="..\scintilla\src\AutoComplete.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
<ClInclude Include="..\scintilla\src\CallTip.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\src\CellBuffer.h">
+ <ClInclude Include="..\scintilla\src\Catalogue.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\src\CharacterSet.h">
+ <ClInclude Include="..\scintilla\src\CellBuffer.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
<ClInclude Include="..\scintilla\src\CharClassify.h">
@@ -81,15 +284,15 @@ <ClInclude Include="..\scintilla\src\Document.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\src\DocumentAccessor.h">
- <Filter>Scintilla\src</Filter>
- </ClInclude>
<ClInclude Include="..\scintilla\src\Editor.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
<ClInclude Include="..\scintilla\src\ExternalLexer.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
+ <ClInclude Include="..\scintilla\src\FontQuality.h">
+ <Filter>Scintilla\src</Filter>
+ </ClInclude>
<ClInclude Include="..\scintilla\src\Indicator.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
@@ -126,9 +329,6 @@ <ClInclude Include="..\scintilla\src\Style.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\src\StyleContext.h">
- <Filter>Scintilla\src</Filter>
- </ClInclude>
<ClInclude Include="..\scintilla\src\SVector.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
@@ -141,29 +341,26 @@ <ClInclude Include="..\scintilla\src\XPM.h">
<Filter>Scintilla\src</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\include\Accessor.h">
- <Filter>Scintilla\include</Filter>
+ <ClInclude Include="..\scintilla\lexlib\Accessor.h">
+ <Filter>Scintilla\lexlib</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\include\KeyWords.h">
- <Filter>Scintilla\include</Filter>
+ <ClInclude Include="..\scintilla\lexlib\CharacterSet.h">
+ <Filter>Scintilla\lexlib</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\include\Platform.h">
- <Filter>Scintilla\include</Filter>
+ <ClInclude Include="..\scintilla\lexlib\LexAccessor.h">
+ <Filter>Scintilla\lexlib</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\include\PropSet.h">
- <Filter>Scintilla\include</Filter>
+ <ClInclude Include="..\scintilla\lexlib\LexerBase.h">
+ <Filter>Scintilla\lexlib</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\include\SciLexer.h">
- <Filter>Scintilla\include</Filter>
+ <ClInclude Include="..\scintilla\lexlib\LexerModule.h">
+ <Filter>Scintilla\lexlib</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\include\Scintilla.h">
- <Filter>Scintilla\include</Filter>
+ <ClInclude Include="..\scintilla\lexlib\LexerSimple.h">
+ <Filter>Scintilla\lexlib</Filter>
</ClInclude>
- <ClInclude Include="..\scintilla\include\ScintillaWidget.h">
- <Filter>Scintilla\include</Filter>
- </ClInclude>
- <ClInclude Include="..\scintilla\include\WindowAccessor.h">
- <Filter>Scintilla\include</Filter>
+ <ClInclude Include="..\scintilla\lexlib\OptionSet.h">
+ <Filter>Scintilla\lexlib</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
@@ -173,9 +370,6 @@ <None Include="..\res\Encoding.bmp">
<Filter>Resource Files</Filter>
</None>
- <None Include="..\scintilla\win32\Margin.cur">
- <Filter>Resource Files</Filter>
- </None>
<None Include="..\res\Next.bmp">
<Filter>Resource Files</Filter>
</None>
@@ -200,6 +394,9 @@ <None Include="..\res\Toolbar.bmp">
<Filter>Resource Files</Filter>
</None>
+ <None Include="..\scintilla\win32\Margin.cur">
+ <Filter>Resource Files</Filter>
+ </None>
</ItemGroup>
<ItemGroup>
<Manifest Include="..\res\Notepad2.exe.manifest">
@@ -211,174 +408,4 @@ <Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
- <ItemGroup>
- <ClCompile Include="Dialogs.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Dlapi.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Edit.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Helpers.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Notepad2.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Print.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Styles.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\AutoComplete.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\CallTip.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\CellBuffer.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\CharClassify.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\ContractionState.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\Decoration.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\Document.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\DocumentAccessor.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\Editor.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\ExternalLexer.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\Indicator.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\KeyMap.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\KeyWords.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexAsm.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexAU3.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexBash.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexConf.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexCPP.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexCSS.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexHTML.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexInno.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexLua.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexNsis.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexOthers.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexPascal.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexPerl.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexPowerShell.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexPython.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexRuby.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexSQL.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexTCL.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexVB.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LineMarker.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\PerLine.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\PositionCache.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\PropSet.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\RESearch.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\RunStyles.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\ScintillaBase.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\Selection.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\Style.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\StyleContext.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\UniConversion.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\ViewStyle.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\WindowAccessor.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\XPM.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\src\LexAHK.cxx">
- <Filter>Scintilla\src</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\win32\PlatWin.cxx">
- <Filter>Scintilla\win32</Filter>
- </ClCompile>
- <ClCompile Include="..\scintilla\win32\ScintillaWin.cxx">
- <Filter>Scintilla\win32</Filter>
- </ClCompile>
- </ItemGroup>
</Project>
\ No newline at end of file diff --git a/src/Styles.c b/src/Styles.c index 05be76e..d4cc9ed 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -1761,8 +1761,10 @@ void Style_SetLexer(HWND hwnd,PEDITLEXER pLexNew) else
SendMessage(hwnd,SCI_SETSTYLEBITS,5,0);
- if (pLexNew->iLexer == SCLEX_CPP)
+ if (pLexNew->iLexer == SCLEX_CPP) {
SendMessage(hwnd,SCI_SETPROPERTY,(WPARAM)"styling.within.preprocessor",(LPARAM)"1");
+ SendMessage(hwnd,SCI_SETPROPERTY,(WPARAM)"lexer.cpp.track.preprocessor",(LPARAM)"0");
+ }
else if (pLexNew->iLexer == SCLEX_PASCAL)
SendMessage(hwnd,SCI_SETPROPERTY,(WPARAM)"lexer.pascal.smart.highlighting",(LPARAM)"1");
else if (pLexNew->iLexer == SCLEX_NSIS)
@@ -1772,6 +1774,13 @@ void Style_SetLexer(HWND hwnd,PEDITLEXER pLexNew) SendMessage(hwnd,SCI_SETPROPERTY,(WPARAM)"lexer.sql.backticks.identifier",(LPARAM)"1");
}
+ // Code folding
+ SciCall_SetProperty("fold", "1");
+ SciCall_SetProperty("fold.compact", "0");
+ SciCall_SetProperty("fold.comment", "1");
+ SciCall_SetProperty("fold.html", "1");
+ SciCall_SetProperty("fold.preprocessor", "1");
+
// Add KeyWord Lists
for (i = 0; i < 9; i++)
SendMessage(hwnd,SCI_SETKEYWORDS,i,(LPARAM)pLexNew->pKeyWords->pszKeyWords[i]);
diff --git a/wdkbuild/build_base.bat b/wdkbuild/build_base.bat index 680799f..240aafa 100644 --- a/wdkbuild/build_base.bat +++ b/wdkbuild/build_base.bat @@ -16,55 +16,59 @@ CALL :SUBMSG "INFO" "compiling stage..." IF /I "%1"=="x86" (SET CLADDCMD=/D "WIN32" /D "_WIN32_WINNT=0x0501")
IF /I "%1"=="x64" (SET CLADDCMD=/D "_WIN64" /D "_WIN32_WINNT=0x0502" /wd4133 /wd4244 /wd4267)
-cl /Fo"%OBJDIR%/" /I "..\scintilla\include" /I "..\scintilla\src" /I "..\scintilla\win32"^
+cl /Fo"%OBJDIR%/" /I "..\scintilla\include" /I "..\scintilla\lexers" /I "..\scintilla\lexlib" /I "..\scintilla\src" /I "..\scintilla\win32"^
/D "STATIC_BUILD" /D "SCI_LEXER" /D "_WINDOWS" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" %CLADDCMD%^
/c /EHsc /MD /O2 /GS /GT /GL /W3 /MP^
+ /Tp "..\scintilla\lexers\LexAHK.cxx"^
+ /Tp "..\scintilla\lexers\LexAsm.cxx"^
+ /Tp "..\scintilla\lexers\LexAU3.cxx"^
+ /Tp "..\scintilla\lexers\LexBash.cxx"^
+ /Tp "..\scintilla\lexers\LexConf.cxx"^
+ /Tp "..\scintilla\lexers\LexCPP.cxx"^
+ /Tp "..\scintilla\lexers\LexCSS.cxx"^
+ /Tp "..\scintilla\lexers\LexHTML.cxx"^
+ /Tp "..\scintilla\lexers\LexInno.cxx"^
+ /Tp "..\scintilla\lexers\LexLua.cxx"^
+ /Tp "..\scintilla\lexers\LexNsis.cxx"^
+ /Tp "..\scintilla\lexers\LexOthers.cxx"^
+ /Tp "..\scintilla\lexers\LexPascal.cxx"^
+ /Tp "..\scintilla\lexers\LexPerl.cxx"^
+ /Tp "..\scintilla\lexers\LexPowerShell.cxx"^
+ /Tp "..\scintilla\lexers\LexPython.cxx"^
+ /Tp "..\scintilla\lexers\LexRuby.cxx"^
+ /Tp "..\scintilla\lexers\LexSQL.cxx"^
+ /Tp "..\scintilla\lexers\LexTCL.cxx"^
+ /Tp "..\scintilla\lexers\LexVB.cxx"^
+ /Tp "..\scintilla\lexlib\Accessor.cxx"^
+ /Tp "..\scintilla\lexlib\CharacterSet.cxx"^
+ /Tp "..\scintilla\lexlib\LexerBase.cxx"^
+ /Tp "..\scintilla\lexlib\LexerModule.cxx"^
+ /Tp "..\scintilla\lexlib\LexerSimple.cxx"^
+ /Tp "..\scintilla\lexlib\PropSetSimple.cxx"^
+ /Tp "..\scintilla\lexlib\StyleContext.cxx"^
+ /Tp "..\scintilla\lexlib\WordList.cxx"^
/Tp "..\scintilla\src\AutoComplete.cxx"^
/Tp "..\scintilla\src\CallTip.cxx"^
+ /Tp "..\scintilla\src\Catalogue.cxx"^
/Tp "..\scintilla\src\CellBuffer.cxx"^
/Tp "..\scintilla\src\CharClassify.cxx"^
/Tp "..\scintilla\src\ContractionState.cxx"^
/Tp "..\scintilla\src\Decoration.cxx"^
/Tp "..\scintilla\src\Document.cxx"^
- /Tp "..\scintilla\src\DocumentAccessor.cxx"^
/Tp "..\scintilla\src\Editor.cxx"^
/Tp "..\scintilla\src\ExternalLexer.cxx"^
/Tp "..\scintilla\src\Indicator.cxx"^
/Tp "..\scintilla\src\KeyMap.cxx"^
- /Tp "..\scintilla\src\KeyWords.cxx"^
- /Tp "..\scintilla\src\LexAHK.cxx"^
- /Tp "..\scintilla\src\LexAsm.cxx"^
- /Tp "..\scintilla\src\LexAU3.cxx"^
- /Tp "..\scintilla\src\LexBash.cxx"^
- /Tp "..\scintilla\src\LexConf.cxx"^
- /Tp "..\scintilla\src\LexCPP.cxx"^
- /Tp "..\scintilla\src\LexCSS.cxx"^
- /Tp "..\scintilla\src\LexHTML.cxx"^
- /Tp "..\scintilla\src\LexLua.cxx"^
- /Tp "..\scintilla\src\LexInno.cxx"^
- /Tp "..\scintilla\src\LexNsis.cxx"^
- /Tp "..\scintilla\src\LexOthers.cxx"^
- /Tp "..\scintilla\src\LexPascal.cxx"^
- /Tp "..\scintilla\src\LexPerl.cxx"^
- /Tp "..\scintilla\src\LexPowerShell.cxx"^
- /Tp "..\scintilla\src\LexPython.cxx"^
- /Tp "..\scintilla\src\LexRuby.cxx"^
- /Tp "..\scintilla\src\LexSQL.cxx"^
- /Tp "..\scintilla\src\LexTCL.cxx"^
- /Tp "..\scintilla\src\LexVB.cxx"^
/Tp "..\scintilla\src\LineMarker.cxx"^
/Tp "..\scintilla\src\PerLine.cxx"^
/Tp "..\scintilla\src\PositionCache.cxx"^
- /Tp "..\scintilla\src\PropSet.cxx"^
/Tp "..\scintilla\src\RESearch.cxx"^
/Tp "..\scintilla\src\RunStyles.cxx"^
/Tp "..\scintilla\src\ScintillaBase.cxx"^
/Tp "..\scintilla\src\Selection.cxx"^
/Tp "..\scintilla\src\Style.cxx"^
- /Tp "..\scintilla\src\StyleContext.cxx"^
/Tp "..\scintilla\src\UniConversion.cxx"^
/Tp "..\scintilla\src\ViewStyle.cxx"^
- /Tp "..\scintilla\src\WindowAccessor.cxx"^
/Tp "..\scintilla\src\XPM.cxx"^
/Tp "..\scintilla\win32\PlatWin.cxx"^
/Tp "..\scintilla\win32\ScintillaWin.cxx"^
@@ -102,23 +106,24 @@ IF /I "%1"=="x64" ( link /OUT:"%OUTDIR%/Notepad2.exe" /INCREMENTAL:NO /RELEASE %LNKADDCMD% /OPT:REF /OPT:ICF /DYNAMICBASE /NXCOMPAT^
/MERGE:.rdata=.text /LTCG kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib shlwapi.lib comdlg32.lib^
comctl32.lib winspool.lib imm32.lib ole32.lib oleaut32.lib psapi.lib^
+ "%OBJDIR%\Accessor.obj"^
"%OBJDIR%\AutoComplete.obj"^
"%OBJDIR%\CallTip.obj"^
+ "%OBJDIR%\Catalogue.obj"^
"%OBJDIR%\CellBuffer.obj"^
+ "%OBJDIR%\CharacterSet.obj"^
"%OBJDIR%\CharClassify.obj"^
"%OBJDIR%\ContractionState.obj"^
"%OBJDIR%\Decoration.obj"^
"%OBJDIR%\Dialogs.obj"^
"%OBJDIR%\Dlapi.obj"^
"%OBJDIR%\Document.obj"^
- "%OBJDIR%\DocumentAccessor.obj"^
"%OBJDIR%\Edit.obj"^
"%OBJDIR%\Editor.obj"^
"%OBJDIR%\ExternalLexer.obj"^
"%OBJDIR%\Helpers.obj"^
"%OBJDIR%\Indicator.obj"^
"%OBJDIR%\KeyMap.obj"^
- "%OBJDIR%\KeyWords.obj"^
"%OBJDIR%\LexAHK.obj"^
"%OBJDIR%\LexAsm.obj"^
"%OBJDIR%\LexAU3.obj"^
@@ -126,6 +131,9 @@ link /OUT:"%OUTDIR%/Notepad2.exe" /INCREMENTAL:NO /RELEASE %LNKADDCMD% /OPT:REF "%OBJDIR%\LexConf.obj"^
"%OBJDIR%\LexCPP.obj"^
"%OBJDIR%\LexCSS.obj"^
+ "%OBJDIR%\LexerBase.obj"^
+ "%OBJDIR%\LexerModule.obj"^
+ "%OBJDIR%\LexerSimple.obj"^
"%OBJDIR%\LexHTML.obj"^
"%OBJDIR%\LexInno.obj"^
"%OBJDIR%\LexLua.obj"^
@@ -146,7 +154,7 @@ link /OUT:"%OUTDIR%/Notepad2.exe" /INCREMENTAL:NO /RELEASE %LNKADDCMD% /OPT:REF "%OBJDIR%\PlatWin.obj"^
"%OBJDIR%\PositionCache.obj"^
"%OBJDIR%\Print.obj"^
- "%OBJDIR%\PropSet.obj"^
+ "%OBJDIR%\PropSetSimple.obj"^
"%OBJDIR%\RESearch.obj"^
"%OBJDIR%\RunStyles.obj"^
"%OBJDIR%\ScintillaBase.obj"^
@@ -157,7 +165,7 @@ link /OUT:"%OUTDIR%/Notepad2.exe" /INCREMENTAL:NO /RELEASE %LNKADDCMD% /OPT:REF "%OBJDIR%\Styles.obj"^
"%OBJDIR%\UniConversion.obj"^
"%OBJDIR%\ViewStyle.obj"^
- "%OBJDIR%\WindowAccessor.obj"^
+ "%OBJDIR%\WordList.obj"^
"%OBJDIR%\XPM.obj"^
"%WDK_LIB%"
|