{ "name": "Dream Maker", "scopeName": "source.dm", "patterns": [ { "include": "#preprocessor-rule-enabled" }, { "include": "#preprocessor-rule-disabled" }, { "include": "#preprocessor-rule-other" }, { "include": "#comments" }, { "name": "meta.initialization.dm", "match": "(?x)\n(var)[\\/ ]\n(?:(static|global|tmp|const)\\/)?\n(?:(datum|atom(?:\\/movable)?|obj|mob|turf|area|savefile|list|client|sound|image|database|matrix|regex|exception)\\/)?\n(?:\n\t([a-zA-Z0-9_\\-$]*)\\/\n)*\n\n([A-Za-z0-9_$]*)\\b", "captures": { "1": { "name": "storage.type.dm" }, "2": { "name": "storage.modifier.dm" }, "3": { "name": "storage.type.dm" }, "5": { "name": "variable.other.dm" } } }, { "name": "constant.numeric.dm", "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)\\b" }, { "name": "keyword.control.dm", "match": "\\b(sleep|spawn|break|continue|do|else|for|goto|if|return|switch|while)\\b" }, { "name": "keyword.other.dm", "match": "\\b(del|new)\\b" }, { "name": "storage.type.dm", "match": "\\b(proc|verb|datum|atom(/movable)?|obj|mob|turf|area|savefile|list|client|sound|image|database|matrix|regex|exception)\\b" }, { "name": "storage.modifier.dm", "match": "\\b(as|const|global|set|static|tmp)\\b" }, { "name": "variable.language.dm", "match": "\\b(usr|world|src|args)\\b" }, { "name": "keyword.operator.dm", "match": "(\\?|(\u003e|\u003c)(=)?|\\.|:|/(=)?|~|\\+(\\+|=)?|-(-|=)?|\\*(\\*|=)?|%|\u003e\u003e|\u003c\u003c|=(=)?|!(=)?|\u003c\u003e|\u0026|\u0026\u0026|\\^|\\||\\|\\||\\bto\\b|\\bin\\b|\\bstep\\b)" }, { "name": "constant.language.dm", "match": "\\b([A-Z_][A-Z_0-9]*)\\b" }, { "name": "constant.language.dm", "match": "\\bnull\\b" }, { "name": "string.quoted.triple.dm", "begin": "{\"", "end": "\"}", "patterns": [ { "include": "#string_escaped_char" }, { "include": "#string_embedded_expression" } ], "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.dm" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.end.dm" } } }, { "name": "string.quoted.double.dm", "begin": "\"", "end": "\"", "patterns": [ { "include": "#string_escaped_char" }, { "include": "#string_embedded_expression" } ], "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.dm" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.end.dm" } } }, { "name": "string.quoted.single.dm", "begin": "'", "end": "'", "patterns": [ { "include": "#string_escaped_char" } ], "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.dm" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.end.dm" } } }, { "name": "meta.preprocessor.macro.dm", "begin": "(?x)\n^\\s* ((\\#)\\s*define) \\s+ # define\n((?\u003cid\u003e[a-zA-Z_][a-zA-Z0-9_]*)) # macro name\n(?:\n\t(\\()\n\t\t(\n\t\t\t\\s* \\g\u003cid\u003e \\s* # first argument\n\t\t\t((,) \\s* \\g\u003cid\u003e \\s*)* # additional arguments\n\t\t\t(?:\\.\\.\\.)? # varargs ellipsis?\n\t\t)\n\t(\\))\n)", "end": "(?=(?://|/\\*))|(?\u003c!\\\\)(?=\\n)", "patterns": [ { "include": "$base" } ], "beginCaptures": { "1": { "name": "keyword.control.directive.define.dm" }, "2": { "name": "punctuation.definition.directive.dm" }, "3": { "name": "entity.name.function.preprocessor.dm" }, "5": { "name": "punctuation.definition.parameters.begin.dm" }, "6": { "name": "variable.parameter.preprocessor.dm" }, "8": { "name": "punctuation.separator.parameters.dm" }, "9": { "name": "punctuation.definition.parameters.end.dm" } } }, { "name": "meta.preprocessor.macro.dm", "begin": "(?x)\n^\\s* ((\\#)\\s*define) \\s+ # define\n((?\u003cid\u003e[a-zA-Z_][a-zA-Z0-9_]*)) # macro name", "end": "(?=(?://|/\\*))|(?\u003c!\\\\)(?=\\n)", "patterns": [ { "include": "$base" } ], "beginCaptures": { "1": { "name": "keyword.control.directive.define.dm" }, "2": { "name": "punctuation.definition.directive.dm" }, "3": { "name": "variable.other.preprocessor.dm" } } }, { "name": "meta.preprocessor.diagnostic.dm", "begin": "^\\s*(#\\s*(error|warn))\\b", "end": "$", "patterns": [ { "name": "punctuation.separator.continuation.dm", "match": "(?\u003e\\\\\\s*\\n)" } ], "captures": { "1": { "name": "keyword.control.import.error.dm" } } }, { "name": "meta.preprocessor.dm", "begin": "^\\s*(?:((#)\\s*(?:elif|else|if|ifdef|ifndef))|((#)\\s*(undef|include)))\\b", "end": "(?=(?://|/\\*))|(?\u003c!\\\\)(?=\\n)", "patterns": [ { "name": "punctuation.separator.continuation.dm", "match": "(?\u003e\\\\\\s*\\n)" } ], "beginCaptures": { "1": { "name": "keyword.control.directive.conditional.dm" }, "2": { "name": "punctuation.definition.directive.dm" }, "3": { "name": "keyword.control.directive.$5.dm" }, "4": { "name": "punctuation.definition.directive.dm" } } }, { "include": "#block" }, { "name": "meta.function.dm", "begin": "(?x)\n\t\t\t\t(?: ^ # begin-of-line\n\t\t\t\t\t|\n\t\t\t\t\t\t (?: (?= \\s ) (?\u003c!else|new|return) (?\u003c=\\w) # or word + space before name\n\t\t\t\t\t\t\t | (?= \\s*[A-Za-z_] ) (?\u003c!\u0026\u0026) (?\u003c=[*\u0026\u003e]) # or type modifier before name\n\t\t\t\t\t\t )\n\t\t\t\t)\n\t\t\t\t(\\s*) (?!(while|for|do|if|else|switch|catch|enumerate|return|r?iterate)\\s*\\()\n\t\t\t\t(\n\t\t\t\t\t(?: [A-Za-z_][A-Za-z0-9_]*+ | :: )++ | # actual name\n\t\t\t\t\t(?: (?\u003c=operator) (?: [-*\u0026\u003c\u003e=+!]+ | \\(\\) | \\[\\] ) ) # if it is a C++ operator\n\t\t\t\t)\n\t\t\t\t \\s*(?=\\()", "end": "(?\u003c=\\})|(?=#)|(;)?", "patterns": [ { "include": "#comments" }, { "include": "#parens" }, { "name": "storage.modifier.dm", "match": "\\bconst\\b" }, { "include": "#block" } ], "beginCaptures": { "1": { "name": "punctuation.whitespace.function.leading.dm" }, "3": { "name": "entity.name.function.dm" }, "4": { "name": "punctuation.definition.parameters.dm" } } } ], "repository": { "access": { "name": "variable.other.dot-access.dm", "match": "\\.[a-zA-Z_][a-zA-Z_0-9]*\\b(?!\\s*\\()" }, "block": { "name": "meta.block.dm", "begin": "\\{", "end": "\\}", "patterns": [ { "include": "#block_innards" } ] }, "block_innards": { "patterns": [ { "include": "#preprocessor-rule-enabled-block" }, { "include": "#preprocessor-rule-disabled-block" }, { "include": "#preprocessor-rule-other-block" }, { "include": "#access" }, { "name": "meta.function-call.dm", "match": "(?x) (?: (?= \\s ) (?:(?\u003c=else|new|return) | (?\u003c!\\w)) (\\s+))?\n\t\t\t(\\b\n\t\t\t\t(?!(while|for|do|if|else|switch|catch|enumerate|return|r?iterate)\\s*\\()(?:(?!NS)[A-Za-z_][A-Za-z0-9_]*+\\b | :: )++ # actual name\n\t\t\t)\n\t\t\t \\s*(\\()", "captures": { "1": { "name": "punctuation.whitespace.function-call.leading.dm" }, "2": { "name": "support.function.any-method.dm" }, "3": { "name": "punctuation.definition.parameters.dm" } } }, { "include": "#block" }, { "include": "$base" } ] }, "comments": { "patterns": [ { "name": "comment.block.dm", "match": "^/\\* =(\\s*.*?)\\s*= \\*/$\\n?", "captures": { "1": { "name": "meta.toc-list.banner.block.dm" } } }, { "name": "comment.block.dm", "begin": "/\\*", "end": "\\*/", "patterns": [ { "include": "#comments" } ], "captures": { "0": { "name": "punctuation.definition.comment.dm" } } }, { "name": "invalid.illegal.stray-comment-end.dm", "match": "\\*/.*\\n" }, { "name": "comment.line.banner.dm", "match": "^// =(\\s*.*?)\\s*=\\s*$\\n?", "captures": { "1": { "name": "meta.toc-list.banner.line.dm" } } }, { "name": "comment.line.double-slash.dm", "begin": "//", "end": "$\\n?", "patterns": [ { "name": "punctuation.separator.continuation.dm", "match": "(?\u003e\\\\\\s*\\n)" } ], "beginCaptures": { "0": { "name": "punctuation.definition.comment.dm" } } } ] }, "disabled": { "begin": "^\\s*#\\s*if(n?def)?\\b.*$", "end": "^\\s*#\\s*endif\\b.*$", "patterns": [ { "include": "#disabled" } ] }, "parens": { "name": "meta.parens.dm", "begin": "\\(", "end": "\\)", "patterns": [ { "include": "$base" } ] }, "preprocessor-rule-disabled": { "begin": "^\\s*(#(if)\\s+(0)\\b).*", "end": "^\\s*(#\\s*(endif)\\b)", "patterns": [ { "begin": "^\\s*(#\\s*(else)\\b)", "end": "(?=^\\s*#\\s*endif\\b.*$)", "patterns": [ { "include": "$base" } ], "captures": { "1": { "name": "meta.preprocessor.dm" }, "2": { "name": "keyword.control.import.else.dm" } } }, { "name": "comment.block.preprocessor.if-branch", "end": "(?=^\\s*#\\s*(else|endif)\\b.*$)", "patterns": [ { "include": "#disabled" } ] } ], "captures": { "1": { "name": "meta.preprocessor.dm" }, "2": { "name": "keyword.control.import.if.dm" }, "3": { "name": "constant.numeric.preprocessor.dm" } } }, "preprocessor-rule-disabled-block": { "begin": "^\\s*(#(if)\\s+(0)\\b).*", "end": "^\\s*(#\\s*(endif)\\b)", "patterns": [ { "begin": "^\\s*(#\\s*(else)\\b)", "end": "(?=^\\s*#\\s*endif\\b.*$)", "patterns": [ { "include": "#block_innards" } ], "captures": { "1": { "name": "meta.preprocessor.dm" }, "2": { "name": "keyword.control.import.else.dm" } } }, { "name": "comment.block.preprocessor.if-branch.in-block", "end": "(?=^\\s*#\\s*(else|endif)\\b.*$)", "patterns": [ { "include": "#disabled" } ] } ], "captures": { "1": { "name": "meta.preprocessor.dm" }, "2": { "name": "keyword.control.import.if.dm" }, "3": { "name": "constant.numeric.preprocessor.dm" } } }, "preprocessor-rule-enabled": { "begin": "^\\s*(#(if)\\s+(0*1)\\b)", "end": "^\\s*(#\\s*(endif)\\b)", "patterns": [ { "contentName": "comment.block.preprocessor.else-branch", "begin": "^\\s*(#\\s*(else)\\b).*", "end": "(?=^\\s*#\\s*endif\\b.*$)", "patterns": [ { "include": "#disabled" } ], "captures": { "1": { "name": "meta.preprocessor.dm" }, "2": { "name": "keyword.control.import.else.dm" } } }, { "end": "(?=^\\s*#\\s*(else|endif)\\b.*$)", "patterns": [ { "include": "$base" } ] } ], "captures": { "1": { "name": "meta.preprocessor.dm" }, "2": { "name": "keyword.control.import.if.dm" }, "3": { "name": "constant.numeric.preprocessor.dm" } } }, "preprocessor-rule-enabled-block": { "begin": "^\\s*(#(if)\\s+(0*1)\\b)", "end": "^\\s*(#\\s*(endif)\\b)", "patterns": [ { "contentName": "comment.block.preprocessor.else-branch.in-block", "begin": "^\\s*(#\\s*(else)\\b).*", "end": "(?=^\\s*#\\s*endif\\b.*$)", "patterns": [ { "include": "#disabled" } ], "captures": { "1": { "name": "meta.preprocessor.dm" }, "2": { "name": "keyword.control.import.else.dm" } } }, { "end": "(?=^\\s*#\\s*(else|endif)\\b.*$)", "patterns": [ { "include": "#block_innards" } ] } ], "captures": { "1": { "name": "meta.preprocessor.dm" }, "2": { "name": "keyword.control.import.if.dm" }, "3": { "name": "constant.numeric.preprocessor.dm" } } }, "preprocessor-rule-other": { "begin": "^\\s*((#\\s*(if(n?def)?))\\b.*?(?:(?=(?://|/\\*))|$))", "end": "^\\s*((#\\s*(endif))\\b).*$", "patterns": [ { "include": "$base" } ], "captures": { "1": { "name": "meta.preprocessor.dm" }, "2": { "name": "keyword.control.import.dm" } } }, "preprocessor-rule-other-block": { "begin": "^\\s*(#\\s*(if(n?def)?)\\b.*?(?:(?=(?://|/\\*))|$))", "end": "^\\s*(#\\s*(endif)\\b).*$", "patterns": [ { "include": "#block_innards" } ], "captures": { "1": { "name": "meta.preprocessor.dm" }, "2": { "name": "keyword.control.import.dm" } } }, "string_embedded_expression": { "patterns": [ { "name": "string.interpolated.dm", "begin": "(?\u003c!\\\\)\\[", "end": "\\]", "patterns": [ { "include": "$self" } ] } ] }, "string_escaped_char": { "patterns": [ { "name": "constant.character.escape.dm", "match": "(?x)\n\\\\\n(\n\th(?:(?:er|im)self|ers|im)\n\t|([tTsS]?he) # Weird regex to match The, the, She, she and he at once.\n\t|He\n\t|[Hh]is\n\t|[aA]n?\n\t|(?:im)?proper\n\t|\\.\\.\\.\n\t|(?:icon|ref|[Rr]oman)(?=\\[) # Macros which need a [] after them.\n\t|[s\u003c\u003e\"n\\n \\[]\n)" }, { "name": "invalid.illegal.unknown-escape.dm", "match": "\\\\." } ] } } }