{ "comment": "This grammar is based on the Java grammar (https://github.com/textmate/java.tmbundle)", "fileTypes": [ "pde" ], "keyEquivalent": "^~P", "name": "Processing", "patterns": [ { "captures": { "1": { "name": "keyword.other.package.processing" }, "2": { "name": "storage.modifier.package.processing" }, "3": { "name": "punctuation.terminator.processing" } }, "match": "^\\s*(package)\\b(?:\\s*([^ ;$]+)\\s*(;)?)?", "name": "meta.package.processing" }, { "captures": { "1": { "name": "keyword.other.import.static.processing" }, "2": { "name": "storage.modifier.import.processing" }, "3": { "name": "punctuation.terminator.processing" } }, "match": "^\\s*(import static)\\b(?:\\s*([^ ;$]+)\\s*(;)?)?", "name": "meta.import.static.processing" }, { "captures": { "1": { "name": "keyword.other.import.processing" }, "2": { "name": "storage.modifier.import.processing" }, "3": { "name": "punctuation.terminator.processing" } }, "match": "^\\s*(import)\\b(?:\\s*([^ ;$]+)\\s*(;)?)?", "name": "meta.import.processing" }, { "comment": ".pde preprocessing wrap the contents of a .pde file inside a class definition. Hence, the body of a .pde file is a Java class body", "include": "#class-body" } ], "repository": { "all-types": { "patterns": [ { "include": "#primitive-arrays" }, { "include": "#primitive-types" }, { "include": "#object-types" } ] }, "annotations": { "patterns": [ { "begin": "(@[^ (]+)(\\()", "beginCaptures": { "1": { "name": "storage.type.annotation.processing" }, "2": { "name": "punctuation.definition.annotation-arguments.begin.processing" } }, "end": "(\\))", "endCaptures": { "1": { "name": "punctuation.definition.annotation-arguments.end.processing" } }, "name": "meta.declaration.annotation.processing", "patterns": [ { "captures": { "1": { "name": "constant.other.key.processing" }, "2": { "name": "keyword.operator.assignment.processing" } }, "match": "(\\w*)\\s*(=)" }, { "include": "#code" }, { "match": ",", "name": "punctuation.seperator.property.processing" } ] }, { "match": "@\\w*", "name": "storage.type.annotation.processing" } ] }, "anonymous-classes-and-new": { "begin": "\\bnew\\b", "beginCaptures": { "0": { "name": "keyword.control.new.processing" } }, "end": "(?<=\\)|\\])(?!\\s*{)|(?<=})|(?=;)", "patterns": [ { "begin": "(\\w+)\\s*(?=\\[)", "beginCaptures": { "1": { "name": "storage.type.processing" } }, "end": "}|(?=\\s*(?:;|\\)))", "patterns": [ { "begin": "\\[", "end": "\\]", "patterns": [ { "include": "#code" } ] }, { "begin": "{", "end": "(?=})", "patterns": [ { "include": "#code" } ] } ] }, { "begin": "(?=\\w.*\\()", "end": "(?<=\\))", "patterns": [ { "include": "#object-types" }, { "begin": "\\(", "beginCaptures": { "1": { "name": "storage.type.processing" } }, "end": "\\)", "patterns": [ { "include": "#code" } ] } ] }, { "begin": "{", "end": "}", "name": "meta.inner-class.processing", "patterns": [ { "include": "#class-body" } ] } ] }, "assertions": { "patterns": [ { "begin": "\\b(assert)\\s", "beginCaptures": { "1": { "name": "keyword.control.assert.processing" } }, "end": "$", "name": "meta.declaration.assertion.processing", "patterns": [ { "match": ":", "name": "keyword.operator.assert.expression-seperator.processing" }, { "include": "#code" } ] } ] }, "class": { "begin": "(?=\\w?[\\w\\s]*(?:class|(?:@)?interface|enum)\\s+\\w+)", "end": "}", "endCaptures": { "0": { "name": "punctuation.section.class.end.processing" } }, "name": "meta.class.processing", "patterns": [ { "include": "#storage-modifiers" }, { "include": "#comments" }, { "captures": { "1": { "name": "storage.modifier.processing" }, "2": { "name": "entity.name.type.class.processing" } }, "match": "(class|(?:@)?interface|enum)\\s+(\\w+)", "name": "meta.class.identifier.processing" }, { "begin": "extends", "beginCaptures": { "0": { "name": "storage.modifier.extends.processing" } }, "end": "(?={|implements)", "name": "meta.definition.class.inherited.classes.processing", "patterns": [ { "include": "#object-types-inherited" }, { "include": "#comments" } ] }, { "begin": "(implements)\\s", "beginCaptures": { "1": { "name": "storage.modifier.implements.processing" } }, "end": "(?=\\s*extends|\\{)", "name": "meta.definition.class.implemented.interfaces.processing", "patterns": [ { "include": "#object-types-inherited" }, { "include": "#comments" } ] }, { "begin": "{", "end": "(?=})", "name": "meta.class.body.processing", "patterns": [ { "include": "#class-body" } ] } ] }, "class-body": { "patterns": [ { "include": "#comments" }, { "include": "#class" }, { "include": "#enums" }, { "include": "#methods" }, { "include": "#annotations" }, { "include": "#storage-modifiers" }, { "include": "#code" } ] }, "code": { "patterns": [ { "include": "#comments" }, { "include": "#class" }, { "begin": "{", "end": "}", "patterns": [ { "include": "#code" } ] }, { "include": "#assertions" }, { "include": "#parens" }, { "include": "#constants-and-special-vars" }, { "include": "#anonymous-classes-and-new" }, { "include": "#keywords" }, { "include": "#storage-modifiers" }, { "include": "#strings" }, { "include": "#all-types" }, { "include": "#processing-methods" }, { "include": "#processing-classes" } ] }, "comments": { "patterns": [ { "captures": { "0": { "name": "punctuation.definition.comment.processing" } }, "match": "/\\*\\*/", "name": "comment.block.empty.processing" }, { "include": "#comments-javadoc" }, { "include": "#comments-inline" } ] }, "comments-inline": { "patterns": [ { "begin": "/\\*(?!\\*)", "captures": { "0": { "name": "punctuation.definition.comment.processing" } }, "end": "\\*/", "name": "comment.block.processing" }, { "begin": "(^[ \\t]+)?(?=//)", "beginCaptures": { "1": { "name": "punctuation.whitespace.comment.leading.processing" } }, "end": "(?!\\G)", "patterns": [ { "begin": "//", "beginCaptures": { "0": { "name": "punctuation.definition.comment.processing" } }, "end": "\\n", "name": "comment.line.double-slash.processing" } ] } ] }, "comments-javadoc": { "patterns": [ { "begin": "/\\*\\*", "captures": { "0": { "name": "punctuation.definition.comment.processing" } }, "end": "\\*/", "name": "comment.block.documentation.processing", "patterns": [ { "captures": { "0": { "name": "keyword.other.documentation.inlinetag.processing" }, "1": { "name": "keyword.other.documentation.tag.processing" }, "2": { "name": "keyword.other.documentation.value.processing" } }, "match": "\\{\\s*(@link)\\s*([a-zA-Z_][a-zA-Z0-9_]+)\\s*\\}" }, { "include": "#comments-javadoc-tags" } ] } ] }, "comments-javadoc-tags": { "patterns": [ { "captures": { "1": { "name": "keyword.other.documentation.params.processing" }, "2": { "name": "keyword.other.documentation.value.processing" } }, "match": "(@param)\\s+([a-zA-Z_][a-zA-Z0-9_]+)\\b" }, { "match": "@[a-zA-Z]+\\b", "name": "keyword.other.documentation.tag.processing" } ] }, "constants-and-special-vars": { "patterns": [ { "include": "#processing-variables-and-constants" }, { "match": "\\b(true|false|null)\\b", "name": "constant.language.processing" }, { "match": "\\b(this|super)\\b", "name": "variable.language.processing" }, { "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)([LlFfUuDd]|UL|ul)?\\b", "name": "constant.numeric.processing" }, { "captures": { "1": { "name": "keyword.operator.dereference.processing" } }, "match": "(\\.)?\\b([A-Z][A-Z0-9_]+)(?!<|\\.class|\\s*\\w+\\s*=)\\b", "name": "constant.other.processing" } ] }, "enums": { "begin": "^(?=\\s*[A-Z0-9_]+\\s*({|\\(|,))", "end": "(?=;|})", "patterns": [ { "begin": "\\w+", "beginCaptures": { "0": { "name": "constant.other.enum.processing" } }, "end": "(?=,|;|})", "name": "meta.enum.processing", "patterns": [ { "include": "#parens" }, { "begin": "{", "end": "}", "patterns": [ { "include": "#class-body" } ] } ] } ] }, "keywords": { "patterns": [ { "match": "((&|\\^|\\||<<|>>>?)=)", "name": "keyword.operator.assignment.bitwise.processing" }, { "match": "(<<|>>>?|~|\\^)", "name": "keyword.operator.bitwise.processing" }, { "match": "\\b(try|catch|finally|throw)\\b", "name": "keyword.control.catch-exception.processing" }, { "match": "\\?|:", "name": "keyword.control.ternary.processing" }, { "match": "\\b(return|break|case|continue|default|do|while|for|switch|if|else)\\b", "name": "keyword.control.processing" }, { "match": "\\b(instanceof)\\b", "name": "keyword.operator.instanceof.processing" }, { "match": "(===?|!=|<=|>=|<>|<|>)", "name": "keyword.operator.comparison.processing" }, { "match": "([+*/%-]=)", "name": "keyword.operator.assignment.arithmetic.processing" }, { "match": "(=)", "name": "keyword.operator.assignment.processing" }, { "match": "(\\-\\-|\\+\\+)", "name": "keyword.operator.increment-decrement.processing" }, { "match": "(\\-|\\+|\\*|\\/|%)", "name": "keyword.operator.arithmetic.processing" }, { "match": "(!|&&|\\|\\|)", "name": "keyword.operator.logical.processing" }, { "match": "(\\||&)", "name": "keyword.operator.bitwise.processing" }, { "match": "(?<=\\S)\\.(?=\\S)", "name": "keyword.operator.dereference.processing" }, { "match": ";", "name": "punctuation.terminator.processing" } ] }, "methods": { "begin": "(?!new)(?=\\w.*\\s+)(?=[^=]+\\()(?=.+{)", "comment": "Method defs have to look-ahead for the opening bracket to be distinguished from a method call", "end": "}|(?=;)", "name": "meta.method.processing", "patterns": [ { "include": "#storage-modifiers" }, { "begin": "(\\w+)\\s*\\(", "beginCaptures": { "1": { "name": "entity.name.function.processing" } }, "end": "\\)", "name": "meta.method.identifier.processing", "patterns": [ { "include": "#parameters" } ] }, { "begin": "(?=\\w.*\\s+\\w+\\s*\\()", "end": "(?=\\w+\\s*\\()", "name": "meta.method.return-type.processing", "patterns": [ { "include": "#all-types" } ] }, { "include": "#throws" }, { "begin": "{", "end": "(?=})", "name": "meta.method.body.processing", "patterns": [ { "include": "#code" } ] } ] }, "object-types": { "patterns": [ { "include": "#processing-classes" }, { "begin": "\\b((?:[a-z]\\w*\\.)*[A-Z]+\\w*)<", "end": ">|[^\\w\\s,\\?<\\[\\]]", "name": "storage.type.generic.processing", "patterns": [ { "include": "#object-types" }, { "begin": "<", "comment": "This is just to support <>'s with no actual type prefix", "end": ">|[^\\w\\s,\\[\\]<]", "name": "storage.type.generic.processing" } ] }, { "begin": "\\b((?:[a-z]\\w*\\.)*[A-Z]+\\w*)(?=\\[)", "end": "(?=[^\\]\\s])", "name": "storage.type.object.array.processing", "patterns": [ { "begin": "\\[", "end": "\\]", "patterns": [ { "include": "#code" } ] } ] }, { "captures": { "1": { "name": "keyword.operator.dereference.processing" } }, "match": "\\b(?:[a-z]\\w*(\\.))*[A-Z]+\\w*\\b", "name": "storage.type.processing" } ] }, "object-types-inherited": { "patterns": [ { "begin": "\\b((?:[a-z]\\w*\\.)*[A-Z]+\\w*)<", "end": ">|[^\\w\\s,<]", "name": "entity.other.inherited-class.processing", "patterns": [ { "include": "#object-types" }, { "begin": "<", "comment": "This is just to support <>'s with no actual type prefix", "end": ">|[^\\w\\s,<]", "name": "storage.type.generic.processing" } ] }, { "captures": { "1": { "name": "keyword.operator.dereference.processing" } }, "match": "\\b(?:[a-z]\\w*(\\.))*[A-Z]+\\w*", "name": "entity.other.inherited-class.processing" } ] }, "parameters": { "patterns": [ { "match": "final", "name": "storage.modifier.processing" }, { "include": "#primitive-arrays" }, { "include": "#primitive-types" }, { "include": "#object-types" }, { "match": "\\w+", "name": "variable.parameter.processing" } ] }, "parens": { "begin": "\\(", "end": "\\)", "patterns": [ { "include": "#code" } ] }, "primitive-arrays": { "patterns": [ { "match": "\\b(?:void|boolean|byte|char|color|short|int|float|long|double)(?=(\\[\\s*\\])+)\\b", "name": "storage.type.primitive.array.processing" } ] }, "primitive-types": { "patterns": [ { "comment": "Most of, if not all, types have a casting method of the same name in Processing. Hence the negative lookahead to check for that", "match": "\\b(?:void|boolean|byte|char|color|short|int|float|long|double)(?!\\s*\\()\\b", "name": "storage.type.primitive.processing" } ] }, "processing-classes": { "patterns": [ { "comment": "Includes only Processing-supplied classes - not the standard Java classes (Array, String, etc.), though they're mentioned in the Processing reference", "match": "\\b(P(Applet|Constants|Font|Graphics|Graphics2D|Graphics3D|GraphicsJava2D|Image|Line|Matrix|Matrix2D|Matrix3D|Polygon|Shape|ShapeSVG|SmoothTriangle|Style|Triangle|Vector)|StdXML(Builder|Parser|Reader)|XML(Element|EntityResolver|Exception|ParseException|ValidationException|Validator|Writer))\\b", "name": "support.type.object.processing" } ] }, "processing-methods": { "patterns": [ { "comment": "Note the neg. look-behind at the beginning and the look-ahead at the end. This distinguishes methods like array.size() from size(), and frameRate() from the frameRate variable, respectively", "match": "\\b(?