current commit
260808.1.1 · #189 highlight svelte block keywords with a nested syntax definition

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=[[\(|\)|\[|\]|\{|\}|\,|\;|\:|\?|\&|<|>|\!|\=|\/|\*|\%|\+|\-|\~|\||\.]]