Skip to content

Commit 872ae2e

Browse files
tidy up.
1 parent 7edbdc0 commit 872ae2e

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

R/indent.R

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,16 @@ indent_op <- function(pd,
3636
pd
3737
}
3838

39-
#' Revert the indention of function declaration heads
39+
#' Revert the indention of function declaration header
4040
#'
41-
#' Necessary for consistent indention of the function declaration head.
41+
#' Necessary for consistent indention of the function declaration header.
4242
#' @param pd A parse table.
4343
#' @seealso set_unindention_child update_indention_ref_fun_dec
4444
unindent_fun_dec <- function(pd) {
4545
if (is_function_dec(pd)) {
4646
idx_closing_brace <- which(pd$token %in% "')'")
4747
fun_dec_head <- seq2(2L, idx_closing_brace)
4848
pd$indent[fun_dec_head] <- 0L
49-
5049
}
5150
pd
5251
}
@@ -144,8 +143,8 @@ compute_indent_indices <- function(pd,
144143
token_closing = NULL) {
145144
npd <- nrow(pd)
146145
potential_triggers <- which(pd$token %in% token_opening)
147-
needs_indention <- needs_indention(
148-
pd, potential_triggers, other_trigger_tokens = c("EQ_SUB", "EQ_FORMALS")
146+
needs_indention <- needs_indention(pd, potential_triggers,
147+
other_trigger_tokens = c("EQ_SUB", "EQ_FORMALS")
149148
)
150149
trigger <- potential_triggers[needs_indention][1]
151150
if (is.na(trigger)) return(numeric(0))
@@ -201,16 +200,16 @@ needs_indention_one <- function(pd,
201200
potential_trigger_pos, before_first_break
202201
)
203202
multi_line_token <- pd_is_multi_line(
204-
pd[row_idx_between_trigger_and_line_break,]
203+
pd[row_idx_between_trigger_and_line_break, ]
205204
)
206205
remaining_row_idx_between_trigger_and_line_break <- setdiff(
207206
row_idx_between_trigger_and_line_break,
208207
potential_trigger_pos
209208
)
210209

211210
other_trigger_on_same_line <-
212-
pd[remaining_row_idx_between_trigger_and_line_break,]$token %in%
213-
other_trigger_tokens
211+
pd[remaining_row_idx_between_trigger_and_line_break, ]$token %in%
212+
other_trigger_tokens
214213

215214
!any(multi_line_token) & !any(other_trigger_on_same_line)
216215
}

R/transform-files.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ parse_transform_serialize <- function(text, transformers) {
131131
#' hence line breaks must be modified first).
132132
#' * spacing rules (must be after line-breaks and updating newlines and
133133
#' multi-line).
134+
#' * indention.
134135
#' * token manipulation / replacement (is last since adding and removing tokens
135136
#' will invalidate columns token_after and token_before).
136137
#' * Update indention reference (must be after line breaks).

man/apply_transformers.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/unindent_fun_dec.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)