{ "name": "Nim", "scopeName": "source.nim", "patterns": [ { "name": "comment.line.number-sign.multi-comment.nim", "begin": "(\\#\\[\\s*(TODO|todo)?)", "end": "(.*]\\#)", "captures": { "1": { "name": "punctuation.definition.multi-comment.nim" }, "2": { "name": "invalid.illegal.TODO.nim" } } }, { "name": "comment.line.number-sign.multi-doc-comment.nim", "begin": "(\\#\\#\\[\\s*(TODO|todo)?)", "end": "(.*]\\#\\#)", "captures": { "1": { "name": "punctuation.definition.multi-doc-comment.nim" }, "2": { "name": "invalid.illegal.TODO.nim" } } }, { "name": "comment.line.number-sign.doc-comment.nim", "match": "(##\\s*(TODO|todo)?).+$\\n?", "captures": { "1": { "name": "punctuation.definition.doc-comment.nim" }, "2": { "name": "invalid.illegal.TODO.nim" } } }, { "name": "comment.line.number-sign.doc-comment.empty.nim", "match": "(##\\s*)$\\n?", "captures": { "1": { "name": "punctuation.definition.doc-comment.empty.nim" } } }, { "name": "comment.line.number-sign.comment.nim", "match": "(#\\s*(TODO|todo)?).*$\\n?", "captures": { "1": { "name": "punctuation.definition.comment.nim" }, "2": { "name": "invalid.illegal.TODO.nim" } } }, { "name": "source.c.embedded.nim", "patterns": [ { "begin": "\\{\\.(emit:) ?(\\\"\\\"\\\")", "end": "(\\\"\\\"\\\")\\.?", "patterns": [ { "name": "keyword.operator.nim", "begin": "\\`", "end": "\\`" }, { "include": "source.c" } ], "captures": { "1": { "name": "keyword.other.nim" }, "2": { "name": "comment.syntax.nim" } }, "endCaptures": { "1": { "name": "comment.syntax.nim" } } } ] }, { "name": "source.asm.embedded.nim", "patterns": [ { "begin": "(asm )(\\\"\\\"\\\")", "end": "\\\"\\\"\\\"", "patterns": [ { "name": "keyword.operator.nim", "begin": "\\`", "end": "\\`" }, {} ], "captures": { "1": { "name": "keyword.other.nim" }, "2": { "name": "comment.syntax.nim" } }, "endCaptures": { "0": { "name": "comment.syntax.nim" } } } ] }, { "name": "meta.proc.nim", "patterns": [ { "begin": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])(proc|method|template|macro|iterator|converter)\\s+((\\`[^\\s\\`]+\\`)|([\\w\\x{80}-\\x{10FFFF}]+))(\\*)?", "end": "(\\=)", "patterns": [ { "match": "\\[[\\w\\x{80}-\\x{10FFFF}]+\\]" }, { "begin": "\\{", "end": "\\}", "patterns": [ { "name": "string.something.nim", "begin": "\\\"", "end": "\\\"" }, { "name": "entity.other.attribute-name.pattern.nim", "match": "([\\w\\x{80}-\\x{10FFFF}]+)" } ] }, { "begin": "\\(", "end": "\\)", "patterns": [ { "begin": "\\{", "end": "\\}", "patterns": [ { "name": "string.something.nim", "begin": "\\\"", "end": "\\\"" }, { "name": "entity.other.attribute-name.pattern.nim", "match": "([\\[\\]\\w\\x{80}-\\x{10FFFF}]+)" } ] }, { "include": "source.nim" } ] }, { "include": "source.nim" } ], "beginCaptures": { "1": { "name": "storage.type.proc.nim" }, "2": { "name": "entity.name.function.nim" }, "5": { "name": "keyword.operator.secondary.kw-public.nim" } }, "endCaptures": { "1": { "name": "keyword.operator.nim" } } } ] }, { "name": "pragma", "begin": "\\{\\.", "end": "\\.?\\}", "patterns": [ { "name": "string.something.nim", "begin": "\\\"", "end": "\\\"" }, { "name": "entity.other.attribute-name.pragma.nim", "match": "([\\w\\x{80}-\\x{10FFFF}]+)" } ] }, { "name": "comment.line.discarded.nim", "begin": "discard \\\"\\\"\\\"", "end": "\\\"\\\"\\\"" }, { "name": "constant.numeric.float.decimal.nim", "match": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])(\\d[_\\d]*((\\.[_\\d]+([eE][\\+\\-]?\\d[_\\d]*)?)|([eE][\\+\\-]?\\d[_\\d]*)))('?([fF](32|64|128))|[fFdD])?" }, { "name": "constant.numeric.integer.hexadecimal.nim", "match": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])(0[xX][0-9A-Fa-f][_0-9A-Fa-f]*)('?(([iIuUfF](8|16|32|64))|[uUfFdD]))?" }, { "name": "constant.numeric.integer.octal.nim", "match": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])(0[ocC][0-7][_0-7]*)('?(([iIuUfF](8|16|32|64))|[uUfFdD]))?" }, { "name": "constant.numeric.integer.binary.nim", "match": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])(0(b|B)[01][_01]*)('?(([iIuUfF](8|16|32|64))|[uUfFdD]))?" }, { "name": "constant.numeric.integer.decimal.nim", "match": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])(\\d[_\\d]*)('?(([iIuUfF](8|16|32|64))|[uUfFdD]))?" }, { "name": "constant.language.nim", "match": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])(true|false|inf|nil)(?![\\w\\x{80}-\\x{10FFFF}])" }, { "begin": "(?:^|\\s+|=)(when|if)\\b", "end": "(?=:)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.control.primary.nim" } }, "endCaptures": { "1": { "name": "control.variable.parameter.nim" } } }, { "begin": "(?:^|\\s+|=)(case)\\b", "end": "(?=\\bof\\b)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.control.primary.nim" } }, "endCaptures": { "1": { "name": "control.variable.parameter.nim" } } }, { "begin": "(?:^|\\s+)(of|else|elif)\\b", "end": "(?=:)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.control.secondary.nim" } }, "endCaptures": { "1": { "name": "control.variable.parameter.nim" } } }, { "name": "keyword.control.nim", "match": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])(await|block|break|continue|do|end|except|finally|raise|return|try|while|yield)(?![\\w\\x{80}-\\x{10FFFF}])" }, { "name": "keyword.operator.boolean.nim", "match": "((?\u003c![\\w\\x{80}-\\x{10FFFF}])(and|in|is|isnot|not|notin|or|xor)(?![\\w\\x{80}-\\x{10FFFF}]))" }, { "name": "keyword.other.nim", "match": "((?\u003c![\\w\\x{80}-\\x{10FFFF}])(addr|as|atomic|bind|cast|const|converter|defer|discard|distinct|div|enum|export|include|let|mixin|object|of|ptr|ref|shl|shr|static|type|var)(?![\\w\\x{80}-\\x{10FFFF}]))" }, { "name": "keyword.operator.nim", "match": "(\\b()\\b|(=|\\+|-|\\*|/|\u003c|\u003e|@|\\$|~|\u0026|%|!|\\?|\\^|\\.|:|\\\\)+)" }, { "name": "meta.forloop.nim", "begin": "(for)\\s+", "end": "(?=:)", "patterns": [ { "match": "\\ [\\w\\x{80}-\\x{10FFFF},]+\\s+(in)\\s+", "captures": { "1": { "name": "keyword.control.nim" } } }, { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.control.nim" } } }, { "match": "((import)\\s+[\\.|\\w|\\/]+,?)", "captures": { "2": { "name": "keyword.control.nim" } } }, { "match": "(from)\\s+[\\/\\w]+\\s+(?=import)", "captures": { "1": { "name": "keyword.control.nim" } } }, { "begin": "(var|let)\\s*\\(", "end": "\\)", "captures": { "1": { "name": "keyword.other.nim" } } }, { "name": "keyword.invalid.nim", "match": "((?\u003c![\\w\\x{80}-\\x{10FFFF}])(generic|interface|lambda|out|shared|with|without)(?![\\w\\x{80}-\\x{10FFFF}]))" }, { "name": "keyword.other.common.function.nim", "match": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])(new|GC_ref|GC_unref|assert|echo|defined|declared|newException|countup|countdown|len|high|low)(?![\\w\\x{80}-\\x{10FFFF}])" }, { "name": "storage.type.concrete.nim", "match": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])(((uint|int|float)(8|16|32|64)?)|clong|culong|cchar|cschar|cshort|cint|csize|clonglong|cfloat|cdouble|clongdouble|cuchar|cushort|cuint|culonglong|cstringArray|bool|string|auto|cstring|char|byte|tobject|typedesc|stmt|expr|any|untyped|typed)(?![\\w\\x{80}-\\x{10FFFF}])" }, { "name": "storage.type.generic.nim", "match": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])(range|array|seq|tuple|natural|set|ref|ptr|pointer)(?![\\w\\x{80}-\\x{10FFFF}])" }, { "name": "storage.type.function.nim", "match": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])(proc|iterator|method|template|macro)(?![\\w\\x{80}-\\x{10FFFF}])" }, { "name": "storage.type.generic.nim", "match": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])(openarray|varargs|void)(?![\\w\\x{80}-\\x{10FFFF}])" }, { "name": "support.constant.nim", "match": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])([A-Z][A-Z0-9_]+)(?![\\w\\x{80}-\\x{10FFFF}])" }, { "name": "support.type.nim", "match": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])([A-Z]\\w+)(?![\\w\\x{80}-\\x{10FFFF}])" }, { "name": "support.function.any-method.nim", "match": "(?\u003c![\\w\\x{80}-\\x{10FFFF}])(\\w+)(?![\\w\\x{80}-\\x{10FFFF}])(?=\\()" }, { "name": "string.quoted.triple.nim", "begin": "r?\\\"\\\"\\\"", "end": "\\\"\\\"\\\"[^\\\"]" }, { "name": "string.quoted.double.raw.nim", "begin": "r\\\"", "end": "\\\"", "patterns": [ { "match": "\\\"\\\"" } ] }, { "name": "string.quoted.double.nim", "begin": "\\\"", "end": "\\\"", "patterns": [ { "include": "#escaped_char" } ] }, { "name": "string.quoted.single.nim", "begin": "\\'", "end": "\\'", "patterns": [ { "name": "invalid.illegal.character.nim", "match": "\\\\n" }, { "include": "#escaped_char" }, { "name": "invalid.illegal.character.nim", "match": "([^\\'][^\\']+?)" } ] }, { "begin": "([\\w\\x{80}-\\x{10FFFF}\\`]+)\\s*(?=\\(|\\[.+?\\]\\s*\\()", "end": "\\)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "support.function.any-method.nim" } } }, { "match": "([\\w\\x{80}-\\x{10FFFF}]+)(?=\\s+[\\w](?![\\w\\x{80}-\\x{10FFFF}]+((?!\\n)\\s)+))", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "support.function.any-method.nim" } } }, { "match": "([\\w\\x{80}-\\x{10FFFF}]+)(?=\\s+[\\\"\\'\\`])", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "support.function.any-method.nim" } } }, { "match": "(tmpl(i)?)(?=( (nim|html|xml|js|css|glsl|md))?\\\"\\\"\\\")", "captures": { "1": { "name": "storage.type.function.nim" }, "2": { "name": "keyword.operator.nim" } } }, { "name": "source.nim.embedded.nim", "patterns": [ { "begin": "(nim)(\\\"\\\"\\\")", "end": "\\\"\\\"\\\"", "patterns": [ { "begin": "(?\u003c!\\$)(\\$)\\(", "end": "\\)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" } } }, { "begin": "(?\u003c!\\$)(\\$)\\{", "end": "\\}", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" }, "2": { "name": "keyword.operator.nim" } } }, { "begin": "(?\u003c!\\$)(\\$)(for|while|case|of|when|if|else|elif)( )", "end": "(\\{|\\n)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" }, "2": { "name": "keyword.control.nim" } }, "endCaptures": { "1": { "name": "plain" } } }, { "name": "keyword.operator.nim", "match": "(?\u003c!\\$)(\\$[a-zA-Z0-9_]+)" }, { "include": "source.nim" } ], "captures": { "1": { "name": "storage.type.function.nim" }, "2": { "name": "comment.syntax.nim" } }, "endCaptures": { "0": { "name": "comment.syntax.nim" } } } ] }, { "name": "source.html.embedded.nim", "patterns": [ { "begin": "(html)(\\\"\\\"\\\")", "end": "\\\"\\\"\\\"", "patterns": [ { "begin": "(?\u003c!\\$)(\\$)\\(", "end": "\\)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" } } }, { "begin": "(?\u003c!\\$)(\\$)\\{", "end": "\\}", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" }, "2": { "name": "keyword.operator.nim" } } }, { "begin": "(?\u003c!\\$)(\\$)(for|while|case|of|when|if|else|elif)( )", "end": "(\\{|\\n)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" }, "2": { "name": "keyword.control.nim" } }, "endCaptures": { "1": { "name": "plain" } } }, { "name": "keyword.operator.nim", "match": "(?\u003c!\\$)(\\$[a-zA-Z0-9_]+)" }, { "include": "text.xml" } ], "captures": { "1": { "name": "storage.type.function.nim" }, "2": { "name": "comment.syntax.nim" } }, "endCaptures": { "0": { "name": "comment.syntax.nim" } } } ] }, { "name": "source.xml.embedded.nim", "patterns": [ { "begin": "(xml)(\\\"\\\"\\\")", "end": "\\\"\\\"\\\"", "patterns": [ { "begin": "(?\u003c!\\$)(\\$)\\(", "end": "\\)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" } } }, { "begin": "(?\u003c!\\$)(\\$)\\{", "end": "\\}", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" }, "2": { "name": "keyword.operator.nim" } } }, { "begin": "(?\u003c!\\$)(\\$)(for|while|case|of|when|if|else|elif)( )", "end": "(\\{|\\n)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" }, "2": { "name": "keyword.control.nim" } }, "endCaptures": { "1": { "name": "plain" } } }, { "name": "keyword.operator.nim", "match": "(?\u003c!\\$)(\\$[a-zA-Z0-9_]+)" }, { "include": "text.xml" } ], "captures": { "1": { "name": "storage.type.function.nim" }, "2": { "name": "comment.syntax.nim" } }, "endCaptures": { "0": { "name": "comment.syntax.nim" } } } ] }, { "name": "source.js.embedded.nim", "patterns": [ { "begin": "(js)(\\\"\\\"\\\")", "end": "\\\"\\\"\\\"", "patterns": [ { "begin": "(?\u003c!\\$)(\\$)\\(", "end": "\\)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" } } }, { "begin": "(?\u003c!\\$)(\\$)\\{", "end": "\\}", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" }, "2": { "name": "keyword.operator.nim" } } }, { "begin": "(?\u003c!\\$)(\\$)(for|while|case|of|when|if|else|elif)( )", "end": "(\\{|\\n)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" }, "2": { "name": "keyword.control.nim" } }, "endCaptures": { "1": { "name": "plain" } } }, { "name": "keyword.operator.nim", "match": "(?\u003c!\\$)(\\$[a-zA-Z0-9_]+)" }, { "include": "source.js" } ], "captures": { "1": { "name": "storage.type.function.nim" }, "2": { "name": "comment.syntax.nim" } }, "endCaptures": { "0": { "name": "comment.syntax.nim" } } } ] }, { "name": "source.css.embedded.nim", "patterns": [ { "begin": "(css)(\\\"\\\"\\\")", "end": "\\\"\\\"\\\"", "patterns": [ { "begin": "(?\u003c!\\$)(\\$)\\(", "end": "\\)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" } } }, { "begin": "(?\u003c!\\$)(\\$)\\{", "end": "\\}", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" }, "2": { "name": "keyword.operator.nim" } } }, { "begin": "(?\u003c!\\$)(\\$)(for|while|case|of|when|if|else|elif)( )", "end": "(\\{|\\n)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" }, "2": { "name": "keyword.control.nim" } }, "endCaptures": { "1": { "name": "plain" } } }, { "name": "keyword.operator.nim", "match": "(?\u003c!\\$)(\\$[a-zA-Z0-9_]+)" }, { "include": "source.css" } ], "captures": { "1": { "name": "storage.type.function.nim" }, "2": { "name": "comment.syntax.nim" } }, "endCaptures": { "0": { "name": "comment.syntax.nim" } } } ] }, { "name": "source.glsl.embedded.nim", "patterns": [ { "begin": "(glsl)(\\\"\\\"\\\")", "end": "\\\"\\\"\\\"", "patterns": [ { "begin": "(?\u003c!\\$)(\\$)\\(", "end": "\\)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" } } }, { "begin": "(?\u003c!\\$)(\\$)\\{", "end": "\\}", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" }, "2": { "name": "keyword.operator.nim" } } }, { "begin": "(?\u003c!\\$)(\\$)(for|while|case|of|when|if|else|elif)( )", "end": "(\\{|\\n)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" }, "2": { "name": "keyword.control.nim" } }, "endCaptures": { "1": { "name": "plain" } } }, { "name": "keyword.operator.nim", "match": "(?\u003c!\\$)(\\$[a-zA-Z0-9_]+)" }, { "include": "source.glsl" } ], "captures": { "1": { "name": "storage.type.function.nim" }, "2": { "name": "comment.syntax.nim" } }, "endCaptures": { "0": { "name": "comment.syntax.nim" } } } ] }, { "name": "source.markdown.embedded.nim", "patterns": [ { "begin": "(md)(\\\"\\\"\\\")", "end": "\\\"\\\"\\\"", "patterns": [ { "begin": "(?\u003c!\\$)(\\$)\\(", "end": "\\)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" } } }, { "begin": "(?\u003c!\\$)(\\$)\\{", "end": "\\}", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" }, "2": { "name": "keyword.operator.nim" } } }, { "begin": "(?\u003c!\\$)(\\$)(for|while|case|of|when|if|else|elif)( )", "end": "(\\{|\\n)", "patterns": [ { "include": "source.nim" } ], "captures": { "1": { "name": "keyword.operator.nim" }, "2": { "name": "keyword.control.nim" } }, "endCaptures": { "1": { "name": "plain" } } }, { "name": "keyword.operator.nim", "match": "(?\u003c!\\$)(\\$[a-zA-Z0-9_]+)" }, {} ], "captures": { "1": { "name": "storage.type.function.nim" }, "2": { "name": "comment.syntax.nim" } }, "endCaptures": { "0": { "name": "comment.syntax.nim" } } } ] } ], "repository": { "escaped_char": { "patterns": [ { "name": "constant.character.escape.newline.nim", "match": "\\\\[nN]" }, { "name": "constant.character.escape.carriagereturn.nim", "match": "\\\\[cC]|\\\\[rR]" }, { "name": "constant.character.escape.linefeed.nim", "match": "\\\\[lL]" }, { "name": "constant.character.escape.formfeed.nim", "match": "\\\\[fF]" }, { "name": "constant.character.escape.tabulator.nim", "match": "\\\\[tT]" }, { "name": "constant.character.escape.verticaltabulator.nim", "match": "\\\\[vV]" }, { "name": "constant.character.escape.double-quote.nim", "match": "\\\\\\\"" }, { "name": "constant.character.escape.single-quote.nim", "match": "\\\\'" }, { "name": "constant.character.escape.chardecimalvalue.nim", "match": "\\\\[0-9]+" }, { "name": "constant.character.escape.alert.nim", "match": "\\\\[aA]" }, { "name": "constant.character.escape.backspace.nim", "match": "\\\\[bB]" }, { "name": "constant.character.escape.escape.nim", "match": "\\\\[eE]" }, { "name": "constant.character.escape.hex.nim", "match": "\\\\[xX][0-9A-Fa-f]{2}" }, { "name": "constant.character.escape.backslash.nim", "match": "\\\\\\\\" } ] } } }