Skip to content

Commit

Permalink
Merge branch 'master' into syscolor-hook
Browse files Browse the repository at this point in the history
  • Loading branch information
sdottaka committed Sep 8, 2024
2 parents e6e3e2d + 90e7844 commit e83cc07
Show file tree
Hide file tree
Showing 40 changed files with 1,287 additions and 2,031 deletions.
2 changes: 2 additions & 0 deletions Externals/crystaledit/editlib/dialogs/ceditreplacedlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ void CEditReplaceDlg::OnChangeEditText ()
{
UpdateData();
UpdateControls();
m_bFound = false;
}
void CEditReplaceDlg::OnChangeSelected ()
{
Expand All @@ -146,6 +147,7 @@ void CEditReplaceDlg::OnChangeSelected ()
m_ctlFindText.SetWindowText(m_sText);
}
UpdateControls();
m_bFound = false;
}

void CEditReplaceDlg::
Expand Down
38 changes: 15 additions & 23 deletions Externals/crystaledit/editlib/parsers/abap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,19 @@ static bool IsNumber(const tchar_t* pszChars, int nLength)
return result;
}

static inline void
DefineIdentiferBlock(const tchar_t *pszChars, int nLength, CrystalLineParser::TEXTBLOCK * pBuf, int &nActualItems, int nIdentBegin, int I)
{
if (IsAbapKeyword(pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK(nIdentBegin, COLORINDEX_KEYWORD);
}
else if (IsNumber(pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK(nIdentBegin, COLORINDEX_NUMBER);
}
}

unsigned
CrystalLineParser::ParseLineAbap(unsigned dwCookie, const tchar_t* pszChars, int nLength, TEXTBLOCK* pBuf, int& nActualItems)
{
Expand Down Expand Up @@ -1210,14 +1223,7 @@ CrystalLineParser::ParseLineAbap(unsigned dwCookie, const tchar_t* pszChars, int
{
if (nIdentBegin >= 0)
{
if (IsAbapKeyword(pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK(nIdentBegin, COLORINDEX_KEYWORD);
}
else if (IsNumber(pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK(nIdentBegin, COLORINDEX_NUMBER);
}
DefineIdentiferBlock(pszChars, nLength, pBuf, nActualItems, nIdentBegin, I);

bRedefineBlock = true;
bDecIndex = true;
Expand All @@ -1227,23 +1233,9 @@ CrystalLineParser::ParseLineAbap(unsigned dwCookie, const tchar_t* pszChars, int
}

if (nIdentBegin >= 0)
{
if (IsAbapKeyword(pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK(nIdentBegin, COLORINDEX_KEYWORD);
}
else if (IsNumber(pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK(nIdentBegin, COLORINDEX_NUMBER);
}
}
DefineIdentiferBlock(pszChars, nLength, pBuf, nActualItems, nIdentBegin, I);

if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
}





73 changes: 29 additions & 44 deletions Externals/crystaledit/editlib/parsers/batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,33 @@ IsUser2Keyword (const tchar_t *pszChars, int nLength)
return ISXKEYWORDI (s_apszUser2KeywordList, pszChars, nLength);
}

static inline void
DefineIdentiferBlock(const tchar_t *pszChars, int nLength, CrystalLineParser::TEXTBLOCK * pBuf, int &nActualItems, int nIdentBegin, int I, unsigned &dwCookie)
{
if (IsBatKeyword (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_KEYWORD);
if ((I - nIdentBegin ==4 && !tc::tcsnicmp (pszChars + nIdentBegin, _T ("GOTO"), 4)) ||
(I - nIdentBegin ==5 && !tc::tcsnicmp (pszChars + nIdentBegin, _T ("GOSUB"), 5))
)
{
dwCookie=COOKIE_PREPROCESSOR;
}
}
else if (IsUser1Keyword (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_USER1);
}
else if (IsUser2Keyword (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_USER2);
}
else if (CrystalLineParser::IsXNumber (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_NUMBER);
}
}

unsigned
CrystalLineParser::ParseLineBatch (unsigned dwCookie, const tchar_t *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
Expand Down Expand Up @@ -846,28 +873,7 @@ CrystalLineParser::ParseLineBatch (unsigned dwCookie, const tchar_t *pszChars, i
}
else
{
if (IsBatKeyword (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_KEYWORD);
if ((I - nIdentBegin ==4 && !tc::tcsnicmp (pszChars + nIdentBegin, _T ("GOTO"), 4)) ||
(I - nIdentBegin ==5 && !tc::tcsnicmp (pszChars + nIdentBegin, _T ("GOSUB"), 5))
)
{
dwCookie=COOKIE_PREPROCESSOR;
}
}
else if (IsUser1Keyword (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_USER1);
}
else if (IsUser2Keyword (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_USER2);
}
else if (IsXNumber (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_NUMBER);
}
DefineIdentiferBlock(pszChars, nLength, pBuf, nActualItems, nIdentBegin, I, dwCookie);
}
bRedefineBlock = true;
bDecIndex = true;
Expand All @@ -878,28 +884,7 @@ CrystalLineParser::ParseLineBatch (unsigned dwCookie, const tchar_t *pszChars, i

if (nIdentBegin >= 0)
{
if (IsBatKeyword (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_KEYWORD);
if ((I - nIdentBegin ==4 && !tc::tcsnicmp (pszChars + nIdentBegin, _T ("GOTO"), 4)) ||
(I - nIdentBegin ==5 && !tc::tcsnicmp (pszChars + nIdentBegin, _T ("GOSUB"), 5))
)
{
dwCookie=COOKIE_PREPROCESSOR;
}
}
else if (IsUser1Keyword (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_USER1);
}
else if (IsUser2Keyword (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_USER2);
}
else if (IsXNumber (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_NUMBER);
}
DefineIdentiferBlock(pszChars, nLength, pBuf, nActualItems, nIdentBegin, I, dwCookie);
}

dwCookie = 0;
Expand Down
104 changes: 40 additions & 64 deletions Externals/crystaledit/editlib/parsers/cplusplus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,44 @@ IsUser1Keyword (const tchar_t *pszChars, int nLength)
return ISXKEYWORD (s_apszUser1KeywordList, pszChars, nLength);
}

static inline void
DefineIdentiferBlock(const tchar_t *pszChars, int nLength, CrystalLineParser::TEXTBLOCK * pBuf, int &nActualItems, int nIdentBegin, int I,
bool (*IsKeyword)(const tchar_t *pszChars, int nLength),
bool (*IsUser1Keyword)(const tchar_t *pszChars, int nLength))
{
if (IsKeyword (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_KEYWORD);
}
else if (IsUser1Keyword && IsUser1Keyword (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_USER1);
}
else if (CrystalLineParser::IsXNumber (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_NUMBER);
}
else
{
bool bFunction = false;

for (int j = I; j < nLength; j++)
{
if (!xisspace (pszChars[j]))
{
if (pszChars[j] == '(')
{
bFunction = true;
}
break;
}
}
if (bFunction)
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_FUNCNAME);
}
}
}
unsigned
CrystalLineParser::ParseLineC (unsigned dwCookie, const tchar_t *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
Expand Down Expand Up @@ -441,38 +479,7 @@ CrystalLineParser::ParseLineCJava (unsigned dwCookie, const tchar_t *pszChars, i
{
if (nIdentBegin >= 0)
{
if (IsKeyword (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_KEYWORD);
}
else if (IsUser1Keyword && IsUser1Keyword (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_USER1);
}
else if (IsXNumber (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_NUMBER);
}
else
{
bool bFunction = false;

for (int j = I; j < nLength; j++)
{
if (!xisspace (pszChars[j]))
{
if (pszChars[j] == '(')
{
bFunction = true;
}
break;
}
}
if (bFunction)
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_FUNCNAME);
}
}
DefineIdentiferBlock(pszChars, nLength, pBuf, nActualItems, nIdentBegin, I, IsKeyword, IsUser1Keyword);
bRedefineBlock = true;
bDecIndex = true;
nIdentBegin = -1;
Expand All @@ -482,38 +489,7 @@ CrystalLineParser::ParseLineCJava (unsigned dwCookie, const tchar_t *pszChars, i

if (nIdentBegin >= 0)
{
if (IsKeyword (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_KEYWORD);
}
else if (IsUser1Keyword && IsUser1Keyword (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_USER1);
}
else if (IsXNumber (pszChars + nIdentBegin, I - nIdentBegin))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_NUMBER);
}
else
{
bool bFunction = false;

for (int j = I; j < nLength; j++)
{
if (!xisspace (pszChars[j]))
{
if (pszChars[j] == '(')
{
bFunction = true;
}
break;
}
}
if (bFunction)
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_FUNCNAME);
}
}
DefineIdentiferBlock(pszChars, nLength, pBuf, nActualItems, nIdentBegin, I, IsKeyword, IsUser1Keyword);
}

if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
Expand Down
Loading

0 comments on commit e83cc07

Please sign in to comment.