Hi,

I've thrown together a small source-highlight language file for C--.
You can use it to e.g. highlight C-- code when piped through less.

### Installion ###

# This works on Debian/Ubuntu
$ sudo apt-get install source-highlight

# Put this file anywhere
$ cat $HOME/cmm.lang
comment start "//"

# multi-line comments
comment delim "/*" "*/" multiline

string delim "\"" "\"" escape "\\"

keyword = "aborts|align|aligned|also|as|big|bits|byteorder|case|const",
  "continuation|cut|cuts|else|equal|export|foreign|goto|if|import|in",
  "invariant|invisible|jump|little|memsize|pragma|reads|register",
  "return|returns|section|semi|span|stackdata|switch|target|targets|to",
  "typedef|unicode|unwinds|writes"

number =
'\<[+-]?((0x[[:xdigit:]]+)|(([[:digit:]]*\.)?
[[:digit:]]+([eE][+-]?[[:digit:]]+)?))u?((int(?:8|16|32|64))|L)?\>'

### Usage ###

$ ghc <source> -ddump-cmm | source-highlight --lang-def=$HOME/cmm.lang
-f esc -s cmm | less -R

Johan

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to