diff runtime/syntax/php.vim @ 18594:e9a47bcf7b94

Update runtime files Commit: https://github.com/vim/vim/commit/5ef1c6a4838a9629b793f3ae676f72a764171b00 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 10 22:09:11 2019 +0100 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Sun, 10 Nov 2019 22:15:04 +0100
parents c460506890ba
children 7f88f6a3ed4c
line wrap: on
line diff
--- a/runtime/syntax/php.vim
+++ b/runtime/syntax/php.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language: php PHP 3/4/5/7
 " Maintainer: Jason Woofenden <jason@jasonwoof.com>
-" Last Change: Jun 20, 2018
+" Last Change: Oct 19, 2019
 " URL: https://jasonwoof.com/gitweb/?p=vim-syntax.git;a=blob;f=php.vim;hb=HEAD
 " Former Maintainers: Peter Hodge <toomuchphp-vim@yahoo.com>
 "         Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
@@ -285,34 +285,34 @@ syn region phpIdentifierComplex matchgro
 syn region phpIdentifierComplexP matchgroup=phpParent start="\[" end="]" contains=@phpClInside contained
 
 " Interpolated indentifiers (inside strings)
-	syn match phpBrackets "[][}{]" contained display
-	" errors
-		syn match phpInterpSimpleError "\[[^]]*\]" contained display " fallback (if nothing else matches)
-		syn match phpInterpSimpleError "->[^a-zA-Z_]" contained display
-		" make sure these stay above the correct DollarCurlies so they don't take priority
-		syn match phpInterpBogusDollarCurley "${[^}]*}" contained display " fallback (if nothing else matches)
-	syn match phpinterpSimpleBracketsInner "\w\+" contained
-	syn match phpInterpSimpleBrackets "\[\h\w*]" contained contains=phpBrackets,phpInterpSimpleBracketsInner
-	syn match phpInterpSimpleBrackets "\[\d\+]" contained contains=phpBrackets,phpInterpSimpleBracketsInner
-	syn match phpInterpSimpleBrackets "\[0[xX]\x\+]" contained contains=phpBrackets,phpInterpSimpleBracketsInner
-	syn match phpInterpSimple "\$\h\w*\(\[[^]]*\]\|->\h\w*\)\?" contained contains=phpInterpSimpleBrackets,phpIdentifier,phpInterpSimpleError,phpMethods,phpMemberSelector display
-	syn match phpInterpVarname "\h\w*" contained
-	syn match phpInterpMethodName "\h\w*" contained " default color
-	syn match phpInterpSimpleCurly "\${\h\w*}" contains=phpInterpVarname contained extend
-	syn region phpInterpDollarCurley1Helper matchgroup=phpParent start="{" end="\[" contains=phpInterpVarname contained
-	syn region phpInterpDollarCurly1 matchgroup=phpParent start="\${\h\w*\["rs=s+1 end="]}" contains=phpInterpDollarCurley1Helper,@phpClConst contained extend
+  syn match phpBrackets "[][}{]" contained display
+  " errors
+    syn match phpInterpSimpleError "\[[^]]*\]" contained display " fallback (if nothing else matches)
+    syn match phpInterpSimpleError "->[^a-zA-Z_]" contained display
+    " make sure these stay above the correct DollarCurlies so they don't take priority
+    syn match phpInterpBogusDollarCurley "${[^}]*}" contained display " fallback (if nothing else matches)
+  syn match phpinterpSimpleBracketsInner "\w\+" contained
+  syn match phpInterpSimpleBrackets "\[\h\w*]" contained contains=phpBrackets,phpInterpSimpleBracketsInner
+  syn match phpInterpSimpleBrackets "\[\d\+]" contained contains=phpBrackets,phpInterpSimpleBracketsInner
+  syn match phpInterpSimpleBrackets "\[0[xX]\x\+]" contained contains=phpBrackets,phpInterpSimpleBracketsInner
+  syn match phpInterpSimple "\$\h\w*\(\[[^]]*\]\|->\h\w*\)\?" contained contains=phpInterpSimpleBrackets,phpIdentifier,phpInterpSimpleError,phpMethods,phpMemberSelector display
+  syn match phpInterpVarname "\h\w*" contained
+  syn match phpInterpMethodName "\h\w*" contained " default color
+  syn match phpInterpSimpleCurly "\${\h\w*}" contains=phpInterpVarname contained extend
+  syn region phpInterpDollarCurley1Helper matchgroup=phpParent start="{" end="\[" contains=phpInterpVarname contained
+  syn region phpInterpDollarCurly1 matchgroup=phpParent start="\${\h\w*\["rs=s+1 end="]}" contains=phpInterpDollarCurley1Helper,@phpClConst contained extend
 
-	syn match phpInterpDollarCurley2Helper "{\h\w*->" contains=phpBrackets,phpInterpVarname,phpMemberSelector contained
+  syn match phpInterpDollarCurley2Helper "{\h\w*->" contains=phpBrackets,phpInterpVarname,phpMemberSelector contained
 
-	syn region phpInterpDollarCurly2 matchgroup=phpParent start="\${\h\w*->"rs=s+1 end="}" contains=phpInterpDollarCurley2Helper,phpInterpMethodName contained
+  syn region phpInterpDollarCurly2 matchgroup=phpParent start="\${\h\w*->"rs=s+1 end="}" contains=phpInterpDollarCurley2Helper,phpInterpMethodName contained
 
-	syn match phpInterpBogusDollarCurley "${\h\w*->}" contained display
-	syn match phpInterpBogusDollarCurley "${\h\w*\[]}" contained display
+  syn match phpInterpBogusDollarCurley "${\h\w*->}" contained display
+  syn match phpInterpBogusDollarCurley "${\h\w*\[]}" contained display
 
-	syn region phpInterpComplex matchgroup=phpParent start="{\$"rs=e-1 end="}" contains=phpIdentifier,phpMemberSelector,phpVarSelector,phpIdentifierComplexP contained extend
-	syn region phpIdentifierComplexP matchgroup=phpParent start="\[" end="]" contains=@phpClInside contained
-	" define a cluster to get all interpolation syntaxes for double-quoted strings
-	syn cluster phpInterpDouble contains=phpInterpSimple,phpInterpSimpleCurly,phpInterpDollarCurly1,phpInterpDollarCurly2,phpInterpBogusDollarCurley,phpInterpComplex
+  syn region phpInterpComplex matchgroup=phpParent start="{\$"rs=e-1 end="}" contains=phpIdentifier,phpMemberSelector,phpVarSelector,phpIdentifierComplexP contained extend
+  syn region phpIdentifierComplexP matchgroup=phpParent start="\[" end="]" contains=@phpClInside contained
+  " define a cluster to get all interpolation syntaxes for double-quoted strings
+  syn cluster phpInterpDouble contains=phpInterpSimple,phpInterpSimpleCurly,phpInterpDollarCurly1,phpInterpDollarCurly2,phpInterpBogusDollarCurley,phpInterpComplex
 
 " Methoden
 syn match phpMethodsVar "->\h\w*" contained contains=phpMethods,phpMemberSelector display
@@ -326,24 +326,28 @@ syn keyword phpDefine new clone containe
 " Boolean
 syn keyword phpBoolean true false contained
 
+" Float
+" Refer to: https://www.php.net/manual/en/language.types.float.php
+syn match phpFloat "\%(\w\|\.\)\@<!\%(\d\|\.\)*\d\%(\d\|\.\)*\%([eE][+-]\=\%(\d\|\.\)\+\)\=\%(\w\|\.\)\@!" contained contains=phpFloatError display
+syn match phpFloatError "[eE.].*\." contained display
+
 " Number
-syn match phpNumber "-\=\<\d\+\>" contained display
-syn match phpNumber "\<0x\x\{1,8}\>" contained display
-
-" Float
-syn match phpFloat "\(-\=\<\d+\|-\=\)\.\d\+\>" contained display
+syn match phpNumber "\%(\.\)\@<!\<\%([1-9]\d*\|0\|0[xX]\x\+\)\>\%(\.\)\@!" contained display
+syn match phpNumber "\%(\.\)\@<!\<0\d\+\>\%(\.\)\@!" contained contains=phpOctalError display
+syn match phpBinaryError "[2-9]" contained display
+syn match phpNumber "\%(\.\)\@<!\<0[bB]\d\+\>\%(\.\)\@!" contained contains=phpBinaryError display
 
 " Backslash escapes
-	syn case match
-	" for double quotes and heredoc
-	syn match phpBackslashSequences "\\[fnrtv\\\"$]" contained display
-	syn match phpBackslashSequences "\\\d\{1,3}" contained contains=phpOctalError display
-	syn match phpBackslashSequences "\\x\x\{1,2}" contained display
-	" additional sequence for double quotes only
-	syn match phpBackslashDoubleQuote "\\[\"]" contained display
-	" for single quotes only
-	syn match phpBackslashSingleQuote "\\[\\']" contained display
-	syn case ignore
+syn case match
+" for double quotes and heredoc
+syn match phpBackslashSequences "\\[fnrtv\\\"$]" contained display
+syn match phpBackslashSequences "\\\d\{1,3}" contained contains=phpOctalError display
+syn match phpBackslashSequences "\\x\x\{1,2}" contained display
+" additional sequence for double quotes only
+syn match phpBackslashDoubleQuote "\\[\"]" contained display
+" for single quotes only
+syn match phpBackslashSingleQuote "\\[\\']" contained display
+syn case ignore
 
 
 " Error
@@ -379,18 +383,18 @@ endif
 syn case match
 
 " HereDoc
-syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\I\i*\)\2$" end="^\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
+syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\I\i*\)\2$" end="^\s*\z1\>" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
 " including HTML,JavaScript,SQL even if not enabled via options
-syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)\2$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
-syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)\2$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
-syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)\2$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
+syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)\2$" end="^\s*\z1\>" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
+syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)\2$" end="^\s*\z1\>" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
+syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)\2$" end="^\s*\z1\>" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
 
 " NowDoc
-syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\I\i*\)'$" end="^\z1\(;\=$\)\@=" contained contains=@Spell keepend extend
+syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\I\i*\)'$" end="^\s*\z1\>" contained contains=@Spell keepend extend
 " including HTML,JavaScript,SQL even if not enabled via options
-syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)'$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,@Spell keepend extend
-syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)'$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,@Spell keepend extend
-syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)'$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,@Spell keepend extend
+syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)'$" end="^\s*\z1\>" contained contains=@htmlTop,@Spell keepend extend
+syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)'$" end="^\s*\z1\>" contained contains=@sqlTop,@Spell keepend extend
+syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)'$" end="^\s*\z1\>" contained contains=@htmlJavascript,@Spell keepend extend
 syn case ignore
 
 " Parent
@@ -623,6 +627,8 @@ hi def link phpBrackets Delimiter
 hi def link phpIdentifierConst Delimiter
 hi def link phpParentError Error
 hi def link phpOctalError Error
+hi def link phpBinaryError Error
+hi def link phpFloatError Error
 hi def link phpInterpSimpleError Error
 hi def link phpInterpBogusDollarCurley Error
 hi def link phpInterpDollarCurly1 Error