--- 
name: SWeave
fileTypes: 
- Snw
- Rnw
- snw
- rnw
firstLineMatch: ^\\documentclass(?!.*\{beamer\})|^<<(.?*)>>=$
scopeName: text.tex.latex.sweave
uuid: 1F450973-8259-4BA2-A754-48C634561A13
foldingStartMarker: ^<<(.?*)>>=|\\begin\{.*\}
patterns: 
- name: meta.block.parameters.sweave
  endCaptures: 
    "1": 
      name: punctuation.definition.parameters.end.sweave
  begin: ^(<<)
  beginCaptures: 
    "1": 
      name: punctuation.definition.parameters.begin.sweave
  end: (>>)(?==)
  patterns: 
  - name: meta.parameter.sweave
    captures: 
      "1": 
        name: keyword.other.name-of-parameter.sweave
      "2": 
        name: punctuation.separator.key-value.sweave
      "3": 
        name: constant.language.boolean.sweave
      "4": 
        name: constant.language.results.sweave
      "5": 
        name: string.unquoted.label.sweave
    match: (\w+)(=)(?:(true|false)|(verbatim|tex|hide)|([\w.]+))
  - name: string.unquoted.label.sweave
    match: "[\\w.]+"
  - name: punctuation.separator.parameters.sweave
    match: ","
- name: meta.block.code.sweave
  endCaptures: 
    "1": 
      name: punctuation.section.embedded.end.sweave
    "2": 
      name: comment.line.other.sweave
  begin: (?<=>>)(=)(.*)\n
  contentName: source.r.embedded.sweave
  beginCaptures: 
    "1": 
      name: punctuation.section.embedded.begin.sweave
    "2": 
      name: comment.line.other.sweave
  end: ^(@)(.*)$
  patterns: 
  - name: invalid.illegal.sweave
    match: ^\s+@.*\n?
  - include: source.r
- name: invalid.illegal.sweave
  match: ^\s+<<.*\n?
- name: meta.block.source.r
  captures: 
    "1": 
      name: punctuation.definition.arguments.begin.latex
    "2": 
      name: punctuation.definition.arguments.end.latex
  begin: ^\\begin(\{)Scode(\})
  contentName: source.r.embedded.sweave
  end: ^\\end(\{)Scode(\})
  patterns: 
  - include: source.r
- name: source.r.embedded.sweave
  endCaptures: 
    "1": 
      name: punctuation.definition.arguments.end.latex
  begin: \\Sexpr(\{)
  beginCaptures: 
    "1": 
      name: punctuation.definition.arguments.begin.latex
  end: (\})
  patterns: 
  - include: source.r
- include: text.tex.latex
foldingStopMarker: ^@(.?*)$|\\end\{.*\}
keyEquivalent: ^~S
