Nano syntax files

Vincent François vincentfrancois.pro@gmail.com
Sun Jan 18 08:41:00 GMT 2009


2009/1/18 Yaakov (Cygwin/X) <yselkowitz@users.sourceforge.net>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Vincent François wrote:
>> In wanting to use the syntax of the text editor NANO, I noticed a
>> problem. In the Cygwin, regular expressions \< and \> are not
>> recognized. In reading the man page (7 regex) I learned that he had
>> used respectively for [[:<:]] for \< and [[:>:]] for \>.
>>
>> I wrote this message to provide a patch to update the syntax files (*.
>> nanorc) available in the directory /usr/share/nano
>>
>> To apply the patch, perform the command:
>> $ patch -p0 -i syntax.nanorc.patch
>>
>> To reverse patch, perform the command:
>> $ patch -p0 -Ri syntax.nanorc.patch
>
> Nice work!  For maximum benefit, could you do two things:
>
> 1) Make this a unified diff (with "diff -u")
> 2) Attach the patch rather than including it inline.
>
> I'll fix cygport.nanorc in cygport accordingly; I hope the nano
> maintainer will consider including this patch in a new release as well.
>
> Thanks!
>
>
> Yaakov
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (Cygwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEAREIAAYFAklypa4ACgkQpiWmPGlmQSODBQCgkN1wQNteVNUblpvU2WLGJgzM
> Ix4An3kLichVlHAiNrupH2QskJOc7ZYM
> =jWeR
> -----END PGP SIGNATURE-----
>
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
>
>

Hello Yakoov,

That I applied the new command (diff -u), the file syntax.nanorc.patch
is now join ;-)

Excuse me for my English, I am of French origin.

Bye
-------------- next part --------------
diff -u /usr/share/nano/asm.nanorc /home/Benjamin/nano/asm.nanorc
--- /usr/share/nano/asm.nanorc	2009-01-18 05:26:20.375000000 +0100
+++ /home/Benjamin/nano/asm.nanorc	2009-01-18 02:25:29.953125000 +0100
@@ -1,7 +1,7 @@
 ## Here is an example for assembler.
 ##
 syntax "asm" "\.(S|s|asm)$"
-color red "\<[A-Z_]{2,}\>"
+color red "[[:<:]][A-Z_]{2,}[[:>:]]"
 color brightgreen "\.(data|subsection|text)"
 color green "\.(align|file|globl|global|hidden|section|size|type|weak)"
 color brightyellow "\.(ascii|asciz|byte|double|float|hword|int|long|short|single|struct|word)"
diff -u /usr/share/nano/c.nanorc /home/Benjamin/nano/c.nanorc
--- /usr/share/nano/c.nanorc	2009-01-18 05:26:20.484375000 +0100
+++ /home/Benjamin/nano/c.nanorc	2009-01-18 02:25:29.968750000 +0100
@@ -1,13 +1,13 @@
 ## Here is an example for C/C++.
 ##
 syntax "c" "\.(c(c|pp|xx)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$"
-color brightred "\<[A-Z_][0-9A-Z_]+\>" 
-color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\>"
-color green "\<((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\>"
-color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\>"
-color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
-color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
-color magenta "\<(goto|continue|break|return)\>"
+color brightred "[[:<:]][A-Z_][0-9A-Z_]+[[:>:]]" 
+color green "[[:<:]](float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)[[:>:]]"
+color green "[[:<:]]((s?size)|((u_?)?int(8|16|32|64|ptr)))_t[[:>:]]"
+color green "[[:<:]](class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)[[:>:]]"
+color brightyellow "[[:<:]](for|if|while|do|else|case|default|switch)[[:>:]]"
+color brightyellow "[[:<:]](try|throw|catch|operator|new|delete)[[:>:]]"
+color magenta "[[:<:]](goto|continue|break|return)[[:>:]]"
 color brightcyan "^[[:space:]]*#[[:space:]]*(define|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
 color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
 ##
diff -u /usr/share/nano/java.nanorc /home/Benjamin/nano/java.nanorc
--- /usr/share/nano/java.nanorc	2009-01-18 05:26:20.765625000 +0100
+++ /home/Benjamin/nano/java.nanorc	2009-01-18 02:25:29.968750000 +0100
@@ -1,11 +1,11 @@
 ## Here is an example for Java.
 ##
 syntax "java" "\.java$"
-color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
-color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
-color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
+color green "[[:<:]](boolean|byte|char|double|float|int|long|new|short|this|transient|void)[[:>:]]"
+color red "[[:<:]](break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)[[:>:]]"
+color cyan "[[:<:]](abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)[[:>:]]"
 color red ""[^"]*""
-color yellow "\<(true|false|null)\>"
+color yellow "[[:<:]](true|false|null)[[:>:]]"
 color blue "//.*"
 color blue start="/\*" end="\*/"
 color brightblue start="/\*\*" end="\*/"
diff -u /usr/share/nano/nanorc.nanorc /home/Benjamin/nano/nanorc.nanorc
--- /usr/share/nano/nanorc.nanorc	2009-01-18 05:26:21.046875000 +0100
+++ /home/Benjamin/nano/nanorc.nanorc	2009-01-18 02:25:29.984375000 +0100
@@ -4,11 +4,11 @@
 ## Possible errors and parameters
 icolor brightwhite "^[[:space:]]*((un)?set|include|syntax|i?color).*$"
 ## Keywords
-icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace|wordbounds)\>"
-icolor green "^[[:space:]]*(set|unset|include|syntax)\>"
+icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)[[:>:]]" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace|wordbounds)[[:>:]]"
+icolor green "^[[:space:]]*(set|unset|include|syntax)[[:>:]]"
 ## Colors
-icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
-icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
+icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?[[:>:]]"
+icolor magenta "^[[:space:]]*i?color[[:>:]]" "[[:<:]](start|end)="
 ## Strings
 icolor white ""(\\.|[^"])*""
 ## Comments
diff -u /usr/share/nano/perl.nanorc /home/Benjamin/nano/perl.nanorc
--- /usr/share/nano/perl.nanorc	2009-01-18 05:26:21.250000000 +0100
+++ /home/Benjamin/nano/perl.nanorc	2009-01-18 02:25:30.000000000 +0100
@@ -1,8 +1,8 @@
 ## Here is an example for Perl.
 ##
 syntax "perl" "\.p[lm]$"
-color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
-color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
+color red "[[:<:]](accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))[[:>:]]" "[[:<:]](get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)[[:>:]]" "[[:<:]](keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)[[:>:]]" "[[:<:]](se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)[[:>:]]" "[[:<:]](un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)[[:>:]]"
+color magenta "[[:<:]](continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)[[:>:]]"
 icolor cyan start="[$@%]" end="( |[^0-9A-Z_]|-)"
 color yellow "".*"|qq\|.*\|"
 color white "[sm]/.*/"
diff -u /usr/share/nano/pov.nanorc /home/Benjamin/nano/pov.nanorc
--- /usr/share/nano/pov.nanorc	2009-01-18 05:26:21.343750000 +0100
+++ /home/Benjamin/nano/pov.nanorc	2009-01-18 02:25:30.031250000 +0100
@@ -2,14 +2,14 @@
 ##
 syntax "pov" "\.(pov|POV|povray|POVRAY)$"
 color brightcyan "^[[:space:]]*#[[:space:]]*(declare)"
-color brightyellow "\<(sphere|cylinder|translate|matrix|rotate|scale)\>"
-color brightyellow "\<(orthographic|location|up|right|direction|clipped_by)\>"
-color brightyellow "\<(fog_type|fog_offset|fog_alt|rgb|distance|transform)\>"
-color brightred "^\<(texture)\>"
-color brightred "\<(light_source|background)\>"
-color brightred "\<(fog|object|camera)\>"
+color brightyellow "[[:<:]](sphere|cylinder|translate|matrix|rotate|scale)[[:>:]]"
+color brightyellow "[[:<:]](orthographic|location|up|right|direction|clipped_by)[[:>:]]"
+color brightyellow "[[:<:]](fog_type|fog_offset|fog_alt|rgb|distance|transform)[[:>:]]"
+color brightred "^[[:<:]](texture)[[:>:]]"
+color brightred "[[:<:]](light_source|background)[[:>:]]"
+color brightred "[[:<:]](fog|object|camera)[[:>:]]"
 color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
-color brightmagenta "\<(union|group|subgroup)\>"
+color brightmagenta "[[:<:]](union|group|subgroup)[[:>:]]"
 ## Comment highlighting
 color brightblue "//.*"
 color brightblue start="/\*" end="\*/"
diff -u /usr/share/nano/python.nanorc /home/Benjamin/nano/python.nanorc
--- /usr/share/nano/python.nanorc	2009-01-18 05:26:21.437500000 +0100
+++ /home/Benjamin/nano/python.nanorc	2009-01-18 02:25:30.062500000 +0100
@@ -2,7 +2,7 @@
 ##
 syntax "python" "\.py$"
 icolor brightblue "def [0-9A-Z_]+"
-color brightcyan "\<(and|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|map|not|or|pass|print|raise|return|try|while)\>"
+color brightcyan "[[:<:]](and|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|map|not|or|pass|print|raise|return|try|while)[[:>:]]"
 color brightgreen "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
 color brightgreen "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
 color brightgreen start=""""[^"]" end=""""" start="'''[^']" end="'''"
diff -u /usr/share/nano/ruby.nanorc /home/Benjamin/nano/ruby.nanorc
--- /usr/share/nano/ruby.nanorc	2009-01-18 05:26:21.531250000 +0100
+++ /home/Benjamin/nano/ruby.nanorc	2009-01-18 02:25:30.078125000 +0100
@@ -2,13 +2,13 @@
 ##
 syntax "ruby" "\.rb$"
 ## Asciibetical list of reserved words
-color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
+color yellow "[[:<:]](BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)[[:>:]]"
 ## Constants
-color brightblue "(\$|@|@@)?\<[A-Z]+[0-9A-Z_a-z]*"
+color brightblue "(\$|@|@@)?[[:<:]][A-Z]+[0-9A-Z_a-z]*"
 ## Ruby "symbols"
-icolor magenta "([ 	]|^):[0-9A-Z_]+\>"
+icolor magenta "([ 	]|^):[0-9A-Z_]+[[:>:]]"
 ## Some unique things we want to stand out
-color brightyellow "\<(__FILE__|__LINE__)\>"
+color brightyellow "[[:<:]](__FILE__|__LINE__)[[:>:]]"
 ## Regular expressions
 color brightmagenta "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
 ## Shell command expansion is in `backticks` or like %x{this}.  These are
diff -u /usr/share/nano/sh.nanorc /home/Benjamin/nano/sh.nanorc
--- /usr/share/nano/sh.nanorc	2009-01-18 05:26:21.625000000 +0100
+++ /home/Benjamin/nano/sh.nanorc	2009-01-18 02:25:30.093750000 +0100
@@ -2,11 +2,11 @@
 ##
 syntax "sh" "\.sh$"
 icolor brightgreen "^[0-9A-Z_]+\(\)"
-color green "\<(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\>"
+color green "[[:<:]](case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)[[:>:]]"
 color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
-color green "-[Ldefgruwx]\>"
-color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
-color brightblue "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|make|mkdir|mv|rm|sed|set|tar|touch|umask|unset)\>"
+color green "-[Ldefgruwx][[:>:]]"
+color green "-(eq|ne|gt|lt|ge|le|s|n|z)[[:>:]]"
+color brightblue "[[:<:]](cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|make|mkdir|mv|rm|sed|set|tar|touch|umask|unset)[[:>:]]"
 icolor brightred "\$\{?[0-9A-Z_!@#$*?-]+\}?"
 color cyan "(^|[[:space:]])#.*$"
 color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
Only in /home/Benjamin/nano/: syntax.nanorc.patch
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list