{ "displayName": "Nim", "fileTypes": [ "nim" ], "name": "nim", "patterns": [ { "begin": "[\\t ]*##\\[", "contentName": "comment.block.doc-comment.content.nim", "end": "]##", "name": "comment.block.doc-comment.nim", "patterns": [ { "include": "#multilinedoccomment", "name": "comment.block.doc-comment.nested.nim" } ] }, { "begin": "[\\t ]*#\\[", "contentName": "comment.block.content.nim", "end": "]#", "name": "comment.block.nim", "patterns": [ { "include": "#multilinecomment", "name": "comment.block.nested.nim" } ] }, { "begin": "(^[\\t ]+)?(?=##)", "beginCaptures": { "1": { "name": "punctuation.whitespace.comment.leading.nim" } }, "end": "(?!\\G)", "patterns": [ { "begin": "##", "beginCaptures": { "0": { "name": "punctuation.definition.comment.nim" } }, "end": "\\n", "name": "comment.line.number-sign.doc-comment.nim" } ] }, { "begin": "(^[\\t ]+)?(?=#[^\\[])", "beginCaptures": { "1": { "name": "punctuation.whitespace.comment.leading.nim" } }, "end": "(?!\\G)", "patterns": [ { "begin": "#", "beginCaptures": { "0": { "name": "punctuation.definition.comment.nim" } }, "end": "\\n", "name": "comment.line.number-sign.nim" } ] }, { "name": "meta.proc.nim", "patterns": [ { "begin": "\\b(proc|method|template|macro|iterator|converter|func)\\s+`?([^(*:`{\\s]*)`?(\\s*\\*)?\\s*(?=[\\n(:=\\[{])", "captures": { "1": { "name": "keyword.other" }, "2": { "name": "entity.name.function.nim" }, "3": { "name": "keyword.control.export" } }, "end": "\\)", "patterns": [ { "include": "source.nim" } ] } ] }, { "begin": "discard \"\"\"", "end": "\"\"\"(?!\")", "name": "comment.line.discarded.nim" }, { "include": "#float_literal" }, { "include": "#integer_literal" }, { "match": "(?<=`)[^ `]+(?=`)", "name": "entity.name.function.nim" }, { "captures": { "1": { "name": "keyword.control.export" } }, "match": "\\b\\s*(\\*)(?:\\s*(?=[,:])|\\s+(?==))" }, { "captures": { "1": { "name": "support.type.nim" }, "2": { "name": "keyword.control.export" } }, "match": "\\b([A-Z]\\w+)(\\*)" }, { "include": "#string_literal" }, { "match": "\\b(true|false|Inf|NegInf|NaN|nil)\\b", "name": "constant.language.nim" }, { "match": "\\b(block|break|case|continue|do|elif|else|end|except|finally|for|if|raise|return|try|when|while|yield)\\b", "name": "keyword.control.nim" }, { "match": "\\b((and|in|is|isnot|not|notin|or|xor))\\b", "name": "keyword.boolean.nim" }, { "match": "([-!$%\\&*+./:<-@\\\\^~])+", "name": "keyword.operator.nim" }, { "match": "\\b((addr|asm??|atomic|bind|cast|const|converter|concept|defer|discard|distinct|div|enum|export|from|import|include|let|mod|mixin|object|of|ptr|ref|shl|shr|static|type|using|var|tuple|iterator|macro|func|method|proc|template))\\b", "name": "keyword.other.nim" }, { "match": "\\b((generic|interface|lambda|out|shared))\\b", "name": "invalid.illegal.invalid-keyword.nim" }, { "match": "\\b(new|await|assert|echo|defined|declared|newException|countup|countdown|high|low)\\b", "name": "keyword.other.common.function.nim" }, { "match": "\\b(((u?int)(8|16|32|64)?)|float(32|64)?|bool|string|auto|cstring|char|byte|tobject|typedesc|stmt|expr|any|untyped|typed)\\b", "name": "storage.type.concrete.nim" }, { "match": "\\b(range|array|seq|set|pointer)\\b", "name": "storage.type.generic.nim" }, { "match": "\\b(openarray|varargs|void)\\b", "name": "storage.type.generic.nim" }, { "match": "\\b[A-Z][0-9A-Z_]+\\b", "name": "support.constant.nim" }, { "match": "\\b[A-Z]\\w+\\b", "name": "support.type.nim" }, { "match": "\\b\\w+\\b(?=(\\[([,0-9A-Z_a-z\\s])+])?\\()", "name": "support.function.any-method.nim" }, { "match": "(?!(openarray|varargs|void|range|array|seq|set|pointer|new|await|assert|echo|defined|declared|newException|countup|countdown|high|low|((u?int)(8|16|32|64)?)|float(32|64)?|bool|string|auto|cstring|char|byte|tobject|typedesc|stmt|expr|any|untyped|typed|addr|asm??|atomic|bind|cast|const|converter|concept|defer|discard|distinct|div|enum|export|from|import|include|let|mod|mixin|object|of|ptr|ref|shl|shr|static|type|using|var|tuple|iterator|macro|func|method|proc|template|and|in|is|isnot|not|notin|or|xor|proc|method|template|macro|iterator|converter|func|true|false|Inf|NegInf|NaN|nil|block|break|case|continue|do|elif|else|end|except|finally|for|if|raise|return|try|when|while|yield)\\b)\\w+\\s+(?!(and|in|is|isnot|not|notin|or|xor|[^\"'-+0-9A-Z_-z]+)\\b)(?=[\"'-+0-9A-Z_-z])", "name": "support.function.any-method.nim" }, { "begin": "(^\\s*)?(?=\\{\\.emit: ?\"\"\")", "beginCaptures": { "0": { "name": "punctuation.whitespace.embedded.leading.nim" } }, "end": "(?!\\G)(\\s*$\\n?)?", "endCaptures": { "0": { "name": "punctuation.whitespace.embedded.trailing.nim" } }, "patterns": [ { "begin": "\\{\\.(emit:) ?(\"\"\")", "captures": { "1": { "name": "keyword.other.nim" }, "2": { "name": "punctuation.section.embedded.begin.nim" } }, "contentName": "source.c", "end": "(\")\"\"(?!\")(\\.?})?", "endCaptures": { "0": { "name": "punctuation.section.embedded.end.nim" }, "1": { "name": "source.c" } }, "name": "meta.embedded.block.c", "patterns": [ { "begin": "`", "end": "`", "name": "keyword.operator.nim" }, { "include": "source.c" } ] } ] }, { "begin": "\\{\\.", "beginCaptures": { "0": { "name": "punctuation.pragma.start.nim" } }, "end": "\\.?}", "endCaptures": { "0": { "name": "punctuation.pragma.end.nim" } }, "patterns": [ { "begin": "\\b(\\p{alpha}\\w*)(?:\\s|\\s*:)", "beginCaptures": { "1": { "name": "meta.preprocessor.pragma.nim" } }, "end": "(?=\\.?}|,)", "patterns": [ { "include": "source.nim" } ] }, { "begin": "\\b(\\p{alpha}\\w*)\\(", "beginCaptures": { "1": { "name": "meta.preprocessor.pragma.nim" } }, "end": "\\)", "patterns": [ { "include": "source.nim" } ] }, { "captures": { "1": { "name": "meta.preprocessor.pragma.nim" } }, "match": "\\b(\\p{alpha}\\w*)(?=\\.?}|,)" }, { "begin": "\\b(\\p{alpha}\\w*)(\"\"\")", "beginCaptures": { "1": { "name": "meta.preprocessor.pragma.nim" }, "2": { "name": "punctuation.definition.string.begin.nim" } }, "end": "\"\"\"(?!\")", "endCaptures": { "0": { "name": "punctuation.definition.string.end.nim" } }, "name": "string.quoted.triple.raw.nim" }, { "begin": "\\b(\\p{alpha}\\w*)(\")", "beginCaptures": { "1": { "name": "meta.preprocessor.pragma.nim" }, "2": { "name": "punctuation.definition.string.begin.nim" } }, "end": "\"", "endCaptures": { "0": { "name": "punctuation.definition.string.end.nim" } }, "name": "string.quoted.double.raw.nim" }, { "begin": "\\b(hint\\[\\w+]):", "beginCaptures": { "1": { "name": "meta.preprocessor.pragma.nim" } }, "end": "(?=\\.?}|,)", "patterns": [ { "include": "source.nim" } ] }, { "match": ",", "name": "punctuation.separator.comma.nim" } ] }, { "begin": "(^\\s*)?(?=asm \"\"\")", "beginCaptures": { "0": { "name": "punctuation.whitespace.embedded.leading.nim" } }, "end": "(?!\\G)(\\s*$\\n?)?", "endCaptures": { "0": { "name": "punctuation.whitespace.embedded.trailing.nim" } }, "patterns": [ { "begin": "(asm) (\"\"\")", "captures": { "1": { "name": "keyword.other.nim" }, "2": { "name": "punctuation.section.embedded.begin.nim" } }, "contentName": "source.asm", "end": "(\")\"\"(?!\")", "endCaptures": { "0": { "name": "punctuation.section.embedded.end.nim" }, "1": { "name": "source.asm" } }, "name": "meta.embedded.block.asm", "patterns": [ { "begin": "`", "end": "`", "name": "keyword.operator.nim" }, { "include": "source.asm" } ] } ] }, { "captures": { "1": { "name": "storage.type.function.nim" }, "2": { "name": "keyword.operator.nim" } }, "match": "(tmpl(i)?)(?=( (html|xml|js|css|glsl|md))?\"\"\")" }, { "begin": "(^\\s*)?(?=html\"\"\")", "beginCaptures": { "0": { "name": "punctuation.whitespace.embedded.leading.nim" } }, "end": "(?!\\G)(\\s*$\\n?)?", "endCaptures": { "0": { "name": "punctuation.whitespace.embedded.trailing.nim" } }, "patterns": [ { "begin": "(html)(\"\"\")", "captures": { "1": { "name": "keyword.other.nim" }, "2": { "name": "punctuation.section.embedded.begin.nim" } }, "contentName": "text.html", "end": "(\")\"\"(?!\")", "endCaptures": { "0": { "name": "punctuation.section.embedded.end.nim" }, "1": { "name": "text.html" } }, "name": "meta.embedded.block.html", "patterns": [ { "begin": "(?