name: Template Toolkit fileTypes:

firstLineMatch: [%.+?%] scopeName: text.html.tt repository:

tt-stuff: 
  patterns: 
  - name: comment.line.number-sign.tt
    captures: 
      "1": 
        name: punctuation.definition.comment.tt
    match: (#).*?(?=%\])
  - captures: 
      "1": 
        name: string.quoted.double.filename.tt
      "2": 
        name: punctuation.definition.string.begin.tt
      "4": 
        name: punctuation.definition.string.begin.tt
      "5": 
        name: string.unquoted.other.filename.tt
    match: ((")([a-z][a-z0-9_]+\/)+[a-z0-9_\.]+("))|(\b([a-z][a-z0-9_]+\/)+[a-z0-9_\.]+\b)
  - include: "#string-double-quoted"
  - include: "#string-single-quoted"
  - name: variable.other.tt
    captures: 
      "1": 
        name: punctuation.definition.variable.tt
    match: (\$?)\b[a-z]([a-z0-9_]\.?)*\b
  - name: keyword.control.tt
    match: \b(?:IF|END|BLOCK|INCLUDE|ELSE|ELSIF|SWITCH|CASE|UNLESS|WRAPPER|FOR|FOREACH|LAST|NEXT|USE|WHILE|FILTER|IN|GET|CALL|SET|INSERT|MACRO|PERL|TRY|CATCH|THROW|FINAL|STOP|META|DEBUG|RAWPERL)\b
  - name: keyword.operator.tt
    match: \||\|\||=|_|-|\*|\/|\?|:|div|mod|;|\+
tag-stuff: 
  patterns: 
  - include: "#tag-generic-attribute"
  - include: "#string-double-quoted"
  - include: "#string-single-quoted"
  - include: "#keyword"
string-double-quoted: 
  name: string.quoted.double.tt
  endCaptures: 
    "0": 
      name: punctuation.definition.string.end.tt
  begin: "\""
  beginCaptures: 
    "0": 
      name: punctuation.definition.string.begin.tt
  end: "\""
  patterns: 
  - include: "#embedded-code"
  - include: "#entities"
tmpl-container-tag: 
  patterns: 
  - name: meta.tag.template.tt
    captures: 
      "0": 
        name: punctuation.definition.tag.tt
    begin: \[%
    end: "%\\]"
    patterns: 
    - include: "#tt-stuff"
entities: 
  patterns: 
  - name: constant.character.entity.html
    captures: 
      "1": 
        name: punctuation.definition.constant.html
      "3": 
        name: punctuation.definition.constant.html
    match: (&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)
  - name: invalid.illegal.bad-ampersand.html
    match: "&"
string-single-quoted: 
  name: string.quoted.single.tt
  endCaptures: 
    "0": 
      name: punctuation.definition.string.end.tt
  begin: "'"
  beginCaptures: 
    "0": 
      name: punctuation.definition.string.begin.tt
  end: "'"
  patterns: 
  - include: "#embedded-code"
  - include: "#entities"
tag-generic-attribute: 
  name: entity.other.attribute-name.tt
  captures: 
    "2": 
      name: punctuation.separator.key-value.tt
  match: \b([a-zA-Z-_:]+)\s*(=)
keyword: 
  name: string.unquoted.tt
  match: \b([A-Za-z0-9_]+)
embedded-code: {}

uuid: 67D0DEC7-9E8C-44B3-8FA5-ADD9BBA05DE3 foldingStartMarker: (<(?i:(head|table|tr|div|style|script|ul|ol|form|dl))b.*?>|^ *[%[^%]*b(?:FOR|WRAPPER|SWITCH|FOREACH|IF|UNLESS|BLOCK|MACRO|FILTER|PERL|TRY)b(?!.*END *%])) patterns:

foldingStopMarker: (</(?i:(head|table|tr|div|style|script|ul|ol|form|dl))>|^ *[% *END *%]) keyEquivalent: ^~T