3

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>
      <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.)

Philipp M
  • 1,877
  • 7
  • 27
  • 38
Migwell
  • 18,631
  • 21
  • 91
  • 160

1 Answers1

2

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.

Migwell
  • 18,631
  • 21
  • 91
  • 160