261103.1.3 · bebfec1cb9cc7a83ae660a38b3fbce00dcf94155
Merge branch 'master' into 'patch-1'
# Conflicts: # langDefs/csharp_unity.lang
reading declarations
Changes to langDefs/. All files
@@ -6,14 +6,15 @@ Categories = {"config", "script"} Keywords={ { Id=1, List={- "if", "elseif", "else", "endif", "foreach", "endforeach", "and", "while", "endwhile", "macro", "endmacro", "function", "endfunction", "set", "unset"+ "if", "elseif", "else", "endif", "foreach", "endforeach", "and", "while", "endwhile",+ "macro", "endmacro", "function", "endfunction", "set", "unset" }, }, { Id=2, Regex=[[ [0-9A-Z_]{2,} ]], }, { Id=3,- Regex=[[\$\{.+\$\{[^}]+\}.+?\}|\$\{[^}]+\} ]],+ Regex=[[ \$\{[^{}]*\$\{[^}]+\}[^{}]*?\}|\$\{[^}]+\} ]], }, { Id=3, Regex=[[ [A-Z_\>]+\:([\w/]+) ]],
@@ -41,7 +41,7 @@ Strings={ RawPrefix="r", Interpolation=[[ %\w ]], DelimiterPairs= {- { Open=[[ q"[\[\(\<\{] ]], Close=[[ "[\]\)\>\}] ]], Raw=true }+ { Open=[[ q"[\[\(\<\{] ]], Close=[[ [\]\)\>\}]" ]], Raw=true } } }
@@ -0,0 +1,51 @@++Description="Svelte template block (nested in svelte.lang)"++Categories = {"markup", "script"}++Digits=[[ (?:0x)[0-9a-fA-F]+|(?:0b)[01]+|(?:0o)[0-8]+|\d*[\.]?\d+(?:[eE][\-\+]\d+)?[lLuU]* ]]++Keywords={+ -- the sigil belongs to the block marker: {#if, {:else, {/each, {@render+ { Id=1,+ Regex=[[[#:\/@]\w+]],+ Group=0,+ },+ -- block keywords plus the javascript ones an expression may contain+ { Id=1,+ List={"if", "else", "each", "as", "await", "then", "catch", "key", "snippet",+ "html", "const", "debug", "render", "attach",+ "break", "class", "continue", "default", "delete", "export", "extends",+ "finally", "instanceof", "import", "in", "new", "of", "from", "return",+ "super", "switch", "this", "throw", "try", "typeof", "var", "let",+ "function", "yield", "static", "true", "false", "null", "do", "for", "while",+ },+ },+ { Id=2,+ List={"boolean", "undefined", "void"},+ },+ { Id=4,+ Regex=[[(\w+)(\s*[:=]\s*function)?\s*\(]],+ Group=1+ },+}++Strings={+ Delimiter=[["|'|`]],+ Interpolation=[[ \$\{[^}]+\} ]],+ Escape = [=[ \\u\{?[[:xdigit:]]{4,6}\}?|\\\d{3}|\\x[[:xdigit:]]{2}|\\[ntvbrfa\\\?'\"] ]=]+}++IgnoreCase=false++Comments={+ { Block=false,+ Delimiter= { [[\/\/]] },+ },+ { Block=true,+ Nested=false,+ Delimiter= { [[\/\*]],[[\*\/]],}+ }+}++Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\:|\?|\&|<|>|\!|\=|\/|\*|\%|\+|\-|\~|\||\.]]
@@ -16,7 +16,10 @@ Keywords={ } Strings={- Delimiter=[["]],+ DelimiterPairs={+ { Open=[[(?<![A-Za-z])"]], Close=[["]] },+ { Open=[[(?<![A-Za-z])']], Close=[['']] },+ }, } Comments={
@@ -0,0 +1,94 @@+Description="KDL"++Categories = {"config"}++-- KDL 2.0.0, plus the KDL 1 spellings of the keywords and of raw strings, as+-- most configuration files in the wild are still written against KDL 1++Identifiers=[[ [a-zA-Z_][\w\-\.]*|[\-\.]+[a-zA-Z_][\w\-\.]* ]]++Digits=[[ [\-\+]?(?:0x[0-9a-fA-F][0-9a-fA-F_]*|0o[0-7][0-7_]*|0b[01][01_]*|\d[\d_]*(?:\.[\d_]+)?(?:[eE][\-\+]?\d[\d_]*)?) ]]++Keywords={+ -- the property key must precede the node name: on a line continued with "\"+ -- both match, and only this one is right+ { Id=2,+ Regex=[[([\w\-\.\x80-\xFF][^\s\(\)\{\}\[\];=\\\/"]*)\s*=]],+ },+ { Id=1,+ Regex=[[^\s*([\w\-\.\x80-\xFF][^\s\(\)\{\}\[\];=\\\/"]*)]],+ },+ { Id=3,+ Regex=[[#(?:true|false|null|inf|-inf|nan)]],+ },+ { Id=3,+ List={"true", "false", "null"}+ },+ { Id=4,+ Regex=[[\(\s*([^\s\(\)]+)\s*\)]],+ },+ -- Raw string delimiters, handed to the string state by OnStateChange, which+ -- pairs their hashes by length. #"""# holds a quote, it is not a multi line+ -- opener; and since "#ff0000" opens a plain string, only close a raw one+ -- where a value ends and cannot begin.+ { Id=5,+ Regex=[[#+"""(?!#)|#+"]]+ },+ { Id=6,+ Regex=[["""#+]]+ },+ { Id=6,+ Regex=[[[^\s=]("#+)(?=[\s;\)\}=]|$)]],+ },+}++Strings={+ Delimiter=[["""|"]],+ AssertEqualLength=true,+ RawPrefix="r",+ -- \" is an escape everywhere except as the tail of a raw string terminator+ Escape=[[ \\u\{[0-9a-fA-F]{1,6}\}|\\[nrtsbf\\\/]|\\"(?!#+(?:[\s;\)\}=]|$)) ]],+}++IgnoreCase=false++Comments={+ -- "/*" and a slashdashed node with a child block share one nesting counter,+ -- so a "}" ends a block comment opened inside a commented out node. The bare+ -- "{" alternative is what feeds the counter the inner blocks.+ { Block=true,+ Nested=true,+ Delimiter= { [[\/\*|\/\-[^\{\}]*\{|\{]], [[\*\/|\}]] }+ },+ -- slashdash without a child block: the node ends with the line+ { Block=false,+ Delimiter= { [[\/\-]] }+ },+ { Block=false,+ Delimiter= { [[\/\/]] }+ },+}++Operators=[[\(|\)|\{|\}|\;|\=|\\]]++function OnStateChange(oldState, newState, token, groupID)++ -- braces delimit a comment only while a slashdashed node is being skipped+ if (token=="{" or token=="}") and oldState~=HL_BLOCK_COMMENT then+ return HL_OPERATOR+ end++ if groupID==5 then+ -- inside a string the hashes are content, and the quote closes it+ if oldState==HL_STRING then+ return HL_REJECT+ end+ OverrideParam("state.string.raw", "true")+ return HL_STRING+ end+ if groupID==6 and oldState==HL_STRING then+ return HL_STRING_END+ end++ return newState+end
@@ -0,0 +1,87 @@+Description="M4 Macro Language"++Categories = {"source", "script"}++Identifiers=[[ [a-zA-Z_][\w\-]* ]]++Digits=[[ (?:0x|0X)[0-9a-fA-F]+|\d+[\.]?\d* ]]++Keywords={+ -- m4 builtins+ { Id=1,+ List={"builtin", "changecom", "changequote", "changeword", "debugfile", "debugmode", "decr",+ "define", "defn", "divert", "divnum", "dumpdef", "errprint", "esyscmd", "eval", "format",+ "ifdef", "ifelse", "include", "incr", "index", "indir", "len", "m4exit", "m4wrap", "mkstemp",+ "patsubst", "popdef", "pushdef", "regexp", "sinclude", "shift", "substr", "syscmd", "sysval",+ "traceoff", "traceon", "translit", "undefine", "undivert"},+ },+ -- autoconf m4sugar aliases+ { Id=1,+ List={"m4_argn", "m4_append", "m4_append_uniq", "m4_bmatch", "m4_bpatsubst", "m4_bpatsubsts",+ "m4_case", "m4_cond", "m4_copy", "m4_curry", "m4_default", "m4_default_nblank",+ "m4_default_nblank_quoted", "m4_default_quoted", "m4_define", "m4_defn", "m4_divert",+ "m4_divert_once", "m4_divert_pop", "m4_divert_push", "m4_divert_text", "m4_do", "m4_dquote",+ "m4_dquote_elt", "m4_dumpdefs", "m4_dumpvars", "m4_echo", "m4_esyscmd", "m4_esyscmd_s",+ "m4_expand", "m4_fatal", "m4_foreach", "m4_foreach_w", "m4_format", "m4_for", "m4_if",+ "m4_ifblank", "m4_ifdef", "m4_ifnblank", "m4_ifndef", "m4_ifset", "m4_ifval", "m4_ifvaln",+ "m4_include", "m4_index", "m4_input", "m4_join", "m4_joinall", "m4_len", "m4_list_cmp",+ "m4_make", "m4_maketemp", "m4_map", "m4_map_args", "m4_map_args_list", "m4_map_args_pair",+ "m4_map_args_sep", "m4_map_sep", "m4_mapall", "m4_max", "m4_min", "m4_newline",+ "m4_pattern_allow", "m4_pattern_forbid", "m4_popdef", "m4_pushdef", "m4_quote",+ "m4_re_escape", "m4_regexp", "m4_rename", "m4_require", "m4_set_add", "m4_set_add_all",+ "m4_set_contains", "m4_set_contents", "m4_set_delete", "m4_set_difference", "m4_set_dump",+ "m4_set_empty", "m4_set_foreach", "m4_set_intersection", "m4_set_list", "m4_set_listc",+ "m4_set_remove", "m4_set_size", "m4_set_union", "m4_shift", "m4_shift2", "m4_shift3",+ "m4_shiftn", "m4_sinclude", "m4_split", "m4_stack_foreach", "m4_stack_foreach_quit",+ "m4_substr", "m4_symbols", "m4_syscmd", "m4_sysval", "m4_text_box", "m4_text_wrap",+ "m4_tolower", "m4_toupper", "m4_translit", "m4_undefine", "m4_undivert", "m4_unquote",+ "m4_version_compare", "m4_warn"},+ },+ -- shell variables and m4 positional parameters+ { Id=2,+ Regex=[[ \$(?:\{[\w]+\}|[@\w]+|\d+|@|#|\*) ]],+ },+ -- shell control keywords inside embedded script+ { Id=3,+ List={"if", "then", "else", "elif", "fi", "case", "esac", "for", "while", "until", "do", "done",+ "in", "function", "select", "time"},+ },+ -- autoconf macros (AC_*)+ { Id=4,+ Regex=[[\bAC_[A-Z][A-Z0-9_]*\b]],+ Group=0,+ },+ -- automake (AM_), m4sh (AS_) and other Autotools macros+ { Id=5,+ Regex=[[\b(AM|AS|AH|AT|AU|AX|LT|PKG|GL|ND|DUTI)_[A-Z][A-Z0-9_]*\b]],+ Group=0,+ },+ -- shell builtin commands inside embedded script+ { Id=6,+ List={"test", "echo", "shift", "set", "unset", "export", "readonly", "return", "exit", "break",+ "continue", "cd", "printf", "read", "pwd", "trap", "true", "false", "eval", "exec",+ "command", "local"},+ },+}++Strings={+ -- shell double-quoted strings inside embedded script+ Delimiter=[=["]=],+ -- m4 quoting: `...'+ DelimiterPairs={+ { Open=[[`]], Close=[[']] },+ },+}++IgnoreCase=false++Comments={+ { Block=false,+ Delimiter= { [[\bdnl\b]] },+ },+ { Block=false,+ Delimiter= { [[\B#]] },+ },+}++Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\:|\&|<|>|\!|\=|\/|\*|\%|\+|\-|\$]]
@@ -46,7 +46,7 @@ PreProcessor={ } NestedSections = {- { Lang="asm", Delimiter= { [[asm]], [[\}]] } }+ { Lang="nbc", Delimiter= { [[asm]], [[\}]] } } } Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\.|\:|\&|<|>|\!|\=|\/|\*|\%|\+|\-|\~]]
@@ -26,7 +26,7 @@ Keywords={ List={"int", "integer", "real", "double", "float", "string", "array", "object", "bool", "mixed", "numeric", "void" }, }, { Id=3,- Regex=[[\$[\w\-"|']+|\$?\{.+?\}]],+ Regex=[[\$[\w\-]+|\$?\{.+?\}]], }, { Id=4, Regex=[[(\w+)\s*\(]],
@@ -68,5 +68,9 @@ function OnStateChange(oldState, newState, token, groupID) return HL_OPERATOR end + if newState==HL_INTERPOLATION and oldState~=HL_STRING and oldState~=HL_ESC_SEQ and oldState~=HL_INTERPOLATION then+ return HL_REJECT+ end+ return newState end
@@ -57,6 +57,10 @@ Keywords={ -- hereDoc opening delimiter, see OnStateChange to handle end of string Strings={ Delimiter=[[<<[\-]?\s*["']?\s*[A-Za-z_]+["']?|"|`|']],+ -- balanced $( ... ) span (recursive); within strings it is absorbed into the+ -- string unit so quotes inside command substitutions do not break pairing;+ -- outside strings OnStateChange rejects it so inner tokens keep their colors+ Interpolation=[[\$\((?:[^()]|(?R))*\)]], } IgnoreCase=false@@ -74,6 +78,13 @@ cmdSubStack = {} function OnStateChange(oldState, newState, token, kwClass) + -- the interpolation span is only wanted inside quoted strings; reject it at+ -- root level so the substitution's content is tokenized normally, and inside+ -- heredocs, which end at the delimiter word and need no quote pairing+ if newState == HL_INTERPOLATION and (oldState == HL_STANDARD or hereDoc ~= nil) then+ return HL_REJECT+ end+ if oldState == HL_STRING and token == hereDoc then hereDoc = nil return HL_STRING_END@@ -85,7 +96,13 @@ function OnStateChange(oldState, newState, token, kwClass) cmdSubStart = string.find(token, "%$%(") if cmdSubStart and cmdSubStack ~= nil then- table.insert(cmdSubStack, {depth = #cmdSubStack + 1, inString = true})+ -- a balanced $( ... ) arrives as a single token, so no closing ) follows+ -- to pop it again: tracking it would leave the stack filled for good+ cmdSubOpen = select(2, string.gsub(token, "%(", ""))+ cmdSubClose = select(2, string.gsub(token, "%)", ""))+ if cmdSubOpen > cmdSubClose then+ table.insert(cmdSubStack, {depth = #cmdSubStack + 1, inString = true})+ end return HL_STRING end
@@ -5,8 +5,8 @@ Categories = {"config", "script"} Keywords={ { Id=1,- List={ "Summary", "Name", "Version", "Release", "Copyright", "Group", "URL",- "Packager", "Prefix", "Distribution", "Vendor", "Icon", "Provides", "Requires",+ List={ "Summary", "Name", "Epoch", "Version", "Release", "Copyright", "Group", "URL",+ "Packager", "Prefix", "Distribution", "Vendor", "Icon", "Provides", "BuildRequires", "Requires", "Serial", "Conflicts", "AutoReqProv", "BuildArch", "ExcludeArch", "ExclusiveArch", "ExclusiveOS", "BuildRoot", "NoSource", "NoPatch", "License", "Buildroot", "Source", "Patch", "case", "in", "esac", "for", "do", "done",
@@ -0,0 +1,51 @@++Description="Svelte"++Categories = {"markup", "script"}++Keywords={+ { Id=1,+ Regex=[[<[!?]?(?!\-\-)\/?[\w\:\-]+>?|[/?]?>]],+ Group=0,+ },+ { Id=2,+ Regex=[=[([-\w\.\:\|]+)=["'{]]=],+ },+ -- full marker: also catches markers after the first on a line, which the+ -- nested section cannot (only one embedded section may open per line)+ { Id=3,+ Regex=[[\{[#\/](?:if|each|await|key|snippet)\b|\{:(?:else|then|catch)\b|\{@(?:html|const|debug|render|attach)\b]],+ Group=0,+ },+ { Id=3,+ Regex=[=[\{[#:\/@]?|\}]=],+ Group=0,+ },+ { Id=4,+ Regex=[[\&\#?\w+;]],+ },+}++Strings={+ Delimiter=[["]],+ -- see http://stackoverflow.com/questions/1723182/a-regex-that-will-never-be-matched-by-anything+ Escape=[[\A(?!x)x]]+}++Comments={+ { Block=true,+ Nested=false,+ Delimiter= { [[<!\-\-]],[[\-\->]] }+ }+}++NestedSections = {+ -- template blocks and interpolations: the block keyword and the expression are+ -- highlighted by inc_svelteblock instead of a single pattern per marker, so+ -- {:else if} and {#each x as y} keep both of their keywords+ { Lang="inc_svelteblock", Delimiter= { [=[\{[#:\/@]]=], [[\}]] } },+ { Lang="css", Delimiter= { [[<style[^>]*>]], [[<\/style>]] } },+ { Lang="javascript", Delimiter= { [[<script[^>]*>]], [[<\/script>]] } },+ -- must come after the generic entry: the last matching delimiter wins+ { Lang="typescript", Delimiter= { [[<script[^>]*lang=["']ts["'][^>]*>]], [[<\/script>]] } },+}
@@ -14,8 +14,10 @@ Keywords={ NestedSections = { - { Lang="css", Delimiter= { [[<style>]], [[<\/style>]] } },- { Lang="js", Delimiter= { [[<script>]], [[<\/script>]] } },- { Lang="html", Delimiter= { [[ <template>]], [[<\/template>]] } },+ { Lang="css", Delimiter= { [[<style[^>]*>]], [[<\/style>]] } },+ { Lang="html", Delimiter= { [[<template[^>]*>]], [[<\/template>]] } },+ { Lang="javascript", Delimiter= { [[<script[^>]*>]], [[<\/script>]] } },+ -- must come after the generic entry: the last matching delimiter wins+ { Lang="typescript", Delimiter= { [[<script[^>]*lang=["']ts["'][^>]*>]], [[<\/script>]] } }, }