Prev Next

AST Nodes

In defining a grammar, you would use AST nodes and AST node attributes that can be recognized in code engineering in Enterprise Architect, in the AST results that are returned by the attribute, attributeEx and node commands. The nodes and attributes are identified in these tables. Any others will be ignored in code engineering.

FILE Node

The FILE node represents a file. It isn't mapped to anything, but contains all the required information.

Multiplicity / Nodes

Description

See also

0..* / PACKAGE

See PACKAGE Node.

0..* / CLASS

See CLASS Node.

0..* / IMPORT

0..* / COMMENT

Field labels as part of a skip rule will be at the root level; the code generator looks for comments of this sort by position relative to the node.

0..1 / INSERT_POSITION

This gives the position where new Classes, Packages and method implementations can be inserted into the file. If it is not found, the code generator will automatically insert new items immediately after the last one is found in code.

PACKAGE node

The PACKAGE node corresponds to a namespace or equivalent in the file. When importing with 'package per namespace', Enterprise Architect will create a Package directly under the import for this and place all Classes within it. When not importing namespaces, Enterprise Architect will look for Classes under this point, but it will do nothing with this node.

Additionally, if you are generating with namespaces enabled (see the Code Options topics for generic languages) a generated Class will not match a Class in code unless they are under the same Package structure.

Contained in nodes:     FILE

Multiplicity / Nodes

Description

See also

1 / NAME

See NAME Node.

0..* / CLASS

See CLASS Node.

0..* / PACKAGE

PACKAGE node

0..1 / OPEN_POSITION

Gives the position where the Package body opens. This can also be used as an insert position.

0..1 / INSERT_POSITION

Gives the position where new Classes and Packages can be inserted into the file. If it is not found, the code generator will automatically insert new items immediately after the last one is found in code.

0..1 / SUPPRESS

Prevents indenting when inserting into this Package.

CLASS/INTERFACE Node

The CLASS (or INTERFACE) node is the most important in code generation. It is brought in as Class (or Interface) Objects.

See Class DECLARATION and Class BODY.

Contained in Nodes: FILE, PACKAGE, Class BODY

CLASS Declaration

Contained in Nodes:     CLASS/INTERFACE

Multiplicity / Nodes

Description

See also

1 / NAME

See NAME Node.

0..* / PARENT

See PARENT Node.

0..* / TAG

See TAG Node.

0..1 / DESCRIPTION

See DESCRIPTION Node.

1 / NAME

The name of the Class. If there is a node NAME, that will overwrite this attribute.

0..1 / SCOPE

The UML Scope of the Class - Public, Private, Protected or Package.

0..1 / ABSTRACT

If present, indicates that this is an abstract Class.

0..1 / VERSION

The version of the Class.

0..1 / STEREOTYPE

The stereotype that Enterprise Architect should assign to the Class. This does not support multiple stereotypes.

0..1 / ISLEAF

0..1 / MULTIPLICITY

0..1 / LANGUAGE

Generally, you do not need to set this.

0..1 / NOTE

Generally not used as it is addressed by the comments above the Class.

0..1 / ALIAS

0..* / MACRO

Adds a numbered Tagged Value that Enterprise Architect can use to round trip macros.

Class BODY Node

Contained in Nodes: CLASS/INTERFACE

Multiplicity / Nodes

Description

See also

0..* / METHOD

See METHOD Node.

0..* / ATTRIBUTE

See ATTRIBUTE Node.

0..* / FIELD

See FIELD Node.

0..* / CLASS

See CLASS Node.

0..* / SCOPE

See SCOPE Node.

0..* / PROPERTY

0..* / TAG

See TAG Node.

0..* / PARENT

See PARENT Node.

0..1 / OPEN_POSITION

Gives the position where the Class body opens. This can also be used as an insert position.

0..1 / INSERT_POSITION

Gives the position where new Class members can be inserted into the file. If it is not found, the code generator will automatically insert new items immediately after the last one is found in code.

SCOPE Node

This is an optional feature for languages resembling C++ that have blocks that specify the scope of elements. The language needs to have a name specified that is used for the scope of all elements in the block. In all other respects it behaves identically to the Class BODY node.

Contained in Nodes:     Class BODY

Multiplicity / Nodes

Description

1 / NAME

Used as the scope for all methods and attributes contained within the scope.

METHOD Node

Contained in Nodes:     Class BODY, SCOPE

Multiplicity / Nodes

Description

1 / Method DECLARATION

See Method DECLARATION Node.

Method DECLARATION Node

Contained in Nodes:       METHOD

Multiplicity / Nodes

Description

See also

0..1 / TYPE

See TYPE Node.

0..* / PARAMETER

See PARAMETER Node.

0..* / TAG

See TAG NODE.

0..1 / DESCRIPTION

See DESCRIPTION Node.

0..1 / MULTI PARAMETER

Supports Delphi's parameter list style of declaration. This is the equivalent of FIELD.

1 / NAME

0..1 / TYPE

0..1 / SCOPE

0..1 / ABSTRACT

0..1 / STEREOTYPE

0..1 / STATIC

0..1 / CONST  or CONSTANT

0..1 / PURE

0..1 / ISQUERY

0..1 / ARRAY

0..1 / SYNCHRONIZED

0..* / MACRO

0..1 / CSHARPIMPLEMENTS

Specifies special behavior for C#.

0..1 / BEHAVIOR

Provides support for Aspect J, using behavior.

0..1 / SHOWBEHAVIOR

Provides support for Aspect J, using behavior, and shows the reverse-engineered behavior on the diagram.

ATTRIBUTE Node

Contained in Nodes: Class BODY, SCOPE

Multiplicity / Nodes

Description

See also

1 / TYPE

See TYPE Node.

0..* / TAG

See TAG Node.

0..1 / DESCRIPTION

See DESCRIPTION Node.

DESCRIPTION Node

1 / NAME

0..1 / TYPE

0..1 / SCOPE

0..1 / DEFAULT

0..1 / CONTAINER or ARRAY

0..1 / CONTAINMENT

Reference or value.

0..1 / STEREOTYPE

0..1 / STATIC

0..1 / CONST or CONSTANT

0..1 / ORDERED

0..1 / LOWBOUND

0..1 / HIGHBOUND

0..1 / TRANSIENT or VOLATILE

FIELD Node

A field corresponds to multiple attribute declarations in one. Anything not defined in the Declarators but defined in the field itself will be set for each declarator. Everything supported in an attribute is supported in the field. If no declarators are found then this works in the same way as an attribute.

Contained in Nodes:     Class BODY, SCOPE

Multiplicity / Nodes

Description

See also

0..* / DECLARATOR

See ATTRIBUTE Node.

PARAMETER Node

Contained in Nodes: Method DECLARATION, TEMPLATE

Multiplicity / Nodes

Description

See also

1 / TYPE

See TYPE Node.

0..* / TAG

See TAG Node.

0..1 / DESCRIPTION

See DESCRIPTION Node.

0..1 / NAME

0..1 / TYPE

0..1 / KIND

Expected to be in, inout, out or return.

0..1 / DEFAULT

0..1 / FIXED

0..1 / ARRAY

NAME Node

Contained in Nodes: PACKAGE, Class DECLARATION

Multiplicity / Nodes

Description

1 / NAME

0..* / QUALIFIER

0..* / NAMEPART

An alternative to using NAME and QUALIFIER. A string of values, all except the last one taken as qualifiers. The last one is taken as the Name.

TYPE Node

Contained in Nodes: Method DECLARATION, ATTRIBUTE, PARAMETER

Multiplicity / Nodes

Description

0..1 / TEMPLATE

The entire text of the template is the name of the type.

Only used if NAME is undefined.

See TEMPLATE Node.

1 / NAME

0..* / QUALIFIER

0..* / NAMEPART

An alternative to using NAME and QUALIFIER. A string of values, all except the last one taken as qualifiers. The last one is taken as the Name.

TEMPLATE Node

Contained in Nodes: TYPE

Multiplicity / Nodes

Description

See also

0..* / PARAMETER

See PARAMETER Node.

1 / NAME

PARENT Node

Contained in Nodes: Class DECLARATION

Multiplicity / Nodes

Description

0..1 / TYPE

Has the value Parent, Implements or VirtualP.

1 / NAME

0..* / QUALIFIER

0..* / NAMEPART

An alternative to using NAME and QUALIFIER. A string of values, all except the last one taken as qualifiers. The last one is taken as the Name.

0..1 / INSTANTIATION

TAG Node

Contained in Nodes: Class DECLARATION, Method DECLARATION, ATTRIBUTE, PARAMETER

Multiplicity / Nodes

Description

1 / NAME

0..* / VALUE

0..1 / MEMO

0..1 / NOMEMO

0..1 / GROUP

DESCRIPTION Node

Contained in Nodes: Class DECLARATION, Method DECLARATION, ATTRIBUTE, PARAMETER

Multiplicity / Nodes

Description

0..* / VALUE

Learn more