]> git.wh0rd.org Git - nano.git/commitdiff
New syntax highlighting from Mike F. Credits:
authorChris Allegretta <chrisa@asty.org>
Sat, 31 May 2008 21:55:21 +0000 (21:55 +0000)
committerChris Allegretta <chrisa@asty.org>
Sat, 31 May 2008 21:55:21 +0000 (21:55 +0000)
awk.nanorc by Donnie Berkholz <dberkholz@gentoo.org>
css.nanorc by Simon Rupf <simon.rupf@int-ag.ch>
xml.nanorc by Josef 'Jupp' Schugt <jupp@rubyforge.org>

Slight tweak by chrisa on the CSS file to make the brightwhite section end on line boundary due to matching too greedily on valid CSS
(see digg's css/111/global.css as an example)

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4254 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

doc/syntax/awk.nanorc [new file with mode: 0644]
doc/syntax/css.nanorc [new file with mode: 0644]
doc/syntax/xml.nanorc [new file with mode: 0644]

diff --git a/doc/syntax/awk.nanorc b/doc/syntax/awk.nanorc
new file mode 100644 (file)
index 0000000..696ab6a
--- /dev/null
@@ -0,0 +1,38 @@
+## Here is an example for awk.
+##
+syntax "awk" "\.awk$"
+## records
+icolor brightred "\$[0-9A-Z_!@#$*?-]+"
+## awk-set variables
+color red "\<(ARGC|ARGIND|ARGV|BINMODE|CONVFMT|ENVIRON|ERRNO|FIELDWIDTHS)\>"
+color red "\<(FILENAME|FNR|FS|IGNORECASE|LINT|NF|NR|OFMT|OFS|ORS)\>"
+color red "\<(PROCINFO|RS|RT|RSTART|RLENGTH|SUBSEP|TEXTDOMAIN)\>"
+## function declarations and special patterns
+color brightgreen "\<(function|extension|BEGIN|END)\>"
+## operators
+color green "(\{|\}|\(|\)|\;|\]|\[|\\|<|>|!|=|&|\+|-|\*|%|/|\?:|\^|\|)"
+## flow control
+color brightyellow "\<(for|if|while|do|else|in|delete|exit)\>"
+color brightyellow "\<(break|continue|return)\>"
+## I/O statements
+color brightgreen "\<(close|getline|next|nextfile|print|printf)\>"
+color brightgreen "\<(system|fflush)\>"
+## standard functions
+color magenta "\<(atan2|cos|exp|int|log|rand|sin|sqrt|srand)\>"
+color magenta "\<(asort|asorti|gensub|gsub|index|length|match)\>"
+color magenta "\<(split|sprintf|strtonum|sub|substr|tolower|toupper)\>"
+color magenta "\<(mktime|strftime|systime)\>"
+color magenta "\<(and|compl|lshift|or|rshift|xor)\>"
+color magenta "\<(bindtextdomain|dcgettext|dcngettext)\>"
+
+##
+## String highlighting.  You will in general want your comments and
+## strings to come last, because syntax highlighting rules will be
+## applied in the order they are read in.
+color brightyellow "<[^=       ]*>" ""(\\.|[^"])*""
+
+## Comment highlighting
+color brightblue "(^|[[:space:]])#.*$"
+
+## Trailing whitespace
+color ,green "[[:space:]]+$"
diff --git a/doc/syntax/css.nanorc b/doc/syntax/css.nanorc
new file mode 100644 (file)
index 0000000..98eea18
--- /dev/null
@@ -0,0 +1,9 @@
+## Here is an example for css files.
+##
+syntax "css" "\.css$"
+color brightred     "."
+color brightyellow  start="\{" end="\}"
+color brightwhite   start=":" end="([;^\{]|$)"
+color brightblue    ":active|:focus|:hover|:link|:visited|:link|:after|:before|$"
+color brightblue    start="\/\*" end="\\*/"
+color green         ";|:|\{|\}"
diff --git a/doc/syntax/xml.nanorc b/doc/syntax/xml.nanorc
new file mode 100644 (file)
index 0000000..1f68c05
--- /dev/null
@@ -0,0 +1,9 @@
+## Here is an example for xml files.
+##
+syntax "xml" "\.([jrs]html?|sgml?|xml|xslt?)$"
+color green  start="<" end=">"
+color cyan   "<[^> ]+"
+color cyan   ">"
+color yellow start="<!DOCTYPE" end="[/]?>"
+color yellow start="<!--" end="-->"
+color red    "&[^;]*;"