Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top