parse_code: Parse Code

View source: R/roclet_rdx.R

parse_codeR Documentation

Parse Code

Description

The function parses the code and returns a list of expressions and source references.

Usage

parse_code(code)

Arguments

code

The code to parse

Permitted values

A character vector

Default value

none

Value

A list of expressions and source references

Each item of the list is a list with the following elements:

  • expr: The expression

  • srcref: The source reference

  • eval: A logical indicating whether the expression should be evaluated, i.e., it is not a comment or an empty line.

Examples

parse_code("1+1\n2*2")

parse_code(c("# sum:", "sum(\n  1, #first\n  2\n)"))

admiraldev documentation built on June 26, 2025, 1:09 a.m.