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>]] } },
}