{ "information_for_contributors": [ "This file has been converted from https://github.com/REditorSupport/vscode-R/blob/master/syntax/r.json", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], "version": "https://github.com/REditorSupport/vscode-R/commit/c937cdd39982995d8ee1f1125919f7c2d150b35d", "name": "R", "scopeName": "source.r", "patterns": [ { "include": "#roxygen" }, { "include": "#comments" }, { "include": "#constants" }, { "include": "#keywords" }, { "include": "#storage-type" }, { "include": "#strings" }, { "include": "#brackets" }, { "include": "#function-declarations" }, { "include": "#lambda-functions" }, { "include": "#builtin-functions" }, { "include": "#function-calls" }, { "include": "#general-variables" } ], "repository": { "comments": { "patterns": [ { "captures": { "1": { "name": "comment.line.pragma.r" }, "2": { "name": "entity.name.pragma.name.r" } }, "match": "^(#pragma[ \\t]+mark)[ \\t](.*)", "name": "comment.line.pragma-mark.r" }, { "begin": "(^[ \\t]+)?(?=#)", "beginCaptures": { "1": { "name": "punctuation.whitespace.comment.leading.r" } }, "end": "(?!\\G)", "patterns": [ { "begin": "#", "beginCaptures": { "0": { "name": "punctuation.definition.comment.r" } }, "end": "\\n", "name": "comment.line.number-sign.r" } ] } ] }, "constants": { "patterns": [ { "match": "\\b(pi|letters|LETTERS|month\\.abb|month\\.name)\\b", "name": "support.constant.misc.r" }, { "match": "\\b(TRUE|FALSE|NULL|NA|NA_integer_|NA_real_|NA_complex_|NA_character_|Inf|NaN)\\b", "name": "constant.language.r" }, { "match": "\\b0(x|X)[0-9a-fA-F]+i\\b", "name": "constant.numeric.imaginary.hexadecimal.r" }, { "match": "\\b[0-9]+\\.?[0-9]*(?:(e|E)(\\+|-)?[0-9]+)?i\\b", "name": "constant.numeric.imaginary.decimal.r" }, { "match": "\\.[0-9]+(?:(e|E)(\\+|-)?[0-9]+)?i\\b", "name": "constant.numeric.imaginary.decimal.r" }, { "match": "\\b0(x|X)[0-9a-fA-F]+L\\b", "name": "constant.numeric.integer.hexadecimal.r" }, { "match": "\\b(?:[0-9]+\\.?[0-9]*)(?:(e|E)(\\+|-)?[0-9]+)?L\\b", "name": "constant.numeric.integer.decimal.r" }, { "match": "\\b0(x|X)[0-9a-fA-F]+\\b", "name": "constant.numeric.float.hexadecimal.r" }, { "match": "\\b[0-9]+\\.?[0-9]*(?:(e|E)(\\+|-)?[0-9]+)?\\b", "name": "constant.numeric.float.decimal.r" }, { "match": "\\.[0-9]+(?:(e|E)(\\+|-)?[0-9]+)?\\b", "name": "constant.numeric.float.decimal.r" } ] }, "general-variables": { "patterns": [ { "captures": { "1": { "name": "variable.parameter.r" }, "2": { "name": "keyword.operator.assignment.r" } }, "match": "([[:alpha:].][[:alnum:]._]*)\\s*(=)(?=[^=])" }, { "captures": { "1": { "name": "variable.parameter.r" }, "2": { "name": "keyword.operator.assignment.r" } }, "match": "(`[^`]+`)\\s*(=)(?=[^=])" }, { "match": "\\b([\\d_][[:alnum:]._]+)\\b", "name": "invalid.illegal.variable.other.r" }, { "match": "\\b([[:alnum:]_]+)(?=::)", "name": "entity.namespace.r" } ] }, "keywords": { "patterns": [ { "match": "\\b(break|next|repeat|else|in)\\b", "name": "keyword.control.r" }, { "match": "\\b(ifelse|if|for|return|switch|while|invisible)\\b(?=\\s*\\()", "name": "keyword.control.r" }, { "match": "(\\-|\\+|\\*|\\/|%\\/%|%%|%\\*%|%o%|%x%|\\^)", "name": "keyword.operator.arithmetic.r" }, { "match": "(:=|<-|<<-|->|->>)", "name": "keyword.operator.assignment.r" }, { "match": "(==|<=|>=|!=|<>|<|>|%in%)", "name": "keyword.operator.comparison.r" }, { "match": "(!|&{1,2}|[|]{1,2})", "name": "keyword.operator.logical.r" }, { "match": "(\\|>)", "name": "keyword.operator.pipe.r" }, { "match": "(%between%|%chin%|%like%|%\\+%|%\\+replace%|%:%|%do%|%dopar%|%>%|%<>%|%T>%|%\\$%)", "name": "keyword.operator.other.r" }, { "match": "(\\.\\.\\.|\\$|:|\\~|@)", "name": "keyword.other.r" } ] }, "storage-type": { "patterns": [ { "match": "\\b(character|complex|double|expression|integer|list|logical|numeric|single|raw)\\b(?=\\s*\\()", "name": "storage.type.r" } ] }, "strings": { "patterns": [ { "begin": "[rR]\"(-*)\\[", "beginCaptures": { "0": { "name": "punctuation.definition.string.raw.begin.r" } }, "end": "\\]\\1\"", "endCaptures": { "0": { "name": "punctuation.definition.string.raw.end.r" } }, "name": "string.quoted.double.raw.r" }, { "begin": "[rR]'(-*)\\[", "beginCaptures": { "0": { "name": "punctuation.definition.string.raw.begin.r" } }, "end": "\\]\\1'", "endCaptures": { "0": { "name": "punctuation.definition.string.raw.end.r" } }, "name": "string.quoted.single.raw.r" }, { "begin": "[rR]\"(-*)\\{", "beginCaptures": { "0": { "name": "punctuation.definition.string.raw.begin.r" } }, "end": "\\}\\1\"", "endCaptures": { "0": { "name": "punctuation.definition.string.raw.end.r" } }, "name": "string.quoted.double.raw.r" }, { "begin": "[rR]'(-*)\\{", "beginCaptures": { "0": { "name": "punctuation.definition.string.raw.begin.r" } }, "end": "\\}\\1'", "endCaptures": { "0": { "name": "punctuation.definition.string.raw.end.r" } }, "name": "string.quoted.single.raw.r" }, { "begin": "[rR]\"(-*)\\(", "beginCaptures": { "0": { "name": "punctuation.definition.string.raw.begin.r" } }, "end": "\\)\\1\"", "endCaptures": { "0": { "name": "punctuation.definition.string.raw.end.r" } }, "name": "string.quoted.double.raw.r" }, { "begin": "[rR]'(-*)\\(", "beginCaptures": { "0": { "name": "punctuation.definition.string.raw.begin.r" } }, "end": "\\)\\1'", "endCaptures": { "0": { "name": "punctuation.definition.string.raw.end.r" } }, "name": "string.quoted.single.raw.r" }, { "begin": "\"", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.r" } }, "end": "\"", "endCaptures": { "0": { "name": "punctuation.definition.string.end.r" } }, "name": "string.quoted.double.r", "patterns": [ { "match": "\\\\.", "name": "constant.character.escape.r" } ] }, { "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.r" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.r" } }, "name": "string.quoted.single.r", "patterns": [ { "match": "\\\\.", "name": "constant.character.escape.r" } ] } ] }, "brackets": { "patterns": [ { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.section.parens.begin.r" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.section.parens.end.r" } }, "patterns": [ { "include": "source.r" } ] }, { "begin": "\\[(?!\\[)", "beginCaptures": { "0": { "name": "punctuation.section.brackets.single.begin.r" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.section.brackets.single.end.r" } }, "patterns": [ { "include": "source.r" } ] }, { "begin": "\\[\\[", "beginCaptures": { "0": { "name": "punctuation.section.brackets.double.begin.r" } }, "end": "\\]\\]", "endCaptures": { "0": { "name": "punctuation.section.brackets.double.end.r" } }, "contentName": "meta.item-access.arguments.r", "patterns": [ { "include": "source.r" } ] }, { "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.section.braces.begin.r" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.braces.end.r" } }, "patterns": [ { "include": "source.r" } ] } ] }, "function-declarations": { "patterns": [ { "match": "((?:`[^`\\\\]*(?:\\\\.[^`\\\\]*)*`)|(?:[[:alpha:].][[:alnum:]._]*))\\s*(