This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Nano syntax files


Hello,

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

Below file syntax.nanorc.patch:

--- BOF --- syntax.nanorc.patch ---
diff -c /usr/share/nano/asm.nanorc /home/Benjamin/nano/asm.nanorc
*** /usr/share/nano/asm.nanorc	Sun Jan 18 02:26:06 2009
--- /home/Benjamin/nano/asm.nanorc	Sun Jan 18 02:25:29 2009
***************
*** 1,7 ****
  ## Here is an example for assembler.
  ##
  syntax "asm" "\.(S|s|asm)$"
! 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)"
--- 1,7 ----
  ## Here is an example for assembler.
  ##
  syntax "asm" "\.(S|s|asm)$"
! 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 -c /usr/share/nano/c.nanorc /home/Benjamin/nano/c.nanorc
*** /usr/share/nano/c.nanorc	Sun Jan 18 02:26:06 2009
--- /home/Benjamin/nano/c.nanorc	Sun Jan 18 02:25:29 2009
***************
*** 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 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}'"
  ##
--- 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 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 -c /usr/share/nano/java.nanorc /home/Benjamin/nano/java.nanorc
*** /usr/share/nano/java.nanorc	Sun Jan 18 02:26:07 2009
--- /home/Benjamin/nano/java.nanorc	Sun Jan 18 02:25:29 2009
***************
*** 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 red ""[^"]*""
! color yellow "\<(true|false|null)\>"
  color blue "//.*"
  color blue start="/\*" end="\*/"
  color brightblue start="/\*\*" end="\*/"
--- 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 red ""[^"]*""
! color yellow "[[:<:]](true|false|null)[[:>:]]"
  color blue "//.*"
  color blue start="/\*" end="\*/"
  color brightblue start="/\*\*" end="\*/"
diff -c /usr/share/nano/nanorc.nanorc /home/Benjamin/nano/nanorc.nanorc
*** /usr/share/nano/nanorc.nanorc	Sun Jan 18 02:26:07 2009
--- /home/Benjamin/nano/nanorc.nanorc	Sun Jan 18 02:25:29 2009
***************
*** 4,14 ****
  ## 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)\>"
  ## 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)="
  ## Strings
  icolor white ""(\\.|[^"])*""
  ## Comments
--- 4,14 ----
  ## 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)[[:>:]]"
  ## 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)="
  ## Strings
  icolor white ""(\\.|[^"])*""
  ## Comments
diff -c /usr/share/nano/perl.nanorc /home/Benjamin/nano/perl.nanorc
*** /usr/share/nano/perl.nanorc	Sun Jan 18 02:26:07 2009
--- /home/Benjamin/nano/perl.nanorc	Sun Jan 18 02:25:30 2009
***************
*** 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)\>"
  icolor cyan start="[$@%]" end="( |[^0-9A-Z_]|-)"
  color yellow "".*"|qq\|.*\|"
  color white "[sm]/.*/"
--- 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)[[:>:]]"
  icolor cyan start="[$@%]" end="( |[^0-9A-Z_]|-)"
  color yellow "".*"|qq\|.*\|"
  color white "[sm]/.*/"
diff -c /usr/share/nano/pov.nanorc /home/Benjamin/nano/pov.nanorc
*** /usr/share/nano/pov.nanorc	Sun Jan 18 02:26:07 2009
--- /home/Benjamin/nano/pov.nanorc	Sun Jan 18 02:25:30 2009
***************
*** 2,15 ****
  ##
  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 green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
! color brightmagenta "\<(union|group|subgroup)\>"
  ## Comment highlighting
  color brightblue "//.*"
  color brightblue start="/\*" end="\*/"
--- 2,15 ----
  ##
  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 green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
! color brightmagenta "[[:<:]](union|group|subgroup)[[:>:]]"
  ## Comment highlighting
  color brightblue "//.*"
  color brightblue start="/\*" end="\*/"
diff -c /usr/share/nano/python.nanorc /home/Benjamin/nano/python.nanorc
*** /usr/share/nano/python.nanorc	Sun Jan 18 02:26:07 2009
--- /home/Benjamin/nano/python.nanorc	Sun Jan 18 02:25:30 2009
***************
*** 2,8 ****
  ##
  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 brightgreen "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
  color brightgreen "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
  color brightgreen start=""""[^"]" end=""""" start="'''[^']" end="'''"
--- 2,8 ----
  ##
  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 brightgreen "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
  color brightgreen "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
  color brightgreen start=""""[^"]" end=""""" start="'''[^']" end="'''"
diff -c /usr/share/nano/ruby.nanorc /home/Benjamin/nano/ruby.nanorc
*** /usr/share/nano/ruby.nanorc	Sun Jan 18 02:26:07 2009
--- /home/Benjamin/nano/ruby.nanorc	Sun Jan 18 02:25:30 2009
***************
*** 2,14 ****
  ##
  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)\>"
  ## Constants
! color brightblue "(\$|@|@@)?\<[A-Z]+[0-9A-Z_a-z]*"
  ## Ruby "symbols"
! icolor magenta "([ 	]|^):[0-9A-Z_]+\>"
  ## Some unique things we want to stand out
! color brightyellow "\<(__FILE__|__LINE__)\>"
  ## Regular expressions
  color brightmagenta "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
  ## Shell command expansion is in `backticks` or like %x{this}.  These are
--- 2,14 ----
  ##
  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)[[:>:]]"
  ## Constants
! color brightblue "(\$|@|@@)?[[:<:]][A-Z]+[0-9A-Z_a-z]*"
  ## Ruby "symbols"
! icolor magenta "([ 	]|^):[0-9A-Z_]+[[:>:]]"
  ## Some unique things we want to stand out
! color brightyellow "[[:<:]](__FILE__|__LINE__)[[:>:]]"
  ## Regular expressions
  color brightmagenta "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
  ## Shell command expansion is in `backticks` or like %x{this}.  These are
diff -c /usr/share/nano/sh.nanorc /home/Benjamin/nano/sh.nanorc
*** /usr/share/nano/sh.nanorc	Sun Jan 18 02:26:08 2009
--- /home/Benjamin/nano/sh.nanorc	Sun Jan 18 02:25:30 2009
***************
*** 2,12 ****
  ##
  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 "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
! 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 ""(\\.|[^"])*"" "'(\\.|[^'])*'"
--- 2,12 ----
  ##
  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 "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
! 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 ""(\\.|[^"])*"" "'(\\.|[^'])*'"
--- EOF --- syntax.nanorc.patch ---

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]