vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 07a71ae4d7bf2ee334be2dadbf09cf077da04c4b parent 8cf108d337f26bda64e3647ef5425209f2f1548f Author: Christian Hesse <mail@eworm.de> Date: Thu, 6 Oct 2016 16:47:07 +0200 lexers/pkgbuild: support arch specific variables Diffstat:
| M | lexers/pkgbuild.lua | | | 30 | +++++++++++++++++++----------- |
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/lexers/pkgbuild.lua b/lexers/pkgbuild.lua @@ -52,39 +52,47 @@ local func = token(l.FUNCTION, word_match{ } * '()') -- Constants. -local constant = token(l.CONSTANT, word_match{ +local constants = { -- We do *not* list pkgver, srcdir and startdir here. -- These are defined by makepkg but user should not alter them. 'arch', 'backup', 'changelog', - 'checkdepends', - 'conflicts', - 'depends', 'epoch', 'groups', 'install', 'license', - 'makedepends', - 'md5sums', 'noextract', - 'optdepends', 'options', 'pkgbase', 'pkgdesc', 'pkgname', 'pkgrel', 'pkgver', + 'url', + 'validpgpkeys' +} +local arch_specific = { + 'checkdepends', + 'conflicts', + 'depends', + 'makedepends', + 'md5sums', + 'optdepends', 'provides', 'replaces', 'sha1sums', 'sha256sums', 'sha384sums', 'sha512sums', - 'source', - 'url', - 'validpgpkeys' -}) + 'source' +} +for _, field in ipairs(arch_specific) do + for _,arch in ipairs({ '', 'i686', 'x86_64' }) do + table.insert(constants, field..(arch ~= '' and '_'..arch or '')) + end +end +local constant = token(l.CONSTANT, word_match(constants)) -- Identifiers. local identifier = token(l.IDENTIFIER, l.word)