Skip to content

Commit

Permalink
・cnt\2やmes@hspなどの色分けができていなかった件の修正
Browse files Browse the repository at this point in the history
・ラベル・関数一覧修正
  • Loading branch information
inovia committed Mar 24, 2024
1 parent b41d3f8 commit 1239496
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ UpgradeLog.htm
/sakura_core/hsp/res/hsptmp
/sakura/err1.hsp
/sakura/test.js
/sakura/*.hsp
16 changes: 10 additions & 6 deletions sakura_core/parse/CWordParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ ECharKind CWordParse::WhatKindOfCharForHSP(
{
return CK_CSYM;
}
else if (c == L'\\' || c == L'@') // cnt\2 などの \ の識別用
{
return CK_ETC;
}
}
return WhatKindOfChar(pData, pDataLen, nIdx);
}
Expand Down Expand Up @@ -398,14 +402,14 @@ bool CWordParse::SearchNextWordPosition(
// 空白とタブは無視する

// 現在位置の文字の種類を調べる
ECharKind nCharKind = WhatKindOfChar( pLine, nLineLen, nIdx );
ECharKind nCharKind = WhatKindOfCharForHSP( pLine, nLineLen, nIdx );

CLogicInt nIdxNext = nIdx;
// 2005-09-02 D.S.Koba GetSizeOfChar
CLogicInt nCharChars = CNativeW::GetSizeOfChar( pLine, nLineLen, nIdxNext );
while( nCharChars > 0 ){
nIdxNext += nCharChars;
ECharKind nCharKindNext = WhatKindOfChar( pLine, nLineLen, nIdxNext );
ECharKind nCharKindNext = WhatKindOfCharForHSP( pLine, nLineLen, nIdxNext );
// 空白とタブは無視する
if( nCharKindNext == CK_TAB || nCharKindNext == CK_SPACE ){
if ( bStopsBothEnds && nCharKind != nCharKindNext ){
Expand Down Expand Up @@ -444,14 +448,14 @@ bool CWordParse::SearchNextWordPosition4KW(
// 空白とタブは無視する

// 現在位置の文字の種類を調べる
ECharKind nCharKind = WhatKindOfChar( pLine, nLineLen, nIdx );
ECharKind nCharKind = WhatKindOfCharForHSP( pLine, nLineLen, nIdx );

CLogicInt nIdxNext = nIdx;
// 2005-09-02 D.S.Koba GetSizeOfChar
CLogicInt nCharChars = CNativeW::GetSizeOfChar( pLine, nLineLen, nIdxNext );
while( nCharChars > 0 ){
nIdxNext += nCharChars;
ECharKind nCharKindNext = WhatKindOfChar( pLine, nLineLen, nIdxNext );
ECharKind nCharKindNext = WhatKindOfCharForHSP( pLine, nLineLen, nIdxNext );
// 空白とタブは無視する
if( nCharKindNext == CK_TAB || nCharKindNext == CK_SPACE ){
if ( bStopsBothEnds && nCharKind != nCharKindNext ){
Expand All @@ -478,7 +482,7 @@ bool CWordParse::SearchPrevWordPosition(const wchar_t* pLine,
CLogicInt nLineLen, CLogicInt nIdx, CLogicInt* pnColumnNew, BOOL bStopsBothEnds)
{
/* 現在位置の文字の種類を調べる */
ECharKind nCharKind = CWordParse::WhatKindOfChar( pLine, nLineLen, nIdx );
ECharKind nCharKind = CWordParse::WhatKindOfCharForHSP( pLine, nLineLen, nIdx );
if( nIdx == 0 ){
return false;
}
Expand All @@ -491,7 +495,7 @@ bool CWordParse::SearchPrevWordPosition(const wchar_t* pLine,
while( nCharChars > 0 ){
CLogicInt nIdxNextPrev = nIdxNext;
nIdxNext -= nCharChars;
ECharKind nCharKindNext = CWordParse::WhatKindOfChar( pLine, nLineLen, nIdxNext );
ECharKind nCharKindNext = CWordParse::WhatKindOfCharForHSP( pLine, nLineLen, nIdxNext );

ECharKind nCharKindMerge = CWordParse::WhatKindOfTwoChars( nCharKindNext, nCharKind );
if( nCharKindMerge == CK_NULL ){
Expand Down
39 changes: 34 additions & 5 deletions sakura_core/types/CType_Hsp3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void CType_Hsp3::InitTypeConfigImp(STypeConfig* pType)
// pType->m_ColorInfoArr[COLORIDX_DIGIT].m_bDisp = true; //半角数値を色分け表示 //Mar. 10, 2001 JEPRO
// pType->m_ColorInfoArr[COLORIDX_BRACKET_PAIR].m_bDisp = true; //対括弧の強調をデフォルトONに //Sep. 21, 2002 genta

pType->m_bStringLineOnly = false; // 文字列の改行を許す
pType->m_bStringLineOnly = false; // 文字列の改行を許さない
pType->m_bUseHokanByKeyword = true;
pType->m_bHokanLoHiCase = true;

Expand All @@ -265,9 +265,6 @@ void CType_Hsp3::InitTypeConfigImp(STypeConfig* pType)
/* HSP3スマートインデント処理 */
void CEditView::SmartIndent_HSP3(wchar_t wcChar)
{
// TODO: HSPのラベル* 未対応


const wchar_t* pLine;
CLogicInt nLineLen;
int k;
Expand Down Expand Up @@ -693,7 +690,23 @@ void CDocOutline::MakeFuncList_HSP3(CFuncInfoArr* pcFuncInfoArr)
// シングルクォーテーション文字列を読み取り中
if ( FL_HSP3_MODE_SINGLE_QUOTE == nMode)
{
if (L'\'' == pLine[i])
if (i < nLineLen - 1
&& L'\\' == pLine[i]
&& L'\\' == pLine[i + 1])
{
// 継続判定:[\\]
++i;
continue;
}
else if (i < nLineLen - 1
&& L'\\' == pLine[i]
&& L'\'' == pLine[i + 1])
{
// 継続判定:\'
++i;
continue;
}
else if (L'\'' == pLine[i])
{
nMode = FL_HSP3_MODE_NORMAL;
continue;
Expand All @@ -704,6 +717,14 @@ void CDocOutline::MakeFuncList_HSP3(CFuncInfoArr* pcFuncInfoArr)
if (FL_HSP3_MODE_DOUBLE_QUOTE == nMode)
{
if (i < nLineLen - 1
&& L'\\' == pLine[i]
&& L'\\' == pLine[i + 1])
{
// 継続判定:[\\]
++i;
continue;
}
else if (i < nLineLen - 1
&& L'\\' == pLine[i]
&& L'"' == pLine[i+1])
{
Expand All @@ -722,6 +743,14 @@ void CDocOutline::MakeFuncList_HSP3(CFuncInfoArr* pcFuncInfoArr)
if (FL_HSP3_MODE_DOUBLE_QUOTE_MULTILINE == nMode)
{
if (i < nLineLen - 1
&& L'\\' == pLine[i]
&& L'\\' == pLine[i + 1])
{
// 継続判定:[\\]
++i;
continue;
}
else if (i < nLineLen - 1
&& L'\\' == pLine[i]
&& L'"' == pLine[i + 1])
{
Expand Down
4 changes: 2 additions & 2 deletions sakura_core/view/CEditView_CmdHokan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ int CEditView::HokanSearchByFile(
if( !bKeyStartWithMark && wcschr( L"$@#\\", pszLine[j] ) != NULL )continue;

// 文字種類取得
ECharKind kindPre = CWordParse::WhatKindOfChar( pszLine, nLineLen, j ); // 文字種類取得
ECharKind kindPre = CWordParse::WhatKindOfCharForHSP( pszLine, nLineLen, j ); // 文字種類取得

// 全角記号は候補に含めない
if ( kindPre == CK_ZEN_SPACE || kindPre == CK_ZEN_NOBASU || kindPre == CK_ZEN_DAKU ||
Expand All @@ -232,7 +232,7 @@ int CEditView::HokanSearchByFile(
if ( pszLine[j] < 0x00C0 && !IS_KEYWORD_CHAR( pszLine[j] ) )break;

// 文字種類取得
ECharKind kindCur = CWordParse::WhatKindOfChar( pszLine, nLineLen, j );
ECharKind kindCur = CWordParse::WhatKindOfCharForHSP( pszLine, nLineLen, j );
// 全角記号は候補に含めない
if ( kindCur == CK_ZEN_SPACE || kindCur == CK_ZEN_KIGO || kindCur == CK_ZEN_SKIGO ){
break;
Expand Down
4 changes: 2 additions & 2 deletions sakura_core/view/colors/CColor_KeywordSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ bool CColor_KeywordSet::BeginColor(const CStringRef& cStr, int nPos)
現在位置からキーワードを抜き出し、そのキーワードが登録単語ならば、色を変える
*/

const ECharKind charKind = CWordParse::WhatKindOfChar( cStr.GetPtr(), cStr.GetLength() , nPos );
const ECharKind charKind = CWordParse::WhatKindOfCharForHSP( cStr.GetPtr(), cStr.GetLength() , nPos );
if( charKind <= CK_SPACE ){
return false; // この文字はキーワード対象文字ではない。
}
if( 0 < nPos ){
const ECharKind charKindPrev = CWordParse::WhatKindOfChar( cStr.GetPtr(), cStr.GetLength() , nPos-1 );
const ECharKind charKindPrev = CWordParse::WhatKindOfCharForHSP( cStr.GetPtr(), cStr.GetLength() , nPos-1 );
const ECharKind charKindTwo = CWordParse::WhatKindOfTwoChars4KW( charKindPrev, charKind );
if( charKindTwo != CK_NULL ){
return false;
Expand Down

0 comments on commit 1239496

Please sign in to comment.