English 中文(简体)
Lisp syntax highlighting for ICSharpCode.TextEditor
原标题:

Is there a Common Lisp syntax highlighting .xshd file for use with ICSharpCode.TextEditor? I haven t been able to find one on google, and the format for writing syntax highlighting specification files is so wretchedly documented that I can t make a very good one myself. I can highlight basic keywords, but not much more.

It needs to have the following:

  • Highlight common lisp keywords, such as list, dolist, read-line. lambda, etc.
  • Syntax highlighting for the words after defun, defmacro, defvar, etc, such that in the text (defun a () ...), a is highlighted. It doesn t have to be complete because I can add more, just one or two is fine to show how it s done.
  • Highlight symbols like :a
  • Highlight quoted lists in both backquote and single quote form, and "unhighlight" escaped forms within quoted lists (escaped by ,, @,, etc)
  • Highlight the name of a function being called. For example, in the text (a b c), a needs to be highlighted
  • Optional: anything else that I missed that would be helpful (I m new to lisp so I don t know everything that can be highlighted)

Does anyone know where to get a Common Lisp syntax highlighting file for ICSharpCode.TextEditor that has these features?

问题回答

Here is a start for a Scheme highlighter. Not very fancy, but shows how recursion works with the rulesets.

<SyntaxDefinition name="Scheme" extensions=".sls;.sps;.ss;.scm" 
     xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
  <Color foreground="Green" name="Comment" />
  <Color foreground="Blue" name="Syntax" />
  <Color foreground="Blue" name="Library Syntax" />
  <Color foreground="Blue" name="Auxilliary Syntax" />
  <Color foreground="DarkMagenta" name="Procedure" />

  <RuleSet>
    <Import ruleSet="Expression"/>
  </RuleSet>

    <RuleSet name="Expression">
        <Span color="Comment" multiline="false">
            <Begin>;</Begin>
        </Span>
    <Span color="Comment" multiline="true" >
      <Begin>#|</Begin>
      <End>|#</End>
    </Span>
    <Span ruleSet="Expression" multiline="true" >
      <Begin fontWeight="bold">(</Begin>
      <End fontWeight="bold">)</End>
    </Span>
    <Span  ruleSet="Expression" multiline="true">
      <Begin fontWeight="bold">#(</Begin>
      <End fontWeight="bold">)</End>
    </Span>

    <Keywords color="Library Syntax">
      <Word>import</Word>
      <Word>export</Word>
      <Word>library</Word>
    </Keywords>

    <Keywords color="Syntax">
      <Word>define</Word>
      <Word>set!</Word>
      <Word>lambda</Word>
      <Word>begin</Word>
      <Word>if</Word>
      <Word>cond</Word>
      <Word>let</Word>
      <Word>letrec</Word>
    </Keywords>

    <Keywords color="Auxilliary Syntax">
      <Word>else</Word>
    </Keywords>

    <Keywords color="Procedure">
      <Word>map</Word>
      <Word>cons</Word>
      <Word>car</Word>
    </Keywords>

  </RuleSet>

</SyntaxDefinition>




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签