From b2b7c2f968247cf85a62ad7b6b0dfc8292a08202 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 26 Feb 2014 21:38:44 +0000 Subject: [PATCH] Updating Gentoo-specific colouring to newer EAPIs, patch by Mike Frysinger. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4616 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ doc/syntax/gentoo.nanorc | 44 ++++++++++++++++++++++++---------------- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index ddaec8cf..8b2a8231 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * doc/syntax/sh.nanorc - Highlight more shell builtins and common commands, and rewrite the variable highlighting to be more exact and handle cases where string operations are used. + * doc/syntax/gentoo.nanorc - Update to newer EAPIs, and fold + in updated shell changes too. Much of this is based on work + by Davide Pesavento . 2014-02-26 Benno Schulenberg * src/global.c (shortcut_init) - Put PageUp and PageDown diff --git a/doc/syntax/gentoo.nanorc b/doc/syntax/gentoo.nanorc index bbedfe2f..15b247e7 100644 --- a/doc/syntax/gentoo.nanorc +++ b/doc/syntax/gentoo.nanorc @@ -2,30 +2,38 @@ ## syntax "ebuild" "\.e(build|class)$" ## All the standard portage functions -color brightgreen "^src_(unpack|prepare|configure|compile|install|test)" "^pkg_(config|nofetch|setup|(pre|post)(inst|rm))" +color brightgreen "(^|\" +color brightgreen "^pkg_(config|nofetch|pretend|setup|(pre|post)(inst|rm))\>" +color brightgreen "\" ## Highlight bash related syntax -color green "\<(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while|continue|break)\>" -color green "\<(declare|eval|exec|let)\>" -color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)" -color green "-[edfgruwxL]\>" -color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>" +color green "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>" +color green "\<(declare|eval|exec|export|let|local)\>" +color green "[{}():;|`$<>!=&\\]" "(\]|\[)" +color green "-[defhnrsuwxzL]\>" +color green "-(eq|ne|gt|lt|ge|le)\>" ## Highlight variables ... official portage ones in red, all others in bright red -color brightred "\$\{?[a-zA-Z_0-9]+\}?" -color red "\<(EAPI|ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|(P|R)?DEPEND|PROVIDE|PROPERTIES|RESTRICT|USERLAND)\>" -color red "\<(S|D|T|PV|PF|P|PN|PR|PVR|A|CATEGORY|DISTDIR|FILESDIR|ROOT|WORKDIR)\>" "\<(AS|C(PP|XX)?|LD)FLAGS\>" "\" -color red "\" "\" "\" +color brightred "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*" +color brightred "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:digit:]]|@)+\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})" +color red "\<(EAPI|ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|(P|R)?DEPEND|PROVIDE|PROPERTIES|REQUIRED_USE|RESTRICT|USERLAND)\>" +color red "\<(S|E?D|T|PV|PF|P|PN|PR|PVR|A|CATEGORY|DISTDIR|FILESDIR|EPREFIX|E?ROOT|WORKDIR)\>" +color red "\<(AS|C(PP|XX)?|LD)FLAGS\>" "\" +color red "\" +color red "\<(PATCHES|(HTML_)?DOCS)\>" "\" "\" ## Highlight portage commands -color magenta "\ [!a-zA-Z0-9_+ -]*" "inherit.*" -color brightblue "\" -color brightblue "\" "\" -color brightblue "\" "\" "\" -color brightblue "\" "\" "\" "\" "\<(has|best)_version\>" +color magenta "\<(use(_(with|enable|if_iuse)|x)?|in_iuse)\> [!a-zA-Z0-9_+ -]*" "inherit.*" +color brightblue "\" +color brightblue "\" "\" +color brightblue "\" "\" +color brightblue "\" "\" +color brightblue "\<(die|has|inherit|nonfatal)\>" "\<(use(_(with|enable|if_iuse)|x)?|in_iuse)\>" "\<(has|best)_version\>" color brightblue "\<(do|new)(ins|(games)?s?bin|doc|lib(\.so|\.a)?|man|info|exe|initd|confd|envd|pam|menu|icon)\>" -color brightblue "\" "\" -color brightblue "prepall(docs|info|man|strip)?" "prep(info|lib|lib\.(so|a)|man|strip|gamesdirs)" +color brightblue "\" "\" +color brightblue "\" "\" color brightblue "\<(doc|ins|exe)?into\>" "\<(f|games)(owners|perms)\>" "\<(exe|ins|dir)opts\>" +color brightblue "\" +color brightblue "\" ## Highlight common commands used in ebuilds -color blue "\" "\<(awk|cat|cd|chmod|chown|cp|echo|env|export|find|e?grep|ln|mkdir|mv|rm|sed|set|tar|touch|unset|xargs)\>" +color blue "\<(awk|cat|cd|chmod|chown|cp|echo|env|find|e?grep|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|tar|touch|unset|xargs)\>" ## Highlight comments (doesnt work that well) color yellow "(^|[[:space:]])#.*$" ## Highlight strings (doesnt work that well)