Custom Syntax problems

Topics: Developer Forum
Apr 18, 2013 at 10:25 PM
This seems to be a very common problem and I've looked through many discussion posts and haven't found anything that's helped me.

I have the following Xml language file:

<ScintillaNET>
<Language Name="mylanguage">
<Lexer LexerName="sql" LineCommentPrefix="--" StreamCommentPrefix="--" StreamCommentSuffix="--">
<Properties>
<Property Name="fold.comment" Value="1" />
</Properties>
<!--Keyword list 0 mylanguage SQL Keywords (Style WORD) --> <Keywords List="0">
:= :> :< :!= : :! [as] [and] [or] on [parameter]$ use #extendedfields outerjoin innerjoin select from union where
</Keywords>
</Lexer>
<Styles>
<Style Name="DOCUMENT_DEFAULT" />
<!--Keyword list 0 mylanguage Keywords --> <Style Name="WORD" ForeColor="blue" bold="true" />
<!--Keyword list 1 mylanguage Types --> <Style Name="COMMENTLINE" ForeColor="green" bold="true" italic="true" />
<Style Name="COMMENTDOC" ForeColor="green" bold="true" italic="true" />
<Style Name="COMMENT" ForeColor="green" bold="true" italic="true" />
</Styles>
</Language>
</ScintillaNET>

With the following code
this.XPathText.Lexing.LexerLanguageMap["mylanguage"] = "sql";
            this.XPathText.ConfigurationManager.CustomLocation = System.IO.Path.GetFullPath("Configuration/mylanguage.xml");
            this.XPathText.ConfigurationManager.Language = "myLanguage";
            this.XPathText.ConfigurationManager.Configure();
The problem is that /* is keying a comment area where I don't what this behavior. The only comment key should be --

How can I prevent the default "/*" stream prefix and suffix and just use the --

Thanks in advance,

Frank
Developer
Apr 30, 2013 at 1:41 PM
This is caused by the fact that the /* stream comment is handled at the lexer level, the CommentPrefix attributes in the xml are there to enable support for commenting out lines or blocks via hotkeys. The only way to not have / */ as a stream comment would be to either use a different lexer, or else create your own.