Learn R Programming

macro (version 0.1.5)

print.symtable: Print the Macro Symbol Table

Description

A class-specific instance of the print function for a macro symbol table and function list. Use verbose = TRUE to print the catalog as a list.

Usage

# S3 method for symtable
print(x, ..., verbose = FALSE)

Value

The object, invisibly.

Arguments

x

The format catalog to print.

...

Any follow-on parameters.

verbose

Whether or not to print the format catalog in verbose style. By default, the parameter is FALSE, meaning to print in tabular style.

See Also

msource()

Other symtable: symclear(), symget(), symput(), symtable()

Examples

Run this code
library(macro)

# Get path to demo macro program
src <- system.file("extdata/Demo4.R", package = "macro")

# Execute source code
msource(src, echo = FALSE)

# Examine symbol table
res <- symtable()

# View results
print(res)
# # Macro Symbol Table: 3 macro variables
#   Name Value
# 1   &x     1
# 2   &y     2
# 3   &z 1 + 2
# # Macro Function List: 1 macro functions
#   Name Parameter Default
# 1 test        vl  Hello!

# View results structure
print(res, verbose = TRUE)
# $variables
# $variables$`&x`
# [1] "1"
#
# $variables$`&y`
# [1] "2"
#
# $variables$`&z`
# [1] "1 + 2"
#
#
# $functions
# $functions$test
# $functions$test$parameters
# $functions$test$parameters$vl
# [1] "Hello!"
#
#
# $functions$test$code
# [1] "print(\"&vl\")"
# attr(,"start")
# [1] 8
# attr(,"end")
# [1] 8

Run the code above in your browser using DataLab