This function is convenient to display all nesting levels of a nested tibble at once.

create_node_from_nested_root(pd_nested)

Arguments

pd_nested

A nested tibble.

Value

An object of class "Node" and "R6".

Examples

code <- "a <- function(x) { if(x > 1) { 1+1 } else {x} }" nested_pd <- styler:::compute_parse_data_nested(code) initialized <- styler:::pre_visit(nested_pd, c(styler:::create_filler)) styler:::create_node_from_nested_root(initialized)
#> levelName #> 1 ROOT (token: short_text [lag_newlines/spaces] {id}) #> 2 °--expr: [0/0] {49} #> 3 ¦--expr: [0/1] {3} #> 4 ¦ °--SYMBOL: a [0/0] {1} #> 5 ¦--LEFT_ASSIGN: <- [0/1] {2} #> 6 °--expr: [0/0] {48} #> 7 ¦--FUNCTION: funct [0/0] {4} #> 8 ¦--'(': ( [0/0] {5} #> 9 ¦--SYMBOL_FORMALS: x [0/0] {6} #> 10 ¦--')': ) [0/1] {7} #> 11 °--expr: [0/0] {45} #> 12 ¦--'{': { [0/1] {9} #> 13 ¦--expr: [0/1] {42} #> 14 ¦ ¦--IF: if [0/0] {10} #> 15 ¦ ¦--'(': ( [0/0] {11} #> 16 ¦ ¦--expr: [0/0] {18} #> 17 ¦ ¦ ¦--expr: [0/1] {14} #> 18 ¦ ¦ ¦ °--SYMBOL: x [0/0] {12} #> 19 ¦ ¦ ¦--GT: > [0/1] {13} #> 20 ¦ ¦ °--expr: [0/0] {16} #> 21 ¦ ¦ °--NUM_CONST: 1 [0/0] {15} #> 22 ¦ ¦--')': ) [0/1] {17} #> 23 ¦ ¦--expr: [0/1] {30} #> 24 ¦ ¦ ¦--'{': { [0/1] {20} #> 25 ¦ ¦ ¦--expr: [0/1] {27} #> 26 ¦ ¦ ¦ ¦--expr: [0/0] {22} #> 27 ¦ ¦ ¦ ¦ °--NUM_CONST: 1 [0/0] {21} #> 28 ¦ ¦ ¦ ¦--'+': + [0/0] {23} #> 29 ¦ ¦ ¦ °--expr: [0/0] {25} #> 30 ¦ ¦ ¦ °--NUM_CONST: 1 [0/0] {24} #> 31 ¦ ¦ °--'}': } [0/0] {26} #> 32 ¦ ¦--ELSE: else [0/1] {31} #> 33 ¦ °--expr: [0/0] {39} #> 34 ¦ ¦--'{': { [0/0] {33} #> 35 ¦ ¦--expr: [0/0] {36} #> 36 ¦ ¦ °--SYMBOL: x [0/0] {34} #> 37 ¦ °--'}': } [0/0] {35} #> 38 °--'}': } [0/0] {40}