Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

parse_transform_serialize_r_block

Parse, transform and serialize a nested parse table


Description

We process blocks of nested parse tables for speed. See cache_find_block() for details on how a top level nest is split into blocks.

Usage

parse_transform_serialize_r_block(
  pd_nested,
  start_line,
  transformers,
  base_indention
)

Arguments

pd_nested

A block of the nested parse table.

start_line

The line number on which the code starts.

transformers

A list of named transformer functions

base_indention

Integer scalar indicating by how many spaces the whole output text should be indented. Note that this is not the same as splitting by line and add a base_indention spaces before the code in the case multi-line strings are present. See 'Examples'.

Examples

text_in <- 'x<- function()
"here
is"
NULL
1+ 1
'
style_text(text_in, base_indention = 3)
# not equal to the naive approach
styler:::construct_vertical(paste0(styler:::add_spaces(3), style_text(text_in), sep = ""))

styler

Non-Invasive Pretty Printing of R Code

v1.4.1
MIT + file LICENSE
Authors
Kirill Müller [aut], Lorenz Walthert [cre, aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.