summaryrefslogtreecommitdiffstats
path: root/runtime/syntax
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2012-01-20 21:08:56 +0100
committerBram Moolenaar <Bram@vim.org>2012-01-20 21:08:56 +0100
commit6be7f8733f34333ed75f6e39425d73a6b2644379 (patch)
tree59ae0f289e6bfaaf3ed2e8ac5dcedb69e5656c01 /runtime/syntax
parent90b280059fd51790105ff2e433303be58d58c430 (diff)
Update runtime files.
Diffstat (limited to 'runtime/syntax')
-rw-r--r--runtime/syntax/c.vim22
-rw-r--r--runtime/syntax/d.vim161
-rw-r--r--runtime/syntax/erlang.vim341
-rw-r--r--runtime/syntax/fortran.vim547
-rw-r--r--runtime/syntax/gp.vim29
-rw-r--r--runtime/syntax/groovy.vim48
-rw-r--r--runtime/syntax/idl.vim583
-rw-r--r--runtime/syntax/mail.vim2
-rw-r--r--runtime/syntax/sh.vim89
-rw-r--r--runtime/syntax/tex.vim60
-rw-r--r--runtime/syntax/upstart.vim4
-rw-r--r--runtime/syntax/vim.vim49
12 files changed, 938 insertions, 997 deletions
diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim
index 7af0067f8a..4553519b09 100644
--- a/runtime/syntax/c.vim
+++ b/runtime/syntax/c.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2012 Jan 04
+" Last Change: 2012 Jan 14
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
@@ -62,6 +62,25 @@ syn match cSpecialCharacter display "L\='\\\o\{1,3}'"
syn match cSpecialCharacter display "'\\x\x\{1,2}'"
syn match cSpecialCharacter display "L'\\x\x\+'"
+if !exists("c_no_c11") " ISO C11
+ if exists("c_no_cformat")
+ syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell
+ else
+ syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell
+ endif
+ syn match cCharacter "[Uu]'[^\\]'"
+ syn match cCharacter "[Uu]'[^']*'" contains=cSpecial
+ if exists("c_gnu")
+ syn match cSpecialError "[Uu]'\\[^'\"?\\abefnrtv]'"
+ syn match cSpecialCharacter "[Uu]'\\['\"?\\abefnrtv]'"
+ else
+ syn match cSpecialError "[Uu]'\\[^'\"?\\abfnrtv]'"
+ syn match cSpecialCharacter "[Uu]'\\['\"?\\abfnrtv]'"
+ endif
+ syn match cSpecialCharacter display "[Uu]'\\\o\{1,3}'"
+ syn match cSpecialCharacter display "[Uu]'\\x\x\+'"
+endif
+
"when wanted, highlight trailing white space
if exists("c_space_errors")
if !exists("c_no_trail_space_error")
@@ -211,6 +230,7 @@ if !exists("c_no_c11")
syn keyword cStorageClass _Noreturn noreturn
syn keyword cOperator _Static_assert static_assert
syn keyword cStorageClass _Thread_local thread_local
+ syn keyword cType char16_t char32_t
endif
if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu")
diff --git a/runtime/syntax/d.vim b/runtime/syntax/d.vim
index b7f5ebac82..25318d8c4c 100644
--- a/runtime/syntax/d.vim
+++ b/runtime/syntax/d.vim
@@ -2,20 +2,21 @@
"
" Language: D
" Maintainer: Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
-" Last Change: 2010 Sep 21
-" Version: 0.22
+" Last Change: 2012 Jan 11
+" Version: 0.24
"
" Contributors:
" - Jason Mills <jasonmills@nf.sympatico.ca>: original Maintainer
-" - Kirk McDonald: version 0.17 updates, with minor modifications
-" (http://paste.dprogramming.com/dplmb7qx?view=hidelines)
-" - Tim Keating: patch to fix a bug in highlighting the `\` literal
-" - Frank Benoit: Fixed a bug that caused some identifiers and numbers to highlight as octal number errors.
-" - Shougo Matsushita <Shougo.Matsu@gmail.com>: updates for latest 2.047 highlighting
-" - Ellery Newcomer: Fixed some highlighting bugs.
-" - Steven N. Oliver: #! highlighting
+" - Kirk McDonald
+" - Tim Keating
+" - Frank Benoit
+" - Shougo Matsushita <Shougo.Matsu@gmail.com>
+" - Ellery Newcomer
+" - Steven N. Oliver
+" - Sohgo Takeuchi
"
-" Please email me with bugs, comments, and suggestions.
+" Please submit bugs/comments/suggestions to the github repo:
+" https://github.com/he-the-great/d.vim
"
" Options:
" d_comment_strings - Set to highlight strings and numbers in comments.
@@ -23,34 +24,23 @@
" d_hl_operator_overload - Set to highlight D's specially named functions
" that when overloaded implement unary and binary operators (e.g. opCmp).
"
-" Todo:
-" - Determine a better method of sync'ing than simply setting minlines
-" to a large number.
-"
-" - Several keywords (e.g., in, out, inout) are both storage class and
-" statements, depending on their context. Perhaps use pattern matching to
-" figure out which and highlight appropriately. For now I have made such
-" keywords storage classes so their highlighting is consistent with other
-" keywords that are commonly used with them, but are true storage classes,
-" such as lazy. Similarly, I made some statement keywords (e.g. body) storage
-" classes.
-"
-" - Mark contents of the asm statement body as special
-"
-" - Maybe highlight the 'exit', 'failure', and 'success' parts of the
-" scope() statement.
-"
-" - Highlighting DDoc comments.
-"
+" d_hl_object_types - Set to highlight some common types from object.di.
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
+" Support cpoptions
+let s:cpo_save = &cpo
+set cpo&vim
+
+" Set the current syntax to be known as d
+let b:current_syntax = "d"
+
" Keyword definitions
"
-syn keyword dExternal import package module extern
+syn keyword dExternal import module
syn keyword dConditional if else switch
syn keyword dBranch goto break continue
syn keyword dRepeat while for do foreach foreach_reverse
@@ -77,21 +67,34 @@ if exists("d_hl_operator_overload")
syn keyword dOpOverload opCall opSlice opSliceAssign opSliceOpAssign
syn keyword dOpOverload opPos opAdd_r opMul_r opAnd_r opOr_r opXor_r
syn keyword dOpOverload opIn opIn_r opPow opDispatch opStar opDot
- syn keyword dOpOverload opApply opApplyReverse
+ syn keyword dOpOverload opApply opApplyReverse opDollar
syn keyword dOpOverload opUnary opIndexUnary opSliceUnary
syn keyword dOpOverload opBinary opBinaryRight
endif
-syn keyword dType void ushort int uint long ulong float
-syn keyword dType byte ubyte double bit char wchar ucent cent
-syn keyword dType short bool dchar wstring dstring
-syn keyword dType real ireal ifloat idouble
-syn keyword dType creal cfloat cdouble
+syn keyword dType byte ubyte short ushort int uint long ulong cent ucent
+syn keyword dType void bool bit
+syn keyword dType float double real
+syn keyword dType ushort int uint long ulong float
+syn keyword dType char wchar dchar string wstring dstring
+syn keyword dType ireal ifloat idouble creal cfloat cdouble
+syn keyword dType size_t ptrdiff_t sizediff_t equals_t hash_t
+if exists("d_hl_object_types")
+ syn keyword dType Object Throwable AssociativeArray Error Exception
+ syn keyword dType Interface OffsetTypeInfo TypeInfo TypeInfo_Typedef
+ syn keyword dType TypeInfo_Enum TypeInfo_Pointer TypeInfo_Array
+ syn keyword dType TypeInfo_StaticArray TypeInfo_AssociativeArray
+ syn keyword dType TypeInfo_Function TypeInfo_Delegate TypeInfo_Class
+ syn keyword dType ClassInfo TypeInfo_Interface TypeInfo_Struct
+ syn keyword dType TypeInfo_Tuple TypeInfo_Const TypeInfo_Invariant
+ syn keyword dType TypeInfo_Shared TypeInfo_Inout MemberInfo
+ syn keyword dType MemberInfo_field MemberInfo_function ModuleInfo
+endif
syn keyword dDebug deprecated unittest invariant
syn keyword dExceptions throw try catch finally
-syn keyword dScopeDecl public protected private export
+syn keyword dScopeDecl public protected private export package
syn keyword dStatement debug return with
-syn keyword dStatement function delegate __traits mixin macro
+syn keyword dStatement function delegate __ctfe mixin macro
syn keyword dStorageClass in out inout ref lazy body
syn keyword dStorageClass pure nothrow
syn keyword dStorageClass auto static override final abstract volatile
@@ -100,15 +103,26 @@ syn keyword dStorageClass synchronized shared immutable const lazy
syn keyword dPragma pragma
syn keyword dIdentifier _arguments _argptr __vptr __monitor _ctor _dtor
syn keyword dScopeIdentifier contained exit success failure
+syn keyword dTraitsIdentifier contained isAbstractClass isArithmetic isAssociativeArray
+syn keyword dTraitsIdentifier contained isFinalClass isFloating isIntegral isScalar
+syn keyword dTraitsIdentifier contained isStaticArray isUnsigned isVirtualFunction
+syn keyword dTraitsIdentifier contained isAbstractFunction isFinalFunction isStaticFunction
+syn keyword dTraitsIdentifier contained isRef isOut isLazy hasMember identifier getMember
+syn keyword dTraitsIdentifier contained getOverloads getVirtualFunctions parent compiles
+syn keyword dTraitsIdentifier contained classInstanceSize allMembers derivedMembers isSame
+syn keyword dExternIdentifier contained Windows Pascal Java System D
syn keyword dAttribute contained safe trusted system
syn keyword dAttribute contained property disable
-syn keyword dVersionIdentifier contained DigitalMars GNU LDC LLVM
-syn keyword dVersionIdentifier contained X86 X86_64 Windows Win32 Win64
-syn keyword dVersionIdentifier contained linux Posix OSX FreeBSD
-syn keyword dVersionIdentifier contained LittleEndian BigEndian D_Coverage
-syn keyword dVersionIdentifier contained D_Ddoc D_InlineAsm_X86
-syn keyword dVersionIdentifier contained D_InlineAsm_X86_64 D_LP64 D_PIC
-syn keyword dVersionIdentifier contained unittest D_Version2 none all
+syn keyword dVersionIdentifier contained DigitalMars GNU LDC SDC D_NET
+syn keyword dVersionIdentifier contained X86 X86_64 ARM PPC PPC64 IA64 MIPS MIPS64 Alpha
+syn keyword dVersionIdentifier contained SPARC SPARC64 S390 S390X HPPA HPPA64 SH SH64
+syn keyword dVersionIdentifier contained linux Posix OSX FreeBSD Windows Win32 Win64
+syn keyword dVersionIdentifier contained OpenBSD BSD Solaris AIX SkyOS SysV3 SysV4 Hurd
+syn keyword dVersionIdentifier contained Cygwin MinGW
+syn keyword dVersionIdentifier contained LittleEndian BigEndian
+syn keyword dVersionIdentifier contained D_InlineAsm_X86 D_InlineAsm_X86_64
+syn keyword dVersionIdentifier contained D_Version2 D_Coverage D_Ddoc D_LP64 D_PIC
+syn keyword dVersionIdentifier contained unittest none all
" Highlight the sharpbang
syn match dSharpBang "\%^#!.*" display
@@ -117,23 +131,38 @@ syn match dSharpBang "\%^#!.*" display
syn match dAnnotation "@[_$a-zA-Z][_$a-zA-Z0-9_]*\>" contains=dAttribute
" Version Identifiers
-syn match dVersion "[^.]version" nextgroup=dVersionInside
-syn match dVersion "^version" nextgroup=dVersionInside
-syn match dVersionInside "([_a-zA-Z][_a-zA-Z0-9]*\>" transparent contained contains=dVersionIdentifier
+syn match dVersion "[^.]\<version\>"hs=s+1 nextgroup=dVersionInside
+syn match dVersion "^\<version\>" nextgroup=dVersionInside
+syn match dVersionInside "\s*([_a-zA-Z][_a-zA-Z0-9]*\>" transparent contained contains=dVersionIdentifier
" Scope StorageClass
-syn match dStorageClass "scope"
+syn match dStorageClass "\<scope\>"
+
+" Traits Expression
+syn match dStatement "\<__traits\>"
+
+" Extern Modifier
+syn match dExternal "\<extern\>"
" Scope Identifiers
-syn match dScope "scope\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+5 contains=dScopeIdentifier
+syn match dScope "\<scope\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+5 contains=dScopeIdentifier
+
+" Traits Identifiers
+syn match dTraits "\<__traits\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+8 contains=dTraitsIdentifier
+
+" Necessary to highlight C++ in extern modifiers.
+syn match dExternIdentifier "C\(++\)\?" contained
+
+" Extern Identifiers
+syn match dExtern "\<extern\s*([_a-zA-Z][_a-zA-Z0-9\+]*\>"he=s+6 contains=dExternIdentifier
" String is a statement and a module name.
-syn match dType "^string"
-syn match dType "[^.]\s*\<string\>"ms=s+1
+syn match dType "[^.]\<string\>"ms=s+1
+syn match dType "^\<string\>"
" Assert is a statement and a module name.
-syn match dAssert "^assert"
-syn match dAssert "[^.]\s*\<assert\>"ms=s+1
+syn match dAssert "[^.]\<assert\>"ms=s+1
+syn match dAssert "^\<assert\>"
" dTokens is used by the token string highlighting
syn cluster dTokens contains=dExternal,dConditional,dBranch,dRepeat,dBoolean
@@ -161,12 +190,12 @@ if exists("d_comment_strings")
syn region dBlockCommentString contained start=+"+ end=+"+ end=+\*/+me=s-1,he=s-1 contains=dCommentStar,dUnicode,dEscSequence,@Spell
syn region dNestedCommentString contained start=+"+ end=+"+ end="+"me=s-1,he=s-1 contains=dCommentPlus,dUnicode,dEscSequence,@Spell
syn region dLineCommentString contained start=+"+ end=+$\|"+ contains=dUnicode,dEscSequence,@Spell
- syn region dBlockComment start="/\*" end="\*/" contains=dBlockCommentString,dTodo,@Spell
- syn region dNestedComment start="/+" end="+/" contains=dNestedComment,dNestedCommentString,dTodo,@Spell
+ syn region dBlockComment start="/\*" end="\*/" contains=dBlockCommentString,dTodo,@Spell fold
+ syn region dNestedComment start="/+" end="+/" contains=dNestedComment,dNestedCommentString,dTodo,@Spell fold
syn match dLineComment "//.*" contains=dLineCommentString,dTodo,@Spell
else
- syn region dBlockComment start="/\*" end="\*/" contains=dBlockCommentString,dTodo,@Spell
- syn region dNestedComment start="/+" end="+/" contains=dNestedComment,dNestedCommentString,dTodo,@Spell
+ syn region dBlockComment start="/\*" end="\*/" contains=dBlockCommentString,dTodo,@Spell fold
+ syn region dNestedComment start="/+" end="+/" contains=dNestedComment,dNestedCommentString,dTodo,@Spell fold
syn match dLineComment "//.*" contains=dLineCommentString,dTodo,@Spell
endif
@@ -280,6 +309,10 @@ syn case match
" TODO: Highlight following Integer and optional Filespec.
syn region dPragma start="#\s*\(line\>\)" skip="\\$" end="$"
+" Block
+"
+syn region dBlock start="{" end="}" transparent fold
+
" The default highlighting.
"
@@ -330,12 +363,14 @@ hi def link dAnnotation PreProc
hi def link dSharpBang PreProc
hi def link dAttribute StorageClass
hi def link dIdentifier Identifier
-hi def link dVersionIdentifier Identifier
hi def link dVersion dStatement
-hi def link dScopeIdentifier dStatement
+hi def link dVersionIdentifier Identifier
hi def link dScope dStorageClass
-
-let b:current_syntax = "d"
+hi def link dScopeIdentifier Identifier
+hi def link dTraits dStatement
+hi def link dTraitsIdentifier Identifier
+hi def link dExtern dExternal
+hi def link dExternIdentifier Identifier
" Marks contents of the asm statment body as special
@@ -464,3 +499,5 @@ syn keyword dAsmOpCode contained pfnacc pfpnacc pfrcp pfrcpit1 pfrcpit2
syn keyword dAsmOpCode contained pfrsqit1 pfrsqrt pfsub pfsubr pi2fd
syn keyword dAsmOpCode contained pmulhrw pswapd
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/syntax/erlang.vim b/runtime/syntax/erlang.vim
index 2f39d61437..28bc4a5d35 100644
--- a/runtime/syntax/erlang.vim
+++ b/runtime/syntax/erlang.vim
@@ -1,229 +1,126 @@
" Vim syntax file
-" Language: erlang (ERicsson LANGuage)
-" http://www.erlang.se
-" http://www.erlang.org
-" Maintainer: Csaba Hoch <csaba.hoch@gmail.com>
-" Former Maintainer: Kreąimir Marľić (Kresimir Marzic) <kmarzic@fly.srk.fer.hr>
-" Last update: 12-Mar-2008
-" Filenames: .erl
-
-
-" There are three sets of highlighting in here:
-" One is "erlang_characters", second is "erlang_functions" and third
-" is "erlang_keywords".
-" If you want to disable keywords highlighting, put in your .vimrc:
-" let erlang_keywords=1
-" If you want to disable erlang BIF highlighting, put in your .vimrc
-" this:
-" let erlang_functions=1
-" If you want to disable special characters highlighting, put in
-" your .vimrc:
-" let erlang_characters=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
+" Language: Erlang
+" Author: Oscar Hellström <oscar@oscarh.net> (http://oscar.hellstrom.st)
+" Contributors: Ricardo Catalinas Jiménez <jimenezrick@gmail.com>
+" License: Vim license
+" Version: 2011/09/11
+
+if exists("b:current_syntax")
+ finish
+else
+ let b:current_syntax = "erlang"
endif
-
-" Case sensitive
-syn case match
-
-
-if ! exists ("erlang_characters")
-
- " Basic elements
- syn match erlangComment "%.*$" contains=erlangAnnotation,erlangTodo
- syn match erlangAnnotation " \@<=@\%(clear\|docfile\|end\|headerfile\|todo\|TODO\|type\|author\|copyright\|doc\|reference\|see\|since\|title\|version\|deprecated\|hidden\|private\|equiv\|spec\|throws\)" contained
- syn match erlangAnnotation "`[^']*'" contained
- syn keyword erlangTodo TODO FIXME XXX contained
- syn match erlangModifier "\~\a\|\\\a\|\\\\" contained
- syn match erlangSpecialCharacter ":\|_\|@\|\\\|\"\|\."
- syn match erlangSeparator "(\|)\|{\|}\|\[\|]\||\|||\|;\|,\|?\|->\|#" contained
- syn region erlangString start=+"+ skip=+\\.+ end=+"+ contains=erlangModifier
- syn region erlangAtom start=+'+ skip=+\\'+ end=+'+
-
- " Operators
- syn match erlangOperator "+\|-\|\*\|\/"
- syn keyword erlangOperator div rem or xor bor bxor bsl bsr
- syn keyword erlangOperator and band not bnot andalso orelse
- syn match erlangOperator "==\|/=\|=:=\|=/=\|<\|=<\|>\|>="
- syn match erlangOperator "++\|--\|=\|!\|<-"
-
- " Numbers
- syn match erlangNumberInteger "\d\+" contains=erlangSeparator
- syn match erlangNumberFloat1 "\d\+\.\d\+" contains=erlangSeparator
- syn match erlangNumberFloat2 "\d\+\(\.\d\+\)\=[eE][+-]\=\d\+\(\.\d\+\)\=" contains=erlangSeparator
- syn match erlangNumberFloat3 "\d\+[#]\x\+" contains=erlangSeparator
- syn match erlangNumberHex "$\x\+" contains=erlangSeparator
-
- " Ignore '_' and '-' in words
- syn match erlangWord "\h\+\w*"
-
- syn match erlangChar /\$./
+if !exists("g:erlang_highlight_bif")
+ let g:erlang_highlight_bif = 1
endif
-if ! exists ("erlang_functions")
- " Functions call
- syn match erlangFCall "\%(\w\+\s*\.\s*\)*\w\+\s*[:@]\s*\w\+"
-
- " build-in-functions (BIFs)
- syn keyword erlangBIF abs alive apply atom_to_list
- syn keyword erlangBIF binary_to_list binary_to_term
- syn keyword erlangBIF concat_binary
- syn keyword erlangBIF date disconnect_node
- syn keyword erlangBIF element erase exit
- syn keyword erlangBIF float float_to_list
- syn keyword erlangBIF get get_keys group_leader
- syn keyword erlangBIF halt hd
- syn keyword erlangBIF integer_to_list is_alive
- syn keyword erlangBIF length link list_to_atom list_to_binary
- syn keyword erlangBIF list_to_float list_to_integer list_to_pid
- syn keyword erlangBIF list_to_tuple load_module
- syn keyword erlangBIF make_ref monitor_node
- syn keyword erlangBIF node nodes now
- syn keyword erlangBIF open_port
- syn keyword erlangBIF pid_to_list process_flag
- syn keyword erlangBIF process_info process put
- syn keyword erlangBIF register registered round
- syn keyword erlangBIF self setelement size spawn
- syn keyword erlangBIF spawn_link split_binary statistics
- syn keyword erlangBIF term_to_binary throw time tl trunc
- syn keyword erlangBIF tuple_to_list
- syn keyword erlangBIF unlink unregister
- syn keyword erlangBIF whereis
-
- " Other BIFs
- syn keyword erlangBIF atom binary constant function integer
- syn keyword erlangBIF list number pid ports port_close port_info
- syn keyword erlangBIF reference record
-
- " erlang:BIFs
- syn keyword erlangBIF check_process_code delete_module
- syn keyword erlangBIF get_cookie hash math module_loaded
- syn keyword erlangBIF preloaded processes purge_module set_cookie
- syn keyword erlangBIF set_node
-
- " functions of math library
- syn keyword erlangFunction acos asin atan atan2 cos cosh exp
- syn keyword erlangFunction log log10 pi pow power sin sinh sqrt
- syn keyword erlangFunction tan tanh
-
- " Other functions
- syn keyword erlangFunction call module_info parse_transform
- syn keyword erlangFunction undefined_function
-
- " Modules
- syn keyword erlangModule error_handler
-endif
-
-if ! exists ("erlang_keywords")
- " Constants and Directives
- syn match erlangDirective "-behaviour\|-behavior"
- syn match erlangDirective "-compile\|-define\|-else\|-endif\|-export\|-file"
- syn match erlangDirective "-ifdef\|-ifndef\|-import\|-include_lib\|-include"
- syn match erlangDirective "-module\|-record\|-undef"
-
- syn match erlangConstant "-author\|-copyright\|-doc\|-vsn"
-
- " Keywords
- syn keyword erlangKeyword after begin case catch
- syn keyword erlangKeyword cond end fun if
- syn keyword erlangKeyword let of query receive
- syn keyword erlangKeyword when
- syn keyword erlangKeyword try
-
- " Processes
- syn keyword erlangProcess creation current_function dictionary
- syn keyword erlangProcess group_leader heap_size high initial_call
- syn keyword erlangProcess linked low memory_in_use message_queue
- syn keyword erlangProcess net_kernel node normal priority
- syn keyword erlangProcess reductions registered_name runnable
- syn keyword erlangProcess running stack_trace status timer
- syn keyword erlangProcess trap_exit waiting
-
- " Ports
- syn keyword erlangPort command count_in count_out creation in
- syn keyword erlangPort in_format linked node out owner packeting
-
- " Nodes
- syn keyword erlangNode atom_tables communicating creation
- syn keyword erlangNode current_gc current_reductions current_runtime
- syn keyword erlangNode current_wall_clock distribution_port
- syn keyword erlangNode entry_points error_handler friends
- syn keyword erlangNode garbage_collection magic_cookie magic_cookies
- syn keyword erlangNode module_table monitored_nodes name next_ref
- syn keyword erlangNode ports preloaded processes reductions
- syn keyword erlangNode ref_state registry runtime wall_clock
-
- " Reserved
- syn keyword erlangReserved apply_lambda module_info module_lambdas
- syn keyword erlangReserved record record_index record_info
-
- " Extras
- syn keyword erlangExtra badarg nocookie false fun true
-
- " Signals
- syn keyword erlangSignal badsig kill killed exit normal
-endif
-
-
+" Erlang is case sensitive
+syn case match
-" 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_erlang_inits")
- if version < 508
- let did_erlang_inits = 1
- command -nargs=+ HiLink hi link <args>
- else
- command -nargs=+ HiLink hi def link <args>
- endif
-
- " erlang_characters
- HiLink erlangComment Comment
- HiLink erlangAnnotation Special
- HiLink erlangTodo Todo
- HiLink erlangSpecialCharacter Special
- HiLink erlangSeparator Normal
- HiLink erlangModifier Special
- HiLink erlangOperator Operator
- HiLink erlangString String
- HiLink erlangAtom Type
-
- HiLink erlangNumberInteger Number
- HiLink erlangNumberFloat1 Float
- HiLink erlangNumberFloat2 Float
- HiLink erlangNumberFloat3 Float
- HiLink erlangNumberFloat4 Float
- HiLink erlangNumberHex Number
-
- HiLink erlangWord Normal
-
- " erlang_functions
- HiLink erlangFCall Function
- HiLink erlangBIF Function
- HiLink erlangFunction Function
- HiLink erlangModuleFunction Function
-
- " erlang_keywords
- HiLink erlangDirective Type
- HiLink erlangConstant Type
- HiLink erlangKeyword Keyword
- HiLink erlangProcess Special
- HiLink erlangPort Special
- HiLink erlangNode Special
- HiLink erlangReserved Statement
- HiLink erlangExtra Statement
- HiLink erlangSignal Statement
-
- delcommand HiLink
+" Match groups
+syn match erlangStringModifier /\\./ contained
+syn match erlangStringModifier /\~\%(-\?[0-9*]\+\)\?\%(\.[0-9*]\+\..\?\)\?\%(c\|f\|e\|g\|s\|w\|p\|W\|P\|B\|X\|#\|b\|+\|n\|i\)/ contained
+syn match erlangModifier /\$\\\?./
+
+syn match erlangInteger /\<\%([0-9]\+#[0-9a-fA-F]\+\|[0-9]\+\)\>/
+syn match erlangFloat /\<[0-9]\+\.[0-9]\+\%(e-\?[0-9]\+\)\?\>/
+
+syn keyword erlangTodo TODO FIXME XXX contained
+syn match erlangComment /%.*$/ contains=@Spell,erlangTodo,erlangAnnotation
+syn match erlangAnnotation /\%(%\s\)\@<=@\%(author\|clear\|copyright\|deprecated\|doc\|docfile\|end\|equiv\|headerfile\|hidden\|private\|reference\|see\|since\|spec\|throws\|title\|todo\|TODO\|type\|version\)/ contained
+syn match erlangAnnotation /`[^']\+'/ contained
+
+syn keyword erlangKeyword band bor bnot bsl bsr bxor div rem xor
+syn keyword erlangKeyword try catch begin receive after cond fun let query
+
+syn keyword erlangConditional case if of end
+syn keyword erlangConditional not and or andalso orelse
+syn keyword erlangConditional when
+
+syn keyword erlangBoolean true false
+
+syn keyword erlangGuard is_list is_alive is_atom is_binary is_bitstring is_boolean is_tuple is_number is_integer is_float is_function is_constant is_pid is_port is_reference is_record is_process_alive
+
+syn match erlangOperator /\/\|*\|+\|-\|++\|--/
+syn match erlangOperator /->\|<-\|||\||\|!\|=/
+syn match erlangOperator /=:=\|==\|\/=\|=\/=\|<\|>\|=<\|>=/
+syn keyword erlangOperator div rem
+
+syn region erlangString start=/"/ end=/"/ skip=/\\/ contains=@Spell,erlangStringModifier
+
+syn match erlangVariable /\<[A-Z_]\w*\>/
+syn match erlangAtom /\%(\%(^-\)\|#\)\@<!\<[a-z][A-Za-z0-9_]*\>\%(\s*[(:]\)\@!/
+syn match erlangAtom /\\\@<!'[^']*\\\@<!'/
+
+syn match erlangRecord /#\w\+/
+
+syn match erlangTuple /{\|}/
+syn match erlangList /\[\|\]/
+
+syn match erlangAttribute /^-\%(vsn\|author\|copyright\|compile\|deprecated\|module\|export\|import\|behaviour\|behavior\|export_type\|ignore_xref\|on_load\)\s*(\@=/
+syn match erlangInclude /^-include\%(_lib\)\?\s*(\@=/
+syn match erlangRecordDef /^-record\s*(\@=/
+syn match erlangDefine /^-\%(define\|undef\)\s*(\@=/
+syn match erlangPreCondit /^-\%(ifdef\|ifndef\|else\|endif\)\%(\s*(\@=\)\?/
+
+syn match erlangType /^-\%(spec\|type\)[( ]\@=/
+
+syn match erlangMacro /\%(-define(\)\@<=\w\+/
+syn match erlangMacro /?\??\w\+/
+
+syn match erlangBitType /\%(\/\|-\)\@<=\%(bits\|bitstring\|binary\|integer\|float\|unit\)\>/
+syn match erlangBitSize /:\@<=[0-9]\+/
+
+syn match erlangBinary /<<\|>>/
+
+" BIFs
+syn match erlangBIF /\%([^:0-9A-Za-z_]\|\<erlang:\)\@<=\%(abs\|apply\|atom_to_binary\|atom_to_list\|binary_part\|binary_to_atom\|binary_to_existing_atom\|binary_to_list\|binary_to_term\|bit_size\|bitstring_to_list\|byte_size\|check_process_code\|date\|delete_module\|demonitor\|disconnect_node\|element\|erase\|exit\|float\|float_to_list\|garbage_collect\|get\|get_keys\|group_leader\|hd\|integer_to_list\|iolist_size\|iolist_to_binary\|is_alive\|is_atom\|is_binary\|is_bitstring\|is_boolean\|is_float\|is_function\|is_integer\|is_list\|is_number\|is_pid\|is_port\|is_process_alive\|is_record\|is_reference\|is_tuple\|length\|link\|list_to_atom\|list_to_binary\|list_to_bitstring\|list_to_existing_atom\|list_to_float\|list_to_integer\|list_to_pid\|list_to_tuple\|load_module\|make_ref\|max\|min\|module_loaded\|monitor\|monitor_node\|node\|nodes\|now\|open_port\|pid_to_list\|port_close\|port_command\|port_connect\|port_control\|pre_loaded\|processes\|process_flag\|process_info\|purge_module\|put\|register\|registered\|round\|self\|setelement\|size\|spawn\|spawn_link\|spawn_monitor\|spawn_opt\|split_binary\|statistics\|term_to_binary\|time\|tl\|trunc\|tuple_size\|tuple_to_list\|unlink\|unregister\|whereis\)\%((\|\/[0-9]\)\@=/
+syn match erlangBIF /\<\%(erlang:\)\@<=\%(append_element\|bump_reductions\|cancel_timer\|decode_packet\|display\|function_exported\|fun_info\|fun_to_list\|get_cookie\|get_stacktrace\|hash\|is_builtin\|loaded\|load_nif\|localtime\|localtime_to_universaltime\|make_tuple\|memory\|monitor_node\|phash\|port_call\|port_info\|ports\|port_to_list\|process_display\|read_timer\|ref_to_list\|resume_process\|send\|send_after\|send_nosuspend\|set_cookie\|start_timer\|suspend_process\|system_flag\|system_info\|system_monitor\|system_profile\|trace\|trace_delivered\|trace_info\|trace_pattern\|universaltime\|universaltime_to_localtime\|yield\)(\@=/
+syn match erlangGBIF /erlang\%(:\w\)\@=/
+
+" Link Erlang stuff to Vim groups
+hi link erlangTodo Todo
+hi link erlangString String
+hi link erlangNoSpellString String
+hi link erlangModifier SpecialChar
+hi link erlangStringModifier SpecialChar
+hi link erlangComment Comment
+hi link erlangAnnotation Special
+hi link erlangVariable Identifier
+hi link erlangInclude Include
+hi link erlangRecordDef Keyword
+hi link erlangAttribute Keyword
+hi link erlangKeyword Keyword
+hi link erlangMacro Macro
+hi link erlangDefine Define
+hi link erlangPreCondit PreCondit
+hi link erlangPreProc PreProc
+hi link erlangDelimiter Delimiter
+hi link erlangBitDelimiter Normal
+hi link erlangOperator Operator
+hi link erlangConditional Conditional
+hi link erlangGuard Conditional
+hi link erlangBoolean Boolean
+hi link erlangAtom Constant
+hi link erlangRecord Structure
+hi link erlangInteger Number
+hi link erlangFloat Number
+hi link erlangFloat Number
+hi link erlangFloat Number
+hi link erlangFloat Number
+hi link erlangHex Number
+hi link erlangFun Keyword
+hi link erlangList Delimiter
+hi link erlangTuple Delimiter
+hi link erlangBinary Keyword
+hi link erlangBitVariable Identifier
+hi link erlangBitType Type
+hi link erlangType Type
+hi link erlangBitSize Number
+
+" Optional highlighting
+if g:erlang_highlight_bif
+ hi link erlangBIF Keyword
+ hi link erlangGBIF Keyword
endif
-
-
-let b:current_syntax = "erlang"
-
diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim
index 3e5cb220b6..6fe42af6f1 100644
--- a/runtime/syntax/fortran.vim
+++ b/runtime/syntax/fortran.vim
@@ -1,7 +1,7 @@
" Vim syntax file
-" Language: Fortran 2008 (and earlier versions including 2003, 95, 90, and 77)
-" Version: 0.91
-" Last Change: 2012 Jan. 02
+" Language: Fortran 2008 (and earlier versions: 2003, 95, 90, and 77)
+" Version: 0.93
+" Last Change: 2012 Jan. 18
" Maintainer: Ajit J. Thakkar (ajit AT unb.ca); <http://www.unb.ca/chem/ajit/>
" Usage: For instructions, do :help fortran-syntax from Vim
" Credits:
@@ -11,66 +11,48 @@
" Walter Dieudonné, Alexander Wagner, Roman Bertle, Charles Rendleman,
" Andrew Griffiths, Joe Krahn, and Hendrik Merx.
-" For version 5.x: Clear all syntax items
-" For version 6.x: Quit if a syntax file is already loaded
-if version < 600
- syntax clear
-elseif exists("b:current_syntax")
+if exists("b:current_syntax")
finish
endif
let s:cpo_save = &cpo
set cpo&vim
-" let b:fortran_dialect = fortran_dialect if set correctly by user
-if exists("fortran_dialect")
- if fortran_dialect =~ '\<\(f\(9[05]\|77\)\|elf\|F\)\>'
- let b:fortran_dialect = matchstr(fortran_dialect,'\<\(f\(9[05]\|77\)\|elf\|F\)\>')
- else
- echohl WarningMsg | echo "Unknown value of fortran_dialect" | echohl None
- let b:fortran_dialect = "unknown"
+" Choose fortran_dialect using the priority:
+" source file directive > buffer-local value > global value > default
+" try using directive in first three lines of file
+let b:fortran_retype = getline(1)." ".getline(2)." ".getline(3)
+if b:fortran_retype =~? '\<fortran_dialect\s*=\s*F\>'
+ let b:fortran_dialect = "F"
+elseif b:fortran_retype =~? '\<fortran_dialect\s*=\s*f08\>'
+ let b:fortran_dialect = "f08"
+elseif !exists("b:fortran_dialect")
+ if exists("g:fortran_dialect") && g:fortran_dialect =~# '\<F\|f08\>'
+ " try global variable
+ let b:fortran_dialect = g:fortran_dialect
+ else " nothing found, so use default
+ let b:fortran_dialect = "f08"
endif
-else
- let b:fortran_dialect = "unknown"
endif
-
-" fortran_dialect not set or set incorrectly by user,
-if b:fortran_dialect == "unknown"
- " set b:fortran_dialect from directive in first three lines of file
- let b:fortran_retype = getline(1)." ".getline(2)." ".getline(3)
- if b:fortran_retype =~ '\<fortran_dialect\s*=\s*F\>'
- let b:fortran_dialect = "F"
- elseif b:fortran_retype =~ '\<fortran_dialect\s*=\s*elf\>'
- let b:fortran_dialect = "elf"
- elseif b:fortran_retype =~ '\<fortran_dialect\s*=\s*f90\>'
- let b:fortran_dialect = "f90"
- elseif b:fortran_retype =~ '\<fortran_dialect\s*=\s*f95\>'
- let b:fortran_dialect = "f95"
- elseif b:fortran_retype =~ '\<fortran_dialect\s*=\s*f77\>'
- let b:fortran_dialect = "f77"
- else
- " no directive found, so assume f95
- let b:fortran_dialect = "f95"
- endif
- unlet b:fortran_retype
+unlet! b:fortran_retype
+" make sure buffer-local value is not invalid
+if b:fortran_dialect !~# '\<F\|f08\>'
+ let b:fortran_dialect = "f08"
endif
" Choose between fixed and free source form if this hasn't been done yet
if !exists("b:fortran_fixed_source")
- if b:fortran_dialect == "elf" || b:fortran_dialect == "F"
- " elf and F require free source form
+ if b:fortran_dialect == "F"
+ " F requires free source form
let b:fortran_fixed_source = 0
- elseif b:fortran_dialect == "f77"
- " f77 requires fixed source form
- let b:fortran_fixed_source = 1
elseif exists("fortran_free_source")
- " User guarantees free source form for all f90 and f95 files
+ " User guarantees free source form for all fortran files
let b:fortran_fixed_source = 0
elseif exists("fortran_fixed_source")
- " User guarantees fixed source form for all f90 and f95 files
+ " User guarantees fixed source form for all fortran files
let b:fortran_fixed_source = 1
else
- " f90 and f95 allow both fixed and free source form.
+ " Modern fortran still allows both free and fixed source form.
" Assume fixed source form unless signs of free source form
" are detected in the first five columns of the first s:lmax lines.
" Detection becomes more accurate and time-consuming if more lines
@@ -96,29 +78,18 @@ endif
syn case ignore
-if b:fortran_dialect !=? "f77"
- if version >= 600
- if b:fortran_fixed_source == 1
- syn match fortranConstructName "^\s\{6,}\zs\a\w*\ze\s*:"
- else
- syn match fortranConstructName "^\s*\zs\a\w*\ze\s*:"
- endif
- if exists("fortran_more_precise")
- syn match fortranConstructName "\(\<end\s*do\s\+\)\@<=\a\w*"
- syn match fortranConstructName "\(\<end\s*if\s\+\)\@<=\a\w*"
- syn match fortranConstructNa