# Encoding: UTF-8

{fileTypes: ["R", "r", "s", "S", "Rprofile"],
 foldingStartMarker: /^[^#]*(?<_1>\([^\)]*$|\{\s*$)/,
 foldingStopMarker: /(?<_1>^\s*\)|^\s*\})/,
 keyEquivalent: "^~R",
 name: "R",
 patterns: 
  [{captures: {1 => {name: "punctuation.definition.comment.r"}},
    match: /(?<_1>#).*$\n?/,
    name: "comment.line.number-sign.r"},
   {match: 
     /\b(?<_1>logical|numeric|character|complex|matrix|array|data\.frame|list|factor)(?=\s*\()/,
    name: "storage.type.r"},
   {match: 
     /\b(?<_1>function|if|break|next|repeat|else|for|return|switch|while|in|invisible)\b/,
    name: "keyword.control.r"},
   {match: 
     /\b(?<_1>(?<_2>0(?<_3>x|X)[0-9a-fA-F]*)|(?<_4>(?<_5>[0-9]+\.?[0-9]*)|(?<_6>\.[0-9]+))(?<_7>(?<_8>e|E)(?<_9>\+|-)?[0-9]+)?)(?<_10>i|L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\b/,
    name: "constant.numeric.r"},
   {match: /\b(?<_1>T|F|TRUE|FALSE|NULL|NA|Inf|NaN)\b/,
    name: "constant.language.r"},
   {match: /\b(?<_1>pi|letters|LETTERS|month\.abb|month\.name)\b/,
    name: "support.constant.misc.r"},
   {match: /(?<_1>\-|\+|\*|\/|%\/%|%%|%\*%|%in%|%o%|%x%|\^)/,
    name: "keyword.operator.arithmetic.r"},
   {match: /(?<_1>=|<-|<<-|->|->>)/, name: "keyword.operator.assignment.r"},
   {match: /(?<_1>==|!=|<>|<|>|<=|>=)/, name: "keyword.operator.comparison.r"},
   {match: /(?<_1>!|&{1,2}|[|]{1,2})/, name: "keyword.operator.logical.r"},
   {match: /(?<_1>\.\.\.|\$|@|:|\~)/, name: "keyword.other.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"}]},
   {captures: 
     {1 => {name: "entity.name.function.r"},
      2 => {name: "keyword.operator.assignment.r"},
      3 => {name: "keyword.control.r"}},
    match: /(?<_1>[[:alpha:].][[:alnum:]._]*)\s*(?<_2><-)\s*(?<_3>function)/,
    name: "meta.function.r"},
   {captures: 
     {1 => {name: "entity.name.tag.r"}, 3 => {name: "entity.name.type.r"}},
    match: 
     /(?<_1>setMethod|setGeneric|setGroupGeneric|setClass)\s*\(\s*(?<_2>"|\x27)(?<_3>[a-zA-Z._\[\$@][a-zA-Z0-9._\[]*?)\k<_2>/,
    name: "meta.method.declaration.r"},
   {match: /(?<_1>[[:alpha:].][[:alnum:]._]*)\s*\(/},
   {captures: 
     {1 => {name: "variable.parameter.r"},
      2 => {name: "keyword.operator.assignment.r"}},
    match: /(?<_1>[[:alpha:].][[:alnum:]._]*)\s*(?<_2>=)(?=[^=])/},
   {match: /\b(?<_1>[\d_][[:alnum:]._]+)\b/,
    name: "invalid.illegal.variable.other.r"},
   {match: /\b(?<_1>[[:alnum:]_]+)(?=::)/,
    name: "entity.name.type.namespace.r"},
   {match: /\b(?<_1>[[:alnum:]._]+)\b/, name: "variable.other.r"}],
 scopeName: "source.r",
 uuid: "B2E6B78D-6E70-11D9-A369-000D93B3A10E"}
