From fa36b5295085164bce72b0240cb3b415840c4af3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Lipok?= Date: Mon, 26 Apr 2021 14:08:35 +0200 Subject: [PATCH] autoit.cpp - #CS #CE support (#753) --- Externals/crystaledit/editlib/parsers/autoit.cpp | 45 +++++++++++++----------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/Externals/crystaledit/editlib/parsers/autoit.cpp b/Externals/crystaledit/editlib/parsers/autoit.cpp index ed0a9c5ad..a26c7b87f 100644 --- a/Externals/crystaledit/editlib/parsers/autoit.cpp +++ b/Externals/crystaledit/editlib/parsers/autoit.cpp @@ -1,7 +1,7 @@ /////////////////////////////////////////////////////////////////////////// // File: autoit.cpp -// Version: 1.1.0.5 -// Updated: 23-Apr-2021 +// Version: 1.1.0.6 +// Updated: 26-Apr-2021 // // Copyright: Ferdinand Prantl, portions by Stcherbatchenko Andrei // E-mail: prantl@ff.cuni.cz @@ -552,17 +552,17 @@ CrystalLineParser::ParseLineAutoIt (unsigned dwCookie, const TCHAR *pszChars, in DEFINE_BLOCK (nPos, COLORINDEX_COMMENT); } else if (dwCookie & (COOKIE_CHAR | COOKIE_STRING)) - { + { DEFINE_BLOCK(nPos, COLORINDEX_STRING); - } + } else if (dwCookie & (COOKIE_USER1 )) - { + { DEFINE_BLOCK(nPos, COLORINDEX_USER1); - } + } else if (dwCookie & (COOKIE_VARIABLE)) - { + { DEFINE_BLOCK(nPos, COLORINDEX_USER2); - } + } else if (dwCookie & COOKIE_PREPROCESSOR) { DEFINE_BLOCK (nPos, COLORINDEX_PREPROCESSOR); @@ -603,6 +603,7 @@ out: { if (pszChars[I] == '\'') { + dwCookie &= ~COOKIE_CHAR; bRedefineBlock = true; } @@ -625,12 +626,13 @@ out: { if (bFirstChar && pszChars[I] == '#' && ((I + 3 <= nLength && memcmp(&pszChars[I], _T("#ce"), 3 * sizeof(TCHAR)) == 0) || + (I + 3 <= nLength && memcmp(&pszChars[I], _T("#CE"), 3 * sizeof(TCHAR)) == 0) || (I + 13 <= nLength && memcmp(&pszChars[I], _T("#comments-end"), 13 * sizeof(TCHAR)) == 0))) { dwCookie &= ~COOKIE_EXT_COMMENT; bRedefineBlock = true; bFirstChar = false; - I += pszChars[I + 2] == 'e' ? 2 : 12; + I += ((pszChars[I + 2] == 'e') || (pszChars[I + 2] == 'E')) ? 2 : 12; } if (!xisspace (pszChars[I])) bFirstChar = false; @@ -653,42 +655,42 @@ out: // Variable begins if (pszChars[I] == '@') - { + { DEFINE_BLOCK(I, COLORINDEX_USER1); dwCookie |= COOKIE_USER1; continue; - } + } // Variable ends if (dwCookie & COOKIE_USER1) - { + { if (!xisalnum(pszChars[I])) - { + { dwCookie &= ~COOKIE_USER1; bRedefineBlock = true; bDecIndex = true; - } + } continue; - } + } if (pszChars[I] == '$') - { + { DEFINE_BLOCK(I, COLORINDEX_USER2); dwCookie |= COOKIE_VARIABLE; continue; - } + } // Variable ends if (dwCookie & COOKIE_VARIABLE) - { + { if (!xisalnum(pszChars[I])) - { + { dwCookie &= ~COOKIE_VARIABLE; bRedefineBlock = true; bDecIndex = true; - } + } continue; - } + } // Normal text if (pszChars[I] == '"') @@ -711,6 +713,7 @@ out: if (pszChars[I] == '#') { if ((I + 3 <= nLength && memcmp(&pszChars[I], _T("#cs"), 3 * sizeof(TCHAR)) == 0) || + (I + 3 <= nLength && memcmp(&pszChars[I], _T("#CS"), 3 * sizeof(TCHAR)) == 0) || (I + 15 <= nLength && memcmp(&pszChars[I], _T("#comments-start"), 15 * sizeof(TCHAR)) == 0)) { DEFINE_BLOCK (I, COLORINDEX_COMMENT); -- 2.11.0