Node Filter Configuration¶
Each node filter definition allows you to specify AST node inclusion/exclusion rules for rendering during the conversion process. You can specify the type of node, the attribute to filter, and a list of values to exclude or include.
Note
If you specify include
, this means that everything else is implictly excluded. Make sure to not provide inclusion filters on broad node types, such as IRProgram
or IRJob
, as it will not do what you expect. Besides excluding other programs and jobs, everything within the included nodes, such as statements will be implicitly excluded.
Note
If you specify both include
and exclude
lists, the exclude
list takes precedence.
Examples¶
Exclude nodes of a specific type with a specific attribute value¶
To exclude all nodes of type CallExpression
with the func_name
attribute equal to print
, use the following configuration:
converter:
node_filter:
- type: CallExpression
attr: func_name
exclude: ["print"]
Exclude nodes of a specific type with a default attribute value¶
To exclude all nodes of type CallExpression
with the id
attribute equal to 123
(where id
is the default attribute), use the following configuration:
converter:
node_filter:
- type: CallExpression
exclude: ["123"]
Exclude any node by ID¶
To exclude any node with a specific ID, use the following configuration:
converter:
node_filter:
- exclude: ["123"]
Exclude a pre/post code of SAS Transform or Job¶
To exclude a pre/post code with the id
attribute equal to 123
(you can find the program id
in a header comment of the corresponding target generated by Alchemist, e.g. Script Gem in Prophecy), use the following configuration:
converter:
node_filter:
- type: SASProgram
exclude: ["123"]
Configuration Options¶
Option | Description | Default Value | Data Type |
---|---|---|---|
type | Type of the node to apply the filter to. | Any node type | str |
attr | Attribute of the node to apply the filter to. | id | str |
exclude | List of values to exclude from rendering. | [] | list |
include | List of values to include in rendering. | [] | list |
exclude_all | Excludes all values. Can't be used with include |
false | bool |