diff options
author | Tyson Andre <tysonandre775@hotmail.com> | 2020-12-19 12:36:08 -0500 |
---|---|---|
committer | Tyson Andre <tysonandre775@hotmail.com> | 2020-12-19 12:39:04 -0500 |
commit | bec4172aa9cb0f4043a1b712ab5557617deb4fd3 (patch) | |
tree | ba469f95389c44c042c2ee39011842ef2c5e17a1 /runtime/syntax/php.vim | |
parent | 46afc1def8ea1b686f96a20711aef96b7f4fd122 (diff) | |
download | rneovim-bec4172aa9cb0f4043a1b712ab5557617deb4fd3.tar.gz rneovim-bec4172aa9cb0f4043a1b712ab5557617deb4fd3.tar.bz2 rneovim-bec4172aa9cb0f4043a1b712ab5557617deb4fd3.zip |
runtime/php: 5ef1c6a4838a9629b793f3ae676f72a764171b00
Port php syntax file only.
Diffstat (limited to 'runtime/syntax/php.vim')
-rw-r--r-- | runtime/syntax/php.vim | 110 |
1 files changed, 58 insertions, 52 deletions
diff --git a/runtime/syntax/php.vim b/runtime/syntax/php.vim index 1c5c24e56b..ee47af83e5 100644 --- 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 matchgroup=phpParent start="{\$"rs=e-1 end="}" c 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 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 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 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 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 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 contained " Boolean syn keyword phpBoolean true false contained -" Number -syn match phpNumber "-\=\<\d\+\>" contained display -syn match phpNumber "\<0x\x\{1,8}\>" contained display - " Float -syn match phpFloat "\(-\=\<\d+\|-\=\)\.\d\+\>" contained display +" 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 "\%(\.\)\@<!\<\%([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 |