R/deparse_tree.R

Defines functions deparse_tree

deparse_tree <- function(x) {
  if (is.atomic(x) || is.name(x)) {
    x
  } else if (is.call(x) || is.pairlist(x)) {
    `class<-`(lapply(x, deparse_tree), 'ast_node')
  } else {
    stop("Don't know how to handle type ", typeof(x),
      call. = FALSE)
  }
}
kirillseva/ast documentation built on May 20, 2019, 10:23 a.m.