Make a AST transformation rule

make_rule(from, to)

Arguments

from

A character string.

to

A character string.

Value

A function that takes a language object and returns a language object.

Examples

library(rockstaR)

rule = make_rule("nothing", "NULL")
lyrics = "Rockstar is nothing"
rewrite(lyrics, list(rule))
#> [1] "Rockstar is NULL"