Skip to content

Commit 6b2d117

Browse files
Merge pull request #68 from lorenzwalthert/indent_multiple
fixing indent multiple - one more time
2 parents 5af854e + 7f10dfe commit 6b2d117

File tree

7 files changed

+28
-16
lines changed

7 files changed

+28
-16
lines changed

R/edge_random-out.R

Lines changed: 0 additions & 12 deletions
This file was deleted.

R/unindent.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ set_unindention_child <- function(pd, token = "')'", unindent_by) {
1919
filter(!candidate)
2020
candidates$child <- map(candidates$child,
2121
unindent_child,
22-
token = token,
2322
unindent_by = abs(pd$indent[closing] - pd$indent[closing-1]))
2423

2524
bind_rows(candidates, non_candidates) %>%
@@ -32,7 +31,7 @@ set_unindention_child <- function(pd, token = "')'", unindent_by) {
3231
#' @param pd A parse table.
3332
#' @param token The token the unindention should be based on.
3433
#' @param unindent_by By how many spaces one level of indention is reversed.
35-
unindent_child <- function(pd, token = "')'", unindent_by = 2) {
34+
unindent_child <- function(pd, token = c("')'", "'}'"), unindent_by = 2) {
3635
closing <- which(pd$token %in% token)
3736
if (!("indent" %in% names(pd))) {
3837
pd$indent <- 0

R/edge_mixed-in.R renamed to tests/testthat/indention_multiple/edge_mixed-in.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@
1313
))
1414
)
1515
}
16+
17+
18+
(((
19+
1 + 2) * (3 + 4 # FIXME only one indention here
20+
)))

R/edge_mixed-out.R renamed to tests/testthat/indention_multiple/edge_mixed-out.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@
1313
))
1414
)
1515
}
16+
17+
18+
(((
19+
1 + 2) * (3 + 4 # FIXME only one indention here
20+
)))
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{({{{{{{{{(( # FIXME spaces between brackets don't vanish
2+
19
3+
))}}}}}}}})}}
4+
5+
6+
(
7+
c("x", "y", "z", "sin(x)")
8+
)
9+
10+
11+
{
12+
c("x", "y", "z", "sin(x)")
13+
}
14+

R/edge_random-in.R renamed to tests/testthat/indention_multiple/edge_random-out.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
{{({{{{{{{{((
1+
{{({{{{{{{{(( # FIXME spaces between brackets don't vanish
22
19
33
))}}}}}}}})}}
44

5+
56
(
67
c("x", "y", "z", "sin(x)")
78
)

tests/testthat/unindention/mixed-out.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
call1(2, 3),
1111
{
1212
sin(cos(pi))
13-
} ) # FIXME space between curly and round bracket must be removed
13+
} ) # FIXME space between curly and round bracket must be removed
1414
}
1515
}

0 commit comments

Comments
 (0)