diff options
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | plugins/language_go.lua | 3 | ||||
-rw-r--r-- | plugins/language_htaccess.lua | 212 | ||||
-rw-r--r-- | plugins/language_php.lua | 100 | ||||
-rw-r--r-- | plugins/language_v.lua | 4 | ||||
-rw-r--r-- | plugins/nonicons.lua | 2 |
6 files changed, 322 insertions, 7 deletions
@@ -37,7 +37,7 @@ to something other than a raw file it should be marked with an asterisk.* | [`centerdoc`](plugins/centerdoc.lua?raw=1) | Centers document's content on the screen and adds zen mode support *([screenshot](https://user-images.githubusercontent.com/3920290/82127896-bf6e4500-97ae-11ea-97fc-ba9a552bc9a4.png))* | | [`colorpreview`](plugins/colorpreview.lua?raw=1) | Underlays color values (eg. `#ff00ff` or `rgb(255, 0, 255)`) with their resultant color. *([screenshot](https://user-images.githubusercontent.com/3920290/80743752-731bd780-8b15-11ea-97d3-847db927c5dc.png))* | | [`console`](https://github.com/franko/console) | A console for running external commands and capturing their output *([gif](https://user-images.githubusercontent.com/3920290/81343656-49325a00-90ad-11ea-8647-ff39d8f1d730.gif))* | -| [`exterm`](https://github.com/ShadiestGoat/lite-xl-exterm)\* | Allows to open an external console in current project directory | +| [`exterm`](https://github.com/ShadiestGoat/lite-xl-exterm)\* | Allows to open an external console in current project directory | | [`contextmenu`](https://github.com/takase1121/lite-contextmenu)\* | Simple context menu *([screenshot](https://github.com/takase1121/lite-contextmenu/blob/master/assets/screenshot.jpg?raw=true))* | | [`copyfilelocation`](plugins/copyfilelocation.lua?raw=1) | Copy file location to clipboard | | [`datetimestamps`](plugins/datetimestamps.lua?raw=1) | Insert date-, time- and date-time-stamps | @@ -68,7 +68,7 @@ to something other than a raw file it should be marked with an asterisk.* | [`language_cmake`](plugins/language_cmake.lua?raw=1) | Syntax for the CMake build system language | | [`language_containerfile`](https://github.com/FilBot3/lite-xl-language-containerfile)\* | Syntax for [Containerfile](https://github.com/containers/common/blob/main/docs/Containerfile.5.md)/[Dockerfile](https://docs.docker.com/engine/reference/builder/) | | [`language_cpp`](plugins/language_cpp.lua?raw=1) | Syntax for the [C++](https://isocpp.org/) programming language | -| [`language_crystal`](https://github.com/Tamnac/lite-xl-plugins) | Syntax for the [Crystal](https://crystal-lang.org) programming language | +| [`language_crystal`](plugins/language_crystal.lua?raw=1) | Syntax for the [Crystal](https://crystal-lang.org) programming language | | [`language_csharp`](plugins/language_csharp.lua?raw=1) | Syntax for the [C#](http://csharp.net) programming language | | [`language_d`](plugins/language_d.lua?raw=1) | Syntax for the [D](https://dlang.org/) programming language | | [`language_dart`](plugins/language_dart.lua?raw=1) | Syntax for the [Dart](https://dart.dev/) programming languiage | @@ -133,7 +133,7 @@ to something other than a raw file it should be marked with an asterisk.* | [`lint+`](https://github.com/liquid600pgm/lintplus)\* | Advanced linter with ErrorLens-like error reporting. Compatible with linters made for `linter` *([screenshot](https://raw.githubusercontent.com/liquid600pgm/lintplus/master/screenshots/1.png))* | | [`linter`](https://github.com/drmargarido/linters)\* | Linters for multiple languages | | [`litepresence`](https://github.com/TorchedSammy/Litepresence)\* | Discord rich presence for Lite XL (display file editing in Discord) | -| [`lorem`](https://github.com/sheetcoder/lorem)\* | Generates Lorem Ipsum placeholder dummy text | +| [`lorem`](https://github.com/sheetcoder/lorem)\* | Generates Lorem Ipsum placeholder dummy text | | [`lsp`](https://github.com/lite-xl/lite-xl-lsp)\* | Provides code completion (also known as IntelliSense) using the Language Server Protocol | | [`lspkind`](https://github.com/TorchedSammy/lite-xl-lspkind)\* | Completion menu kind/type icons for Lite XL LSP | | [`macmodkeys`](plugins/macmodkeys.lua?raw=1) | Remaps mac modkeys `command/option` to `ctrl/alt` | @@ -142,7 +142,7 @@ to something other than a raw file it should be marked with an asterisk.* | [`minimap`](plugins/minimap.lua?raw=1) | Shows a minimap on the right-hand side of the docview. Taken from [@andsve](https://github.com/andsve/lite-plugins/tree/minimap-plugin), and improved upon. | | [`motiontrail`](plugins/motiontrail.lua?raw=1) | Adds a motion-trail to the caret *([screenshot](https://user-images.githubusercontent.com/3920290/83256814-085ccb00-a1ab-11ea-9e35-e6633cbed1a9.gif))* | | [`navigate`](plugins/navigate.lua?raw=1) | Allows moving back and forward between document positions, reducing the amount of scrolling | -| [`nonicons`](plugins/nonicons.lua?raw=1) | File icons set for TreeView. Download [font](https://github.com/yamatsum/nonicons/raw/master/dist/nonicons.ttf) to your config/fonts folder | +| [`nonicons`](plugins/nonicons.lua?raw=1) | File icons set for TreeView. Download [font](https://github.com/yamatsum/nonicons/raw/6a2faf4fbdfbe353c5ae6a496740ac4bfb6d0e74/dist/nonicons.ttf) to your config/fonts folder | | [`opacity`](plugins/opacity.lua?raw=1) | Change the opaqueness/transparency of `lite-xl` using shift+mousewheel or a command. | | [`open_ext`](plugins/open_ext.lua?raw=1) | Automatically prompts you if you tried to open a binary file in the editor | | [`openfilelocation`](plugins/openfilelocation.lua?raw=1) | Opens the parent directory of the current file in the file manager | diff --git a/plugins/language_go.lua b/plugins/language_go.lua index b670eac..93db0e4 100644 --- a/plugins/language_go.lua +++ b/plugins/language_go.lua @@ -45,6 +45,9 @@ syntax.add { { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, { pattern = ":=", type = "operator" }, -- function calls + { pattern = "func()%s*[%a_][%w_]*()%f[%[(]", -- function statement + type = {"keyword", "function", "normal"} + }, { pattern = "[%a_][%w_]*%f[(]", type = "function" }, { pattern = "%.()[%a_][%w_]*%f[(]", type = { "normal", "function" } diff --git a/plugins/language_htaccess.lua b/plugins/language_htaccess.lua new file mode 100644 index 0000000..acfa419 --- /dev/null +++ b/plugins/language_htaccess.lua @@ -0,0 +1,212 @@ +-- mod-version:3 +local syntax = require "core.syntax" + +local keywords = { + "AcceptFilter", "AcceptMutex", "AcceptPathInfo", "AccessFileName", "Action", "AddAlt", + "AddAltByEncoding", "AddAltByType", "AddCharset", "AddDefaultCharset", "AddDescription", + "AddEncoding", "AddHandler", "AddIcon", "AddIconByType", "AddIconByEncoding", "AddIconByEncoding", + "AddIconByType", "AddInputFilter", "AddLanguage", "AddModuleInfo", "AddOutputFilterByType", + "AddOutputFilter", "AddOutputFilterByType", "AddType", "Alias", "ScriptAlias", "ServerAlias", + "AliasMatch", "Allow", "AllowOverride", "AllowEncodedSlashes", "_ROUTING__allow_GET", + "_ROUTING__allow_HEAD", "_ROUTING__allow_POST", "Allow", "AllowOverride", "AllowEncodedSlashes", + "AllowCONNECT", "AllowEncodedSlashes", "AllowMethods", "AllowOverride", "AllowOverrideList", + "Anonymous", "Anonymous_LogEmail", "Anonymous_NoUserID", "Anonymous_Authoritative", + "Anonymous_LogEmail", "Anonymous_MustGiveEmail", "Anonymous_NoUserId", "Anonymous_VerifyEmail", + "AssignUserID", "AsyncRequestWorkerFactor", "AuthAuthoritative", "AuthBasicAuthoritative", + "AuthBasicFake", "AuthBasicProvider", "AuthBasicUseDigestAlgorithm", "AuthDBDUserPWQuery", + "AuthDBDUserRealmQuery", "AuthDBMAuthoritative", "AuthDBMGroupFile", "AuthDBMType", + "AuthDBMUserFile", "AuthDefaultAuthoritative", "AuthDigestAlgorithm", "AuthDigestDomain", + "AuthDigestFile", "AuthDigestGroupFile", "AuthDigestNcCheck", "AuthDigestNonceFormat", + "AuthDigestNonceLifetime", "AuthDigestProvider", "AuthDigestQop", "AuthDigestShmemSize", + "AuthFormAuthoritative", "AuthFormBody", "AuthFormDisableNoStore", "AuthFormFakeBasicAuth", + "AuthFormLocation", "AuthFormLoginRequiredLocation", "AuthFormLoginSuccessLocation", + "AuthFormLogoutLocation", "AuthFormMethod", "AuthFormMimetype", "AuthFormPassword", + "AuthFormProvider", "AuthFormSitePassphrase", "AuthFormSize", "AuthFormUsername", "AuthGroupFile", + "AuthLDAPAuthoritative", "AuthLDAPAuthorizePrefix", "AuthLDAPAuthzEnabled", + "AuthLDAPBindAuthoritative", "AuthLDAPBindDN", "AuthLDAPBindPassword", "AuthLDAPCharsetConfig", + "AuthLDAPCompareAsUser", "AuthLDAPCompareDNOnServer", "AuthLDAPDereferenceAliases", + "AuthLDAPEnabled", "AuthLDAPFrontPageHack", "AuthLDAPGroupAttribute", "AuthLDAPGroupAttributeIsDN", + "AuthLDAPGroupAttributeIsDN", "AuthLDAPInitialBindAsUser", "AuthLDAPInitialBindPattern", + "AuthLDAPMaxSubGroupDepth", "AuthLDAPRemoteUserAttribute", "AuthLDAPRemoteUserIsDN", + "AuthLDAPSearchAsUser", "AuthLDAPSubGroupAttribute", "AuthLDAPSubGroupClass", "AuthLDAPURL", + "AuthMerging", "AuthName", "AuthnCacheContext", "AuthnCacheEnable", "AuthnCacheProvideFor", + "AuthnCacheProvider", "AuthnCacheSOCache", "AuthnCacheTimeout", "AuthnzFcgiCheckAuthnProvider", + "AuthnzFcgiDefineProvider", "AuthType", "AuthUserFile", "AuthzDBDLoginToReferer", "AuthzDBDQuery", + "AuthzDBDRedirectQuery", "AuthzDBMAuthoritative", "AuthzDBMType", "AuthzDefaultAuthoritative", + "AuthzGroupFileAuthoritative", "AuthzLDAPAuthoritative", "AuthzOwnerAuthoritative", + "AuthzSendForbiddenOnFailure", "AuthzUserAuthoritative", "BalancerGrowth", "BalancerInherit", + "BalancerMember", "BalancerNonce", "BalancerPersist", "BrowserMatch", "BrowserMatchNoCase", + "BrowserMatchNoCase", "BS2000Account", "BufferedLogs", "DeflateBufferSize", "BufferSize", + "CacheDefaultExpire", "CacheDetailHeader", "CacheDirLength", "CacheDirLevels", "CacheDisable", + "CacheEnable", "CacheExpiryCheck", "cachefile", "CacheForceCompletion", "CacheGcClean", + "CacheGcDaily", "CacheGcInterval", "CacheGcMemUsage", "CacheGcUnused", "CacheHeader", + "CacheIgnoreCacheControl", "CacheIgnoreHeaders", "CacheIgnoreNoLastMod", "CacheIgnoreQueryString", + "CacheIgnoreURLSessionIdentifiers", "CacheKeyBaseURL", "CacheLastModifiedFactor", "CacheLock", + "CacheLockMaxAge", "CacheLockPath", "CacheMaxExpire", "CacheMaxFileSize", "CacheMinExpire", + "CacheMinFileSize", "CacheNegotiatedDocs", "CacheQuickHandler", "CacheReadSize", "CacheReadTime", + "CacheRoot", "MCacheSize", "CacheSocache", "CacheSocacheMaxSize", "CacheSocacheMaxTime", + "CacheSocacheMinTime", "CacheSocacheReadSize", "CacheSocacheReadTime", "CacheStaleOnError", + "CacheStoreExpired", "CacheStoreNoStore", "CacheStorePrivate", "CacheTimeMargin", "CaseFilter", + "CaseFilterIn", "CGIDScriptTimeout", "CGIMapExtension", "CGIPassAuth", "CGIVar", "CharsetDefault", + "CharsetOptions", "CharsetSourceEnc", "CheckCaseOnly", "CheckSpelling", "ChildperUserID", "ChrootDir", + "ClientRecheckTime", "ContentDigest", "CookieDomain", "CookieExpires", "CookieLog", "CookieName", + "CookieStyle", "CookieTracking", "CoreDumpDirectory", "CustomLog", "DAV", "DAVDepthInfinity", + "DAVGenericLockDB", "DAVLockDB", "DAVMinTimeout", "DBDExptime", "DBDInitSQL", "DBDKeep", "DBDMax", + "DBDMin", "DBDParams", "DBDPersist", "DBDPrepareSQL", "DBDriver", "DefaultIcon", "DefaultLanguage", + "DefaultRuntimeDir", "DefaultType", "Define", "DeflateBufferSize", "DeflateCompressionLevel", + "DeflateFilterNote", "DeflateInflateLimitRequestBody", "DeflateInflateRatioBurst", + "DeflateInflateRatioLimit", "DeflateMemLevel", "DeflateWindowSize", "Deny", "Deny", "DirectoryIndex", + "DirectorySlash", "DirectoryCheckHandler", "DirectoryIndex", "DirectoryIndexRedirect", "DirectoryMatch", + "DirectorySlash", "VirtualDocumentRoot", "DocumentRoot", "DTracePrivileges", "DumpIOInput", + "DumpIOLogLevel", "DumpIOOutput", "EnableExceptionHook", "EnableMMAP", "EnableSendfile", "ErrorDocument", + "ErrorLog", "ErrorLogFormat", "ExpiresActive", "ExpiresByType", "ExpiresDefault", "ExtendedStatus", + "ExtFilterDefine", "ExtFilterOptions", "FallbackResource", "FancyIndexing", "FileETag", "Files", + "FilesMatch", "FilterChain", "FilterDeclare", "FilterProtocol", "FilterProvider", "FilterTrace", + "ForceLanguagePriority", "ForceType", "ForensicLog", "GlobalLog", "GprofDir", "AuthGroupFile", "Group", + "AuthDBMGroupFile", "AuthLDAPGroupAttribute", "AuthLDAPGroupAttributeIsDN", "AuthzGroupFileAuthoritative", + "H2AltSvc", "H2AltSvcMaxAge", "H2Direct", "H2MaxSessionStreams", "H2MaxWorkerIdleSeconds", "H2MaxWorkers", + "H2MinWorkers", "H2ModernTLSOnly", "H2Push", "H2PushDiarySize", "H2PushPriority", "H2SerializeHeaders", + "H2SessionExtraFiles", "H2StreamMaxMemSize", "H2TLSCoolDownSecs", "H2TLSWarmUpSize", "H2Upgrade", + "H2WindowSize", "Header", "RequestHeader", "HeaderName", "HeaderName", "HeartbeatAddress", + "HeartbeatListen", "HeartbeatMaxServers", "HeartbeatStorage", "HostnameLookups", "IdentityCheck", + "IdentityCheckTimeout", "IfDefine", "IfModule", "IfVersion", "ImapBase", "ImapDefault", "ImapMenu", + "Include", "IncludeOptional", "IndexHeadInsert", "IndexIgnore", "IndexIgnoreReset", "IndexOptions", + "IndexOrderDefault", "IndexStyleSheet", "InputSed", "ISAPIAppendLogToErrors", "ISAPIAppendLogToQuery", + "ISAPICacheFile", "ISAPIFakeAsync", "ISAPILogNotSupported", "ISAPIReadAheadBuffer", "KeepAlive", + "KeepAliveTimeout", "MaxKeepAliveRequests", "KeepAliveTimeout", "KeptBodySize", "LanguagePriority", + "ForceLanguagePriority", "LDAPCacheEntries", "LDAPCacheTTL", "LDAPConnectionPoolTTL", + "LDAPConnectionTimeout", "LDAPLibraryDebug", "LDAPOpCacheEntries", "LDAPOpCacheTTL", "LDAPReferralHopLimit", + "LDAPReferrals", "LDAPRetries", "LDAPRetryDelay", "LDAPSharedCacheFile", "LDAPSharedCacheSize", + "LDAPTimeout", "LDAPTrustedCA", "LDAPTrustedCAType", "LDAPTrustedClientCert", "LDAPTrustedGlobalCert", + "LDAPTrustedMode", "LDAPVerifyServerCert", "LimitRequestBody", "RLimitMEM", "LimitRequestFields", + "LimitRequestFieldSize", "LimitRequestLine", "LimitExcept", "LimitInternalRecursion", "LimitRequestBody", + "LimitRequestFields", "LimitRequestFieldsize", "LimitRequestLine", "LimitXMLRequestBody", "LoadFile", + "LoadModule", "Location", "LocationMatch", "LockFile", "LogFormat", "LogIOTrackTTFB", "RewriteLogLevel", + "LogLevel", "LogMessage", "LuaAuthzProvider", "Lua_____ByteCodeHack", "LuaCodeCache", "LuaHookAccessChecker", + "LuaHookAuthChecker", "LuaHookCheckUserID", "LuaHookFixups", "LuaHookInsertFilter", "LuaHookLog", + "LuaHookMapToStorage", "LuaHookTranslateName", "LuaHookTypeChecker", "LuaInherit", "LuaInputFilter", + "LuaMapHandler", "LuaOutputFilter", "LuaPackageCPath", "LuaPackagePath", "LuaQuickHandler", "LuaRoot", + "LuaScope", "MaxClientConnections", "MaxClients", "MaxConnectionsPerChild", "MaxKeepAliveRequests", + "MaxMemFree", "MaxRangeOverlaps", "MaxRangeReversals", "MaxRanges", "MaxRequestsPerChild", + "MaxRequestsPerThread", "MaxRequestWorkers", "MaxSpareServers", "MaxSpareThreads", "MaxThreads", + "MaxThreadsPerChild", "MCacheMaxObjectCount", "MCacheMaxObjectSize", "MCacheMaxStreamingBuffer", + "MCacheMinObjectSize", "MCacheRemovalAlgorithm", "MCacheSize", "MemcacheConnTTL", "MergeTrailers", + "MetaDir", "MetaFiles", "MetaSuffix", "MimeMagicFile", "MinSpareServers", "MinSpareThreads", "mmapfile", + "ModemStandard", "ModMimeUsePathInfo", "MultiviewsMatch", "Mutex", "NameVirtualHost", "NoProxy", + "NumServers", "NWSSLTrustedCerts", "NWSSLUpgradeable", "Options", "RewriteOptions", "IndexOptions", + "Order", "IndexOrderDefault", "Order", "IndexOrderDefault", "OutputSed", "PassEnv", "php_admin_flag", + "php_admin_value", "php_flag", "php_value", "PidFile", "Port", "PrivilegesMode", "FilterProtocol", + "Protocol", "ProtocolEcho", "Protocols", "ProtocolsHonorOrder", "ProxyPass", "ProxyPassMatch", + "ProxyPassReverse", "ProxyRequests", "ProxyAddHeaders", "ProxyBadHeader", "ProxyBlock", "ProxyDomain", + "ProxyErrorOverride", "ProxyExpressDBMFile", "ProxyExpressDBMType", "ProxyExpressEnable", + "ProxyFtpDirCharset", "ProxyFtpEscapeWildcards", "ProxyFtpListOnWildcard", "ProxyHCExpr", "ProxyHCTemplate", + "ProxyHCTPsize", "ProxyHTMLBufSize", "ProxyHTMLCharsetOut", "ProxyHTMLDoctype", "ProxyHTMLEnable", + "ProxyHTMLEvents", "ProxyHTMLExtended", "ProxyHTMLFixups", "ProxyHTMLInterp", "ProxyHTMLLinks", + "ProxyHTMLMeta", "ProxyHTMLStripComments", "ProxyHTMLURLMap", "ProxyIOBufferSize", "ProxyMatch", + "ProxyMaxForwards", "ProxyPass", "ProxyPassMatch", "ProxyPassReverse", "ProxyPassInherit", + "ProxyPassInterpolateEnv", "ProxyPassMatch", "ProxyPassReverse", "ProxyPassReverseCookieDomain", + "ProxyPassReverseCookiePath", "ProxyPreserveHost", "ProxyReceiveBufferSize", "ProxyRemote", + "ProxyRemoteMatch", "ProxyRequests", "ProxySCGIInternalRedirect", "ProxySCGISendfile", "ProxySet", + "ProxySourceAddress", "ProxyStatus", "ProxyTimeout", "ProxyVia", "QualifyRedirectURL", "ReadmeName", + "Redirect", "RedirectMatch", "RedirectTemp", "RedirectPermanent", "RedirectMatch", "RedirectPermanent", + "RedirectTemp", "ReflectorHeader", "RemoteIPHeader", "RemoteIPInternalProxy", "RemoteIPInternalProxyList", + "RemoteIPProxiesHeader", "RemoteIPTrustedProxy", "RemoteIPTrustedProxyList", "RemoveCharset", + "RemoveEncoding", "RemoveHandler", "RemoveInputFilter", "RemoveLanguage", "RemoveOutputFilter", "RemoveType", + "RequestHeader", "RequestReadTimeout", "RequestTimeout", "Require", "RewriteBase", "RewriteCond", + "RewriteEngine", "RewriteLock", "RewriteLog", "RewriteLogLevel", "RewriteLogLevel", "RewriteMap", + "RewriteOptions", "RewriteRule", "RLimitCPU", "RLimitMEM", "RLimitNPROC", "Satisfy", "ScoreboardFile", + "ScoreBoardFile", "Script", "ScriptAlias", "ScriptAlias", "ScriptAliasMatch", "ScriptInterpreterSource", + "ScriptLog", "ScriptLogBuffer", "ScriptLogLength", "Scriptsock", "ScriptSock", "SecureListen", + "SeeRequestTail", "SerfCluster", "SerfPass", "ServerAdmin", "ServerAlias", "ServerLimit", "ServerName", + "ServerPath", "ServerRoot", "ServerSignature", "ServerTokens", "Session", "SessionCookieName", + "SessionCookieName2", "SessionCookieRemove", "SessionCryptoCipher", "SessionCryptoDriver", + "SessionCryptoPassphrase", "SessionCryptoPassphraseFile", "SessionDBDCookieName", "SessionDBDCookieName2", + "SessionDBDCookieRemove", "SessionDBDDeleteLabel", "SessionDBDInsertLabel", "SessionDBDPerUser", + "SessionDBDSelectLabel", "SessionDBDUpdateLabel", "SessionEnv", "SessionExclude", "SessionHeader", + "SessionInclude", "SessionMaxAge", "SetEnvIfNoCase", "SetEnv", "SetEnvIf", "SetEnvIfNoCase", "SetEnvIf", + "SetEnvIfExpr", "SetEnvIfNoCase", "SetHandler", "SetInputFilter", "SetOutputFilter", "SimpleProcCount", + "SimpleThreadCount", "SSIAccessEnable", "SSIEndTag", "SSIErrorMsg", "SSIEtag", "SSILastModified", + "SSILegacyExprParser", "SSIStartTag", "SSITimeFormat", "SSIUndefinedEcho", "SSLLog", "SSLLogLevel", + "StartServers", "StartThreads", "Substitute", "SubstituteInheritBefore", "SubstituteMaxLineLength", + "Suexec", "SuexecUserGroup", "ThreadLimit", "ThreadsPerChild", "ThreadStackSize", "KeepAliveTimeout", + "AuthnCacheTimeout", "TraceEnable", "TransferLog", "TrustedProxy", "TypesConfig", "UnDefine", "UnsetEnv", + "UseCanonicalName", "UseCanonicalPhysicalPort", "User", "AuthUserFile", "UserDir", "AuthDBMUserFile", + "Anonymous_NoUserID", "UserDir", "VHostCGIMode", "VHostCGIPrivs", "VHostGroup", "VHostPrivs", "VHostSecure", + "VHostUser", "VirtualDocumentRoot", "VirtualDocumentRootIP", "VirtualHost", "VirtualScriptAlias", + "VirtualScriptAliasIP", "Win32DisableAcceptEx", "XBitHack", "xml2EncAlias", "xml2EncDefault", + "xml2StartParse", "SecFilterEngine", "from", "SSLOptions", "SSLRequireSSL", "SSLRequire" +} +local literals = { + "on", "off", "deny", "denied", "all", "allow", "basic", "valid-user", "append", "unset", "set", "eq", + "any", "email" +} + +local symbols = {} +for _,lt in ipairs(literals) do + symbols[lt] = "literal" + symbols[lt:gsub("%f[%w]%l", string.upper)] = "literal" +end +for _,kw in ipairs(keywords) do + symbols[kw] = "keyword" +end + +local url_syntax = { + patterns = { + { pattern = "[%%$]%d+", type = "keyword2" }, + { pattern = "[%%$]%{[%w_:%-]+%}", type = "keyword2" }, + { pattern = "[^%%$%s]", type = "string" } + }, + symbols = {} +} +local xml_syntax = { + patterns = {{ pattern = { '"', '"', '\\' }, type = "string" }}, + symbols = {} +} + +syntax.add { + name = ".htaccess File", + files = { "^%.htaccess$" }, + comment = "#", + patterns = { + -- Comments + { pattern = "#.*\n", type = "comment" }, + -- Strings + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = { "'", "'", '\\' }, type = "string" }, + { pattern = { '`', '`', '\\' }, type = "string" }, + -- URLs + { pattern = { "%w-://", "%f[%s]" }, type = "string", syntax = url_syntax }, + { pattern = { "%f[%S]/", "%f[%s]" }, type = "string", syntax = url_syntax }, + -- Mime types + { pattern = "%f[%w]application/[%w%._+-]+", type = "keyword2" }, + { pattern = "%f[%w]font/[%w%._+-]+", type = "keyword2" }, + { pattern = "%f[%w]image/[%w%._+-]+", type = "keyword2" }, + { pattern = "%f[%w]text/[%w%._+-]+", type = "keyword2" }, + { pattern = "%f[%w]audio/[%w%._+-]+", type = "keyword2" }, + { pattern = "%f[%w]video/[%w%._+-]+", type = "keyword2" }, + -- IPs + { pattern = "%d+%.%d+%.%d+%.%d+", type = "keyword2" }, + { pattern = "%d+%.%d+%.%d+%.%d+/%d+", type = "keyword2" }, + { regex = "([a-f0-9:]+:+)+[a-f0-9]+", type = "keyword2" }, + -- Emails + { pattern = "%w+@%w+%.%w+", type = "keyword2" }, + -- Rewrite option sections + { pattern = "%f[%S]%b[]", type = "number" }, + -- XML tags + { pattern = { "</?%w+", ">" }, type = "literal", syntax = xml_syntax }, + -- Variables + { pattern = "[%%$]%d+", type = "keyword2" }, + { pattern = "[%%$]%{[%w_:%-]+%}", type = "keyword2" }, + -- Numbers + { pattern = "A?%d+", type = "number" }, + -- Operators + { pattern = "%f[%S][!=+%-]+", type = "operator" }, + -- Regex (TODO: improve this, it's pretty naive and only works on some regex) + { pattern = "%f[^%s!]%^%S*", type = "literal" }, + { pattern = "%f[^%s!]%S*%$", type = "literal" }, + { pattern = "%f[^%s!]%b()", type = "literal" }, + -- Everything else + { pattern = "[%a_][%w_-]*", type = "symbol" }, + }, + symbols = symbols +} diff --git a/plugins/language_php.lua b/plugins/language_php.lua index 6aa49a6..fda30cb 100644 --- a/plugins/language_php.lua +++ b/plugins/language_php.lua @@ -2,14 +2,55 @@ --[[ language_php.lua provides php syntax support allowing mixed html, css and js - version: 20220606_1 + version: 20220614_1 --]] local syntax = require "core.syntax" +local common = require "core.common" +local config = require "core.config" -- load syntax dependencies to add additional rules require "plugins.language_css" require "plugins.language_js" +local psql_found = pcall(require, "plugins.language_psql") +local sql_strings = {} + +config.plugins.language_php = common.merge({ + sql_strings = true, + -- The config specification used by the settings gui + config_spec = { + name = "Language PHP", + { + label = "SQL Strings", + description = "Highlight as SQL, strings starting with sql statements, " + .. "depends on language_psql.", + path = "sql_strings", + type = "toggle", + default = true, + on_apply = function(enabled) + local syntax_php = syntax.get("file.phps") + if enabled and psql_found then + if + not syntax_php.patterns[6].syntax + or + syntax_php.patterns[6].syntax ~= '.sql' + then + table.insert(syntax_php.patterns, 5, sql_strings[1]) + table.insert(syntax_php.patterns, 6, sql_strings[2]) + end + elseif + syntax_php.patterns[6].syntax + and + syntax_php.patterns[6].syntax == '.sql' + then + table.remove(syntax_php.patterns, 5) + table.remove(syntax_php.patterns, 5) + end + end + } + } +}, config.plugins.language_php) + -- Patterns to match some of the string inline variables local inline_variables = { { pattern = "%s+", type = "string" }, @@ -56,6 +97,56 @@ local function combine_patterns(t1, t2) return temp end +local function clone(tbl) + local t = {} + if tbl then + for k, v in pairs(tbl) do + if type(v) == "table" then + t[k] = clone(v) + else + t[k] = v + end + end + end + return t +end + +-- optionally allow sql syntax on strings +if psql_found then + -- generate SQL string marker regex + local sql_markers = { 'create', 'select', 'insert', 'update', 'replace', 'delete', 'drop', 'alter' } + local sql_regex = {} + for _, marker in ipairs(sql_markers) do + table.insert(sql_regex, marker) + table.insert(sql_regex, string.upper(marker)) + end + sql_regex = table.concat(sql_regex, '|') + + -- inject inline variable rules to cloned psql syntax + local syntax_phpsql = clone(syntax.get("file.sql")) + syntax_phpsql.name = "PHP SQL" + syntax_phpsql.files = "%.phpsql$" + table.insert(syntax_phpsql.patterns, 2, { pattern = "\\%$", type = "symbol" }) + table.insert(syntax_phpsql.patterns, 3, { pattern = "%{[%$%s]*%}", type = "symbol" }) + for i=4, 9 do + table.insert(syntax_phpsql.patterns, i, inline_variables[i]) + end + + -- SQL strings + sql_strings = { + { + regex = { '"(?=(?:'..sql_regex..')\\s+)', '"', '\\' }, + syntax = syntax_phpsql, + type = "string" + }, + { + regex = { '\'(?=(?:'..sql_regex..')\\s+)', '\'', '\\' }, + syntax = '.sql', + type = "string" + }, + } +end + -- define the core php syntax coloring syntax.add { name = "PHP Source", @@ -224,6 +315,13 @@ syntax.add { }, } +-- insert sql string rules after the "/%*", "%*/" pattern +if psql_found and config.plugins.language_php.sql_strings then + local syntax_php = syntax.get("file.phps") + table.insert(syntax_php.patterns, 5, sql_strings[1]) + table.insert(syntax_php.patterns, 6, sql_strings[2]) +end + -- allows html, css and js coloring on php files syntax.add { name = "PHP", diff --git a/plugins/language_v.lua b/plugins/language_v.lua index c7876e6..d5b9764 100644 --- a/plugins/language_v.lua +++ b/plugins/language_v.lua @@ -3,7 +3,7 @@ local syntax = require "core.syntax" syntax.add { name = "V", - files = "%.v$", "%.vsh$", + files = { "%.v$", "%.vsh$" }, headers = "^#!.*[ /]v\n", comment = "//", patterns = { @@ -12,6 +12,8 @@ syntax.add { { pattern = { '"', '"', '\\' }, type = "string" }, { pattern = { "'", "'", '\\' }, type = "string" }, { pattern = { "`", "`", '\\' }, type = "string" }, + { pattern = { "r'", "'" }, type = "string" }, -- raw string single quotes + { pattern = { 'r"', '"' }, type = "string" }, -- raw string double quotes { pattern = "0x[%da-fA-F_]+", type = "number" }, { pattern = "0b[01_]+", type = "number" }, { pattern = "00[01234567_]+", type = "number" }, diff --git a/plugins/nonicons.lua b/plugins/nonicons.lua index 9540ce6..143da13 100644 --- a/plugins/nonicons.lua +++ b/plugins/nonicons.lua @@ -121,7 +121,7 @@ function TreeView:get_item_icon(item, active, hovered) font = icon_font color = style.text if item.type == "dir" then - icon = item.expanded and "" or "" -- unicode 61771 and 61772 + icon = item.expanded and "" or "" -- unicode U+F23C and U+F23B end end if config.plugins.nonicons.draw_treeview_icons then |