Recognizing also header lines that use "/usr/bin/env" to call

the program, instead of just a direct call via "/bin/program".
Doing this for Shell scripts, and for Python, Perl and Ruby.
This fixes Savannah bug #43270 reported by Kitty.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5095 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2014-09-21 15:29:40 +00:00
parent 97a5d1270a
commit edabd27cd8
5 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2014-09-21 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/{perl,python,ruby,sh}.nanorc: Recognize also header
lines of the form "#!/usr/bin/env thing" besides "#!/bin/thing".
This fixes Savannah bug #43270 reported by Kitty.
2014-08-29 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_justify): Replace the old get_shortcut() wrapper
with the new func_from_key().

View File

@ -1,7 +1,7 @@
## Here is an example for Perl.
syntax "perl" "\.p[lm]$"
header "^#!.*/perl[-0-9._]*"
header "^#!.*perl[-0-9._]*"
magic "Perl script text"
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)\>"

View File

@ -1,7 +1,7 @@
## Here is an example for Python.
syntax "python" "\.py$"
header "^#!.*/python[-0-9._]*"
header "^#!.*python[-0-9._]*"
# Function definitions.
icolor brightblue "def [0-9A-Z_]+"

View File

@ -1,7 +1,7 @@
## Here is an example for Ruby.
syntax "ruby" "\.rb$"
header "^#!.*/ruby[-0-9._]*"
header "^#!.*ruby[-0-9._]*"
# 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)\>"

View File

@ -1,7 +1,7 @@
## Here is an example for Bourne shell scripts.
syntax "sh" "\.sh$"
header "^#!.*/(ba|k|pdk)?sh[-0-9_]*"
header "^#!.*(ba|k|pdk)?sh[-0-9_]*"
magic "(POSIX|Bourne.*) shell script text"
icolor brightgreen "^[0-9A-Z_]+\(\)"