styler1.10.3 package

Non-Invasive Pretty Printing of R Code

add_cache_block

Add the block id to a parse table

add_id_and_short

Add column pos_id and short

add_roxygen_mask

Add the roxygen mask to code

add_spaces_or_newlines

Concentrate newlines or spaces in a string

add_stylerignore

Adds the stylerignore column

add_token_terminal

Add information about previous / next token to each terminal

alignment_col1_all_named

Checks if all arguments of column 1 are named

alignment_drop_comments

Remove all comment tokens

alignment_drop_last_expr

Remove last expression

alignment_ensure_no_closing_brace

Ensure the closing brace of the call is removed

alignment_ensure_trailing_comma

Ensure last pd has a trailing comma

alignment_has_correct_spacing_around_comma

Check if spacing around comma is correct

alignment_has_correct_spacing_around_eq_sub

Check if spacing around = is correct

alignment_serialize

Serialize text from a parse table

alignment_serialize_column

Serialize all lines for a given column

alignment_serialize_line

Serialize one line for a column

apply_ref_indention

Apply reference indention to tokens

apply_ref_indention_one

Applying reference indention of a target token

apply_stylerignore

Ensure correct positional information for stylerignore expressions

apply_transformers

Apply transformers to a parse table

assert_filetype

Make sure all supplied file types are allowed

assert_text

Assert text to be of positive length and replace it with the empty str...

assert_tokens

Check token validity

assert_transformers

Assert the transformers

bind_with_child

Bind a parse table with one of its children

cache_activate

Activate or deactivate the styler cache

cache_by_expression

Cache text

cache_clear

Clear the cache

cache_find_block

Find the groups of expressions that should be processed together

cache_find_path

Where is the cache?

cache_info

Show information about the styler cache

cache_is_activated

Check if a cache is activated

cache_make_key

Make a key for R.cache

cache_more_specs

Create more specs

cache_write

Write to the cache

caching

Remember the past to be quicker in the future

calls_sys

Invoke a system command

catch_style_file_output

Capture and post-process the output of style_file without causing si...

choose_indention

Choose the indention method for the tokens

combine_children

Combine child and internal child

communicate_summary

Communicate the summary of styling

communicate_warning

Communicate a warning if necessary

compute_indent_indices

Compute the indices that need indention

compute_parse_data_nested

Obtain a nested parse table from a character vector

construct_out

Construct *-out.R from a *-in.R

construct_tree

Construct paths of a tree object given the paths of *-in.R files

construct_vertical

Construct an object of class vertical

contains_else_expr_that_needs_braces

Check whether an else expression needs braces

context_to_terminals

Propagate context to terminals

context_towards_terminals

Update the a parse table given outer context

convert_newlines_to_linebreaks

Replace the newline character with a line break

copy_to_tempdir

Copy a file to a temporary directory

create_node_from_nested

Create node from nested parse data

create_node_from_nested_root

Convert a nested data frame into a node tree

create_pos_ids

Create valid pos_ids if possible

create_style_guide

Create a style guide

create_tokens

Create a terminal token

create_tree

Create a tree from text

default_style_guide_attributes

Initialize default style guide attributes

delete_if_cache_directory

Delete a cache or temp directory

dir_without_.

dir(), but without dot-prefix and different defaults

dir_without_._one

dir(), but with full names, ignored case, and included hidden files ...

emulate_rd

Convert roxygen comments to Rd code

enhance_mapping_special

Enhance the mapping of text to the token "SPECIAL"

enrich_terminals

Enrich flattened parse table

ensure_correct_txt

Ensure a correct text of all strings and numeric constants

ensure_last_n_empty

Ensure there is one (and only one) blank line at the end of a vector

env_add_stylerignore

Add positional information of token to next terminal

env_current

The elements that are added to this environment are:

expressions_are_identical

Check whether two expressions are identical

extend_if_comment

Find the index of the last comment in the sequence of comments-only to...

extract_terminals

Extract terminal tokens

finalize_raw_chunks

Drop start / stop, when formatting is turned off

find_blank_lines_to_next_block

Number of lines between cache blocks

find_blank_lines_to_next_expr

Find blank lines

find_dont_seqs

Find dontrun and friend sequences

find_line_break_position_in_multiline_call

Find index of the token before which the line should be broken

find_pos_id_to_keep

Find the pos ids to keep

find_start_pos_id

Find legit starting value for a new positional id

find_tokens_to_update

Find the tokens to update when applying a reference indention

fix_quotes

Replace single quotes with double quotes

flatten_operators

Flatten some token in the nested parse table based on operators

flatten_operators_one

Flatten one level of nesting with its child

flatten_pd

Flatten a parse table

generate_test_samples

Generate a comprehensive collection test cases for comment / insertion...

get_addins_style_transformer_name

Return the style function or name

get_engine_pattern

What's the engine pattern for rmd code chunks?

get_knitr_pattern

Get chunk pattern

get_parse_data

Obtain robust parse data

has_crlf_as_first_line_sep

Check if a string uses CRLF EOLs

hash_standardize

Standardize text for hashing

identify_raw_chunks

Identifies raw Rmd or Rnw code chunks

identify_start_to_stop_of_roxygen_examples_from_text

Figure out where code examples start and stop

if_for_while_part_requires_braces

Check if if, for or while loop expression require a braces.

initialize_attributes

Initialize attributes

invalid_utf8

Drop-in replacement for xfun:::invalid_utf8()

is_cached

Check if text is cached

is_code_chunk_header_or_xaringan_or_code_output

Identify spinning code chunk header or xaringan

is_double_indent_function_declaration

Is the function declaration double indented?

is_insufficiently_parsed_string

Identify strings that were not fully parsed

is_shebang

Identify comments that are shebangs

local_test_setup

Establish testing setup for current environment

lookup_new_special

Lookup which new tokens were created from "SPECIAL"

lookup_tokens

Lookup all tokens that have a unique token-text mapping

make_transformer

Closure to return a transformer function

map_filetype_to_pattern

Map the file type to a corresponding regular expression

match_stop_to_start

Match a stop candidate to a start

math_token_spacing

Specify spacing around math tokens

n_times_faster_with_cache

Times two function calls with temporarily enabled cache

needs_indention

Check whether indention is needed

needs_indention_one

Check whether indention is needed

needs_rd_emulation

Check if rd emulation is required with roxygen2::roc_proc_text()

nest_parse_data

Nest a flat parse table

next_non_comment

Find the index of the next or previous non-comment in a parse table.

next_terminal

Tell me what the next terminal is

option_read

Get the value of an option

parse_roxygen

Parse roxygen comments into text

parse_safely

Save parsing from text

parse_transform_serialize_r

Parse, transform and serialize text

parse_transform_serialize_r_block

Parse, transform and serialize a nested parse table

parse_transform_serialize_roxygen

Parse, transform and serialize roxygen comments

parse_tree_must_be_identical

Check whether a round trip verification can be carried out

parser_version_set

Work with parser versions

pd_is

What is a parse table representing?

pd_is_multi_line

Check whether a parse table is a multi-line token

post_parse_roxygen

Changing the line definition

prettify_any

Prettify R code in current working directory

prettify_pkg

Prettify a package

print.vertical

Print styled code

read_utf8

Read UTF-8

read_utf8_bare

Drop-in replacement for xfun::read_utf8(), with an optional warnar...

reindention

Specify what is re-indented how

remove_dont_mask

Remove dont* mask

remove_roxygen_header

Remove roxygen header

rep_char

Repeat elements of a character vector times times and collapse it

roxygen_remove_extra_brace

Fix tools::parse_Rd() output

save_after_styling_is_active

Heuristic to see if a file styled with the addin should be saved or no...

scope_normalize

Convert the styling scope to its lower-level representation

separate_chunks

Separate chunks within Rmd and Rnw contents

serialize_parse_data_flattened

Serialize flattened parse data

set_and_assert_arg_filetype

Set the file type argument

set_arg_paths

Standardize paths in root

set_arg_write_tree

Set the write_tree argument

set_line_break_after_opening_if_call_is_multi_line

Sets line break after opening parenthesis

set_line_break_around_curly_curly

Styling around \{\{

set_line_break_before_curly_opening

Set line break before a curly brace

set_line_break_if_call_is_multi_line

Set line break for multi-line function calls

set_multi_line

Set the multi-line column

set_regex_indention

Set indention of tokens that match regex

set_space_around_op

Set spaces around operators

set_space_between_eq_sub_and_comma

Set space between EQ_SUB and "','"

set_space_between_levels

Set space between levels of nesting

set_spaces

Helper for setting spaces

set_style_transformers

Asks the user to supply a style

set_unindention_child

Unindent a child if necessary

shallowify

Shallowify the parse table

specify_transformers_drop

Specify which tokens must be absent for a transformer to be dropped

split_roxygen_segments

Split text into roxygen and non-roxygen example segments

start_comments_with_space

Start comments with a space

style_active_pkg

Wrapper around style_pkg() for access via Addin.

style_dir

Prettify arbitrary R code

style_file

Style files with R source code

style_guides

Style guides

style_pkg

Prettify R source code

style_roxygen_code_example

Style a roxygen code example that may contain dontrun and friends

style_roxygen_code_example_one

Style a roxygen code example with exactly one @example or `@exampleI...

style_roxygen_code_example_segment

Style a roxygen code example segment

style_roxygen_example_snippet

Given a code snippet is dont* or run, style it

style_selection

Styles the highlighted selection in a .R or .Rmd file.

style_space_around_math_token

Style spacing around math tokens

style_space_around_token

Set spacing of token to a certain level

style_text

Style a string

style_text_without_curly_curly

style_text() without rules for \{\{

styler-package

styler: Non-Invasive Pretty Printing of R Code

styler_addins

Stylers for RStudio Addins

stylerignore

Turn off styling for parts of the code

stylerignore_consolidate_col

Consolidate columns after a merge

test_collection

Run a collection of tests

test_dry

Test the dry argument

test_transformer

Transforming test input with a transformer function

test_transformers_drop

Test transformers_drop for consistency

testthat_file

Create the path to a test that file

text_to_flat_pd

Creates a flat parse table with minimal initialization

tidyverse_style

The tidyverse style

token_is_on_aligned_line

Check if tokens are aligned

tokenize

Obtain token table from text

transform_and_check

Transform a file an check the result

transform_code

Transform code from R, Rmd or Rnw files

transform_file

Transform a file and output a customized message

transform_files

Transform files with transformer functions

transform_mixed

Transform mixed contents

transform_mixed_non_empty

Ensure for .Rmd and friends that a code chunk without code is format...

transform_utf8

Apply a function to the contents of a file

transform_utf8_one

Potentially transform a file

transformers_drop

Remove transformers that are not needed

try_transform_as_r_file

Style a file as if it was an .R file

unindent_child

Unindent a child

unindent_fun_dec

Revert the indention of function declaration header

update_indention

Update indention information of parse data

update_indention_ref

Update the indention reference

update_newlines

Update the newlines attribute

validate_new_pos_ids

Validate sequence of new position ids

verify_roundtrip

Verify the styling

visit

Visit'em all

visit_one

Transform a flat parse table with a list of transformers

wrap_else_multiline_curly

Add curly braces to else

wrap_expr_in_curly

Wrap an expression in curly braces

wrap_expr_in_expr

Wrap an expression into an expression

wrap_if_else_while_for_fun_multi_line_in_curly

Wrap if-else, while and for statements in curly braces

wrap_multiline_curly

Wrap a multi-line statement in curly braces

wrap_subexpr_in_curly

Wrap a sub-expression in curly braces

write_utf8

Drop-in replacement for xfun::write_utf8()

Pretty-prints R code without changing the user's formatting intent.

  • Maintainer: Lorenz Walthert
  • License: MIT + file LICENSE
  • Last published: 2024-04-07