lobstr (version 1.0.0)

ast: Display the abstract syntax tree

Description

This is a useful alternative to str() for expression objects.

Usage

ast(x)

Arguments

x

A language object to display.

Examples

Run this code
# NOT RUN {
# Leaves
ast(1)
ast(x)

# Simple calls
ast(f())
ast(f(x, 1, g(), h(i())))
ast(f()())
ast(f(x)(y))

ast((x + 1))

# All operations have this same structure
ast(if (TRUE) 3 else 4)
ast(y <- x * 10)
ast(function(x = 1, y = 2) { x + y } )

# Operator precedence
ast(1 * 2 + 3)
ast(!1 + !1)
# }

Run the code above in your browser using DataLab