开发者

How do you add a new language setting to ScintillaNet?

开发者 https://www.devze.com 2023-01-27 02:05 出处:网络
I\'m writing a C# program that uses a text editor to edit a file format similar to compiled lua with ScintillaNet (rbf). I understand that you can add new languages to Scintilla by adding an Xml file,

I'm writing a C# program that uses a text editor to edit a file format similar to compiled lua with ScintillaNet (rbf). I understand that you can add new languages to Scintilla by adding an Xml file, and referencing this in the CustomDirectory property. I would like the language to have the same Lexer/Parser as lua, but without the keywords and code completion. Could someone post up the Xml code like this that I can use as an example?

It currently looks like this:

<?xml version="1.0" encoding="utf-8"?>
<ScintillaNET>
  <Language Name="rbf">
    <Indentation TabWidth="4" SmartIndentType="cpp" />
    <Lexer LineCommentPrefix="--" StreamCommentPrefix="[[" StreamCommentSuffix="]]" >
    </Lexer>
    <Styles>
开发者_JAVA技巧      <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 >

I would also be helpful if someone could tell me how to set the default colours for the different styles (strings, comments, numbers etc.)


I've worked it out, you add this line to inherit the lexer from an already supported language:

<Lexer LexerName="lua"/>

Now all I need to know is how to disable comments.

0

精彩评论

暂无评论...
验证码 换一张
取 消