summaryrefslogtreecommitdiff
path: root/runtime/syntax/awk.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-07-15 22:54:41 +0200
committerBram Moolenaar <Bram@vim.org>2016-07-15 22:54:41 +0200
commit269f595f9eef584937e7eae70fde68cdd7da5bcf (patch)
tree67631e8ab3b7f15377a35dd27024613570b37618 /runtime/syntax/awk.vim
parente0d3797664c59afc9705808f86a7cf00fd6d874d (diff)
downloadvim-git-269f595f9eef584937e7eae70fde68cdd7da5bcf.tar.gz
Updated runtime files.
Diffstat (limited to 'runtime/syntax/awk.vim')
-rw-r--r--runtime/syntax/awk.vim134
1 files changed, 54 insertions, 80 deletions
diff --git a/runtime/syntax/awk.vim b/runtime/syntax/awk.vim
index 40491eea1..ae0f21758 100644
--- a/runtime/syntax/awk.vim
+++ b/runtime/syntax/awk.vim
@@ -1,15 +1,15 @@
" Vim syntax file
" Language: awk, nawk, gawk, mawk
" Maintainer: Antonio Colombo <azc100@gmail.com>
-" Last Change: 2014 Oct 21
+" Last Change: 2016 Jul 15
-" AWK ref. is: Alfred V. Aho, Brian W. Kernighan, Peter J. Weinberger
+" AWK ref. is: Alfred V. Aho, Brian W. Kernighan, Peter J. Weinberger
" The AWK Programming Language, Addison-Wesley, 1988
" GAWK ref. is: Arnold D. Robbins
" Effective AWK Programming, Third Edition, O'Reilly, 2001
" Effective AWK Programming, Fourth Edition, O'Reilly, 2015
-" (also available with the gawk source distribution)
+" (also available and updated with the gawk source distribution)
" MAWK is a "new awk" meaning it implements AWK ref.
" mawk conforms to the Posix 1003.2 (draft 11.3)
@@ -19,11 +19,8 @@
" TODO:
" Dig into the commented out syntax expressions below.
-" For version 5.x: Clear all syntax items
-" For version 6.x: Quit when a syntax file was already loaded
-if version < 600
- syn clear
-elseif exists("b:current_syntax")
+" Quit when a syntax file was already loaded
+if exists("b:current_syntax")
finish
endif
@@ -35,13 +32,13 @@ set cpo&vim
syn keyword awkStatement break continue delete exit
syn keyword awkStatement function getline next
syn keyword awkStatement print printf return
-" GAWK ref. Chapter 7
-syn keyword awkStatement nextfile
+" GAWK ref. Chapter 7-9
+syn keyword awkStatement switch nextfile
+syn keyword awkStatement func
"
" GAWK ref. Chapter 9, Functions
-"
" Numeric Functions
-syn keyword awkFunction atan2 cos div exp int log rand sin sqrt srand
+syn keyword awkFunction atan2 cos exp int intdiv log rand sin sqrt srand
" String Manipulation Functions
syn keyword awkFunction asort asort1 gensub gsub index length match
syn keyword awkFunction patsplit split sprintf strtonum sub substr
@@ -52,17 +49,17 @@ syn keyword awkFunction close fflush system
syn keyword awkFunction mktime strftime systime
" Bit Manipulation Functions
syn keyword awkFunction and compl lshift or rshift xor
-" Getting Type Function
-syn keyword awkFunction isarray
+" Getting Type Functions
+syn keyword awkFunction isarray typeof
" String-Translation Functions
syn keyword awkFunction bindtextdomain dcgettext dcngetext
syn keyword awkConditional if else
-syn keyword awkRepeat while for
+syn keyword awkRepeat while for do
-syn keyword awkTodo contained TODO
+syn keyword awkTodo contained TODO
-syn keyword awkPatterns BEGIN END
+syn keyword awkPatterns BEGIN END BEGINFILE ENDFILE
" GAWK ref. Chapter 7
" Built-in Variables That Control awk
@@ -74,20 +71,18 @@ syn keyword awkVariables ARGC ARGV ARGIND ENVIRON ERRNO FILENAME
syn keyword awkVariables FNR NF FUNCTAB NR PROCINFO RLENGTH RSTART
syn keyword awkVariables RT SYMTAB
-syn keyword awkRepeat do
" Octal format character.
syn match awkSpecialCharacter display contained "\\[0-7]\{1,3\}"
-syn keyword awkStatement func nextfile
" Hex format character.
syn match awkSpecialCharacter display contained "\\x[0-9A-Fa-f]\+"
syn match awkFieldVars "\$\d\+"
-"catch errors caused by wrong parenthesis
-syn region awkParen transparent start="(" end=")" contains=ALLBUT,awkParenError,awkSpecialCharacter,awkArrayElement,awkArrayArray,awkTodo,awkRegExp,awkBrktRegExp,awkBrackets,awkCharClass
+" catch errors caused by wrong parenthesis
+syn region awkParen transparent start="(" end=")" contains=ALLBUT,awkParenError,awkSpecialCharacter,awkArrayElement,awkArrayArray,awkTodo,awkRegExp,awkBrktRegExp,awkBrackets,awkCharClass,awkComment
syn match awkParenError display ")"
-syn match awkInParen display contained "[{}]"
+"syn match awkInParen display contained "[{}]"
" 64 lines for complex &&'s, and ||'s in a big "if"
syn sync ccomment awkParen maxlines=64
@@ -141,7 +136,7 @@ syn match awkExpression "?\|:"
syn keyword awkExpression in
" Boolean Logic (OR, AND, NOT)
-"syn match awkBoolLogic "||\|&&\|\!"
+syn match awkBoolLogic "||\|&&\|\!"
" This is overridden by less-than & greater-than.
" Put this above those to override them.
@@ -171,63 +166,42 @@ syn region awkArray transparent start="\[" end="\]" contains=awkArray,awkArrayE
" (for the few instances where it would be more than "oneline")
syn sync ccomment awkArray maxlines=10
-" 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_awk_syn_inits")
- if version < 508
- let did_awk_syn_inits = 1
- command -nargs=+ HiLink hi link <args>
- else
- command -nargs=+ HiLink hi def link <args>
- endif
-
- HiLink awkConditional Conditional
- HiLink awkFunction Function
- HiLink awkRepeat Repeat
- HiLink awkStatement Statement
-
- HiLink awkString String
- HiLink awkSpecialPrintf Special
- HiLink awkSpecialCharacter Special
-
- HiLink awkSearch String
- HiLink awkBrackets awkRegExp
- HiLink awkBrktRegExp awkNestRegExp
- HiLink awkCharClass awkNestRegExp
- HiLink awkNestRegExp Keyword
- HiLink awkRegExp Special
-
- HiLink awkNumber Number
- HiLink awkFloat Float
-
- HiLink awkFileIO Special
- HiLink awkOperator Special
- HiLink awkExpression Special
- HiLink awkBoolLogic Special
-
- HiLink awkPatterns Special
- HiLink awkVariables Special
- HiLink awkFieldVars Special
-
- HiLink awkLineSkip Special
- HiLink awkSemicolon Special
- HiLink awkComma Special
- "HiLink awkIdentifier Identifier
-
- HiLink awkComment Comment
- HiLink awkTodo Todo
-
- " Change this if you want nested array names to be highlighted.
- HiLink awkArrayArray awkArray
- HiLink awkArrayElement Special
-
- HiLink awkParenError awkError
- HiLink awkInParen awkError
- HiLink awkError Error
-
- delcommand HiLink
-endif
+" Define the default highlighting.
+" Only used when an item doesn't have highlighting yet
+hi def link awkConditional Conditional
+hi def link awkFunction Function
+hi def link awkRepeat Repeat
+hi def link awkStatement Statement
+hi def link awkString String
+hi def link awkSpecialPrintf Special
+hi def link awkSpecialCharacter Special
+hi def link awkSearch String
+hi def link awkBrackets awkRegExp
+hi def link awkBrktRegExp awkNestRegExp
+hi def link awkCharClass awkNestRegExp
+hi def link awkNestRegExp Keyword
+hi def link awkRegExp Special
+hi def link awkNumber Number
+hi def link awkFloat Float
+hi def link awkFileIO Special
+hi def link awkOperator Special
+hi def link awkExpression Special
+hi def link awkBoolLogic Special
+hi def link awkPatterns Special
+hi def link awkVariables Special
+hi def link awkFieldVars Special
+hi def link awkLineSkip Special
+hi def link awkSemicolon Special
+hi def link awkComma Special
+hi def link awkIdentifier Identifier
+hi def link awkComment Comment
+hi def link awkTodo Todo
+" Change this if you want nested array names to be highlighted.
+hi def link awkArrayArray awkArray
+hi def link awkArrayElement Special
+hi def link awkParenError awkError
+hi def link awkInParen awkError
+hi def link awkError Error
let b:current_syntax = "awk"