syn region htmlTag start=+<[^/]+ end=+>+ contains=htmlString,htmlTagName,htmlArg,htmlValue,htmlTagError,htmlEvent,phtmlRegion
syn region javaScript start=+<script+ end=+</script>+ contains=javaScriptSpecial,javaScriptNumber,javaScriptLineComment,javaScriptComment,javaScriptStringS,javaScriptStringD,javaStringCharacter,javaStringSpecialCharacter,javaScriptConditional,javaScriptRepeat,javaScriptBranch,javaScriptOperator,javaScriptType,javaScriptStatement,javaScriptFunction,javaScriptBoolean,javaScriptBraces,javaScriptParen,javaScriptParenError,phtmlRegion
syn case match
" Env Variables
syn keyword phtmlEnvVar SERVER_SOFTWARE SERVER_NAME SERVER_URL GATEWAY_INTERFACE contained
syn keyword phtmlEnvVar SERVER_PROTOCOL SERVER_PORT REQUEST_METHOD PATH_INFO contained
syn keyword phtmlEnvVar PATH_TRANSLATED SCRIPT_NAME QUERY_STRING REMOTE_HOST contained
syn keyword phtmlEnvVar REMOTE_ADDR AUTH_TYPE REMOTE_USER CONTEN_TYPE contained
syn keyword phtmlEnvVar CONTENT_LENGTH HTTPS HTTPS_KEYSIZE HTTPS_SECRETKEYSIZE contained
syn keyword phtmlEnvVar HTTP_ACCECT HTTP_USER_AGENT HTTP_IF_MODIFIED_SINCE contained
syn keyword phtmlEnvVar HTTP_FROM contained
syn case ignore
" Internal Variables
syn keyword phtmlIntVar phperrmsg php_self contained
" Comment
syn region phtmlComment start="/\*" skip=">" end="\*/" contained contains=phtmlTodo
" Function names
syn keyword phtmlFunctions Abs Ada_Close Ada_Connect Ada_Exec Ada_FetchRow contained
syn keyword phtmlFunctions Ada_FieldName Ada_FieldNum Ada_FieldType contained
syn keyword phtmlFunctions Ada_FreeResult Ada_NumFields Ada_NumRows Ada_Result contained
syn keyword phtmlFunctions Ada_ResultAll AddSlashes ASort BinDec Ceil ChDir contained
syn keyword phtmlFunctions AdaGrp ChMod ChOwn Chop Chr ClearStack ClearStatCache contained
syn keyword phtmlFunctions closeDir CloseLog Cos Count Crypt Date dbList contained
syn keyword phtmlFunctions dbmClose dbmDelete dbmExists dbmFetch dbmFirstKey contained
syn keyword phtmlFunctions dbmInsert dbmNextKey dbmOpen dbmReplace DecBin DecHex contained
syn keyword phtmlFunctions DecOct doubleval Echo End ereg eregi ereg_replace contained
syn keyword phtmlFunctions eregi_replace EscapeShellCmd Eval Exec Exit Exp contained
syn keyword phtmlFunctions reg_Match reg_replace reg_Search Rename Reset return contained
syn keyword phtmlFunctions rewind rewindDir RmDir SetCookie SetErrorReporting contained
syn keyword phtmlFunctions SetLogging SetShowInfo SetType shl shr Sin Sleep contained
syn keyword phtmlFunctions Solid_Close Solid_Connect Solid_Exec Solid_FetchRow contained
syn keyword phtmlFunctions Solid_FieldName Solid_FieldNum Solid_FreeResult contained
syn keyword phtmlFunctions Solid_NumFields Solid_NumRows Solid_Result Sort contained
syn keyword phtmlFunctions Spundtex Sprintf Sqrt Srand strchr strtr contained
syn keyword phtmlFunctions StripSlashes strlen strchr strstr strtok strtolower contained
syn keyword phtmlFunctions strtoupper strval substr sybSQL_CheckConnect contained
syn keyword phtmlFunctions sybSQL_DBUSE sybSQL_Connect sybSQL_Exit contained
syn keyword phtmlFunctions sybSQL_Fieldname sybSQL_GetField sybSQL_IsRow contained
syn keyword phtmlFunctions sybSQL_NextRow sybSQL_NumFields sybSQL_NumRows contained
syn keyword phtmlFunctions sybSQL_Query sybSQL_Result sybSQL_Result sybSQL_Seek contained
syn keyword phtmlFunctions Symlink syslog System Tan TempNam Time Umask UniqId contained
syn keyword phtmlFunctions Unlink Unset UrlDecode UrlEncode USleep Virtual contained
" Identifier
syn match phtmlIdentifier "$[a-zA-Z_][a-zA-Z0-9_]*" contained contains=phtmlEnvVar,phtmlIntVar
" Conditional
syn keyword phtmlConditional if else elseif endif switch endswitch contained
" Repeat
syn keyword phtmlRepeat while endwhile contained
" Repeat
syn keyword phtmlLabel case default contained
" Statement
syn keyword phtmlStatement break return continue exit contained
" Operator
syn match phtmlOperator "[-=+%^&|*]" contained
syn match phtmlOperator "[-+*/%^&|]=" contained
syn match phtmlOperator "/[^*]"me=e-1 contained
syn match phtmlOperator "/$" contained
syn match phtmlRelation "&&" contained
syn match phtmlRelation "||" contained
syn match phtmlRelation "[!=<>]=" contained
syn match phtmlRelation "[<>]" contained
" Include
syn keyword phtmlInclude include contained
" Definesag
syn keyword phtmlDefine Function contained
" String
syn region phtmlString keepend matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=phtmlIdentifier,phtmlSpecialChar contained
" Number
syn match phtmlNumber "-\=\<\d\+\>" contained
" Float
syn match phtmlFloat "\(-\=\<\d+\|-\=\)\.\d\+\>" contained
" SpecialChar
syn match phtmlSpecialChar "\\[abcfnrtyv\\]" contained
syn match phtmlSpecialChar "\\\d\{3}" contained contains=phtmlOctalError
syn match phtmlSpecialChar "\\x[0-9a-fA-F]\{2}" contained
syn match phtmlOctalError "[89]" contained
syn match phtmlParentError "[)}\]]" contained
" Todo
syn keyword phtmlTodo TODO Todo todo contained
" Parents
syn region phtmlParent1 matchgroup=Delimiter start="(" end=")" contained contains=phtmlComment,phtmlFunctions,phtmlIdentifier,phtmlConditional,phtmlRepeat,phtmlLabel,phtmlStatement,phtmlOperator,phtmlRelation,phtmlString,phtmlNumber,phtmlFloat,phtmlSpecialChar,phtmlParent1,phtmlParent2,phtmlParent3,phtmlInclude
syn region phtmlParent2 matchgroup=Delimiter start="{" end="}" contained contains=phtmlComment,phtmlFunctions,phtmlIdentifier,phtmlConditional,phtmlRepeat,phtmlLabel,phtmlStatement,phtmlOperator,phtmlRelation,phtmlString,phtmlNumber,phtmlFloat,phtmlSpecialChar,phtmlParent1,phtmlParent2,phtmlParent3,phtmlInclude
syn region phtmlParent3 matchgroup=Delimiter start="\[" end="\]" contained contains=phtmlComment,phtmlFunctions,phtmlIdentifier,phtmlConditional,phtmlRepeat,phtmlLabel,phtmlStatement,phtmlOperator,phtmlRelation,phtmlString,phtmlNumber,phtmlFloat,phtmlSpecialChar,phtmlParent1,phtmlParent2,phtmlParent3,phtmlInclude
syn region phtmlRegion keepend matchgroup=Delimiter start="<?" skip=+(.*>.*)\|".*>.*"+ end=">" contains=phtmlComment,phtmlFunctions,phtmlIdentifier,phtmlConditional,phtmlRepeat,phtmlLabel,phtmlStatement,phtmlOperator,phtmlRelation,phtmlInclude,phtmlDefine,phtmlString,phtmlNumber,phtmlFloat,phtmlSpecialChar,phtmlParentError,phtmlTodo,phtmlParent1,phtmlParent2,phtmlParent3
if !exists("did_phtml_syntax_inits")
let did_phtml_syntax_inits = 1
" The default methods for highlighting. Can be overridden later