comparison runtime/syntax/php.vim @ 10048:43efa4f5a8ea

commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 30 23:26:57 2016 +0200 Updated runtime files. Remove version checks for Vim older than 6.0.
author Christian Brabandt <cb@256bit.org>
date Tue, 30 Aug 2016 23:30:09 +0200
parents 35ce559b8553
children 46763b01cd9a
comparison
equal deleted inserted replaced
10047:a62862410ca1 10048:43efa4f5a8ea
53 " where the string started. In this case a following ) or ] after 53 " where the string started. In this case a following ) or ] after
54 " the string would be highlighted as an error, what is incorrect. 54 " the string would be highlighted as an error, what is incorrect.
55 " ii) Same problem if you are setting php_folding = 2 with a closing 55 " ii) Same problem if you are setting php_folding = 2 with a closing
56 " } inside an string on the first line of this string. 56 " } inside an string on the first line of this string.
57 57
58 " For version 5.x: Clear all syntax items 58 " quit when a syntax file was already loaded
59 " For version 6.x: Quit when a syntax file was already loaded 59 if exists("b:current_syntax")
60 if version < 600
61 syntax clear
62 elseif exists("b:current_syntax")
63 finish 60 finish
64 endif 61 endif
65 62
66 if !exists("main_syntax") 63 if !exists("main_syntax")
67 let main_syntax = 'php' 64 let main_syntax = 'php'
68 endif 65 endif
69 66
70 if version < 600 67 runtime! syntax/html.vim
71 unlet! php_folding 68 unlet b:current_syntax
72 if exists("php_sync_method") && !php_sync_method
73 let php_sync_method=-1
74 endif
75 so <sfile>:p:h/html.vim
76 else
77 runtime! syntax/html.vim
78 unlet b:current_syntax
79 endif
80 69
81 " accept old options 70 " accept old options
82 if !exists("php_sync_method") 71 if !exists("php_sync_method")
83 if exists("php_minlines") 72 if exists("php_minlines")
84 let php_sync_method=php_minlines 73 let php_sync_method=php_minlines
92 let php_parent_error_open=1 81 let php_parent_error_open=1
93 endif 82 endif
94 83
95 syn cluster htmlPreproc add=phpRegion,phpRegionAsp,phpRegionSc 84 syn cluster htmlPreproc add=phpRegion,phpRegionAsp,phpRegionSc
96 85
97 if version < 600 86 syn include @sqlTop syntax/sql.vim
98 syn include @sqlTop <sfile>:p:h/sql.vim
99 else
100 syn include @sqlTop syntax/sql.vim
101 endif
102 syn sync clear 87 syn sync clear
103 unlet b:current_syntax 88 unlet b:current_syntax
104 syn cluster sqlTop remove=sqlString,sqlComment 89 syn cluster sqlTop remove=sqlString,sqlComment
105 if exists( "php_sql_query") 90 if exists( "php_sql_query")
106 syn cluster phpAddStrings contains=@sqlTop 91 syn cluster phpAddStrings contains=@sqlTop
379 if exists("php_parent_error_open") 364 if exists("php_parent_error_open")
380 syn region phpComment start="/\*" end="\*/" contained contains=phpTodo,@Spell 365 syn region phpComment start="/\*" end="\*/" contained contains=phpTodo,@Spell
381 else 366 else
382 syn region phpComment start="/\*" end="\*/" contained contains=phpTodo,@Spell extend 367 syn region phpComment start="/\*" end="\*/" contained contains=phpTodo,@Spell extend
383 endif 368 endif
384 if version >= 600 369 syn match phpComment "#.\{-}\(?>\|$\)\@=" contained contains=phpTodo,@Spell
385 syn match phpComment "#.\{-}\(?>\|$\)\@=" contained contains=phpTodo,@Spell 370 syn match phpComment "//.\{-}\(?>\|$\)\@=" contained contains=phpTodo,@Spell
386 syn match phpComment "//.\{-}\(?>\|$\)\@=" contained contains=phpTodo,@Spell
387 else
388 syn match phpComment "#.\{-}$" contained contains=phpTodo,@Spell
389 syn match phpComment "#.\{-}?>"me=e-2 contained contains=phpTodo,@Spell
390 syn match phpComment "//.\{-}$" contained contains=phpTodo,@Spell
391 syn match phpComment "//.\{-}?>"me=e-2 contained contains=phpTodo,@Spell
392 endif
393 371
394 " String 372 " String
395 if exists("php_parent_error_open") 373 if exists("php_parent_error_open")
396 syn region phpStringDouble matchgroup=phpStringDouble start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpBackslashSequences,phpBackslashDoubleQuote,@phpInterpDouble,@Spell contained keepend 374 syn region phpStringDouble matchgroup=phpStringDouble start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpBackslashSequences,phpBackslashDoubleQuote,@phpInterpDouble,@Spell contained keepend
397 syn region phpBacktick matchgroup=phpBacktick start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpBackslashSequences,phpIdentifierSimply,phpIdentifierComplex contained keepend 375 syn region phpBacktick matchgroup=phpBacktick start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpBackslashSequences,phpIdentifierSimply,phpIdentifierComplex contained keepend
401 syn region phpBacktick matchgroup=phpBacktick start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpBackslashSequences,phpIdentifierSimply,phpIdentifierComplex contained extend keepend 379 syn region phpBacktick matchgroup=phpBacktick start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpBackslashSequences,phpIdentifierSimply,phpIdentifierComplex contained extend keepend
402 syn region phpStringSingle matchgroup=phpStringSingle start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings,phpBackslashSingleQuote,@Spell contained keepend extend 380 syn region phpStringSingle matchgroup=phpStringSingle start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings,phpBackslashSingleQuote,@Spell contained keepend extend
403 endif 381 endif
404 382
405 " HereDoc and NowDoc 383 " HereDoc and NowDoc
406 if version >= 600 384 syn case match
407 syn case match 385
408 386 " HereDoc
409 " HereDoc 387 syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\I\i*\)\2$" end="^\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
410 syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\I\i*\)\2$" end="^\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
411 " including HTML,JavaScript,SQL even if not enabled via options 388 " including HTML,JavaScript,SQL even if not enabled via options
412 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 389 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
413 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 390 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
414 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 391 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
415 392
416 " NowDoc 393 " NowDoc
417 syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\I\i*\)'$" end="^\z1\(;\=$\)\@=" contained contains=@Spell keepend extend 394 syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\I\i*\)'$" end="^\z1\(;\=$\)\@=" contained contains=@Spell keepend extend
418 " including HTML,JavaScript,SQL even if not enabled via options 395 " including HTML,JavaScript,SQL even if not enabled via options
419 syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)'$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,@Spell keepend extend 396 syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)'$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,@Spell keepend extend
420 syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)'$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,@Spell keepend extend 397 syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)'$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,@Spell keepend extend
421 syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)'$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,@Spell keepend extend 398 syn region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)'$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,@Spell keepend extend
422 syn case ignore 399 syn case ignore
423 endif
424 400
425 " Parent 401 " Parent
426 if exists("php_parent_error_close") || exists("php_parent_error_open") 402 if exists("php_parent_error_close") || exists("php_parent_error_open")
427 syn match phpParent "[{}]" contained 403 syn match phpParent "[{}]" contained
428 syn region phpParent matchgroup=Delimiter start="(" end=")" contained contains=@phpClInside transparent 404 syn region phpParent matchgroup=Delimiter start="(" end=")" contained contains=@phpClInside transparent
619 syntax region phpDocTags start="{@\(example\|id\|internal\|inheritdoc\|link\|source\|toc\|tutorial\)" end="}" containedin=phpComment 595 syntax region phpDocTags start="{@\(example\|id\|internal\|inheritdoc\|link\|source\|toc\|tutorial\)" end="}" containedin=phpComment
620 syntax match phpDocTags "@\(abstract\|access\|author\|category\|copyright\|deprecated\|example\|final\|global\|ignore\|internal\|license\|link\|method\|name\|package\|param\|property\|return\|see\|since\|static\|staticvar\|subpackage\|tutorial\|uses\|var\|version\|contributor\|modified\|filename\|description\|filesource\|throws\)\(\s\+\)\?" containedin=phpComment 596 syntax match phpDocTags "@\(abstract\|access\|author\|category\|copyright\|deprecated\|example\|final\|global\|ignore\|internal\|license\|link\|method\|name\|package\|param\|property\|return\|see\|since\|static\|staticvar\|subpackage\|tutorial\|uses\|var\|version\|contributor\|modified\|filename\|description\|filesource\|throws\)\(\s\+\)\?" containedin=phpComment
621 syntax match phpDocTodo "@\(todo\|fixme\|xxx\)\(\s\+\)\?" containedin=phpComment 597 syntax match phpDocTodo "@\(todo\|fixme\|xxx\)\(\s\+\)\?" containedin=phpComment
622 598
623 " Define the default highlighting. 599 " Define the default highlighting.
624 " For version 5.7 and earlier: only when not done already 600 " Only when an item doesn't have highlighting yet
625 " For version 5.8 and later: only when an item doesn't have highlighting yet 601 command -nargs=+ HiLink hi def link <args>
626 if version >= 508 || !exists("did_php_syn_inits") 602
627 if version < 508 603 HiLink phpConstant Constant
628 let did_php_syn_inits = 1 604 HiLink phpCoreConstant Constant
629 command -nargs=+ HiLink hi link <args> 605 HiLink phpComment Comment
630 else 606 HiLink phpDocTags PreProc
631 command -nargs=+ HiLink hi def link <args> 607 HiLink phpDocCustomTags Type
632 endif 608 HiLink phpException Exception
633 609 HiLink phpBoolean Boolean
634 HiLink phpConstant Constant 610 HiLink phpStorageClass StorageClass
635 HiLink phpCoreConstant Constant 611 HiLink phpSCKeyword StorageClass
636 HiLink phpComment Comment 612 HiLink phpFCKeyword Define
637 HiLink phpDocTags PreProc 613 HiLink phpStructure Structure
638 HiLink phpDocCustomTags Type 614 HiLink phpStringSingle String
639 HiLink phpException Exception 615 HiLink phpStringDouble String
640 HiLink phpBoolean Boolean 616 HiLink phpBacktick String
641 HiLink phpStorageClass StorageClass 617 HiLink phpNumber Number
642 HiLink phpSCKeyword StorageClass 618 HiLink phpFloat Float
643 HiLink phpFCKeyword Define 619 HiLink phpMethods Function
644 HiLink phpStructure Structure 620 HiLink phpFunctions Function
645 HiLink phpStringSingle String 621 HiLink phpBaselib Function
646 HiLink phpStringDouble String 622 HiLink phpRepeat Repeat
647 HiLink phpBacktick String 623 HiLink phpConditional Conditional
648 HiLink phpNumber Number 624 HiLink phpLabel Label
649 HiLink phpFloat Float 625 HiLink phpStatement Statement
650 HiLink phpMethods Function 626 HiLink phpKeyword Statement
651 HiLink phpFunctions Function 627 HiLink phpType Type
652 HiLink phpBaselib Function 628 HiLink phpInclude Include
653 HiLink phpRepeat Repeat 629 HiLink phpDefine Define
654 HiLink phpConditional Conditional 630 HiLink phpBackslashSequences SpecialChar
655 HiLink phpLabel Label 631 HiLink phpBackslashDoubleQuote SpecialChar
656 HiLink phpStatement Statement 632 HiLink phpBackslashSingleQuote SpecialChar
657 HiLink phpKeyword Statement 633 HiLink phpParent Delimiter
658 HiLink phpType Type 634 HiLink phpBrackets Delimiter
659 HiLink phpInclude Include 635 HiLink phpIdentifierConst Delimiter
660 HiLink phpDefine Define 636 HiLink phpParentError Error
661 HiLink phpBackslashSequences SpecialChar 637 HiLink phpOctalError Error
662 HiLink phpBackslashDoubleQuote SpecialChar 638 HiLink phpInterpSimpleError Error
663 HiLink phpBackslashSingleQuote SpecialChar 639 HiLink phpInterpBogusDollarCurley Error
664 HiLink phpParent Delimiter 640 HiLink phpInterpDollarCurly1 Error
665 HiLink phpBrackets Delimiter 641 HiLink phpInterpDollarCurly2 Error
666 HiLink phpIdentifierConst Delimiter 642 HiLink phpInterpSimpleBracketsInner String
667 HiLink phpParentError Error 643 HiLink phpInterpSimpleCurly Delimiter
668 HiLink phpOctalError Error 644 HiLink phpInterpVarname Identifier
669 HiLink phpInterpSimpleError Error 645 HiLink phpTodo Todo
670 HiLink phpInterpBogusDollarCurley Error 646 HiLink phpDocTodo Todo
671 HiLink phpInterpDollarCurly1 Error 647 HiLink phpMemberSelector Structure
672 HiLink phpInterpDollarCurly2 Error 648 if exists("php_oldStyle")
673 HiLink phpInterpSimpleBracketsInner String 649 hi phpIntVar guifg=Red ctermfg=DarkRed
674 HiLink phpInterpSimpleCurly Delimiter 650 hi phpEnvVar guifg=Red ctermfg=DarkRed
675 HiLink phpInterpVarname Identifier 651 hi phpOperator guifg=SeaGreen ctermfg=DarkGreen
676 HiLink phpTodo Todo 652 hi phpVarSelector guifg=SeaGreen ctermfg=DarkGreen
677 HiLink phpDocTodo Todo 653 hi phpRelation guifg=SeaGreen ctermfg=DarkGreen
678 HiLink phpMemberSelector Structure 654 hi phpIdentifier guifg=DarkGray ctermfg=Brown
679 if exists("php_oldStyle") 655 hi phpIdentifierSimply guifg=DarkGray ctermfg=Brown
680 hi phpIntVar guifg=Red ctermfg=DarkRed 656 else
681 hi phpEnvVar guifg=Red ctermfg=DarkRed 657 HiLink phpIntVar Identifier
682 hi phpOperator guifg=SeaGreen ctermfg=DarkGreen 658 HiLink phpEnvVar Identifier
683 hi phpVarSelector guifg=SeaGreen ctermfg=DarkGreen 659 HiLink phpOperator Operator
684 hi phpRelation guifg=SeaGreen ctermfg=DarkGreen 660 HiLink phpVarSelector Operator
685 hi phpIdentifier guifg=DarkGray ctermfg=Brown 661 HiLink phpRelation Operator
686 hi phpIdentifierSimply guifg=DarkGray ctermfg=Brown 662 HiLink phpIdentifier Identifier
687 else 663 HiLink phpIdentifierSimply Identifier
688 HiLink phpIntVar Identifier 664 endif
689 HiLink phpEnvVar Identifier 665
690 HiLink phpOperator Operator 666 delcommand HiLink
691 HiLink phpVarSelector Operator
692 HiLink phpRelation Operator
693 HiLink phpIdentifier Identifier
694 HiLink phpIdentifierSimply Identifier
695 endif
696
697 delcommand HiLink
698 endif
699 667
700 let b:current_syntax = "php" 668 let b:current_syntax = "php"
701 669
702 if main_syntax == 'php' 670 if main_syntax == 'php'
703 unlet main_syntax 671 unlet main_syntax