" Vim syntax file " Language: php PHP 3/4/5/7/8 " Maintainer: Tyson Andre " Last Change: Sep 18, 2021 " URL: https://github.com/TysonAndre/php-vim-syntax " Former Maintainers: " Jason Woofenden " Peter Hodge " Debian VIM Maintainers " " Note: If you are using a colour terminal with dark background, you will " probably find the 'elflord' colorscheme is much better for PHP's syntax " than the default colourscheme, because elflord's colours will better " highlight the break-points (Statements) in your code. " " Note: This embeds a modified copy of the html.vim with (mostly) different symbols, " in order to implement php_htmlInStrings=2 can work as expected and correctly parse " ` " Previous Maintainer Claudio Fleiner " Repository https://notabug.org/jorgesumle/vim-html-syntax " Last Change 2021 Mar 02 " Included patch #7900 to fix comments " Included patch #7916 to fix a few more things " " Options: " Set to anything to enable: " php_sql_query SQL syntax highlighting inside strings " php_htmlInStrings HTML syntax highlighting inside strings " " By setting this to 2, this will use a local copy of " HTML syntax highlighting instead of the official " HTML syntax highlighting, and properly highlight " ` as php " Set to a specific value: " php_folding = 1 fold classes and functions " php_folding = 2 fold all { } regions " php_sync_method = x where x is an integer: " -1 sync by search ( default ) " >0 sync at least x lines backwards " 0 sync from start " Set to 0 to _disable_: (Added by Peter Hodge On June 9, 2006) " php_special_functions = 0 highlight functions with abnormal behaviour " php_alt_comparisons = 0 comparison operators in an alternate colour " php_alt_assignByReference = 0 '= &' in an alternate colour " " " Note: " Setting php_folding=1 will match a closing } by comparing the indent " before the class or function keyword with the indent of a matching }. " Setting php_folding=2 will match all of pairs of {,} ( see known " bugs ii ) " Known Bugs: " - setting php_parent_error_close on and php_parent_error_open off " has these two leaks: " i) A closing ) or ] inside a string match to the last open ( or [ " before the string, when the the closing ) or ] is on the same line " where the string started. In this case a following ) or ] after " the string would be highlighted as an error, what is incorrect. " ii) Same problem if you are setting php_folding = 2 with a closing " } inside an string on the first line of this string. " quit when a syntax file was already loaded if exists("b:current_syntax") finish endif if !exists("main_syntax") let main_syntax = 'php' endif " Start of copy of html for embedding in strings with {{{ " This is a clone of https://notabug.org/jorgesumle/vim-html-syntax " from 2021 Mar 02 with changed symbols and modifications to rules. See the Note in the file header. " " The default behavior of php_htmlInStrings causes a bug " when you're working with code that contains the string literal `'&]" " tags syn region phpInnerHtmlString contained start=+"+ end=+"+ contains=phpInnerHtmlSpecialChar,javaScriptExpression,@phpInnerHtmlPreproc syn region phpInnerHtmlString contained start=+'+ end=+'+ contains=phpInnerHtmlSpecialChar,javaScriptExpression,@phpInnerHtmlPreproc syn match phpInnerHtmlValue contained "=[\t ]*[^'" \t>][^ \t>]*"hs=s+1 contains=javaScriptExpression,@phpInnerHtmlPreproc syn region phpInnerHtmlEndTag contained start=++ contains=phpInnerHtmlTagN,phpInnerHtmlTagError syn region phpInnerHtmlTag contained start=+<[^/]+ end=+>+ fold contains=phpInnerHtmlTagN,phpInnerHtmlString,htmlArg,phpInnerHtmlValue,phpInnerHtmlTagError,phpInnerHtmlEvent,phpInnerHtmlCssDefinition,@phpInnerHtmlPreproc,@phpInnerHtmlArgCluster syn match phpInnerHtmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,htmlSpecialTagName,@phpInnerHtmlTagNameCluster syn match phpInnerHtmlTagN contained +]<"ms=s+1 " special characters syn match phpInnerHtmlSpecialChar "&#\=[0-9A-Za-z]\{1,8};" " Comments (the real ones or the old netscape ones) if exists("html_wrong_comments") syn region phpInnerHtmlComment start=+ " Idem 8.2.4.43,44: Except and are parser errors " Idem 8.2.4.52: dash-dash-bang (--!>) is error ignored by parser, also closes comment syn region phpInnerHtmlComment matchgroup=phpInnerHtmlComment start=+ is all right syn match phpInnerHtmlCommentNested contained "\@!" syn match phpInnerHtmlCommentError contained "[^>+ keepend " server-parsed commands syn region phpInnerHtmlPreProc start=++ contains=phpInnerHtmlPreStmt,phpInnerHtmlPreError,phpInnerHtmlPreAttr syn match phpInnerHtmlPreStmt contained "