DumpAst
The tool called DumpAst
(see in repo) is used to create a snapshot of an AST and visualize it.
It has to be used within your application code, and comes with a fluent interface to add and/or filter parts of the AST.
First, import the entry point class Dumper
import de.tudresden.inf.st.jastadd.dumpAst.ast.Dumper;
Then, read in the ASTnode in question:
Dumper.read(astNode)
Using the return value, the following methods are supported and can be chained together.
Name | Description |
---|---|
customPreamble | Add the given string as preamble to the visualization. |
disableTypes | Disable all objects with types matching at least one of the given regex strings. Disabled objects won't be included in any output. However, their children are still processed. |
dumpAsPNG | Write out content as PNG image generated by plantuml. (Only available in dumpAstWithPlantuml) |
dumpAsSource | Write out content as plantuml source code |
dumpAsSVG | Write out content as SVG image generated by plantuml. (Only available in dumpAstWithPlantuml) |
dumpAsYaml | Write out content as YAML representation of the ASTNode |
enableDebug | Add debug information in dumped content, mainly version numbers. |
excludeAttributesFor | experimental, documentation missing |
excludeChildren | Exclude every child whose name (i.e., context) matches at least on of the given regex strings. This means, that the complete object and its (transitive) children will never be included in any output. |
excludeChildrenFor | experimental, documentation missing |
excludeNonterminalAttributesFor | experimental, documentation missing |
excludeRelations | Exclude every relation whose role-name matches at least on of the given regex strings. This means two things: a) the relation to any potential target object(s) is never shown, and b) the target object(s) are not shown unless they are reachable by another relation or by containment. |
excludeRelationsFor | experimental, documentation missing |
excludeTokens | Exclude tokens and their value if the token name matches at least one of the given regex strings. |
excludeTokensFor | experimental, documentation missing |
includeAttributes | Include attributes (as tokens) and their value if the attribute name matches at least on of the given regex strings. |
includeAttributesFor | experimental, documentation missing |
includeChildrenFor | experimental, documentation missing |
includeEmptyStringsOnTokens | Include empty strings for all tokens |
includeNonterminalAttributes | Includes nonterminal-attributes (as children) and their values if their attribute name matches at least on of the given regex strings. Note: A leading "get" and a trailing "List" in the name will be removed prior to matching. Thus, it should not be contained in the regex either. |
includeNonterminalAttributesFor | experimental, documentation missing |
includeRelationsFor | experimental, documentation missing |
includeTokensFor | experimental, documentation missing |
setScale | Set plantuml scale setting |
skinParam | Add plantuml skinParam setting |
Inclusion and Exclusion of Types
Types can be only be disabled, see disableTypes
.
Inclusion and Exclusion of Childrens, tokens and relations
Childrens, tokens and relations are included by default. This can be changed using exclusions and inclusion, both in general and per-type. They are applied in the following order making later conditions take precedence over the first ones.
- Include everything as default.
- Exclude general.
- Include per type.
- Exclude per type.
Inclusion and Exclusion of Attributes
Attributes are excluded by default, i.e., not shown. This can be changed using inclusions and exclusions, both in general and per-type. They are applied in the following order making later conditions take precedence over the first ones.
- Exclude everything as default.
- Include general.
- Exclude per type.
- Include per type