help-source-highlight
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-source-highlight] C-sharp style of surce-highlight


From: Lorenzo Bettini
Subject: Re: [Help-source-highlight] C-sharp style of surce-highlight
Date: Fri, 21 Apr 2006 18:57:51 +0200
User-agent: Mail/News 1.5 (X11/20060228)

I modified the file you sent me as follows:

--------------------------------

preproc = "using"

include "cpp.lang"

subst keyword = "abstract|event|new|struct ",
 "as|explicit|null|switch",
 "base|extern|this",
 "false|operator|throw",
 "break|finally|out|true",
 "fixed|override|try",
 "case|params|typeof",
 "catch|for|private",
 "foreach|protected",
 "checked|goto|public|unchecked",
 "class|if|readonly|unsafe",
 "const|implicit|ref",
 "continue|in|return",
 "virtual",
 "default|interface|sealed|volatile",
 "delegate|internal",
 "do|is|sizeof|while",
 "lock|stackalloc",
 "else|static",
 "enum|namespace",
 "get|partial|set",
 "value|where|yield"

subst type = "bool|byte|sbyte|char|decimal|double",
 "float|int|uint|long|ulong|object",
 "short|ushort|string"

--------------------------------

this way we reuse the cpp.lang and only substitute (or add as in the case of using) the parts that are different. Notice that I also removed the types from the keywords (otherwise they will never be formatted as types).

I also updated the c_comment.lang (see the attached file).

I also attach an Hello World (I found online).

what do you think?

--
+-----------------------------------------------------+
|  Lorenzo Bettini          ICQ# lbetto, 16080134     |
|  PhD in Computer Science                            |
|  Dip. Sistemi e Informatica, Univ. di Firenze       |
|  Florence - Italy        (GNU/Linux User # 158233)  |
|  Home Page        : http://www.lorenzobettini.it    |
|  http://music.dsi.unifi.it         XKlaim language  |
|  http://www.purplesucker.com Deep Purple Cover Band |
|  http://www.gnu.org/software/src-highlite           |
|  http://www.gnu.org/software/gengetopt              |
|  http://www.lorenzobettini.it/software/gengen       |
|  http://www.lorenzobettini.it/software/doublecpp    |
+-----------------------------------------------------+
# c_comment.lang

vardef TODO = '(TODO|FIXME)([:]?)'

# comments with documentation tags
environment comment start "///" begin
  include "url.lang"
  include "html.lang"
  type = '@[[:alpha:]]+'
  todo = $TODO
end

comment start "//"

# comments with documentation tags
environment comment delim "/**" "*/" multiline nested begin
  include "url.lang"
  include "html.lang"
  type = '@[[:alpha:]]+'
  todo = $TODO
end

# standard comments
environment comment delim "/*" "*/" multiline nested begin
  include "url.lang"
  todo = $TODO
end
// classic HelloWorld in C#
using System;

/// <summary> 
/// classic HelloWorld in C#
/// </summary> 
class HelloWorld
{
	/// <summary> The main method </summary> 
	static void Main() 
	{
		Console.WriteLine("Hello, World!");
	}
}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]