[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
nano syntax highlighting for Octave?
From: |
Mike Miller |
Subject: |
nano syntax highlighting for Octave? |
Date: |
Wed, 10 Mar 2010 13:47:31 -0600 (CST) |
User-agent: |
Alpine 2.00 (DEB 1167 2008-08-23) |
I'm really more of an Emacs guy, but for students I recommend Nano to get
them started. I've been working on getting the syntax highlighting to
work for various kinds of scripts. I found something for R and modified
it to produce what you see below (don't blame Haptonstahl if anything is
broken in that code because it might be my fault). I think it works
fairly well but there is definitely room for improvement.
Of course I'd like some nano syntax highlighting code for Octave and/or
MATLAB if anybody out here has worked on that. Thanks in advance.
Mike
The following was originally taken from here...
http://srh.ucdavis.edu/drupal/node/20
...but then modified by me (Mike Miller). I haven't asked Haptonstahl yet
if I can distribute it, but he seems to want that, so I'm not worried (I
cc'd him on this message).
###############################
# Syntax highlighting for R #
# by Stephen Haptonstahl #
# March 15, 2009 #
###############################
syntax "R" "\.R$"
# reserved words
color brightyellow
"\b(if|else|repeat|while|function|for|in|next|break|TRUE|T|FALSE|F|NULL|Inf|NaN|NA|NA_integer_|NA_real_|NA_complex_|NA_character_|\.\.\.)\b"
color brightyellow "\.\.[0-9]"
color brightred "\b(require|library)\b"
# logicals
color brightgreen "(==|<=|>=|!=|!|<|>|\||\|\||&|&&|%in%|%%|%\*%|%/%|%o%|%x%)"
# strings
color cyan "'[^']*'"
color cyan ""[^"]*""
# variable definitions
color blue "^.*?<-"
color yellow start="address@hidden" end="[[:alnum:]]*"
# function definitions
color brightwhite "\<([A-Za-z0-9\.]+)\>\("
# parameters -- not working yet
# icolor brightblue "[^,\(=]*=(?:[^=])"
# danger!
color black,red "(stop|warning|return)"
color red " = "
color yellow "[(){}[;|<>]"
color yellow "\]"
color brightred "<-"
## Comment highlighting
color brightblack "#.*$"
- nano syntax highlighting for Octave?,
Mike Miller <=