如何在ScintillaNet中添加新的语言设置?

3
我正在编写一个C#程序,使用文本编辑器来编辑类似于编译后的lua格式的文件,并使用ScintillaNet(rbf)。我了解到可以通过添加Xml文件并在CustomDirectory属性中引用它来向Scintilla添加新语言。我希望该语言具有与lua相同的Lexer/Parser,但没有关键字和代码完成。能否有人发布像这样的Xml代码,以便我可以用作示例?目前它看起来是这样的:
<?xml version="1.0" encoding="utf-8"?>
<ScintillaNET>
  <Language Name="rbf">
    <Indentation TabWidth="4" SmartIndentType="cpp" />
    <Lexer LineCommentPrefix="--" StreamCommentPrefix="[[" StreamCommentSuffix="]]" >
    </Lexer>
    <Styles>
      <Style Name="DEFAULT" FontName="Courier New" Size="10"/>
      <Style Name="COMMENT" ForeColor="Green" Size="8"/>
      <Style Name="COMMENTLINE" ForeColor="Green" Size="8"/>
      <Style Name="NUMBER" ForeColor="Orange"/>
      <Style Name="WORD" ForeColor="Blue" Bold="Yes"/>
      <Style Name="WORD3" ForeColor="DarkBlue" Bold="Yes"/>
      <Style Name="WORD4" ForeColor="DarkBlue" Bold="Yes"/>
      <Style Name="WORD5" ForeColor="LightGreen" Bold="Yes"/>
    </Styles>
  </Language>
</ScintillaNET >

如果有人能告诉我如何设置不同样式(字符串、注释、数字等)的默认颜色,那将非常有帮助。

1个回答

2
我已经解决了,您需要添加以下代码来继承已支持语言的词法分析器:
<Lexer LexerName="lua"/>

现在我需要知道的是如何禁用评论。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接