首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Scintilla添加关键字

使用Scintilla添加关键字
EN

Stack Overflow用户
提问于 2010-12-04 12:05:07
回答 1查看 3.8K关注 0票数 4

我正在使用ScintillaNET作为Scintilla控件的包装器。我想更改特定语言的关键字(用于语法突出显示),我假设我必须为此构建自己的SciLexer.dll版本。但我在Scintilla项目中找不到这些语言的关键字文件。它们在哪里?我如何更改它们?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-12-04 13:21:47

您不需要构建自己的SciLexer.dll,ScintillaNET支持XML配置文件。如下所示设置闪光灯的属性:

代码语言:javascript
复制
// Relative to your running directory
scintilla1.ConfigurationManager.CustomLocation = "Config.xml"; 
//Name of the language as defined in the file
scintilla1.ConfigurationManager.Language = "MyLanguage";

然后创建一个配置文件,如下所示,它基于lua:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<ScintillaNET>
  <!--This is what you set the Language property to-->
  <Language Name="lua">

    <!--These are characters after which autocomplete will open-->
    <AutoComplete FillUpCharacters=".([" SingleLineAccept="True" IsCaseSensitive="False">
      <List>
          <!--Insert autocomplete keywords here-->
          and break do else elseif end false for function
          if in local nil not or repeat return then true until while
      </List>
    </AutoComplete>

     <!--Indentation width and indentation type-->
    <Indentation TabWidth="4" SmartIndentType="cpp" />

     <!--Comment characters and the lexer to use-->
    <Lexer LexerName="lua" LineCommentPrefix="--" StreamCommentPrefix="--[[ " StreamCommentSuffix=" ]]" >
      <Keywords List="0" Inherit="False">
        <!--Insert highlighted keywords here-->
         and break do else elseif end false for function
         if in local nil not or repeat return then true until while
      </Keywords>
    </Lexer>
  </Language>
</ScintillaNET>
票数 9
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4351871

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档