This project is read-only.

Syntax Highlighting; Custom Lexar?

Topics: User Forum
May 20, 2011 at 10:08 PM
Edited May 20, 2011 at 10:43 PM


   I've been trying to work this out such that I wouldn't bother anyone but I can't seem to get this to work. I would like to use just the syntax highlighting feature, by providing a list of keywords and defining a style. Do I need to create my own Lexer to do such a task?
   I've created a custom configuration but I noticed I needed to provide a LexerName to make it work. Then after choosing "cpp" I noticed I also got all of the defaults pertaining to cpp. I then created files under the LexerStyleNames; LexerKeywordListListNames; and modified the default.xml to support the styles defining in that I thought would be my own custom Lexer. The problem is that I know there's more behind the Lexer, so I gave up that route and attempted to create a stripped down version of cpp. I'm just a little overwhelmed.

Any assistance for just the simple task of highlighting a keyword would be most appreciative.


May 20, 2011 at 10:21 PM

If your only looking to highlight a keyword, set it as the only keyword for any of the lexers, then set the style correctly, and it should work.

May 20, 2011 at 10:40 PM
Edited May 20, 2011 at 10:40 PM


    Thanks for the reply. I've done the following but I noticed that: int, bool, they get highlighted but my keywords are ignored.
    You can see at the bottom where I'm trying to "drown out" the existing styles.


<?xml version="1.0" encoding="utf-8"?>
  <Language Name="sae">
    <AutoComplete FillUpCharacters=".([" SingleLineAccept="True" IsCaseSensitive="False">
        Value1 Value2 Value3

    <Indentation TabWidth="4" SmartIndentType="cpp" />

    <Lexer LineCommentPrefix="//" StreamCommentPrefix="/* " StreamCommentSuffix=" /*" LexerName="cpp" >
      <Keywords List="0" Inherit="False">
        Value1 Value2 Value3
      <Keywords List="1" Inherit="False">
        Value4 Value5 Value6
      <Keywords List="2" Inherit="False">
      <Keywords List="3" Inherit="False">

      <Style Name="DOCUMENT_DEFAULT"  />
      <Style Name="COMMENT" ForeColor="Black" />
      <Style Name="COMMENTLINE"    ForeColor="Black" />
      <Style Name="NUMBER"    ForeColor="Black" />
      <Style Name="WORD"    ForeColor="Black" />
      <Style Name="STRING"    ForeColor="Black" />
      <Style Name="CHARACTER"    ForeColor="Black" />
      <Style Name="UUID"    ForeColor="Black" />
      <Style Name="OPERATOR"    ForeColor="Black" />