R: Split source lines into complete expressions

split_source {xfun} | R Documentation

## Split source lines into complete expressions

### Description

Parse the lines of code one by one to find complete expressions in the code, and put them in a list.

### Usage

    split_source(x)

### Arguments

`x` | A character vector of R source code.

### Value

A list of character vectors, and each vector contains a complete R expression.

### Examples

    xfun::split_source(c("if (TRUE) {", "1 + 1", "}", "print(1:5)"))

[Package xfun version 0.23 Index]