{
  "name": "Rascal",
  "scopeName": "source.rascal",
  "patterns": [
    {
      "include": "#top_level"
    }
  ],
  "repository": {
    "annotation": {
      "patterns": [
        {
          "name": "comment.block.annotation.rascal",
          "begin": "(@[^ {]+)({)",
          "end": "(})",
          "beginCaptures": {
            "1": {
              "name": "storage.type.annotation.block.rascal"
            },
            "2": {
              "name": "punctuation.annotation-argument.begin.rascal"
            }
          },
          "endCaptures": {
            "1": {
              "name": "punctuation.annotation-argument.end.rascal"
            }
          }
        },
        {
          "name": "meta.annotation.inline.rascal",
          "match": "(@[A-Za-z_0-9]+)",
          "captures": {
            "1": {
              "name": "storage.type.annotation.inline.rascal"
            }
          }
        }
      ]
    },
    "char_set": {
      "patterns": [
        {
          "name": "punctuation.other.lexicalcharset.rascal",
          "begin": "\\[",
          "end": "\\]",
          "patterns": [
            {
              "include": "#string_escape"
            }
          ]
        }
      ]
    },
    "comment": {
      "patterns": [
        {
          "name": "comment.line.double-slash.rascal",
          "match": "//.*$\\n?"
        },
        {
          "name": "comment.block.rascal",
          "begin": "/\\*",
          "end": "\\*/"
        }
      ]
    },
    "regex": {
      "patterns": [
        {
          "name": "string.regexp.rascal",
          "end": "/([dims]*)",
          "patterns": [
            {
              "include": "#regex_escape"
            },
            {
              "include": "#string_interpolation"
            }
          ],
          "endCaptures": {
            "1": {
              "name": "storage.modifier.regex.rascal"
            }
          }
        }
      ]
    },
    "regex_escape": {
      "patterns": [
        {
          "name": "constant.character.escape.regex.rascal",
          "match": "\\\\(/|\u003c|\u003e|\\\\)"
        }
      ]
    },
    "string": {
      "patterns": [
        {
          "name": "string.quoted.single.rascal",
          "begin": "'",
          "end": "'",
          "patterns": [
            {
              "include": "#string_escape"
            }
          ]
        },
        {
          "name": "string.quoted.double.rascal",
          "begin": "\"",
          "end": "\"",
          "patterns": [
            {
              "include": "#string_escape"
            },
            {
              "include": "#string_interpolation"
            }
          ]
        },
        {
          "name": "string.interpolated.rascal",
          "begin": "`",
          "end": "`",
          "patterns": [
            {
              "include": "#string_interpolation"
            },
            {
              "include": "#syntax_escape"
            }
          ]
        }
      ]
    },
    "string_escape": {
      "patterns": [
        {
          "name": "constant.character.escape.ordinary.rascal",
          "match": "\\\\(\\\"|\\'|\u003c|\u003e|\\\\|[bnfrt])"
        },
        {
          "name": "constant.character.escape.unicode.rascal",
          "match": "\\\\(u[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f] |U(0[0-9 A-F a-f]|10)[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f] |a[0-7][0-9A-Fa-f] )"
        }
      ]
    },
    "string_interpolation": {
      "patterns": [
        {
          "name": "support.interpolated-string.rascal",
          "begin": "(\u003c)",
          "end": "(\u003e)",
          "patterns": [
            {
              "include": "#top_level"
            }
          ],
          "beginCaptures": {
            "1": {
              "name": "punctuation.interpolation.begin.rascal"
            }
          },
          "endCaptures": {
            "2": {
              "name": "punctuation.interpolation.end.rascal"
            }
          }
        }
      ]
    },
    "syntax_escape": {
      "patterns": [
        {
          "name": "constant.character.escape.syntax.rascal",
          "match": "\\\\(\\\\|\u003c|\u003e|`)"
        }
      ]
    },
    "top_level": {
      "patterns": [
        {
          "name": "punctuation.other.syntactic.rascal",
          "begin": "(lexical|syntax)\\s+([a-zA-Z][A-Za-z_0-9]*)",
          "end": ";",
          "patterns": [
            {
              "include": "#char_set"
            },
            {
              "include": "#string"
            },
            {
              "include": "#comment"
            },
            {
              "include": "#regex"
            },
            {
              "include": "#annotation"
            }
          ],
          "captures": {
            "1": {
              "name": "keyword.control.rascal"
            },
            "2": {
              "name": "entity.name.type.rascal"
            }
          }
        },
        {
          "name": "constant.numeric.decimal.rascal",
          "match": "(?\u003c![A-Za-z_])(0(?![0-9a-z_A-Z])|[1-9][0-9]*(?![0-9a-z_A-Z]))"
        },
        {
          "name": "constant.numeric.hex.rascal",
          "match": "(?\u003c![A-Za-z_])0[Xx][0-9A-Fa-f]+(?![0-9a-z_A-Z])"
        },
        {
          "name": "constant.numeric.octal.rascal",
          "match": "(?\u003c![A-Za-z_])0[0-7]+(?![0-9a-z_A-Z])"
        },
        {
          "name": "string.other.datetime.rascal",
          "begin": "\\\\$",
          "end": "\\\\$"
        },
        {
          "name": "constant.numeric.real.rascal",
          "match": "(?\u003c![A-Za-z_]) ([0-9]+[dDfF] |[0-9]+[eE][+\\-]?[0-9]+[dDfF]? |[0-9]+\\.(?!\\.)[0-9]*[dDfF]? |[0-9]+\\.[0-9]*[eE][+\\-]?[0-9]+[dDfF]? |\\.(?!\\.)[0-9]+[dDfF]? |\\.(?!\\.)[0-9]+[eE][+\\-]?[0-9]+[dDfF]? )"
        },
        {
          "name": "constant.language.bool.rascal",
          "match": "\\b(true|false)\\b"
        },
        {
          "name": "constant.numeric.rational.rascal",
          "match": "(?\u003c![A-Za-z_])([0-9][0-9]*r|[1-9][0-9]*r[0-9][0-9]*(?![0-9a-z_A-Z]))"
        },
        {
          "name": "keyword.control.rascal",
          "match": "\\b(syntax|keyword|lexical|break|continue|finally|private|fail|filter|if|tag|extend|append|non-assoc|assoc|test|anno|layout|data|join|it|bracket|in|import|all|solve|try|catch|notin|else|insert|switch|return|case|while|throws|visit|for|assert|default|map|alias|any|module|mod|public|one|throw|start)\\b"
        },
        {
          "name": "support.type.basic.rascal",
          "match": "\\b(value|loc|node|num|type|bag|int|rat|rel|lrel|real|tuple|str|bool|void|datetime|set|map|list)\\b"
        },
        {
          "include": "#string"
        },
        {
          "include": "#regex"
        },
        {
          "include": "#annotation"
        },
        {
          "include": "#comment"
        },
        {
          "name": "variable.other.ordinary.rascal",
          "match": "\\b[a-zA-Z][A-Za-z_0-9]*\\b"
        },
        {
          "name": "variable.other.escaped-keyword.rascal",
          "match": "\\\\(syntax|keyword|lexical|break|continue|finally|private|fail|filter|if|tag|extend|append|non-assoc|assoc|test|anno|layout|data|join|it|bracket|in|import|all|solve|try|catch|notin|else|insert|switch|return|case|while|throws|visit|for|assert|default|map|alias|any|module|mod|public|one|throw|start|value|loc|node|num|type|bag|int|rat|rel|lrel|real|tuple|str|bool|void|datetime|set|map|list)"
        },
        {
          "name": "string.other.url.rascal",
          "match": "\\|([0-9a-z_A-Z.\\-_~:/?#\\[\\]@!$\u0026'()*+,;=`])+\\|",
          "captures": {
            "1": {
              "name": "markup.underline.link.rascal"
            }
          }
        }
      ]
    }
  }
}