apache_conf_highlight_rules.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. /* ***** BEGIN LICENSE BLOCK *****
  2. * Distributed under the BSD license:
  3. *
  4. * Copyright (c) 2012, Ajax.org B.V.
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions are met:
  9. * * Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * * Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * * Neither the name of Ajax.org B.V. nor the
  15. * names of its contributors may be used to endorse or promote products
  16. * derived from this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  19. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  20. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
  22. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  23. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  24. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  25. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  27. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. *
  29. * ***** END LICENSE BLOCK ***** */
  30. /* This file was autogenerated from https://raw.github.com/colinta/ApacheConf.tmLanguage/master/ApacheConf.tmLanguage (uuid: ) */
  31. /****************************************************************************************
  32. * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
  33. * fileTypes *
  34. ****************************************************************************************/
  35. define(function(require, exports, module) {
  36. "use strict";
  37. var oop = require("../lib/oop");
  38. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  39. var ApacheConfHighlightRules = function() {
  40. // regexp must not have capturing parentheses. Use (?:) instead.
  41. // regexps are ordered -> the first match is used
  42. this.$rules = { start:
  43. [ { token:
  44. [ 'punctuation.definition.comment.apacheconf',
  45. 'comment.line.hash.ini',
  46. 'comment.line.hash.ini' ],
  47. regex: '^((?:\\s)*)(#)(.*$)' },
  48. { token:
  49. [ 'punctuation.definition.tag.apacheconf',
  50. 'entity.tag.apacheconf',
  51. 'text',
  52. 'string.value.apacheconf',
  53. 'punctuation.definition.tag.apacheconf' ],
  54. regex: '(<)(Proxy|ProxyMatch|IfVersion|Directory|DirectoryMatch|Files|FilesMatch|IfDefine|IfModule|Limit|LimitExcept|Location|LocationMatch|VirtualHost)(?:(\\s)(.+?))?(>)' },
  55. { token:
  56. [ 'punctuation.definition.tag.apacheconf',
  57. 'entity.tag.apacheconf',
  58. 'punctuation.definition.tag.apacheconf' ],
  59. regex: '(</)(Proxy|ProxyMatch|IfVersion|Directory|DirectoryMatch|Files|FilesMatch|IfDefine|IfModule|Limit|LimitExcept|Location|LocationMatch|VirtualHost)(>)' },
  60. { token:
  61. [ 'keyword.alias.apacheconf', 'text',
  62. 'string.regexp.apacheconf', 'text',
  63. 'string.replacement.apacheconf', 'text' ],
  64. regex: '(Rewrite(?:Rule|Cond))(\\s+)(.+?)(\\s+)(.+?)($|\\s)' },
  65. { token:
  66. [ 'keyword.alias.apacheconf', 'text',
  67. 'entity.status.apacheconf', 'text',
  68. 'string.regexp.apacheconf', 'text',
  69. 'string.path.apacheconf', 'text' ],
  70. regex: '(RedirectMatch)(?:(\\s+)(\\d\\d\\d|permanent|temp|seeother|gone))?(\\s+)(.+?)(\\s+)(?:(.+?)($|\\s))?' },
  71. { token:
  72. [ 'keyword.alias.apacheconf', 'text',
  73. 'entity.status.apacheconf', 'text',
  74. 'string.path.apacheconf', 'text',
  75. 'string.path.apacheconf', 'text' ],
  76. regex: '(Redirect)(?:(\\s+)(\\d\\d\\d|permanent|temp|seeother|gone))?(\\s+)(.+?)(\\s+)(?:(.+?)($|\\s))?' },
  77. { token:
  78. [ 'keyword.alias.apacheconf', 'text',
  79. 'string.regexp.apacheconf', 'text',
  80. 'string.path.apacheconf', 'text' ],
  81. regex: '(ScriptAliasMatch|AliasMatch)(\\s+)(.+?)(\\s+)(?:(.+?)(\\s))?' },
  82. { token:
  83. [ 'keyword.alias.apacheconf', 'text',
  84. 'string.path.apacheconf', 'text',
  85. 'string.path.apacheconf', 'text' ],
  86. regex: '(RedirectPermanent|RedirectTemp|ScriptAlias|Alias)(\\s+)(.+?)(\\s+)(?:(.+?)($|\\s))?' },
  87. { token: 'keyword.core.apacheconf',
  88. regex: '\\b(?:AcceptPathInfo|AccessFileName|AddDefaultCharset|AddOutputFilterByType|AllowEncodedSlashes|AllowOverride|AuthName|AuthType|CGIMapExtension|ContentDigest|DefaultType|DocumentRoot|EnableMMAP|EnableSendfile|ErrorDocument|ErrorLog|FileETag|ForceType|HostnameLookups|IdentityCheck|Include|KeepAlive|KeepAliveTimeout|LimitInternalRecursion|LimitRequestBody|LimitRequestFields|LimitRequestFieldSize|LimitRequestLine|LimitXMLRequestBody|LogLevel|MaxKeepAliveRequests|NameVirtualHost|Options|Require|RLimitCPU|RLimitMEM|RLimitNPROC|Satisfy|ScriptInterpreterSource|ServerAdmin|ServerAlias|ServerName|ServerPath|ServerRoot|ServerSignature|ServerTokens|SetHandler|SetInputFilter|SetOutputFilter|TimeOut|TraceEnable|UseCanonicalName)\\b' },
  89. { token: 'keyword.mpm.apacheconf',
  90. regex: '\\b(?:AcceptMutex|AssignUserID|BS2000Account|ChildPerUserID|CoreDumpDirectory|EnableExceptionHook|Group|Listen|ListenBacklog|LockFile|MaxClients|MaxMemFree|MaxRequestsPerChild|MaxRequestsPerThread|MaxSpareServers|MaxSpareThreads|MaxThreads|MaxThreadsPerChild|MinSpareServers|MinSpareThreads|NumServers|PidFile|ReceiveBufferSize|ScoreBoardFile|SendBufferSize|ServerLimit|StartServers|StartThreads|ThreadLimit|ThreadsPerChild|ThreadStackSize|User|Win32DisableAcceptEx)\\b' },
  91. { token: 'keyword.access.apacheconf',
  92. regex: '\\b(?:Allow|Deny|Order)\\b' },
  93. { token: 'keyword.actions.apacheconf',
  94. regex: '\\b(?:Action|Script)\\b' },
  95. { token: 'keyword.alias.apacheconf',
  96. regex: '\\b(?:Alias|AliasMatch|Redirect|RedirectMatch|RedirectPermanent|RedirectTemp|ScriptAlias|ScriptAliasMatch)\\b' },
  97. { token: 'keyword.auth.apacheconf',
  98. regex: '\\b(?:AuthAuthoritative|AuthGroupFile|AuthUserFile)\\b' },
  99. { token: 'keyword.auth_anon.apacheconf',
  100. regex: '\\b(?:Anonymous|Anonymous_Authoritative|Anonymous_LogEmail|Anonymous_MustGiveEmail|Anonymous_NoUserID|Anonymous_VerifyEmail)\\b' },
  101. { token: 'keyword.auth_dbm.apacheconf',
  102. regex: '\\b(?:AuthDBMAuthoritative|AuthDBMGroupFile|AuthDBMType|AuthDBMUserFile)\\b' },
  103. { token: 'keyword.auth_digest.apacheconf',
  104. regex: '\\b(?:AuthDigestAlgorithm|AuthDigestDomain|AuthDigestFile|AuthDigestGroupFile|AuthDigestNcCheck|AuthDigestNonceFormat|AuthDigestNonceLifetime|AuthDigestQop|AuthDigestShmemSize)\\b' },
  105. { token: 'keyword.auth_ldap.apacheconf',
  106. regex: '\\b(?:AuthLDAPAuthoritative|AuthLDAPBindDN|AuthLDAPBindPassword|AuthLDAPCharsetConfig|AuthLDAPCompareDNOnServer|AuthLDAPDereferenceAliases|AuthLDAPEnabled|AuthLDAPFrontPageHack|AuthLDAPGroupAttribute|AuthLDAPGroupAttributeIsDN|AuthLDAPRemoteUserIsDN|AuthLDAPUrl)\\b' },
  107. { token: 'keyword.autoindex.apacheconf',
  108. regex: '\\b(?:AddAlt|AddAltByEncoding|AddAltByType|AddDescription|AddIcon|AddIconByEncoding|AddIconByType|DefaultIcon|HeaderName|IndexIgnore|IndexOptions|IndexOrderDefault|ReadmeName)\\b' },
  109. { token: 'keyword.cache.apacheconf',
  110. regex: '\\b(?:CacheDefaultExpire|CacheDisable|CacheEnable|CacheForceCompletion|CacheIgnoreCacheControl|CacheIgnoreHeaders|CacheIgnoreNoLastMod|CacheLastModifiedFactor|CacheMaxExpire)\\b' },
  111. { token: 'keyword.cern_meta.apacheconf',
  112. regex: '\\b(?:MetaDir|MetaFiles|MetaSuffix)\\b' },
  113. { token: 'keyword.cgi.apacheconf',
  114. regex: '\\b(?:ScriptLog|ScriptLogBuffer|ScriptLogLength)\\b' },
  115. { token: 'keyword.cgid.apacheconf',
  116. regex: '\\b(?:ScriptLog|ScriptLogBuffer|ScriptLogLength|ScriptSock)\\b' },
  117. { token: 'keyword.charset_lite.apacheconf',
  118. regex: '\\b(?:CharsetDefault|CharsetOptions|CharsetSourceEnc)\\b' },
  119. { token: 'keyword.dav.apacheconf',
  120. regex: '\\b(?:Dav|DavDepthInfinity|DavMinTimeout|DavLockDB)\\b' },
  121. { token: 'keyword.deflate.apacheconf',
  122. regex: '\\b(?:DeflateBufferSize|DeflateCompressionLevel|DeflateFilterNote|DeflateMemLevel|DeflateWindowSize)\\b' },
  123. { token: 'keyword.dir.apacheconf',
  124. regex: '\\b(?:DirectoryIndex|DirectorySlash)\\b' },
  125. { token: 'keyword.disk_cache.apacheconf',
  126. regex: '\\b(?:CacheDirLength|CacheDirLevels|CacheExpiryCheck|CacheGcClean|CacheGcDaily|CacheGcInterval|CacheGcMemUsage|CacheGcUnused|CacheMaxFileSize|CacheMinFileSize|CacheRoot|CacheSize|CacheTimeMargin)\\b' },
  127. { token: 'keyword.dumpio.apacheconf',
  128. regex: '\\b(?:DumpIOInput|DumpIOOutput)\\b' },
  129. { token: 'keyword.env.apacheconf',
  130. regex: '\\b(?:PassEnv|SetEnv|UnsetEnv)\\b' },
  131. { token: 'keyword.expires.apacheconf',
  132. regex: '\\b(?:ExpiresActive|ExpiresByType|ExpiresDefault)\\b' },
  133. { token: 'keyword.ext_filter.apacheconf',
  134. regex: '\\b(?:ExtFilterDefine|ExtFilterOptions)\\b' },
  135. { token: 'keyword.file_cache.apacheconf',
  136. regex: '\\b(?:CacheFile|MMapFile)\\b' },
  137. { token: 'keyword.headers.apacheconf',
  138. regex: '\\b(?:Header|RequestHeader)\\b' },
  139. { token: 'keyword.imap.apacheconf',
  140. regex: '\\b(?:ImapBase|ImapDefault|ImapMenu)\\b' },
  141. { token: 'keyword.include.apacheconf',
  142. regex: '\\b(?:SSIEndTag|SSIErrorMsg|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|XBitHack)\\b' },
  143. { token: 'keyword.isapi.apacheconf',
  144. regex: '\\b(?:ISAPIAppendLogToErrors|ISAPIAppendLogToQuery|ISAPICacheFile|ISAPIFakeAsync|ISAPILogNotSupported|ISAPIReadAheadBuffer)\\b' },
  145. { token: 'keyword.ldap.apacheconf',
  146. regex: '\\b(?:LDAPCacheEntries|LDAPCacheTTL|LDAPConnectionTimeout|LDAPOpCacheEntries|LDAPOpCacheTTL|LDAPSharedCacheFile|LDAPSharedCacheSize|LDAPTrustedCA|LDAPTrustedCAType)\\b' },
  147. { token: 'keyword.log.apacheconf',
  148. regex: '\\b(?:BufferedLogs|CookieLog|CustomLog|LogFormat|TransferLog|ForensicLog)\\b' },
  149. { token: 'keyword.mem_cache.apacheconf',
  150. regex: '\\b(?:MCacheMaxObjectCount|MCacheMaxObjectSize|MCacheMaxStreamingBuffer|MCacheMinObjectSize|MCacheRemovalAlgorithm|MCacheSize)\\b' },
  151. { token: 'keyword.mime.apacheconf',
  152. regex: '\\b(?:AddCharset|AddEncoding|AddHandler|AddInputFilter|AddLanguage|AddOutputFilter|AddType|DefaultLanguage|ModMimeUsePathInfo|MultiviewsMatch|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|TypesConfig)\\b' },
  153. { token: 'keyword.misc.apacheconf',
  154. regex: '\\b(?:ProtocolEcho|Example|AddModuleInfo|MimeMagicFile|CheckSpelling|ExtendedStatus|SuexecUserGroup|UserDir)\\b' },
  155. { token: 'keyword.negotiation.apacheconf',
  156. regex: '\\b(?:CacheNegotiatedDocs|ForceLanguagePriority|LanguagePriority)\\b' },
  157. { token: 'keyword.nw_ssl.apacheconf',
  158. regex: '\\b(?:NWSSLTrustedCerts|NWSSLUpgradeable|SecureListen)\\b' },
  159. { token: 'keyword.proxy.apacheconf',
  160. regex: '\\b(?:AllowCONNECT|NoProxy|ProxyBadHeader|ProxyBlock|ProxyDomain|ProxyErrorOverride|ProxyFtpDirCharset|ProxyIOBufferSize|ProxyMaxForwards|ProxyPass|ProxyPassReverse|ProxyPreserveHost|ProxyReceiveBufferSize|ProxyRemote|ProxyRemoteMatch|ProxyRequests|ProxyTimeout|ProxyVia)\\b' },
  161. { token: 'keyword.rewrite.apacheconf',
  162. regex: '\\b(?:RewriteBase|RewriteCond|RewriteEngine|RewriteLock|RewriteLog|RewriteLogLevel|RewriteMap|RewriteOptions|RewriteRule)\\b' },
  163. { token: 'keyword.setenvif.apacheconf',
  164. regex: '\\b(?:BrowserMatch|BrowserMatchNoCase|SetEnvIf|SetEnvIfNoCase)\\b' },
  165. { token: 'keyword.so.apacheconf',
  166. regex: '\\b(?:LoadFile|LoadModule)\\b' },
  167. { token: 'keyword.ssl.apacheconf',
  168. regex: '\\b(?:SSLCACertificateFile|SSLCACertificatePath|SSLCARevocationFile|SSLCARevocationPath|SSLCertificateChainFile|SSLCertificateFile|SSLCertificateKeyFile|SSLCipherSuite|SSLEngine|SSLMutex|SSLOptions|SSLPassPhraseDialog|SSLProtocol|SSLProxyCACertificateFile|SSLProxyCACertificatePath|SSLProxyCARevocationFile|SSLProxyCARevocationPath|SSLProxyCipherSuite|SSLProxyEngine|SSLProxyMachineCertificateFile|SSLProxyMachineCertificatePath|SSLProxyProtocol|SSLProxyVerify|SSLProxyVerifyDepth|SSLRandomSeed|SSLRequire|SSLRequireSSL|SSLSessionCache|SSLSessionCacheTimeout|SSLUserName|SSLVerifyClient|SSLVerifyDepth)\\b' },
  169. { token: 'keyword.usertrack.apacheconf',
  170. regex: '\\b(?:CookieDomain|CookieExpires|CookieName|CookieStyle|CookieTracking)\\b' },
  171. { token: 'keyword.vhost_alias.apacheconf',
  172. regex: '\\b(?:VirtualDocumentRoot|VirtualDocumentRootIP|VirtualScriptAlias|VirtualScriptAliasIP)\\b' },
  173. { token:
  174. [ 'keyword.php.apacheconf',
  175. 'text',
  176. 'entity.property.apacheconf',
  177. 'text',
  178. 'string.value.apacheconf',
  179. 'text' ],
  180. regex: '\\b(php_value|php_flag)\\b(?:(\\s+)(.+?)(?:(\\s+)(.+?))?)?(\\s)' },
  181. { token:
  182. [ 'punctuation.variable.apacheconf',
  183. 'variable.env.apacheconf',
  184. 'variable.misc.apacheconf',
  185. 'punctuation.variable.apacheconf' ],
  186. regex: '(%\\{)(?:(HTTP_USER_AGENT|HTTP_REFERER|HTTP_COOKIE|HTTP_FORWARDED|HTTP_HOST|HTTP_PROXY_CONNECTION|HTTP_ACCEPT|REMOTE_ADDR|REMOTE_HOST|REMOTE_PORT|REMOTE_USER|REMOTE_IDENT|REQUEST_METHOD|SCRIPT_FILENAME|PATH_INFO|QUERY_STRING|AUTH_TYPE|DOCUMENT_ROOT|SERVER_ADMIN|SERVER_NAME|SERVER_ADDR|SERVER_PORT|SERVER_PROTOCOL|SERVER_SOFTWARE|TIME_YEAR|TIME_MON|TIME_DAY|TIME_HOUR|TIME_MIN|TIME_SEC|TIME_WDAY|TIME|API_VERSION|THE_REQUEST|REQUEST_URI|REQUEST_FILENAME|IS_SUBREQ|HTTPS)|(.*?))(\\})' },
  187. { token: [ 'entity.mime-type.apacheconf', 'text' ],
  188. regex: '\\b((?:text|image|application|video|audio)/.+?)(\\s)' },
  189. { token: 'entity.helper.apacheconf',
  190. regex: '\\b(?:from|unset|set|on|off)\\b',
  191. caseInsensitive: true },
  192. { token: 'constant.integer.apacheconf', regex: '\\b\\d+\\b' },
  193. { token:
  194. [ 'text',
  195. 'punctuation.definition.flag.apacheconf',
  196. 'string.flag.apacheconf',
  197. 'punctuation.definition.flag.apacheconf',
  198. 'text' ],
  199. regex: '(\\s)(\\[)(.*?)(\\])(\\s)' } ] }
  200. this.normalizeRules();
  201. };
  202. ApacheConfHighlightRules.metaData = { fileTypes:
  203. [ 'conf',
  204. 'CONF',
  205. 'htaccess',
  206. 'HTACCESS',
  207. 'htgroups',
  208. 'HTGROUPS',
  209. 'htpasswd',
  210. 'HTPASSWD',
  211. '.htaccess',
  212. '.HTACCESS',
  213. '.htgroups',
  214. '.HTGROUPS',
  215. '.htpasswd',
  216. '.HTPASSWD' ],
  217. name: 'Apache Conf',
  218. scopeName: 'source.apacheconf' }
  219. oop.inherits(ApacheConfHighlightRules, TextHighlightRules);
  220. exports.ApacheConfHighlightRules = ApacheConfHighlightRules;
  221. });