Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: phtml PHP 2.0 |
| 3 | " Maintainer: Lutz Eymers <ixtab@polzin.com> |
| 4 | " URL: http://www.isp.de/data/phtml.vim |
| 5 | " Email: Subject: send syntax_vim.tgz |
| 6 | " Last change: 2003 May 11 |
| 7 | " |
| 8 | " Options phtml_sql_query = 1 for SQL syntax highligthing inside strings |
| 9 | " phtml_minlines = x to sync at least x lines backwards |
| 10 | |
| 11 | " For version 5.x: Clear all syntax items |
| 12 | " For version 6.x: Quit when a syntax file was already loaded |
| 13 | if version < 600 |
| 14 | syntax clear |
| 15 | elseif exists("b:current_syntax") |
| 16 | finish |
| 17 | endif |
| 18 | |
| 19 | if !exists("main_syntax") |
| 20 | let main_syntax = 'phtml' |
| 21 | endif |
| 22 | |
| 23 | if version < 600 |
| 24 | so <sfile>:p:h/html.vim |
| 25 | else |
| 26 | runtime! syntax/html.vim |
| 27 | unlet b:current_syntax |
| 28 | endif |
| 29 | |
| 30 | syn cluster htmlPreproc add=phtmlRegionInsideHtmlTags |
| 31 | |
| 32 | if exists( "phtml_sql_query") |
| 33 | if phtml_sql_query == 1 |
| 34 | syn include @phtmlSql <sfile>:p:h/sql.vim |
| 35 | unlet b:current_syntax |
| 36 | endif |
| 37 | endif |
| 38 | syn cluster phtmlSql remove=sqlString,sqlComment |
| 39 | |
| 40 | syn case match |
| 41 | |
| 42 | " Env Variables |
| 43 | syn keyword phtmlEnvVar SERVER_SOFTWARE SERVER_NAME SERVER_URL GATEWAY_INTERFACE contained |
| 44 | syn keyword phtmlEnvVar SERVER_PROTOCOL SERVER_PORT REQUEST_METHOD PATH_INFO contained |
| 45 | syn keyword phtmlEnvVar PATH_TRANSLATED SCRIPT_NAME QUERY_STRING REMOTE_HOST contained |
| 46 | syn keyword phtmlEnvVar REMOTE_ADDR AUTH_TYPE REMOTE_USER CONTEN_TYPE contained |
| 47 | syn keyword phtmlEnvVar CONTENT_LENGTH HTTPS HTTPS_KEYSIZE HTTPS_SECRETKEYSIZE contained |
| 48 | syn keyword phtmlEnvVar HTTP_ACCECT HTTP_USER_AGENT HTTP_IF_MODIFIED_SINCE contained |
| 49 | syn keyword phtmlEnvVar HTTP_FROM HTTP_REFERER contained |
| 50 | syn keyword phtmlEnvVar PHP_SELF contained |
| 51 | |
| 52 | syn case ignore |
| 53 | |
| 54 | " Internal Variables |
| 55 | syn keyword phtmlIntVar phperrmsg php_self contained |
| 56 | |
| 57 | " Comment |
| 58 | syn region phtmlComment start="/\*" end="\*/" contained contains=phtmlTodo |
| 59 | |
| 60 | " Function names |
| 61 | syn keyword phtmlFunctions Abs Ada_Close Ada_Connect Ada_Exec Ada_FetchRow contained |
| 62 | syn keyword phtmlFunctions Ada_FieldName Ada_FieldNum Ada_FieldType contained |
| 63 | syn keyword phtmlFunctions Ada_FreeResult Ada_NumFields Ada_NumRows Ada_Result contained |
| 64 | syn keyword phtmlFunctions Ada_ResultAll AddSlashes ASort BinDec Ceil ChDir contained |
| 65 | syn keyword phtmlFunctions AdaGrp ChMod ChOwn Chop Chr ClearStack ClearStatCache contained |
| 66 | syn keyword phtmlFunctions closeDir CloseLog Cos Count Crypt Date dbList contained |
| 67 | syn keyword phtmlFunctions dbmClose dbmDelete dbmExists dbmFetch dbmFirstKey contained |
| 68 | syn keyword phtmlFunctions dbmInsert dbmNextKey dbmOpen dbmReplace DecBin DecHex contained |
| 69 | syn keyword phtmlFunctions DecOct doubleval Echo End ereg eregi ereg_replace contained |
| 70 | syn keyword phtmlFunctions eregi_replace EscapeShellCmd Eval Exec Exit Exp contained |
| 71 | syn keyword phtmlFunctions fclose feof fgets fgetss File fileAtime fileCtime contained |
| 72 | syn keyword phtmlFunctions fileGroup fileInode fileMtime fileOwner filePerms contained |
| 73 | syn keyword phtmlFunctions fileSize fileType Floor Flush fopen fputs FPassThru contained |
| 74 | syn keyword phtmlFunctions fseek fsockopen ftell getAccDir GetEnv getHostByName contained |
| 75 | syn keyword phtmlFunctions getHostByAddr GetImageSize getLastAcess contained |
| 76 | syn keyword phtmlFunctions getLastbrowser getLastEmail getLastHost getLastMod contained |
| 77 | syn keyword phtmlFunctions getLastref getLogDir getMyInode getMyPid getMyUid contained |
| 78 | syn keyword phtmlFunctions getRandMax getStartLogging getToday getTotal GetType contained |
| 79 | syn keyword phtmlFunctions gmDate Header HexDec HtmlSpecialChars ImageArc contained |
| 80 | syn keyword phtmlFunctions ImageChar ImageCharUp IamgeColorAllocate contained |
| 81 | syn keyword phtmlFunctions ImageColorTransparent ImageCopyResized ImageCreate contained |
| 82 | syn keyword phtmlFunctions ImageCreateFromGif ImageDestroy ImageFill contained |
| 83 | syn keyword phtmlFunctions ImageFilledPolygon ImageFilledRectangle contained |
| 84 | syn keyword phtmlFunctions ImageFillToBorder ImageGif ImageInterlace ImageLine contained |
| 85 | syn keyword phtmlFunctions ImagePolygon ImageRectangle ImageSetPixel contained |
| 86 | syn keyword phtmlFunctions ImageString ImageStringUp ImageSX ImageSY Include contained |
| 87 | syn keyword phtmlFunctions InitSyslog intval IsSet Key Link LinkInfo Log Log10 contained |
| 88 | syn keyword phtmlFunctions LosAs Mail Max Md5 mi_Close mi_Connect mi_DBname contained |
| 89 | syn keyword phtmlFunctions mi_Exec mi_FieldName mi_FieldNum mi_NumFields contained |
| 90 | syn keyword phtmlFunctions mi_NumRows mi_Result Microtime Min MkDir MkTime msql contained |
| 91 | syn keyword phtmlFunctions msql_connect msql_CreateDB msql_dbName msql_DropDB contained |
| 92 | syn keyword phtmlFunctions msqlFieldFlags msql_FieldLen msql_FieldName contained |
| 93 | syn keyword phtmlFunctions msql_FieldType msql_FreeResult msql_ListDBs contained |
| 94 | syn keyword phtmlFunctions msql_Listfields msql_ListTables msql_NumFields contained |
| 95 | syn keyword phtmlFunctions msql_NumRows msql_RegCase msql_Result msql_TableName contained |
| 96 | syn keyword phtmlFunctions mysql mysql_affected_rows mysql_close mysql_connect contained |
| 97 | syn keyword phtmlFunctions mysql_CreateDB mysql_dbName mysqlDropDB contained |
| 98 | syn keyword phtmlFunctions mysql_FieldFlags mysql_FieldLen mysql_FieldName contained |
| 99 | syn keyword phtmlFunctions mysql_FieldType mysql_FreeResult mysql_insert_id contained |
| 100 | syn keyword phtmlFunctions mysql_listDBs mysql_Listfields mysql_ListTables contained |
| 101 | syn keyword phtmlFunctions mysql_NumFields mysql_NumRows mysql_Result contained |
| 102 | syn keyword phtmlFunctions mysql_TableName Next OctDec openDir OpenLog contained |
| 103 | syn keyword phtmlFunctions Ora_Bind Ora_Close Ora_Commit Ora_CommitOff contained |
| 104 | syn keyword phtmlFunctions Ora_CommitOn Ora_Exec Ora_Fetch Ora_GetColumn contained |
| 105 | syn keyword phtmlFunctions Ora_Logoff Ora_Logon Ora_Parse Ora_Rollback Ord contained |
| 106 | syn keyword phtmlFunctions Parse_str PassThru pclose pg_Close pg_Connect contained |
| 107 | syn keyword phtmlFunctions pg_DBname pg_ErrorMessage pg_Exec pg_FieldName contained |
| 108 | syn keyword phtmlFunctions pg_FieldPrtLen pg_FieldNum pg_FieldSize contained |
| 109 | syn keyword phtmlFunctions pg_FieldType pg_FreeResult pg_GetLastOid pg_Host contained |
| 110 | syn keyword phtmlFunctions pg_NumFields pg_NumRows pg_Options pg_Port contained |
| 111 | syn keyword phtmlFunctions pg_Result pg_tty phpInfo phpVersion popen pos pow contained |
| 112 | syn keyword phtmlFunctions Prev PutEnv QuoteMeta Rand readDir ReadFile ReadLink contained |
| 113 | syn keyword phtmlFunctions reg_Match reg_replace reg_Search Rename Reset return contained |
| 114 | syn keyword phtmlFunctions rewind rewindDir RmDir rSort SetCookie SetErrorReporting contained |
| 115 | syn keyword phtmlFunctions SetLogging SetShowInfo SetType shl shr Sin Sleep contained |
| 116 | syn keyword phtmlFunctions Solid_Close Solid_Connect Solid_Exec Solid_FetchRow contained |
| 117 | syn keyword phtmlFunctions Solid_FieldName Solid_FieldNum Solid_FreeResult contained |
| 118 | syn keyword phtmlFunctions Solid_NumFields Solid_NumRows Solid_Result Sort contained |
| 119 | syn keyword phtmlFunctions Spundtex Sprintf Sqrt Srand strchr strtr contained |
| 120 | syn keyword phtmlFunctions StripSlashes strlen strchr strstr strtok strtolower contained |
| 121 | syn keyword phtmlFunctions strtoupper strval substr sybSQL_CheckConnect contained |
| 122 | syn keyword phtmlFunctions sybSQL_DBUSE sybSQL_Connect sybSQL_Exit contained |
| 123 | syn keyword phtmlFunctions sybSQL_Fieldname sybSQL_GetField sybSQL_IsRow contained |
| 124 | syn keyword phtmlFunctions sybSQL_NextRow sybSQL_NumFields sybSQL_NumRows contained |
| 125 | syn keyword phtmlFunctions sybSQL_Query sybSQL_Result sybSQL_Result sybSQL_Seek contained |
| 126 | syn keyword phtmlFunctions Symlink syslog System Tan TempNam Time Umask UniqId contained |
| 127 | syn keyword phtmlFunctions Unlink Unset UrlDecode UrlEncode USleep Virtual contained |
| 128 | syn keyword phtmlFunctions SecureVar contained |
| 129 | |
| 130 | " Conditional |
| 131 | syn keyword phtmlConditional if else elseif endif switch endswitch contained |
| 132 | |
| 133 | " Repeat |
| 134 | syn keyword phtmlRepeat while endwhile contained |
| 135 | |
| 136 | " Repeat |
| 137 | syn keyword phtmlLabel case default contained |
| 138 | |
| 139 | " Statement |
| 140 | syn keyword phtmlStatement break return continue exit contained |
| 141 | |
| 142 | " Operator |
| 143 | syn match phtmlOperator "[-=+%^&|*!]" contained |
| 144 | syn match phtmlOperator "[-+*/%^&|]=" contained |
| 145 | syn match phtmlOperator "/[^*]"me=e-1 contained |
| 146 | syn match phtmlOperator "\$" contained |
| 147 | syn match phtmlRelation "&&" contained |
| 148 | syn match phtmlRelation "||" contained |
| 149 | syn match phtmlRelation "[!=<>]=" contained |
| 150 | syn match phtmlRelation "[<>]" contained |
| 151 | |
| 152 | " Identifier |
| 153 | syn match phtmlIdentifier "$\h\w*" contained contains=phtmlEnvVar,phtmlIntVar,phtmlOperator |
| 154 | |
| 155 | |
| 156 | " Include |
| 157 | syn keyword phtmlInclude include contained |
| 158 | |
| 159 | " Definesag |
| 160 | syn keyword phtmlDefine Function contained |
| 161 | |
| 162 | " String |
| 163 | syn region phtmlString keepend matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=phtmlIdentifier,phtmlSpecialChar,@phtmlSql contained |
| 164 | |
| 165 | " Number |
| 166 | syn match phtmlNumber "-\=\<\d\+\>" contained |
| 167 | |
| 168 | " Float |
| 169 | syn match phtmlFloat "\(-\=\<\d+\|-\=\)\.\d\+\>" contained |
| 170 | |
| 171 | " SpecialChar |
| 172 | syn match phtmlSpecialChar "\\[abcfnrtyv\\]" contained |
| 173 | syn match phtmlSpecialChar "\\\d\{3}" contained contains=phtmlOctalError |
| 174 | syn match phtmlSpecialChar "\\x[0-9a-fA-F]\{2}" contained |
| 175 | |
| 176 | syn match phtmlOctalError "[89]" contained |
| 177 | |
| 178 | |
| 179 | syn match phtmlParentError "[)}\]]" contained |
| 180 | |
| 181 | " Todo |
| 182 | syn keyword phtmlTodo TODO Todo todo contained |
| 183 | |
| 184 | " Parents |
| 185 | syn cluster phtmlInside contains=phtmlComment,phtmlFunctions,phtmlIdentifier,phtmlConditional,phtmlRepeat,phtmlLabel,phtmlStatement,phtmlOperator,phtmlRelation,phtmlString,phtmlNumber,phtmlFloat,phtmlSpecialChar,phtmlParent,phtmlParentError,phtmlInclude |
| 186 | |
| 187 | syn cluster phtmlTop contains=@phtmlInside,phtmlInclude,phtmlDefine,phtmlParentError,phtmlTodo |
| 188 | syn region phtmlParent matchgroup=Delimiter start="(" end=")" contained contains=@phtmlInside |
| 189 | syn region phtmlParent matchgroup=Delimiter start="{" end="}" contained contains=@phtmlInside |
| 190 | syn region phtmlParent matchgroup=Delimiter start="\[" end="\]" contained contains=@phtmlInside |
| 191 | |
| 192 | syn region phtmlRegion keepend matchgroup=Delimiter start="<?" skip=+(.*>.*)\|".\{-}>.\{-}"\|/\*.\{-}>.\{-}\*/+ end=">" contains=@phtmlTop |
| 193 | syn region phtmlRegionInsideHtmlTags keepend matchgroup=Delimiter start="<?" skip=+(.*>.*)\|/\*.\{-}>.\{-}\*/+ end=">" contains=@phtmlTop contained |
| 194 | |
| 195 | " sync |
| 196 | if exists("phtml_minlines") |
| 197 | exec "syn sync minlines=" . phtml_minlines |
| 198 | else |
| 199 | syn sync minlines=100 |
| 200 | endif |
| 201 | |
| 202 | " Define the default highlighting. |
| 203 | " For version 5.7 and earlier: only when not done already |
| 204 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 205 | if version >= 508 || !exists("did_phtml_syn_inits") |
| 206 | if version < 508 |
| 207 | let did_phtml_syn_inits = 1 |
| 208 | command -nargs=+ HiLink hi link <args> |
| 209 | else |
| 210 | command -nargs=+ HiLink hi def link <args> |
| 211 | endif |
| 212 | |
| 213 | HiLink phtmlComment Comment |
| 214 | HiLink phtmlString String |
| 215 | HiLink phtmlNumber Number |
| 216 | HiLink phtmlFloat Float |
| 217 | HiLink phtmlIdentifier Identifier |
| 218 | HiLink phtmlIntVar Identifier |
| 219 | HiLink phtmlEnvVar Identifier |
| 220 | HiLink phtmlFunctions Function |
| 221 | HiLink phtmlRepeat Repeat |
| 222 | HiLink phtmlConditional Conditional |
| 223 | HiLink phtmlLabel Label |
| 224 | HiLink phtmlStatement Statement |
| 225 | HiLink phtmlType Type |
| 226 | HiLink phtmlInclude Include |
| 227 | HiLink phtmlDefine Define |
| 228 | HiLink phtmlSpecialChar SpecialChar |
| 229 | HiLink phtmlParentError Error |
| 230 | HiLink phtmlOctalError Error |
| 231 | HiLink phtmlTodo Todo |
| 232 | HiLink phtmlOperator Operator |
| 233 | HiLink phtmlRelation Operator |
| 234 | |
| 235 | delcommand HiLink |
| 236 | endif |
| 237 | |
| 238 | let b:current_syntax = "phtml" |
| 239 | |
| 240 | if main_syntax == 'phtml' |
| 241 | unlet main_syntax |
| 242 | endif |
| 243 | |
| 244 | " vim: ts=8 |