From fc1421eb53b17aa58b01a9c07ba2007eb4a1aa4f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 20 Apr 2006 22:17:20 +0000 Subject: updated for version 7.0e04 --- runtime/syntax/bindzone.vim | 146 ++++++----- runtime/syntax/crontab.vim | 42 ++-- runtime/syntax/inform.vim | 6 +- runtime/syntax/lua.vim | 596 ++++++++++++++++++++++---------------------- 4 files changed, 403 insertions(+), 387 deletions(-) (limited to 'runtime/syntax') diff --git a/runtime/syntax/bindzone.vim b/runtime/syntax/bindzone.vim index 3c23e219fd..9facdbe77d 100644 --- a/runtime/syntax/bindzone.vim +++ b/runtime/syntax/bindzone.vim @@ -1,9 +1,12 @@ " Vim syntax file -" Language: BIND 8.x zone files (RFC1035) -" Maintainer: glory hump -" Last change: Thu Apr 26 02:16:18 SAMST 2001 -" Filenames: /var/named/* -" URL: http://rnd.web-drive.ru/vim/syntax/bindzone.vim +" Language: BIND zone files (RFC1035) +" Maintainer: Julian Mehnle +" URL: http://www.mehnle.net/source/odds+ends/vim/syntax/ +" Last Change: Thu 2006-04-20 12:30:45 UTC +" +" Based on an earlier version by Вячеслав Горбанев (Slava Gorbanev), with +" heavy modifications. +" " $Id$ " For version 5.x: Clear all syntax items @@ -16,54 +19,55 @@ endif syn case match -if version >= 600 - setlocal iskeyword=.,-,48-58,A-Z,a-z,_ -else - set iskeyword=.,-,48-58,A-Z,a-z,_ -endif - - -" Master File Format (rfc 1035) - -" directives -syn region zoneRRecord start=+^+ end=+$+ contains=zoneLHSDomain,zoneLHSIP,zoneIllegalDom,zoneWhitespace,zoneComment,zoneParen,zoneSpecial -syn match zoneDirective /\$ORIGIN\s\+/ nextgroup=zoneDomain,zoneIllegalDom -syn match zoneDirective /\$TTL\s\+/ nextgroup=zoneTTL -syn match zoneDirective /\$INCLUDE\s\+/ -syn match zoneDirective /\$GENERATE\s/ - -syn match zoneWhitespace contained /^\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType -syn match zoneError "\s\+$" -syn match zoneSpecial contained /^[@.]\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType -syn match zoneSpecial contained /@$/ - -" domains and IPs -syn match zoneLHSDomain contained /^[-0-9A-Za-z.]\+\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType -syn match zoneLHSIP contained /^[0-9]\{1,3}\(\.[0-9]\{1,3}\)\{,3}\s\+/ nextgroup=zoneTTL,zoneClass,zoneRRType -syn match zoneIPaddr contained /\<[0-9]\{1,3}\(\.[0-9]\{1,3}\)\{,3}\>/ -syn match zoneDomain contained /\<[0-9A-Za-z][-0-9A-Za-z.]\+\>/ - -syn match zoneIllegalDom contained /\S*[^-A-Za-z0-9.[:space:]]\S*\>/ -"syn match zoneIllegalDom contained /[0-9]\S*[-A-Za-z]\S*/ - -" keywords -syn keyword zoneClass IN CHAOS nextgroup=zoneRRType - -syn match zoneTTL contained /\<[0-9HhWwDd]\+\s\+/ nextgroup=zoneClass,zoneRRType -syn match zoneRRType contained /\s*\<\(NS\|HINFO\)\s\+/ nextgroup=zoneSpecial,zoneDomain -syn match zoneRRType contained /\s*\/ - -syn match zoneMailPrio contained /\<[0-9]\+\s*/ nextgroup=zoneDomain,zoneIllegalDom -syn match zoneErrParen /)/ -syn region zoneParen contained start=+(+ end=+)+ contains=zoneSerial,zoneTTL,zoneComment -syn match zoneComment ";.*" +" Directives +syn region zoneRRecord start=/^/ end=/$/ contains=zoneOwnerName,zoneSpecial,zoneTTL,zoneClass,zoneRRType,zoneComment,zoneUnknown + +syn match zoneDirective /^\$ORIGIN\s\+/ nextgroup=zoneOrigin,zoneUnknown +syn match zoneDirective /^\$TTL\s\+/ nextgroup=zoneNumber,zoneUnknown +syn match zoneDirective /^\$INCLUDE\s\+/ nextgroup=zoneText,zoneUnknown +syn match zoneDirective /^\$GENERATE\s/ + +syn match zoneUnknown contained /\S\+/ + +syn match zoneOwnerName contained /^[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\)\@=/ nextgroup=zoneTTL,zoneClass,zoneRRType skipwhite +syn match zoneOrigin contained /[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\|$\)\@=/ +syn match zoneDomain contained /[^[:space:]!"#$%&'()*+,\/:;<=>?@[\]\^`{|}~]\+\(\s\|;\|$\)\@=/ + +syn match zoneSpecial contained /^[@*.]\s/ +syn match zoneTTL contained /\<\d[0-9HhWwDd]*\>/ nextgroup=zoneClass,zoneRRType skipwhite +syn keyword zoneClass contained IN CHAOS nextgroup=zoneRRType,zoneTTL skipwhite +syn keyword zoneRRType contained A AAAA CNAME HINFO MX NS PTR SOA SRV TXT nextgroup=zoneRData skipwhite +syn match zoneRData contained /[^;]*/ contains=zoneDomain,zoneIPAddr,zoneIP6Addr,zoneText,zoneNumber,zoneParen,zoneUnknown + +syn match zoneIPAddr contained /\<[0-9]\{1,3}\(\.[0-9]\{1,3}\)\{,3}\>/ + +" Plain IPv6 address IPv6-embedded-IPv4 address +" 1111:2:3:4:5:6:7:8 1111:2:3:4:5:6:127.0.0.1 +syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{6}\(\x\{1,4}:\x\{1,4}\|\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\>/ +" ::[...:]8 ::[...:]127.0.0.1 +syn match zoneIP6Addr contained /\s\@<=::\(\(\x\{1,4}:\)\{,6}\x\{1,4}\|\(\x\{1,4}:\)\{,5}\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\>/ +" 1111::[...:]8 1111::[...:]127.0.0.1 +syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{1}:\(\(\x\{1,4}:\)\{,5}\x\{1,4}\|\(\x\{1,4}:\)\{,4}\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\>/ +" 1111:2::[...:]8 1111:2::[...:]127.0.0.1 +syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{2}:\(\(\x\{1,4}:\)\{,4}\x\{1,4}\|\(\x\{1,4}:\)\{,3}\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\>/ +" 1111:2:3::[...:]8 1111:2:3::[...:]127.0.0.1 +syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{3}:\(\(\x\{1,4}:\)\{,3}\x\{1,4}\|\(\x\{1,4}:\)\{,2}\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\>/ +" 1111:2:3:4::[...:]8 1111:2:3:4::[...:]127.0.0.1 +syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{4}:\(\(\x\{1,4}:\)\{,2}\x\{1,4}\|\(\x\{1,4}:\)\{,1}\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\>/ +" 1111:2:3:4:5::[...:]8 1111:2:3:4:5::127.0.0.1 +syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{5}:\(\(\x\{1,4}:\)\{,1}\x\{1,4}\|\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\>/ +" 1111:2:3:4:5:6::8 - +syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{6}:\x\{1,4}\>/ +" 1111[:...]:: - +syn match zoneIP6Addr contained /\<\(\x\{1,4}:\)\{1,7}:\(\s\|;\|$\)\@=/ + +syn match zoneText contained /"\([^"\\]\|\\.\)*"\(\s\|;\|$\)\@=/ +syn match zoneNumber contained /\<[0-9]\+\(\s\|;\|$\)\@=/ +syn match zoneSerial contained /\<[0-9]\{9,10}\(\s\|;\|$\)\@=/ + +syn match zoneErrParen /)/ +syn region zoneParen contained start="(" end=")" contains=zoneSerial,zoneNumber,zoneComment +syn match zoneComment /;.*/ " Define the default highlighting. " For version 5.7 and earlier: only when not done already @@ -76,23 +80,31 @@ if version >= 508 || !exists("did_bind_zone_syn_inits") command -nargs=+ HiLink hi def link endif - HiLink zoneComment Comment - HiLink zoneDirective Macro - HiLink zoneLHSDomain Statement - HiLink zoneLHSIP Statement - HiLink zoneClass Include - HiLink zoneSpecial Special - HiLink zoneRRType Type - HiLink zoneError Error - HiLink zoneErrParen Error - HiLink zoneIllegalDom Error - HiLink zoneSerial Todo - HiLink zoneIPaddr Number - HiLink zoneDomain Identifier + HiLink zoneDirective Macro + + HiLink zoneUnknown Error + + HiLink zoneOrigin Statement + HiLink zoneOwnerName Statement + HiLink zoneDomain Identifier + + HiLink zoneSpecial Special + HiLink zoneTTL Constant + HiLink zoneClass Include + HiLink zoneRRType Type + + HiLink zoneIPAddr Number + HiLink zoneIP6Addr Number + HiLink zoneText String + HiLink zoneNumber Number + HiLink zoneSerial Special + + HiLink zoneErrParen Error + HiLink zoneComment Comment delcommand HiLink endif let b:current_syntax = "bindzone" -" vim: ts=17 +" vim:sts=2 sw=2 diff --git a/runtime/syntax/crontab.vim b/runtime/syntax/crontab.vim index 372478c1ed..117f98d754 100644 --- a/runtime/syntax/crontab.vim +++ b/runtime/syntax/crontab.vim @@ -1,10 +1,12 @@ " Vim syntax file -" Language: crontab -" Maintainer: John Hoelzel johnh51@users.sourceforge.net -" Maintainer: David Necas (Yeti) -" Last Change: 2005-04-26 -" Filenames: /tmp/crontab.* used by "crontab -e" -" URL: http://trific.ath.cx/Ftp/vim/syntax/crontab.vim +" Language: crontab +" Maintainer: David Necas (Yeti) +" Original Maintainer: John Hoelzel johnh51@users.sourceforge.net +" License: This file can be redistribued and/or modified under the same terms +" as Vim itself. +" Filenames: /tmp/crontab.* used by "crontab -e" +" URL: http://trific.ath.cx/Ftp/vim/syntax/crontab.vim +" Last Change: 2006-04-20 " " crontab line format: " Minutes Hours Days Months Days_of_Week Commands # comments @@ -17,24 +19,23 @@ elseif exists("b:current_syntax") finish endif -syntax match crontabMin "^\s*[-0-9/,.*]\+" nextgroup=crontabHr skipwhite -syntax match crontabHr "\s[-0-9/,.*]\+" nextgroup=crontabDay skipwhite contained -syntax match crontabDay "\s[-0-9/,.*]\+" nextgroup=crontabMnth skipwhite contained +syntax match crontabMin "^\s*[-0-9/,.*]\+" nextgroup=crontabHr skipwhite +syntax match crontabHr "\s[-0-9/,.*]\+" nextgroup=crontabDay skipwhite contained +syntax match crontabDay "\s[-0-9/,.*]\+" nextgroup=crontabMnth skipwhite contained -syntax match crontabMnth "\s[-a-z0-9/,.*]\+" nextgroup=crontabDow skipwhite contained -syntax keyword crontabMnth12 contained jan feb mar apr may jun jul aug sep oct nov dec +syntax match crontabMnth "\s[-a-z0-9/,.*]\+" nextgroup=crontabDow skipwhite contained +syntax keyword crontabMnth12 contained jan feb mar apr may jun jul aug sep oct nov dec -syntax match crontabDow "\s[-a-z0-9/,.*]\+" nextgroup=crontabCmd skipwhite contained -syntax keyword crontabDow7 contained sun mon tue wed thu fri sat +syntax match crontabDow "\s[-a-z0-9/,.*]\+" nextgroup=crontabCmd skipwhite contained +syntax keyword crontabDow7 contained sun mon tue wed thu fri sat -" syntax region crontabCmd start="\<[a-z0-9\/\(]" end="$" nextgroup=crontabCmnt skipwhite contained contains=crontabCmnt keepend +syntax region crontabCmd start="\S" end="$" skipwhite contained keepend contains=crontabPercent +syntax match crontabCmnt "^\s*#.*" +syntax match crontabPercent "[^\\]%.*"lc=1 contained -syntax region crontabCmd start="\S" end="$" nextgroup=crontabCmnt skipwhite contained keepend -syntax match crontabCmnt "^\s*#.*" +syntax match crontabNick "^\s*@\(reboot\|yearly\|annually\|monthly\|weekly\|daily\|midnight\|hourly\)\>" nextgroup=crontabCmd skipwhite -syntax match crontabNick "^\s*@\(reboot\|yearly\|annually\|monthly\|weekly\|daily\|midnight\|hourly\)\>" nextgroup=crontabCmd skipwhite - -syntax match crontabVar "^\s*\k\w*\s*="me=e-1 +syntax match crontabVar "^\s*\k\w*\s*="me=e-1 " Define the default highlighting. " For version 5.7 and earlier: only when not done already @@ -63,9 +64,10 @@ if version >= 508 || !exists("did_crontab_syn_inits") HiLink crontabNick Special HiLink crontabVar Identifier + HiLink crontabPercent Special " comment out next line for to suppress unix commands coloring. - HiLink crontabCmd Type + HiLink crontabCmd Statement HiLink crontabCmnt Comment diff --git a/runtime/syntax/inform.vim b/runtime/syntax/inform.vim index 11901639c5..d8ba43dcee 100644 --- a/runtime/syntax/inform.vim +++ b/runtime/syntax/inform.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Inform -" Maintainer: Stephen Thomas (informvim@stephenthomas.uklinux.net) -" URL: http://www.stephenthomas.uklinux.net/informvim -" Last Change: 2004 May 16 +" Maintainer: Stephen Thomas (stephen@gowarthomas.com) +" URL: http://www.gowarthomas.com/informvim +" Last Change: 2006 April 20 " Quit when a syntax file was already loaded if version < 600 diff --git a/runtime/syntax/lua.vim b/runtime/syntax/lua.vim index fe97712ee4..7d72603bf2 100644 --- a/runtime/syntax/lua.vim +++ b/runtime/syntax/lua.vim @@ -1,297 +1,299 @@ -" Vim syntax file -" Language: Lua 4.0, Lua 5.0 and Lua 5.1 -" Maintainer: Marcus Aurelius Farias -" First Author: Carlos Augusto Teixeira Mendes -" Last Change: 2006 Apr. 19 -" Options: lua_version = 4 or 5 -" lua_subversion = 0 (4.0, 5.0) or 1 (5.1) -" default 5.1 - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") - finish -endif - -if !exists("lua_version") - " Default is lua 5.1 - let lua_version = 5 - let lua_subversion = 1 -elseif !exists("lua_subversion") - " lua_version exists, but lua_subversion doesn't. So, set it to 0 - let lua_subversion = 0 -endif - -syn case match - -" syncing method -syn sync minlines=100 - -" Comments -syn keyword luaTodo contained TODO FIXME XXX -syn match luaComment "--.*$" contains=luaTodo -if lua_version == 5 && lua_subversion == 0 - syn region luaComment matchgroup=luaComment start="--\[\[" end="\]\]" contains=luaTodo,luaInnerComment - syn region luaInnerComment contained transparent start="\[\[" end="\]\]" -elseif lua_version > 5 || (lua_version == 5 && lua_subversion >= 1) - " Comments in Lua 5.1: [[ ... ]], [=[ ... ]=], [===[ ... ]===], etc. - syn region luaComment matchgroup=luaComment start="--\[\z(=*\)\[" end="\]\z1\]" -endif - -" First line may start with #! -syn match luaComment "\%^#!.*" - -" catch errors caused by wrong parenthesis and wrong curly brackets or -" keywords placed outside their respective blocks - -syn region luaParen transparent start='(' end=')' contains=ALLBUT,luaError,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaCondStart,luaBlock,luaRepeatBlock,luaRepeat,luaStatement -syn match luaError ")" -syn match luaError "}" -syn match luaError "\<\%(end\|else\|elseif\|then\|until\|in\)\>" - -" Function declaration -syn region luaFunctionBlock transparent matchgroup=luaFunction start="\" end="\" contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaRepeat - -" if then else elseif end -syn keyword luaCond contained else - -" then ... end -syn region luaCondEnd contained transparent matchgroup=luaCond start="\" end="\" contains=ALLBUT,luaTodo,luaSpecial,luaRepeat - -" elseif ... then -syn region luaCondElseif contained transparent matchgroup=luaCond start="\" end="\" contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaRepeat - -" if ... then -syn region luaCondStart transparent matchgroup=luaCond start="\" end="\"me=e-4 contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaRepeat nextgroup=luaCondEnd skipwhite skipempty - -" do ... end -syn region luaBlock transparent matchgroup=luaStatement start="\" end="\" contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaRepeat - -" repeat ... until -syn region luaRepeatBlock transparent matchgroup=luaRepeat start="\" end="\" contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaRepeat - -" while ... do -syn region luaRepeatBlock transparent matchgroup=luaRepeat start="\" end="\"me=e-2 contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaRepeat nextgroup=luaBlock skipwhite skipempty - -" for ... do and for ... in ... do -syn region luaRepeatBlock transparent matchgroup=luaRepeat start="\" end="\"me=e-2 contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd nextgroup=luaBlock skipwhite skipempty - -" Following 'else' example. This is another item to those -" contains=ALLBUT,... because only the 'for' luaRepeatBlock contains it. -syn keyword luaRepeat contained in - -" other keywords -syn keyword luaStatement return local break -syn keyword luaOperator and or not -syn keyword luaConstant nil -if lua_version > 4 - syn keyword luaConstant true false -endif - -" Strings -syn match luaSpecial contained "\\[\\abfnrtv\'\"[\]]\|\\\d\{,3}" -syn region luaString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=luaSpecial -syn region luaString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=luaSpecial -" Nested strings -if (lua_version == 5 && lua_subversion == 0) || lua_version < 5 - syn region luaString2 matchgroup=luaString start=+\[\[+ end=+\]\]+ contains=luaString2 -elseif lua_version > 5 || (lua_version == 5 && lua_subversion >= 1) - syn region luaString2 matchgroup=luaString start="\[\z(=*\)\[" end="\]\z1\]" -endif - -" integer number -syn match luaNumber "\<[0-9]\+\>" -" floating point number, with dot, optional exponent -syn match luaFloat "\<[0-9]\+\.[0-9]*\%(e[-+]\=[0-9]\+\)\=\>" -" floating point number, starting with a dot, optional exponent -syn match luaFloat "\.[0-9]\+\%(e[-+]\=[0-9]\+\)\=\>" -" floating point number, without dot, with exponent -syn match luaFloat "\<[0-9]\+e[-+]\=[0-9]\+\>" - -" tables -syn region luaTableBlock transparent matchgroup=luaTable start="{" end="}" contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaCondStart,luaBlock,luaRepeatBlock,luaRepeat,luaStatement - -syn keyword luaFunc assert collectgarbage dofile error gcinfo next -syn keyword luaFunc print rawget rawset tonumber tostring type _VERSION - -if lua_version == 4 - syn keyword luaFunc _ALERT _ERRORMESSAGE - syn keyword luaFunc call copytagmethods dostring - syn keyword luaFunc foreach foreachi getglobal getn - syn keyword luaFunc gettagmethod globals newtag - syn keyword luaFunc setglobal settag settagmethod sort - syn keyword luaFunc tag tinsert tremove - syn keyword luaFunc _INPUT _OUTPUT _STDIN _STDOUT _STDERR - syn keyword luaFunc openfile closefile flush seek - syn keyword luaFunc setlocale execute remove rename tmpname - syn keyword luaFunc getenv date clock exit - syn keyword luaFunc readfrom writeto appendto read write - syn keyword luaFunc PI abs sin cos tan asin - syn keyword luaFunc acos atan atan2 ceil floor - syn keyword luaFunc mod frexp ldexp sqrt min max log - syn keyword luaFunc log10 exp deg rad random - syn keyword luaFunc randomseed strlen strsub strlower strupper - syn keyword luaFunc strchar strrep ascii strbyte - syn keyword luaFunc format strfind gsub - syn keyword luaFunc getinfo getlocal setlocal setcallhook setlinehook -elseif lua_version == 5 - " Not sure if all these functions need to be highlighted... - syn keyword luaFunc _G getfenv getmetatable ipairs loadfile - syn keyword luaFunc loadstring pairs pcall rawequal - syn keyword luaFunc require setfenv setmetatable unpack xpcall - if lua_subversion == 0 - syn keyword luaFunc loadlib LUA_PATH _LOADED _REQUIREDNAME - elseif lua_subversion == 1 - syn keyword luaFunc load module select - syn match luaFunc /package\.cpath/ - syn match luaFunc /package\.loaded/ - syn match luaFunc /package\.loadlib/ - syn match luaFunc /package\.path/ - syn match luaFunc /package\.preload/ - syn match luaFunc /package\.seeall/ - syn match luaFunc /coroutine\.running/ - endif - syn match luaFunc /coroutine\.create/ - syn match luaFunc /coroutine\.resume/ - syn match luaFunc /coroutine\.status/ - syn match luaFunc /coroutine\.wrap/ - syn match luaFunc /coroutine\.yield/ - syn match luaFunc /string\.byte/ - syn match luaFunc /string\.char/ - syn match luaFunc /string\.dump/ - syn match luaFunc /string\.find/ - syn match luaFunc /string\.len/ - syn match luaFunc /string\.lower/ - syn match luaFunc /string\.rep/ - syn match luaFunc /string\.sub/ - syn match luaFunc /string\.upper/ - syn match luaFunc /string\.format/ - syn match luaFunc /string\.gsub/ - if lua_subversion == 0 - syn match luaFunc /string\.gfind/ - elseif lua_subversion == 1 - syn match luaFunc /string\.gmatch/ - syn match luaFunc /string\.match/ - syn match luaFunc /string\.reverse/ - syn match luaFunc /table\.maxn/ - endif - syn match luaFunc /table\.concat/ - syn match luaFunc /table\.foreach/ - syn match luaFunc /table\.foreachi/ - syn match luaFunc /table\.getn/ - syn match luaFunc /table\.sort/ - syn match luaFunc /table\.insert/ - syn match luaFunc /table\.remove/ - syn match luaFunc /table\.setn/ - syn match luaFunc /math\.abs/ - syn match luaFunc /math\.acos/ - syn match luaFunc /math\.asin/ - syn match luaFunc /math\.atan/ - syn match luaFunc /math\.atan2/ - syn match luaFunc /math\.ceil/ - syn match luaFunc /math\.sin/ - syn match luaFunc /math\.cos/ - syn match luaFunc /math\.tan/ - syn match luaFunc /math\.deg/ - syn match luaFunc /math\.exp/ - syn match luaFunc /math\.floor/ - syn match luaFunc /math\.log/ - syn match luaFunc /math\.log10/ - syn match luaFunc /math\.max/ - syn match luaFunc /math\.min/ - if lua_subversion == 0 - syn match luaFunc /math\.mod/ - elseif lua_subversion == 1 - syn match luaFunc /math\.fmod/ - syn match luaFunc /math\.modf/ - syn match luaFunc /math\.cosh/ - syn match luaFunc /math\.sinh/ - syn match luaFunc /math\.tanh/ - endif - syn match luaFunc /math\.pow/ - syn match luaFunc /math\.rad/ - syn match luaFunc /math\.sqrt/ - syn match luaFunc /math\.frexp/ - syn match luaFunc /math\.ldexp/ - syn match luaFunc /math\.random/ - syn match luaFunc /math\.randomseed/ - syn match luaFunc /math\.pi/ - syn match luaFunc /io\.stdin/ - syn match luaFunc /io\.stdout/ - syn match luaFunc /io\.stderr/ - syn match luaFunc /io\.close/ - syn match luaFunc /io\.flush/ - syn match luaFunc /io\.input/ - syn match luaFunc /io\.lines/ - syn match luaFunc /io\.open/ - syn match luaFunc /io\.output/ - syn match luaFunc /io\.popen/ - syn match luaFunc /io\.read/ - syn match luaFunc /io\.tmpfile/ - syn match luaFunc /io\.type/ - syn match luaFunc /io\.write/ - syn match luaFunc /os\.clock/ - syn match luaFunc /os\.date/ - syn match luaFunc /os\.difftime/ - syn match luaFunc /os\.execute/ - syn match luaFunc /os\.exit/ - syn match luaFunc /os\.getenv/ - syn match luaFunc /os\.remove/ - syn match luaFunc /os\.rename/ - syn match luaFunc /os\.setlocale/ - syn match luaFunc /os\.time/ - syn match luaFunc /os\.tmpname/ - syn match luaFunc /debug\.debug/ - syn match luaFunc /debug\.gethook/ - syn match luaFunc /debug\.getinfo/ - syn match luaFunc /debug\.getlocal/ - syn match luaFunc /debug\.getupvalue/ - syn match luaFunc /debug\.setlocal/ - syn match luaFunc /debug\.setupvalue/ - syn match luaFunc /debug\.sethook/ - syn match luaFunc /debug\.traceback/ - if lua_subversion == 1 - syn match luaFunc /debug\.getfenv/ - syn match luaFunc /debug\.getmetatable/ - syn match luaFunc /debug\.getregistry/ - syn match luaFunc /debug\.setfenv/ - syn match luaFunc /debug\.setmetatable/ - endif -endif - -" Define the default highlighting. -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_lua_syntax_inits") - if version < 508 - let did_lua_syntax_inits = 1 - command -nargs=+ HiLink hi link - else - command -nargs=+ HiLink hi def link - endif - - HiLink luaStatement Statement - HiLink luaRepeat Repeat - HiLink luaString String - HiLink luaString2 String - HiLink luaNumber Number - HiLink luaFloat Float - HiLink luaOperator Operator - HiLink luaConstant Constant - HiLink luaCond Conditional - HiLink luaFunction Function - HiLink luaComment Comment - HiLink luaTodo Todo - HiLink luaTable Structure - HiLink luaError Error - HiLink luaSpecial SpecialChar - HiLink luaFunc Identifier - - delcommand HiLink -endif - -let b:current_syntax = "lua" - -" vim: et ts=8 +" Vim syntax file +" Language: Lua 4.0, Lua 5.0 and Lua 5.1 +" Maintainer: Marcus Aurelius Farias +" First Author: Carlos Augusto Teixeira Mendes +" Last Change: 2006 Apr 21 +" Options: lua_version = 4 or 5 +" lua_subversion = 0 (4.0, 5.0) or 1 (5.1) +" default 5.1 + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +if !exists("lua_version") + " Default is lua 5.1 + let lua_version = 5 + let lua_subversion = 1 +elseif !exists("lua_subversion") + " lua_version exists, but lua_subversion doesn't. So, set it to 0 + let lua_subversion = 0 +endif + +syn case match + +" syncing method +syn sync minlines=100 + +" Comments +syn keyword luaTodo contained TODO FIXME XXX +syn match luaComment "--.*$" contains=luaTodo +if lua_version == 5 && lua_subversion == 0 + syn region luaComment matchgroup=luaComment start="--\[\[" end="\]\]" contains=luaTodo,luaInnerComment + syn region luaInnerComment contained transparent start="\[\[" end="\]\]" +elseif lua_version > 5 || (lua_version == 5 && lua_subversion >= 1) + " Comments in Lua 5.1: --[[ ... ]], [=[ ... ]=], [===[ ... ]===], etc. + syn region luaComment matchgroup=luaComment start="--\[\z(=*\)\[" end="\]\z1\]" +endif + +" First line may start with #! +syn match luaComment "\%^#!.*" + +" catch errors caused by wrong parenthesis and wrong curly brackets or +" keywords placed outside their respective blocks + +syn region luaParen transparent start='(' end=')' contains=ALLBUT,luaError,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaCondStart,luaBlock,luaRepeatBlock,luaRepeat,luaStatement +syn match luaError ")" +syn match luaError "}" +syn match luaError "\<\%(end\|else\|elseif\|then\|until\|in\)\>" + +" Function declaration +syn region luaFunctionBlock transparent matchgroup=luaFunction start="\" end="\" contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaRepeat + +" if then else elseif end +syn keyword luaCond contained else + +" then ... end +syn region luaCondEnd contained transparent matchgroup=luaCond start="\" end="\" contains=ALLBUT,luaTodo,luaSpecial,luaRepeat + +" elseif ... then +syn region luaCondElseif contained transparent matchgroup=luaCond start="\" end="\" contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaRepeat + +" if ... then +syn region luaCondStart transparent matchgroup=luaCond start="\" end="\"me=e-4 contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaRepeat nextgroup=luaCondEnd skipwhite skipempty + +" do ... end +syn region luaBlock transparent matchgroup=luaStatement start="\" end="\" contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaRepeat + +" repeat ... until +syn region luaRepeatBlock transparent matchgroup=luaRepeat start="\" end="\" contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaRepeat + +" while ... do +syn region luaRepeatBlock transparent matchgroup=luaRepeat start="\" end="\"me=e-2 contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaRepeat nextgroup=luaBlock skipwhite skipempty + +" for ... do and for ... in ... do +syn region luaRepeatBlock transparent matchgroup=luaRepeat start="\" end="\"me=e-2 contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd nextgroup=luaBlock skipwhite skipempty + +" Following 'else' example. This is another item to those +" contains=ALLBUT,... because only the 'for' luaRepeatBlock contains it. +syn keyword luaRepeat contained in + +" other keywords +syn keyword luaStatement return local break +syn keyword luaOperator and or not +syn keyword luaConstant nil +if lua_version > 4 + syn keyword luaConstant true false +endif + +" Strings +if lua_version < 5 + syn match luaSpecial contained "\\[\\abfnrtv\'\"]\|\\\d\{,3}" +elseif lua_version == 5 && lua_subversion == 0 + syn match luaSpecial contained "\\[\\abfnrtv\'\"[\]]\|\\\d\{,3}" + syn region luaString2 matchgroup=luaString start=+\[\[+ end=+\]\]+ contains=luaString2 +elseif lua_version > 5 || (lua_version == 5 && lua_subversion >= 1) + syn match luaSpecial contained "\\[\\abfnrtv\'\"]\|\\\d\{,3}" + syn region luaString2 matchgroup=luaString start="\[\z(=*\)\[" end="\]\z1\]" +endif +syn region luaString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=luaSpecial +syn region luaString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=luaSpecial + +" integer number +syn match luaNumber "\<[0-9]\+\>" +" floating point number, with dot, optional exponent +syn match luaFloat "\<[0-9]\+\.[0-9]*\%(e[-+]\=[0-9]\+\)\=\>" +" floating point number, starting with a dot, optional exponent +syn match luaFloat "\.[0-9]\+\%(e[-+]\=[0-9]\+\)\=\>" +" floating point number, without dot, with exponent +syn match luaFloat "\<[0-9]\+e[-+]\=[0-9]\+\>" + +" tables +syn region luaTableBlock transparent matchgroup=luaTable start="{" end="}" contains=ALLBUT,luaTodo,luaSpecial,luaCond,luaCondElseif,luaCondEnd,luaCondStart,luaBlock,luaRepeatBlock,luaRepeat,luaStatement + +syn keyword luaFunc assert collectgarbage dofile error next +syn keyword luaFunc print rawget rawset tonumber tostring type _VERSION + +if lua_version == 4 + syn keyword luaFunc _ALERT _ERRORMESSAGE gcinfo + syn keyword luaFunc call copytagmethods dostring + syn keyword luaFunc foreach foreachi getglobal getn + syn keyword luaFunc gettagmethod globals newtag + syn keyword luaFunc setglobal settag settagmethod sort + syn keyword luaFunc tag tinsert tremove + syn keyword luaFunc _INPUT _OUTPUT _STDIN _STDOUT _STDERR + syn keyword luaFunc openfile closefile flush seek + syn keyword luaFunc setlocale execute remove rename tmpname + syn keyword luaFunc getenv date clock exit + syn keyword luaFunc readfrom writeto appendto read write + syn keyword luaFunc PI abs sin cos tan asin + syn keyword luaFunc acos atan atan2 ceil floor + syn keyword luaFunc mod frexp ldexp sqrt min max log + syn keyword luaFunc log10 exp deg rad random + syn keyword luaFunc randomseed strlen strsub strlower strupper + syn keyword luaFunc strchar strrep ascii strbyte + syn keyword luaFunc format strfind gsub + syn keyword luaFunc getinfo getlocal setlocal setcallhook setlinehook +elseif lua_version == 5 + " Not sure if all these functions need to be highlighted... + syn keyword luaFunc _G getfenv getmetatable ipairs loadfile + syn keyword luaFunc loadstring pairs pcall rawequal + syn keyword luaFunc require setfenv setmetatable unpack xpcall + if lua_subversion == 0 + syn keyword luaFunc gcinfo loadlib LUA_PATH _LOADED _REQUIREDNAME + elseif lua_subversion == 1 + syn keyword luaFunc load module select + syn match luaFunc /package\.cpath/ + syn match luaFunc /package\.loaded/ + syn match luaFunc /package\.loadlib/ + syn match luaFunc /package\.path/ + syn match luaFunc /package\.preload/ + syn match luaFunc /package\.seeall/ + syn match luaFunc /coroutine\.running/ + endif + syn match luaFunc /coroutine\.create/ + syn match luaFunc /coroutine\.resume/ + syn match luaFunc /coroutine\.status/ + syn match luaFunc /coroutine\.wrap/ + syn match luaFunc /coroutine\.yield/ + syn match luaFunc /string\.byte/ + syn match luaFunc /string\.char/ + syn match luaFunc /string\.dump/ + syn match luaFunc /string\.find/ + syn match luaFunc /string\.len/ + syn match luaFunc /string\.lower/ + syn match luaFunc /string\.rep/ + syn match luaFunc /string\.sub/ + syn match luaFunc /string\.upper/ + syn match luaFunc /string\.format/ + syn match luaFunc /string\.gsub/ + if lua_subversion == 0 + syn match luaFunc /string\.gfind/ + syn match luaFunc /table\.getn/ + syn match luaFunc /table\.setn/ + syn match luaFunc /table\.foreach/ + syn match luaFunc /table\.foreachi/ + elseif lua_subversion == 1 + syn match luaFunc /string\.gmatch/ + syn match luaFunc /string\.match/ + syn match luaFunc /string\.reverse/ + syn match luaFunc /table\.maxn/ + endif + syn match luaFunc /table\.concat/ + syn match luaFunc /table\.sort/ + syn match luaFunc /table\.insert/ + syn match luaFunc /table\.remove/ + syn match luaFunc /math\.abs/ + syn match luaFunc /math\.acos/ + syn match luaFunc /math\.asin/ + syn match luaFunc /math\.atan/ + syn match luaFunc /math\.atan2/ + syn match luaFunc /math\.ceil/ + syn match luaFunc /math\.sin/ + syn match luaFunc /math\.cos/ + syn match luaFunc /math\.tan/ + syn match luaFunc /math\.deg/ + syn match luaFunc /math\.exp/ + syn match luaFunc /math\.floor/ + syn match luaFunc /math\.log/ + syn match luaFunc /math\.log10/ + syn match luaFunc /math\.max/ + syn match luaFunc /math\.min/ + if lua_subversion == 0 + syn match luaFunc /math\.mod/ + elseif lua_subversion == 1 + syn match luaFunc /math\.fmod/ + syn match luaFunc /math\.modf/ + syn match luaFunc /math\.cosh/ + syn match luaFunc /math\.sinh/ + syn match luaFunc /math\.tanh/ + endif + syn match luaFunc /math\.pow/ + syn match luaFunc /math\.rad/ + syn match luaFunc /math\.sqrt/ + syn match luaFunc /math\.frexp/ + syn match luaFunc /math\.ldexp/ + syn match luaFunc /math\.random/ + syn match luaFunc /math\.randomseed/ + syn match luaFunc /math\.pi/ + syn match luaFunc /io\.stdin/ + syn match luaFunc /io\.stdout/ + syn match luaFunc /io\.stderr/ + syn match luaFunc /io\.close/ + syn match luaFunc /io\.flush/ + syn match luaFunc /io\.input/ + syn match luaFunc /io\.lines/ + syn match luaFunc /io\.open/ + syn match luaFunc /io\.output/ + syn match luaFunc /io\.popen/ + syn match luaFunc /io\.read/ + syn match luaFunc /io\.tmpfile/ + syn match luaFunc /io\.type/ + syn match luaFunc /io\.write/ + syn match luaFunc /os\.clock/ + syn match luaFunc /os\.date/ + syn match luaFunc /os\.difftime/ + syn match luaFunc /os\.execute/ + syn match luaFunc /os\.exit/ + syn match luaFunc /os\.getenv/ + syn match luaFunc /os\.remove/ + syn match luaFunc /os\.rename/ + syn match luaFunc /os\.setlocale/ + syn match luaFunc /os\.time/ + syn match luaFunc /os\.tmpname/ + syn match luaFunc /debug\.debug/ + syn match luaFunc /debug\.gethook/ + syn match luaFunc /debug\.getinfo/ + syn match luaFunc /debug\.getlocal/ + syn match luaFunc /debug\.getupvalue/ + syn match luaFunc /debug\.setlocal/ + syn match luaFunc /debug\.setupvalue/ + syn match luaFunc /debug\.sethook/ + syn match luaFunc /debug\.traceback/ + if lua_subversion == 1 + syn match luaFunc /debug\.getfenv/ + syn match luaFunc /debug\.getmetatable/ + syn match luaFunc /debug\.getregistry/ + syn match luaFunc /debug\.setfenv/ + syn match luaFunc /debug\.setmetatable/ + endif +endif + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_lua_syntax_inits") + if version < 508 + let did_lua_syntax_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink luaStatement Statement + HiLink luaRepeat Repeat + HiLink luaString String + HiLink luaString2 String + HiLink luaNumber Number + HiLink luaFloat Float + HiLink luaOperator Operator + HiLink luaConstant Constant + HiLink luaCond Conditional + HiLink luaFunction Function + HiLink luaComment Comment + HiLink luaTodo Todo + HiLink luaTable Structure + HiLink luaError Error + HiLink luaSpecial SpecialChar + HiLink luaFunc Identifier + + delcommand HiLink +endif + +let b:current_syntax = "lua" + +" vim: et ts=8 -- cgit v1.2.3