Update the indention reference

update_indention_ref_fun_call(pd_nested)

update_indention_ref_fun_dec(pd_nested)

Arguments

pd_nested

A nested parse table.

Functions

  • update_indention_ref_fun_call: Updates the reference id for all tokens in pd_nested if pd_nested contains a function call. Tokens that start on the same line as the opening parenthesis, are not themselves function calls or expressions wrapped in curly brackets are re-indented, that is, they are indented up to the level at which the call ends in terms of col2. We need to take the last from the first child because calls like package::function() can have three elements.

  • update_indention_ref_fun_dec: Updates the reference id for all tokens in pd_nested if pd_nested contains a function declaration. Tokens inside a function declaration are are re-indented, that is, they are indented up to the level at which the token FUNCTION ends in terms of col2.

Examples

# NOT RUN {
# not re-indented
call(call(
  xyz
))
# re-indented
call(call(1,
          2))
# }# NOT RUN {
a <- function(x,
              y) {
x + y
}
# }