diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp index c9b5a869f..a0387d962 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp @@ -60,7 +60,7 @@ static LRESULT CALLBACK hookProcMouse(UINT nCode, WPARAM wParam, LPARAM lParam) } -DockingCont::DockingCont(void) +DockingCont::DockingCont() { _isMouseOver = FALSE; _isMouseClose = FALSE; @@ -211,12 +211,12 @@ void DockingCont::setActiveTb(INT iItem) } } -INT DockingCont::getActiveTb(void) +INT DockingCont::getActiveTb() { return ::SendMessage(_hContTab, TCM_GETCURSEL, 0, 0); } -tTbData* DockingCont::getDataOfActiveTb(void) +tTbData* DockingCont::getDataOfActiveTb() { tTbData* pTbData = NULL; INT iItem = getActiveTb(); @@ -233,7 +233,7 @@ tTbData* DockingCont::getDataOfActiveTb(void) return pTbData; } -vector DockingCont::getDataOfVisTb(void) +vector DockingCont::getDataOfVisTb() { vector vTbData; TCITEM tcItem = {0}; @@ -988,7 +988,7 @@ BOOL CALLBACK DockingCont::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara return FALSE; } -void DockingCont::onSize(void) +void DockingCont::onSize() { TCITEM tcItem = {0}; RECT rc = {0}; @@ -1101,7 +1101,7 @@ void DockingCont::onSize(void) } } -void DockingCont::doClose(void) +void DockingCont::doClose() { INT iItemOff = 0; INT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0); @@ -1349,21 +1349,23 @@ void DockingCont::SelectTab(INT iTab) } } -void DockingCont::updateCaption(void) +bool DockingCont::updateCaption() { if (!_hContTab) - return; + return false; TCITEM tcItem = {0}; INT iItem = getActiveTb(); if (iItem < 0) - return; + return false; // get data of new active dialog tcItem.mask = TCIF_PARAM; ::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem); + if (!tcItem.lParam) return false; + // update caption text lstrcpy(_pszCaption, ((tTbData*)tcItem.lParam)->pszName); @@ -1383,9 +1385,10 @@ void DockingCont::updateCaption(void) { ::SetWindowText(_hCaption, _pszCaption); } + return true; } -void DockingCont::focusClient(void) +void DockingCont::focusClient() { TCITEM tcItem = {0}; INT iItem = getActiveTb(); diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingCont.h b/PowerEditor/src/WinControls/DockingWnd/DockingCont.h index 2daae8437..42b7e6c56 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingCont.h +++ b/PowerEditor/src/WinControls/DockingWnd/DockingCont.h @@ -61,10 +61,10 @@ public: DockingCont(); ~DockingCont(); - HWND getTabWnd(void) { + HWND getTabWnd() { return _hContTab; }; - HWND getCaptionWnd(void) { + HWND getCaptionWnd() { if (_isFloating == false) return _hCaption; else @@ -92,26 +92,26 @@ public: void setActiveTb(tTbData* pTbData); void setActiveTb(INT iItem); - INT getActiveTb(void); - tTbData* getDataOfActiveTb(void); - vector getDataOfAllTb(void) { + INT getActiveTb(); + tTbData* getDataOfActiveTb(); + vector getDataOfAllTb() { return _vTbData; }; - vector getDataOfVisTb(void); + vector getDataOfVisTb(); bool isTbVis(tTbData* data); void doDialog(bool willBeShown = true, bool isFloating = false); - bool isFloating(void) { + bool isFloating() { return _isFloating; } - INT getElementCnt(void) { + INT getElementCnt() { return _vTbData.size(); } // interface function for gripper - BOOL startMovingFromTab(void) { + BOOL startMovingFromTab() { BOOL dragFromTabTemp = _dragFromTab; _dragFromTab = FALSE; return dragFromTabTemp; @@ -122,7 +122,7 @@ public: onSize(); }; - void focusClient(void); + void focusClient(); void SetActive(BOOL bState) { _isActive = bState; @@ -161,13 +161,13 @@ protected : // drawing functions void drawCaptionItem(DRAWITEMSTRUCT *pDrawItemStruct); void drawTabItem(DRAWITEMSTRUCT *pDrawItemStruct); - void onSize(void); + void onSize(); // functions for caption handling and drawing eMousePos isInRect(HWND hwnd, INT x, INT y); // handling of toolbars - void doClose(void); + void doClose(); // return new item INT SearchPosInTab(tTbData* pTbData); @@ -179,7 +179,7 @@ protected : return hideToolbar(pTbData, FALSE); }; - void updateCaption(void); + bool updateCaption(); LPARAM NotifyParent(UINT message); private: diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h b/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h index 8be2d245d..93d1b1259 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h +++ b/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h @@ -51,10 +51,6 @@ public: // supported features by plugin data->uMask = 0; - // icons - //data->hIconBar = ::LoadIcon(hInst, IDB_CLOSE_DOWN); - //data->hIconTab = ::LoadIcon(hInst, IDB_CLOSE_DOWN); - // additional info data->pszAddInfo = NULL; @@ -62,7 +58,7 @@ public: }; - virtual void updateDockingDlg(void) { + virtual void updateDockingDlg() { ::SendMessage(_hParent, NPPM_DMMUPDATEDISPINFO, 0, (LPARAM)_hSelf); } diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp index 4311ffc88..e4b0495bf 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp @@ -830,7 +830,7 @@ int DockingManager::GetContainer(DockingCont* pCont) return iRet; } -int DockingManager::FindEmptyContainer(void) +int DockingManager::FindEmptyContainer() { int iRetCont = -1; BOOL* pPrevDockList = (BOOL*) new BOOL[_vContainer.size()+1]; diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingManager.h b/PowerEditor/src/WinControls/DockingWnd/DockingManager.h index eef88c1b8..8125b7be1 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingManager.h +++ b/PowerEditor/src/WinControls/DockingWnd/DockingManager.h @@ -119,7 +119,7 @@ public : int GetContainer(DockingCont* pCont); /* get all container in vector */ - vector & getContainerInfo(void) { + vector & getContainerInfo() { return _vContainer; }; /* get dock data (sized areas) */ @@ -167,13 +167,13 @@ private : static LRESULT CALLBACK staticWinProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); - void onSize(void); + void onSize(); void toggleTb(DockingCont* pContSrc, DockingCont* pContTgt, tTbData TbData); /* test if container exists */ BOOL ContExists(size_t iCont); - int FindEmptyContainer(void); + int FindEmptyContainer(); LRESULT SendNotify(HWND hWnd, UINT message) { NMHDR nmhdr; diff --git a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp index 214b80881..59e737d1b 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp @@ -73,7 +73,7 @@ static LRESULT CALLBACK hookProcKeyboard(INT nCode, WPARAM wParam, LPARAM lParam return ::CallNextHookEx(hookKeyboard, nCode, wParam, lParam); } -Gripper::Gripper(void) +Gripper::Gripper() { _hInst = NULL; _hParent = NULL; @@ -247,7 +247,7 @@ LRESULT Gripper::runProc(UINT message, WPARAM wParam, LPARAM lParam) } -void Gripper::create(void) +void Gripper::create() { RECT rc = {0}; POINT pt = {0}; @@ -301,7 +301,7 @@ void Gripper::create(void) } -void Gripper::onMove(void) +void Gripper::onMove() { POINT pt = {0,0}; POINT ptBuf = {0,0}; @@ -324,7 +324,7 @@ void Gripper::onMove(void) } -void Gripper::onButtonUp(void) +void Gripper::onButtonUp() { POINT pt = {0,0}; POINT ptBuf = {0,0}; diff --git a/PowerEditor/src/WinControls/DockingWnd/Gripper.h b/PowerEditor/src/WinControls/DockingWnd/Gripper.h index d542e80d0..51d71810f 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Gripper.h +++ b/PowerEditor/src/WinControls/DockingWnd/Gripper.h @@ -60,13 +60,13 @@ public: protected : - void create(void); + void create(); static LRESULT CALLBACK staticWinProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); LRESULT runProc(UINT Message, WPARAM wParam, LPARAM lParam); - void onMove(void); - void onButtonUp(void); + void onMove(); + void onButtonUp(); void doTabReordering(POINT pt); void drawRectangle(POINT pt); diff --git a/PowerEditor/src/WinControls/Grid/BabyGrid.cpp b/PowerEditor/src/WinControls/Grid/BabyGrid.cpp index a2ec08fe6..b238a791d 100644 --- a/PowerEditor/src/WinControls/Grid/BabyGrid.cpp +++ b/PowerEditor/src/WinControls/Grid/BabyGrid.cpp @@ -115,7 +115,7 @@ void ShowVscroll(HWND,int); void ShowHscroll(HWND,int); int BinarySearchListBox(HWND,TCHAR*); void DisplayEditString(HWND ,int ,TCHAR*); -int CountGrids(void); +int CountGrids(); diff --git a/PowerEditor/src/WinControls/ToolTip/ToolTip.h b/PowerEditor/src/WinControls/ToolTip/ToolTip.h index aa0db2d4f..9ab496451 100644 --- a/PowerEditor/src/WinControls/ToolTip/ToolTip.h +++ b/PowerEditor/src/WinControls/ToolTip/ToolTip.h @@ -34,7 +34,7 @@ class ToolTip : public Window public : ToolTip() : _bTrackMouse(FALSE) {}; - void destroy(void){ + void destroy(){ ::DestroyWindow(_hSelf); _hSelf = NULL; }; @@ -57,7 +57,7 @@ protected: return (((ToolTip *)(::GetWindowLongPtr(hwnd, GWL_USERDATA)))->runProc(Message, wParam, lParam)); }; LRESULT runProc(UINT Message, WPARAM wParam, LPARAM lParam); - void SendHitMessage(void); + void SendHitMessage(); }; #endif // __TOOLTIP_H__ diff --git a/scintilla/include/SciLexer.h b/scintilla/include/SciLexer.h index 39f9d4738..69e074b54 100644 --- a/scintilla/include/SciLexer.h +++ b/scintilla/include/SciLexer.h @@ -115,6 +115,11 @@ #define SCE_UNIVERSAL_FOUND_STYLE_INC 28 #define SCE_UNIVERSAL_TAGMATCH 27 #define SCE_UNIVERSAL_TAGATTR 26 +#define SCE_UNIVERSAL_FOUND_STYLE_EXT1 25 +#define SCE_UNIVERSAL_FOUND_STYLE_EXT2 24 +#define SCE_UNIVERSAL_FOUND_STYLE_EXT3 23 +#define SCE_UNIVERSAL_FOUND_STYLE_EXT4 22 +#define SCE_UNIVERSAL_FOUND_STYLE_EXT5 21 #define SCE_P_DEFAULT 0 #define SCE_P_COMMENTLINE 1 diff --git a/scintilla/src/LexMySQL.cxx b/scintilla/src/LexMySQL.cxx new file mode 100644 index 000000000..4e25f477d --- /dev/null +++ b/scintilla/src/LexMySQL.cxx @@ -0,0 +1,367 @@ +// Scintilla source code edit control +/** @file LexMySQL.cxx + ** Lexer for MySQL + **/ +// Adopted from LexSQL.cxx by Anders Karlsson +// Original work by Neil Hodgson +// Copyright 1998-2005 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool IsAWordChar(int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '_'); +} + +static inline bool IsAWordStart(int ch) { + return (ch < 0x80) && (isalpha(ch) || ch == '_'); +} + +static inline bool IsADoxygenChar(int ch) { + return (islower(ch) || ch == '$' || ch == '@' || + ch == '\\' || ch == '&' || ch == '<' || + ch == '>' || ch == '#' || ch == '{' || + ch == '}' || ch == '[' || ch == ']'); +} + +static inline bool IsANumberChar(int ch) { + // Not exactly following number definition (several dots are seen as OK, etc.) + // but probably enough in most cases. + return (ch < 0x80) && + (isdigit(ch) || toupper(ch) == 'E' || + ch == '.' || ch == '-' || ch == '+'); +} + +static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], + Accessor &styler) { + + WordList &major_keywords = *keywordlists[0]; + WordList &keywords = *keywordlists[1]; + WordList &database_objects = *keywordlists[2]; + WordList &functions = *keywordlists[3]; + WordList &system_variables = *keywordlists[4]; + WordList &procedure_keywords = *keywordlists[5]; + WordList &kw_user1 = *keywordlists[6]; + WordList &kw_user2 = *keywordlists[7]; + WordList &kw_user3 = *keywordlists[8]; + + StyleContext sc(startPos, length, initStyle, styler); + + for (; sc.More(); sc.Forward()) { + // Determine if the current state should terminate. + switch (sc.state) { + case SCE_MYSQL_OPERATOR: + sc.SetState(SCE_MYSQL_DEFAULT); + break; + case SCE_MYSQL_NUMBER: + // We stop the number definition on non-numerical non-dot non-eE non-sign char + if (!IsANumberChar(sc.ch)) { + sc.SetState(SCE_MYSQL_DEFAULT); + } + break; + case SCE_MYSQL_IDENTIFIER: + if (!IsAWordChar(sc.ch)) { + int nextState = SCE_MYSQL_DEFAULT; + char s[1000]; + sc.GetCurrentLowered(s, sizeof(s)); + if (major_keywords.InList(s)) { + sc.ChangeState(SCE_MYSQL_MAJORKEYWORD); + } else if (keywords.InList(s)) { + sc.ChangeState(SCE_MYSQL_KEYWORD); + } else if (database_objects.InList(s)) { + sc.ChangeState(SCE_MYSQL_DATABASEOBJECT); + } else if (functions.InList(s)) { + sc.ChangeState(SCE_MYSQL_FUNCTION); + } else if (procedure_keywords.InList(s)) { + sc.ChangeState(SCE_MYSQL_PROCEDUREKEYWORD); + } else if (kw_user1.InList(s)) { + sc.ChangeState(SCE_MYSQL_USER1); + } else if (kw_user2.InList(s)) { + sc.ChangeState(SCE_MYSQL_USER2); + } else if (kw_user3.InList(s)) { + sc.ChangeState(SCE_MYSQL_USER3); + } + sc.SetState(nextState); + } + break; + case SCE_MYSQL_VARIABLE: + if (!IsAWordChar(sc.ch)) { + sc.SetState(SCE_MYSQL_DEFAULT); + } + break; + case SCE_MYSQL_SYSTEMVARIABLE: + if (!IsAWordChar(sc.ch)) { + char s[1000]; + sc.GetCurrentLowered(s, sizeof(s)); +// Check for known system variables here. + if (system_variables.InList(&s[2])) { + sc.ChangeState(SCE_MYSQL_KNOWNSYSTEMVARIABLE); + } + sc.SetState(SCE_MYSQL_DEFAULT); + } + break; + case SCE_MYSQL_QUOTEDIDENTIFIER: + if (sc.ch == 0x60) { + if (sc.chNext == 0x60) { + sc.Forward(); // Ignore it + } else { + sc.ForwardSetState(SCE_MYSQL_DEFAULT); + } + } + break; + case SCE_MYSQL_COMMENT: + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_MYSQL_DEFAULT); + } + break; + case SCE_MYSQL_COMMENTLINE: + if (sc.atLineStart) { + sc.SetState(SCE_MYSQL_DEFAULT); + } + break; + case SCE_MYSQL_SQSTRING: + if (sc.ch == '\\') { + // Escape sequence + sc.Forward(); + } else if (sc.ch == '\'') { + if (sc.chNext == '\'') { + sc.Forward(); + } else { + sc.ChangeState(SCE_MYSQL_STRING); + sc.ForwardSetState(SCE_MYSQL_DEFAULT); + } + } + break; + case SCE_MYSQL_DQSTRING: + if (sc.ch == '\\') { + // Escape sequence + sc.Forward(); + } else if (sc.ch == '\"') { + if (sc.chNext == '\"') { + sc.Forward(); + } else { + sc.ChangeState(SCE_MYSQL_STRING); + sc.ForwardSetState(SCE_MYSQL_DEFAULT); + } + } + break; + } + + // Determine if a new state should be entered. + if (sc.state == SCE_MYSQL_DEFAULT) { + if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { + sc.SetState(SCE_MYSQL_NUMBER); + } else if (IsAWordStart(sc.ch)) { + sc.SetState(SCE_MYSQL_IDENTIFIER); +// Note that the order of SYSTEMVARIABLE and VARIABLE is important here. + } else if (sc.ch == 0x40 && sc.chNext == 0x40) { + sc.SetState(SCE_MYSQL_SYSTEMVARIABLE); + sc.Forward(); // Skip past the second at-sign. + } else if (sc.ch == 0x40) { + sc.SetState(SCE_MYSQL_VARIABLE); + } else if (sc.ch == 0x60) { + sc.SetState(SCE_MYSQL_QUOTEDIDENTIFIER); + } else if (sc.Match('/', '*')) { + sc.SetState(SCE_MYSQL_COMMENT); + sc.Forward(); // Eat the * so it isn't used for the end of the comment + } else if (sc.Match('-', '-') || sc.Match('#')) { + sc.SetState(SCE_MYSQL_COMMENTLINE); + } else if (sc.ch == '\'') { + sc.SetState(SCE_MYSQL_SQSTRING); + } else if (sc.ch == '\"') { + sc.SetState(SCE_MYSQL_DQSTRING); + } else if (isoperator(static_cast(sc.ch))) { + sc.SetState(SCE_MYSQL_OPERATOR); + } + } + } + sc.Complete(); +} + +static bool IsStreamCommentStyle(int style) { + return style == SCE_MYSQL_COMMENT; +} + +// 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. +static void FoldMySQLDoc(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 foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 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 levelNext = levelCurrent; + char chNext = styler[startPos]; + int styleNext = styler.StyleAt(startPos); + int style = initStyle; + bool endFound = false; + bool whenFound = false; + bool elseFound = false; + 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)) { + levelNext++; + } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { + // Comments don't end at end of line and the next character may be unstyled. + levelNext--; + } + } + if (foldComment && (style == SCE_MYSQL_COMMENTLINE)) { + // MySQL needs -- comments to be followed by space or control char + if ((ch == '-') && (chNext == '-')) { + char chNext2 = styler.SafeGetCharAt(i + 2); + char chNext3 = styler.SafeGetCharAt(i + 3); + if (chNext2 == '{' || chNext3 == '{') { + levelNext++; + } else if (chNext2 == '}' || chNext3 == '}') { + levelNext--; + } + } + } + if (style == SCE_MYSQL_OPERATOR) { + if (ch == '(') { + levelNext++; + } else if (ch == ')') { + levelNext--; + } + } + +// Style new keywords here. + if ((style == SCE_MYSQL_MAJORKEYWORD && stylePrev != SCE_MYSQL_MAJORKEYWORD) + || (style == SCE_MYSQL_KEYWORD && stylePrev != SCE_MYSQL_KEYWORD) + || (style == SCE_MYSQL_PROCEDUREKEYWORD && stylePrev != SCE_MYSQL_PROCEDUREKEYWORD)) { + const int MAX_KW_LEN = 6; // Maximum length of folding keywords + char s[MAX_KW_LEN + 2]; + unsigned int j = 0; + for (; j < MAX_KW_LEN + 1; j++) { + if (!iswordchar(styler[i + j])) { + break; + } + s[j] = static_cast(tolower(styler[i + j])); + } + if (j == MAX_KW_LEN + 1) { + // Keyword too long, don't test it + s[0] = '\0'; + } else { + s[j] = '\0'; + } + if (!foldOnlyBegin && endFound && (strcmp(s, "if") == 0 || strcmp(s, "while") == 0 || strcmp(s, "loop") == 0)) { + endFound = false; + levelNext--; + if (levelNext < SC_FOLDLEVELBASE) { + levelNext = SC_FOLDLEVELBASE; + } +// Note that else is special here. It may or may be followed by an if then, but in aly case the level stays the +// same. When followed by a if .. then, the level will be increased later, if not, at eol. + } else if (!foldOnlyBegin && strcmp(s, "else") == 0) { + levelNext--; + elseFound = true; + } else if (!foldOnlyBegin && strcmp(s, "then") == 0) { + if(whenFound) { + whenFound = false; + } else { + levelNext++; + } + } else if (strcmp(s, "if") == 0) { + elseFound = false; + } else if (strcmp(s, "when") == 0) { + whenFound = true; + } else if (strcmp(s, "begin") == 0) { + levelNext++; + } else if (!foldOnlyBegin && (strcmp(s, "loop") == 0 || strcmp(s, "repeat") == 0 + || strcmp(s, "while") == 0)) { + if(endFound) { + endFound = false; + } else { + levelNext++; + } + } else if (strcmp(s, "end") == 0) { +// Multiple END in a row are counted multiple times! + if (endFound) { + levelNext--; + if (levelNext < SC_FOLDLEVELBASE) { + levelNext = SC_FOLDLEVELBASE; + } + } + endFound = true; + whenFound = false; + } + } +// Handle this for a trailing end withiut 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(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); + } + lineCurrent++; + levelCurrent = levelNext; + visibleChars = 0; + endFound = false; + whenFound = false; + } + if (!isspacechar(ch)) { + visibleChars++; + } + } +} + +static const char * const mysqlWordListDesc[] = { + "Major Keywords", + "Keywords", + "Database Objects", + "Functions", + "System Variables", + "Procedure keywords", + "User Keywords 1", + "User Keywords 2", + "User Keywords 3" +}; + +LexerModule lmMySQL(SCLEX_MYSQL, ColouriseMySQLDoc, "mysql", FoldMySQLDoc, mysqlWordListDesc);