R: Parse a package, file, or inline code

parse_package {roxygen2} | R Documentation

## Parse a package, file, or inline code

### Description

`parse_package()`, `parse_file()`, and `parse_text()` allow you to use roxygen's parsing code to parse the roxygen blocks from a package, file, or character vector of code. `env_package()` and `env_file()` provide defaults that generate a temporary environment making it possible to associate each block with the corresponding live object.

### Usage

    parse_package(path = ".", env = env_package(path),
      registry = default_tags(), global_options = list())

    parse_file(file, env = env_file(file), registry = default_tags(),
      global_options = list())

    parse_text(text, env = env_file(file), registry = default_tags(),
      global_options = list())

    env_file(file)

    env_package(path)

### Arguments

`path, file, text` | Either specify a `path` to the root directory of a package, an R `file`, or a character vector `text`.
`env` | An environment environment containing the result of evaluating the input code. The defaults will do this for you in a test environment: for real code you'll need to generate the environment yourself. You can also set to `NULL` if you only want to get the tokenized code blocks only. This suppresses evaluation of `@eval` tags, and will not find the code object associated with each block.
`registry` | A roclet tag registry: this is a named list where the name gives the tag and the value gives the parsing code. See the `tag_` functions in roxy_tag for built-in options.
`global_options` | A list of global options: `wrap` Logical; should roxygen2 output be wrapped? `FALSE` by default. 'markdown“ Logical value indicating whether to parse Markdown tags.

### Value

A list of roxy_block objects

[Package roxygen2 version 6.1.0 Index]