Version 1.1

Added missing keyword 'default'. Added highlighting of escaped single quotes, double quotes, backslashes, and dollar signs in strings. Shows up same color as \r, \n & friends.
This commit is contained in:
Paul Garvin 2010-04-02 00:00:00 +00:00 committed by Able Scraper
parent 09ddf308e3
commit 0148af0668
2 changed files with 18 additions and 14 deletions

View file

@ -41,7 +41,7 @@ $extensions = array(
'xmlrpc', 'xsl', /*'wddx',*/ 'zip', 'zlib'
);
$out_file = 'C:\php_vimgen_out.vim'; // Pick your output file & location.
$out_file = '~/php_vimgen_out.vim'; // Pick your output file & location.
$out_str = '';
$store = array();
$errors = array();

View file

@ -1,7 +1,7 @@
" Vim syntax file
" Language: PHP 5.3 & up
" Maintainer: Paul Garvin <paul@paulgarvin.net>
" Last Change: October 23, 2009
" Last Change: April 2, 2010
" URL:
"
" Former Maintainer: Peter Hodge <toomuchphp-vim@yahoo.com>
@ -478,11 +478,14 @@ syn match phpNumber "\<0x\x\{1,8}\>" contained display
syn match phpNumber "\(-\=\<\d+\|-\=\)\.\d\+\>" contained display
" SpecialChar
syn match phpSpecialChar "\\[abcfnrtyv\\]" contained display
syn match phpSpecialChar "\\[fnrtv\\]" contained display
syn match phpSpecialChar "\\\d\{3}" contained contains=phpOctalError display
syn match phpSpecialChar "\\x\x\{2}" contained display
" corrected highlighting for an escaped '\$' inside a double-quoted string
syn match phpSpecialChar "\\\$" contained display
syn match phpSpecialChar +\\"+ contained display
syn match phpStrEsc "\\\\" contained display
syn match phpStrEsc "\\'" contained display
" Error
syn match phpOctalError "[89]" contained display
@ -511,23 +514,23 @@ endif
" String
if exists("php_parent_error_open")
syn region phpStringDouble matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex contained keepend
syn region phpBacktick matchgroup=None start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex contained keepend
syn region phpStringSingle matchgroup=None start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings contained keepend
syn region phpStringDouble matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained keepend
syn region phpBacktick matchgroup=None start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained keepend
syn region phpStringSingle matchgroup=None start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings,phpStrEsc contained keepend
else
syn region phpStringDouble matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex contained extend keepend
syn region phpBacktick matchgroup=None start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex contained extend keepend
syn region phpStringSingle matchgroup=None start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings contained keepend extend
syn region phpStringDouble matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained extend keepend
syn region phpBacktick matchgroup=None start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained extend keepend
syn region phpStringSingle matchgroup=None start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings,phpStrEsc contained keepend extend
endif
" HereDoc
syn case match
syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar keepend extend
syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar keepend extend
syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
" including HTML,JavaScript,SQL even if not enabled via options
syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar keepend extend
syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar keepend extend
syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar keepend extend
syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
syn case ignore
" NowDoc
@ -640,6 +643,7 @@ if !exists("did_php_syn_inits")
hi def link phpSCKeyword Type
hi def link phpMemberSelector Type
hi def link phpSpecialChar Special
hi def link phpStrEsc Special
hi def link phpParent Special
hi def link phpParentError Error
hi def link phpOctalError Error