Skip to content

Commit 0148af0

Browse files
paulygvim-scripts
authored andcommitted
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.
1 parent 09ddf30 commit 0148af0

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

php_vimgen.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
'xmlrpc', 'xsl', /*'wddx',*/ 'zip', 'zlib'
4242
);
4343

44-
$out_file = 'C:\php_vimgen_out.vim'; // Pick your output file & location.
44+
$out_file = '~/php_vimgen_out.vim'; // Pick your output file & location.
4545
$out_str = '';
4646
$store = array();
4747
$errors = array();

syntax/php.vim

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" Vim syntax file
22
" Language: PHP 5.3 & up
33
" Maintainer: Paul Garvin <paul@paulgarvin.net>
4-
" Last Change: October 23, 2009
4+
" Last Change: April 2, 2010
55
" URL:
66
"
77
" Former Maintainer: Peter Hodge <toomuchphp-vim@yahoo.com>
@@ -478,11 +478,14 @@ syn match phpNumber "\<0x\x\{1,8}\>" contained display
478478
syn match phpNumber "\(-\=\<\d+\|-\=\)\.\d\+\>" contained display
479479

480480
" SpecialChar
481-
syn match phpSpecialChar "\\[abcfnrtyv\\]" contained display
481+
syn match phpSpecialChar "\\[fnrtv\\]" contained display
482482
syn match phpSpecialChar "\\\d\{3}" contained contains=phpOctalError display
483483
syn match phpSpecialChar "\\x\x\{2}" contained display
484484
" corrected highlighting for an escaped '\$' inside a double-quoted string
485485
syn match phpSpecialChar "\\\$" contained display
486+
syn match phpSpecialChar +\\"+ contained display
487+
syn match phpStrEsc "\\\\" contained display
488+
syn match phpStrEsc "\\'" contained display
486489

487490
" Error
488491
syn match phpOctalError "[89]" contained display
@@ -511,23 +514,23 @@ endif
511514

512515
" String
513516
if exists("php_parent_error_open")
514-
syn region phpStringDouble matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex contained keepend
515-
syn region phpBacktick matchgroup=None start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex contained keepend
516-
syn region phpStringSingle matchgroup=None start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings contained keepend
517+
syn region phpStringDouble matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained keepend
518+
syn region phpBacktick matchgroup=None start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained keepend
519+
syn region phpStringSingle matchgroup=None start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings,phpStrEsc contained keepend
517520
else
518-
syn region phpStringDouble matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex contained extend keepend
519-
syn region phpBacktick matchgroup=None start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex contained extend keepend
520-
syn region phpStringSingle matchgroup=None start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings contained keepend extend
521+
syn region phpStringDouble matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained extend keepend
522+
syn region phpBacktick matchgroup=None start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpSpecialChar,phpIdentifierSimply,phpIdentifierComplex,phpStrEsc contained extend keepend
523+
syn region phpStringSingle matchgroup=None start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings,phpStrEsc contained keepend extend
521524
endif
522525

523526
" HereDoc
524527
syn case match
525-
syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar keepend extend
526-
syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar keepend extend
528+
syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
529+
syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
527530
" including HTML,JavaScript,SQL even if not enabled via options
528-
syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar keepend extend
529-
syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar keepend extend
530-
syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar keepend extend
531+
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
532+
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
533+
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
531534
syn case ignore
532535

533536
" NowDoc
@@ -640,6 +643,7 @@ if !exists("did_php_syn_inits")
640643
hi def link phpSCKeyword Type
641644
hi def link phpMemberSelector Type
642645
hi def link phpSpecialChar Special
646+
hi def link phpStrEsc Special
643647
hi def link phpParent Special
644648
hi def link phpParentError Error
645649
hi def link phpOctalError Error

0 commit comments

Comments
 (0)