260808.1.1 · 938e0847dc900866de7418030e788a1835648826
#189 highlight svelte block keywords with a nested syntax definition
reading declarations
Changes to langDefs/svelte.lang. All files
@@ -11,12 +11,14 @@ Keywords={ { 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=[=[[\{\}]]=],+ Regex=[=[\{[#:\/@]?|\}]=], Group=0, }, { Id=4,@@ -38,6 +40,10 @@ Comments={ } 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