{ "name": "GNU Modula-2 Definition", "scopeName": "source.modula2.definition", "patterns": [ { "include": "#comments" }, { "include": "#strings" }, { "include": "#numbers" }, { "include": "#header" }, { "include": "#imports" }, { "include": "#exports" }, { "include": "#declarations" }, { "include": "#procedure" }, { "include": "#attributes" }, { "include": "#types" }, { "include": "#operators" }, { "include": "#keywords" } ], "repository": { "comments": { "patterns": [ { "name": "comment.block.modula2", "begin": "\\(\\*", "end": "\\*\\)" } ] }, "strings": { "patterns": [ { "name": "string.quoted.double.modula2", "begin": "\"", "end": "\"", "patterns": [ { "name": "constant.character.escape.modula2", "match": "\\\\." } ] } ] }, "numbers": { "patterns": [ { "name": "constant.numeric.modula2", "match": "\\b(?:[0-9]+|[0-9A-Fa-f]+H)\\b" } ] }, "header": { "patterns": [ { "name": "meta.module.definition.modula2", "match": "\\b(DEFINITION)\\s+(MODULE)\\s+([A-Za-z_][A-Za-z0-9_]*)", "captures": { "1": { "name": "keyword.control.module.modula2" }, "2": { "name": "keyword.control.module.modula2" }, "3": { "name": "entity.name.namespace.modula2" } } }, { "name": "meta.module.end.modula2", "match": "\\b(END)\\s+([A-Za-z_][A-Za-z0-9_]*)\\s*\\.", "captures": { "1": { "name": "keyword.control.module.modula2" }, "2": { "name": "entity.name.namespace.modula2" } } }, { "name": "keyword.control.module.modula2", "match": "\\bFOR\\b(?=\\s+\")" } ] }, "imports": { "patterns": [ { "name": "keyword.control.import.modula2", "match": "\\b(?:FROM|IMPORT)\\b" }, { "name": "entity.name.namespace.import.modula2", "match": "\\b(FROM)\\s+([A-Za-z_][A-Za-z0-9_]*)", "captures": { "1": { "name": "keyword.control.import.modula2" }, "2": { "name": "entity.name.namespace.import.modula2" } } } ] }, "exports": { "patterns": [ { "name": "keyword.control.export.modula2", "match": "\\bEXPORT(?:\\s+(?:QUALIFIED|UNQUALIFIED))?\\b" } ] }, "declarations": { "patterns": [ { "name": "storage.type.declaration.modula2", "match": "\\b(?:CONST|TYPE|VAR)\\b" }, { "name": "entity.name.type.modula2", "match": "\\bTYPE\\s+([A-Za-z_][A-Za-z0-9_]*)", "captures": { "1": { "name": "entity.name.type.modula2" } } }, { "name": "constant.other.modula2", "match": "\\bCONST\\s+([A-Za-z_][A-Za-z0-9_]*)", "captures": { "1": { "name": "constant.other.modula2" } } }, { "name": "variable.other.modula2", "match": "\\bVAR\\s+([A-Za-z_][A-Za-z0-9_]*)", "captures": { "1": { "name": "variable.other.modula2" } } } ] }, "procedure": { "patterns": [ { "name": "keyword.control.procedure.modula2", "match": "\\bPROCEDURE\\b" }, { "name": "meta.procedure.modula2", "match": "\\b(PROCEDURE)\\s+((?:__ATTRIBUTE__\\s+__BUILTIN__\\s+)?[A-Za-z_][A-Za-z0-9_]*)", "captures": { "1": { "name": "keyword.control.procedure.modula2" }, "2": { "name": "entity.name.function.modula2" } } } ] }, "attributes": { "patterns": [ { "name": "keyword.other.gnu.modula2", "match": "\\b__(?:ATTRIBUTE|BUILTIN)__\\b" } ] }, "types": { "patterns": [ { "name": "storage.type.modula2", "match": "\\b(?:INTEGER|CARDINAL|REAL|LONGREAL|SHORTREAL|CHAR|BOOLEAN|BITSET|ADDRESS|WORD|LOC|BYTE)\\b" }, { "name": "keyword.operator.type.modula2", "match": "\\b(?:ARRAY|OF|POINTER)\\b" } ] }, "operators": { "patterns": [ { "name": "keyword.operator.modula2", "match": ":=|<=|>=|<>|#|=|<|>|\\+|-|\\*|/|\\.\\.|;|:|\\." } ] }, "keywords": { "patterns": [ { "name": "keyword.control.modula2", "match": "\\b(?:AND|BEGIN|BY|CASE|DEFINITION|DIV|DO|ELSE|ELSIF|END|EXIT|EXPORT|FOR|FROM|IF|IMPLEMENTATION|IMPORT|IN|LOOP|MOD|MODULE|NOT|OF|OR|POINTER|PROCEDURE|QUALIFIED|RECORD|REPEAT|RETURN|SET|THEN|TO|TYPE|UNTIL|VAR|WHILE|WITH)\\b" } ] } } }