@@ -62,7 +62,7 @@ indent_without_paren <- function(pd, indent_by = 2) {
62
62
compute_indent_indices <- function (pd , token = " '('" , indent_last = FALSE ) {
63
63
npd <- nrow(pd )
64
64
opening <- which(pd $ token %in% token )[1 ]
65
- if (! needs_indention(pd , token , opening )) return (numeric (0 ))
65
+ if (! needs_indention(pd , opening )) return (numeric (0 ))
66
66
start <- opening + 1
67
67
stop <- npd - ifelse(indent_last , 0 , 1 )
68
68
which(between(seq_len(npd ), start , stop ))
@@ -72,17 +72,15 @@ compute_indent_indices <- function(pd, token = "'('", indent_last = FALSE) {
72
72
# ' Check whether indention is needed
73
73
# '
74
74
# ' @param pd A parse table.
75
- # ' @param token Which token the check should be based on.
76
75
# ' @param opening the index of the opening parse table. Since always computed
77
76
# ' before this function is called, it is included as an argument so it does
78
77
# ' not have to be recomputed.
79
78
# ' @return returns `TRUE` if indention is needed, `FALSE` otherwise. Indention
80
- # ' is needed:
81
- # ' * if `token` occurs in `pd`.
82
- # ' * if there is no child that starts on the same line as `token` and
83
- # ' "opens" indention without closing it on this line.
79
+ # ' is needed if and only if:
80
+ # ' * the opening token is not `NA`.
81
+ # ' * if there is a multi-line token before the first line break.
84
82
# ' @return `TRUE` if indention is needed, `FALSE` otherwise.
85
- needs_indention <- function (pd , token = " '(' " , opening ) {
83
+ needs_indention <- function (pd , opening ) {
86
84
if (is.na(opening )) return (FALSE )
87
85
before_first_break <- which(pd $ lag_newlines > 0 )[1 ] - 1
88
86
if (is.na(before_first_break )) return (FALSE )
0 commit comments