Skip to content

RewriteMechanism

AST Rewrite Mechanism

Synopsis

Declared in <src/docs/mrdocs/modules/ast_rewrite.h>

Description

The AST rewrite mechanism permits editing an application's AST, including addition, deletion, or replacement of subtrees. Using the rewrite system as part of a traversal is a common way to build a preprocessor. A transformation is implemented by applying a specific change to the AST and then unparsing the result.

The primary user‐level entry point is AST_Rewrite::addSourceCodeString, which uses enum values defined in AST_Rewrite to specify insertion locations.

Created with MrDocs