Setup language definition based on the keywords file.

Although, seems like those files are not in the base game?
This commit is contained in:
Artyom Shalkhakov 2025-02-15 09:10:27 -07:00
parent e8d48cc6e0
commit a1a9f61330
2 changed files with 25 additions and 23 deletions

View file

@ -321,6 +321,31 @@ void SyntaxRichEditCtrl::SetKeyWords( const keyWord_t kws[] ) {
}
keyWordHash.Add( hash, i );
}
TextEditor::LanguageDefinition langDef;
for ( i = 0; i < numKeyWords; i++ ) {
if ( keyWords[i].description != '\0' ) {
TextEditor::Identifier id;
id.mDeclaration = keyWords[i].description;
langDef.mIdentifiers.insert( std::make_pair( std::string( keyWords[i].keyWord ), id ) );
} else {
langDef.mKeywords.insert( std::string( keyWords[i].keyWord ) );
}
}
langDef.mTokenize = TextEditor::LanguageDefinition::C().mTokenize;
langDef.mCommentStart = "/*";
langDef.mCommentEnd = "*/";
langDef.mSingleLineComment = "//";
langDef.mCaseSensitive = caseSensitive;
langDef.mAutoIndentation = true;
langDef.mName = "doomscript"; // TODO: change?
scriptEdit->SetLanguageDefinition( langDef );
}
/*
@ -588,28 +613,6 @@ void SyntaxRichEditCtrl::SetColor( int startCharIndex, int endCharIndex, const i
updateSyntaxHighlighting = true;*/
}
/*
================
SyntaxRichEditCtrl::GetForeColor
================
*/
idVec3 SyntaxRichEditCtrl::GetForeColor( int charIndex ) const {
/*tom::ITextRange* range;
tom::ITextFont *font;
long foreColor;
m_TextDoc->Range( charIndex, charIndex, &range );
range->get_Font( &font );
font->get_BackColor( &foreColor );
font->Release();
range->Release();
return foreColor;*/
return vec3_origin;
}
/*
================
SyntaxRichEditCtrl::GetBackColor

View file

@ -112,7 +112,6 @@ public:
void SetStringColor( const idVec3 &color, const idVec3 &altColor = vec3_origin );
void SetLiteralColor( const idVec3 &color );
idVec3 GetForeColor( int charIndex ) const;
idVec3 GetBackColor( int charIndex ) const;
void GetCursorPos( int &line, int &column, int &character ) const;