{ "name": "Firestore Rules", "scopeName": "source.firestore", "patterns": [ { "include": "#main" } ], "repository": { "accessControl": { "name": "storage.modifier.access-control.firestore", "match": "\\b(get|list|read|create|update|delete|write)\\b(?=[\\s,:;]|$)" }, "arithmetic": { "name": "keyword.operator.arithmetic.firestore", "match": "[-+*/%]" }, "basicTypes": { "name": "storage.type.$1.firestore", "match": "\\b(request|math|user|duration|string|int|cloud)\\b" }, "booleans": { "name": "constant.language.boolean.$1.firestore", "match": "\\b(true|false)\\b" }, "comment": { "name": "comment.line.double-slash.firestore", "begin": "//", "end": "$", "beginCaptures": { "0": { "name": "punctuation.definition.comment.firestore" } } }, "comparisons": { "name": "keyword.operator.comparison.firestore", "match": "!!|\u0026\u0026|\\|\\||[!=]==?|\u003e=|\u003c=|\u003c\u003c[\u003c=]?|\u003e\u003e[\u003e=]?|[=!\u003e\u003c|\u0026]" }, "functionName": { "name": "entity.name.function.firestore", "match": "[.\\s\\(][a-zA-Z]+(?=\\()", "captures": { "0": { "patterns": [ { "include": "#punctuation" } ] } } }, "functionParameter": { "name": "variable.parameter.function.firestore", "match": "\\b(?\u003c!['\"])[a-zA-Z0-9_]+(?!['\"])\\b" }, "functionParameterList": { "name": "meta.function.parameters.firestore", "begin": "\\(", "end": "\\)", "patterns": [ { "include": "#functionParameter" }, { "include": "#main" } ], "beginCaptures": { "0": { "name": "punctuation.definition.parameters.begin.bracket.round.firestore" } }, "endCaptures": { "0": { "name": "punctuation.definition.parameters.end.bracket.round.firestore" } } }, "globalFunc": { "name": "support.function.global.$1.firestore", "match": "^\\s*(service|match|allow)(?=\\s)" }, "keywords": { "patterns": [ { "name": "keyword.control.$1.firestore", "match": "\\b(if|in|return|is)\\b" }, { "name": "constant.language.null.firestore", "match": "\\b(null)\\b" }, { "name": "storage.type.function.firestore", "match": "\\b(function)\\b" } ] }, "main": { "patterns": [ { "include": "#comment" }, { "include": "#pathMatchLiteral" }, { "include": "#pathMatchVariable" }, { "include": "#basicTypes" }, { "include": "#number" }, { "include": "#strings" }, { "include": "#functionName" }, { "include": "#functionParameterList" }, { "include": "#globalFunc" }, { "include": "#accessControl" }, { "include": "#keywords" }, { "include": "#booleans" }, { "include": "#comparisons" }, { "include": "#arithmetic" }, { "include": "#typeMember" }, { "include": "#punctuation" } ] }, "number": { "patterns": [ { "name": "constant.numeric.decimal.float.firestore", "match": "(?x)\n-?[0-9]+\\.[0-9]* | # 1.2, -3.4, -3.\n-? \\.[0-9]+ # .12, -.34, -.3" }, { "name": "constant.numeric.decimal.integer.firestore", "match": "-?[0-9]+" } ] }, "pathMatchLiteral": { "name": "string.unquoted.path.firestore", "match": "(/)[-a-zA-Z0-9_]+(?=[\\s/])", "captures": { "1": { "name": "punctuation.definition.string.slash.firestore" } } }, "pathMatchVariable": { "name": "string.unquoted.path.interpolation.firestore", "match": "(?x)\n(/) #1\n({) #2\n([^}]+?) #3\n((=)\\*+)? #4-5\n(}) #6\n(?=[\\s/])", "captures": { "1": { "name": "punctuation.definition.string.slash.firestore" }, "2": { "name": "punctuation.definition.section.begin.firestore" }, "3": { "name": "variable.parameter.path.match.firestore" }, "4": { "name": "keyword.operator.wildcard.firestore" }, "5": { "name": "punctuation.separator.key-value.firestore" }, "6": { "name": "punctuation.definition.section.end.firestore" } } }, "punctuation": { "patterns": [ { "name": "keyword.operator.assignment.colon.key-value.firestore", "match": ":" }, { "name": "punctuation.terminator.statement.semicolon.firestore", "match": ";" }, { "name": "punctuation.separator.delimiter.comma.firestore", "match": "," }, { "name": "punctuation.definition.bracket.curly.begin.firestore", "match": "{" }, { "name": "punctuation.definition.bracket.curly.end.firestore", "match": "}" }, { "name": "punctuation.definition.bracket.square.begin.firestore", "match": "\\[" }, { "name": "punctuation.definition.bracket.square.end.firestore", "match": "\\]" }, { "name": "punctuation.definition.bracket.round.begin.firestore", "match": "\\(" }, { "name": "punctuation.definition.bracket.round.end.firestore", "match": "\\)" }, { "name": "punctuation.definition.full-stop.dot.period.firestore", "match": "\\." } ] }, "strings": { "patterns": [ { "name": "string.quoted.double.firestore", "begin": "\"", "end": "\"", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.firestore" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.end.firestore" } } }, { "name": "string.quoted.single.firestore", "begin": "'", "end": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.firestore" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.end.firestore" } } } ] }, "typeMember": { "name": "variable.parameter.type.member.firestore", "match": "\\.[a-zA-Z0-9_]+", "captures": { "0": { "patterns": [ { "include": "#punctuation" } ] } } } } }