2017-07-02 21:27:04 +03:00
## Here is an example for Gentoo ebuilds/eclasses,
## and (further down) one for Portage control files.
2014-05-17 00:21:34 +04:00
2018-02-07 13:25:46 +03:00
syntax ebuild "\.e(build|class|blit)$"
2016-05-25 23:13:50 +03:00
comment "#"
2014-05-17 00:21:34 +04:00
2017-07-02 21:27:04 +03:00
## All the standard portage functions:
2014-02-27 01:38:44 +04:00
color brightgreen "(^|\<default_)src_(unpack|prepare|configure|compile|install|test)\>"
2014-03-24 16:31:25 +04:00
color brightgreen "^pkg_(config|nofetch|info|pretend|setup|(pre|post)(inst|rm))\>"
color brightgreen "\<default(_pkg_nofetch|_src_(unpack|prepare|configure|compile|test))?\>"
2017-07-02 21:27:04 +03:00
## Bash-related syntax:
2014-02-27 01:38:44 +04:00
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)\>"
2017-07-02 21:27:04 +03:00
## Variables... official portage ones in red, all others in bright red:
2014-02-27 01:38:44 +04:00
color brightred "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*"
color brightred "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:digit:]]|@)+\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})"
2019-10-24 13:22:04 +03:00
color red "\<(EAPI|ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|[BHPR]?DEPEND|PROVIDE|PROPERTIES|REQUIRED_USE|RESTRICT|USERLAND)\>"
2014-02-27 01:38:44 +04:00
color red "\<(S|E?D|T|PV|PF|P|PN|PR|PVR|A|CATEGORY|DISTDIR|FILESDIR|EPREFIX|E?ROOT|WORKDIR)\>"
2014-03-24 16:31:25 +04:00
color red "\<(AS|C(PP|XX)?|LD)FLAGS\>" "\<C(HOST|TARGET|BUILD)\>" "\<(MERGE_TYPE|REPLACING_VERSIONS|REPLACED_BY_VERSION)\>"
color red "\<EBUILD_PHASE(_FUNC)?\>"
2014-02-27 01:38:44 +04:00
color red "\<QA_((TEXTRELS|EXECSTACK|WX_LOAD)(_[a-zA-Z_0-9]+)?|DT_HASH|PRESTRIPPED)\>"
color red "\<(PATCHES|(HTML_)?DOCS)\>" "\<WANT_(AUTO(CONF|MAKE)|LIBTOOL)\>" "\<AT_M4DIR\>"
2017-07-02 21:27:04 +03:00
## Portage commands:
2017-12-30 19:32:15 +03:00
color magenta "\<(use(_(with|enable|if_iuse)|x)?|in_iuse) [!a-zA-Z0-9_+ -]*" "inherit.*"
2014-02-27 01:38:44 +04:00
color brightblue "\<e(begin|end|conf|install|make|qmake4|ant|(qa)?warn|infon?|error|log|patch(_user)?|new(group|user))\>"
color brightblue "\<e(pause|beep|mktemp|(cvs|svn)_clean|punt_cxx)\>" "\<e(aclocal|auto(reconf|header|conf|make)|libtoolize)\>"
color brightblue "\<e(stack|shopts|umask)_(push|pop)\>" "\<version_is_at_least\>"
color brightblue "\<make_desktop_entry\>" "\<unpack(_(makeself|pdv))?\>"
2014-03-24 16:31:25 +04:00
color brightblue "\<(die|hasv?|inherit|nonfatal)\>" "\<(use(_(with|enable|if_iuse)|x)?|in_iuse)\>" "\<(has|best)_version\>"
2009-08-18 06:55:22 +04:00
color brightblue "\<(do|new)(ins|(games)?s?bin|doc|lib(\.so|\.a)?|man|info|exe|initd|confd|envd|pam|menu|icon)\>"
2014-03-24 16:31:25 +04:00
color brightblue "\<do(compress|header|python|sed|dir|hard|sym|html|jar|mo)\>" "\<keepdir\>"
2014-02-27 01:38:44 +04:00
color brightblue "\<prepall(docs|info|man|strip)?\>" "\<prep(info|lib|lib\.(so|a)|man|strip|gamesdirs)\>"
2009-08-18 06:55:22 +04:00
color brightblue "\<(doc|ins|exe)?into\>" "\<(f|games)(owners|perms)\>" "\<(exe|ins|dir)opts\>"
2014-02-27 01:38:44 +04:00
color brightblue "\<tc-get(BUILD_)?(AR|AS|CC|CPP|CXX|LD|NM|OBJCOPY|PKG_CONFIG|RANLIB)\>"
color brightblue "\<tc-(arch(-kernel)?|export|has-(tls|openmp))\>"
2017-07-02 21:27:04 +03:00
## Common commands used in ebuilds:
2014-02-27 01:38:44 +04:00
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)\>"
2017-07-02 21:27:04 +03:00
## Comments (doesn't work that well):
2018-11-03 23:12:44 +03:00
color yellow "(^|[[:space:]])#.*"
2017-07-02 21:27:04 +03:00
## Strings (doesn't work that well):
2008-03-20 07:45:55 +03:00
color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'"
## Trailing space is bad!
color ,green "[[:space:]]+$"
2017-02-20 21:07:50 +03:00
## Mixed whitespace is also bad.
color ,green " "
2008-03-20 07:45:55 +03:00
2017-07-02 21:27:04 +03:00
2018-02-07 13:25:46 +03:00
syntax /etc/portage "\.(accept_keywords|env|keywords|mask|unmask|use)(/.+)?$"
2017-07-02 21:27:04 +03:00
comment "#"
2008-03-20 07:45:55 +03:00
## Base text:
2018-11-03 23:12:44 +03:00
color green ".+"
2009-01-28 21:32:33 +03:00
## Likely version and slot numbers:
2016-11-14 21:44:53 +03:00
color magenta "-[[:digit:].]+(_(alpha|beta|pre|rc|p)[[:digit:]]*)*(-r[[:digit:]]+)?([:[:space:]]|$)"
2009-01-28 21:32:33 +03:00
color magenta ":[^[:space:]]+([[:space:]]|$)"
2016-11-14 21:44:53 +03:00
## Use flags (must come after version/slot):
color brightred "[[:space:]]+\+?[A-Za-z0-9+_@-]+"
color brightblue "[[:space:]]+-[A-Za-z0-9+_@-]+"
2008-03-20 07:45:55 +03:00
## Accepted arches:
2016-11-14 21:44:53 +03:00
color white "[~-]?\<(alpha|amd64|arm(64)?|hppa|ia64|m68k|mips|nios2|ppc(64)?|riscv|s390|sh|sparc|x86)(-(aix|(f|free|net|open)bsd|cygwin|hpux|interix|linux|macos|mint|solaris|winnt))?\>"
2009-01-28 21:32:33 +03:00
color white "[[:space:]][*~-]?\*"
2008-03-20 07:45:55 +03:00
## Categories:
2016-11-14 21:44:53 +03:00
color cyan "^[[:space:]]*[^/]*/"
2008-03-20 07:45:55 +03:00
## Masking regulators:
2016-11-14 21:44:53 +03:00
color brightmagenta "^[[:space:]]*(=|~|<|<=|>|>=)"
2008-03-20 07:45:55 +03:00
## Comments:
2018-11-03 23:12:44 +03:00
color yellow "#.*"
2014-03-24 16:31:25 +04:00
## Trailing space is bad!
color ,green "[[:space:]]+$"
2017-02-20 21:07:50 +03:00
## Mixed whitespace is also bad.
color ,green " "