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

The node to represent the imported namespace/Package or equivalent. The 'NAME' attribute of the node will be the name of imported namespace/Package or equivalent.

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

The child Package node.

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

If present, indicates that this is a leaf/final/sealed Class which cannot be inherited by any sub-Class.

0..1 / MULTIPLICITY

If present, represents the multiplicity of the Class.

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

If present, represents the Alias of any identifier, such as a Namespace, Class or variable.

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

This node represents the Property definition within the Class Body.

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

The name of the method.

0..1 / TYPE

The return type of the method.

0..1 / SCOPE

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

0..1 / ABSTRACT

If present, indicates that the method is Abstract.

0..1 / STEREOTYPE

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

0..1 / STATIC

If present, indicates that the method is static.

0..1 / CONST or CONSTANT

If present, indicates that the method is constant.

0..1 / PURE

If present, indicates that the method is a Pure method.

0..1 / ISQUERY

If present, indicates that the method is query/read only.

0..1 / ARRAY

If present, indicates that the method type (return type) is an array.

0..1 / SYNCHRONIZED

If present, indicates that the method is a synchronized method.

0..* / MACRO

The Macro specified in the method declaration.

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

The name of the Attribute.

0..1 / TYPE

The type of the Attribute.

0..1 / SCOPE

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

0..1 / DEFAULT

The default value of the Attribute.

0..1 / CONTAINER or ARRAY

If present, indicates the container for the Attribute.

0..1 / CONTAINMENT

Reference or value.

0..1 / STEREOTYPE

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

0..1 / STATIC

If present, indicates that it is a static Attribute.

0..1 / CONST or CONSTANT

If present, indicates that it is a constant Attribute.

0..1 / ORDERED

If present, indicates that the Attribute (value) is ordered.

0..1 / LOWBOUND

If present, represents the lower boundary of the Attribute value.

0..1 / HIGHBOUND

If present, represents the higher boundary of the Attribute value.

0..1 / TRANSIENT or VOLATILE

If present, indicates that the Attribute is 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

The name of the parameter.

0..1 / TYPE

The type of the parameter.

0..1 / KIND

Expected to be in, inout, out or return.

0..1 / DEFAULT

The default value of the parameter.

0..1 / FIXED

If present, indicates that the parameter is fixed/constant.

0..1 / ARRAY

If present, indicates that the parameter type is an array.

NAME Node

Contained in Nodes: PACKAGE, Class DECLARATION

Multiplicity / Nodes

Description

1 / NAME

The name portion.

0..* / QUALIFIER

The qualifier portion.

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

The name portion.

0..* / QUALIFIER

The qualifier portion.

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

The name portion of the Parent.

0..* / QUALIFIER

The qualifier portion of the Parent.

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

If present, indicates the instantiation of a template parameter.

TAG Node

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

Multiplicity / Nodes

Description

1 / NAME

The name of the Tagged Value (the Tag).

0..* / VALUE

The value of the Tagged Value.

0..1 / MEMO

If present, indicates that the type of the Tagged Value is <memo>.

0..1 / NOMEMO

If present, indicates that the type of the Tagged Value is not <memo>.

0..1 / GROUP

If present, indicates that the value is a Tagged Value group.

DESCRIPTION Node

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

Multiplicity / Nodes

Description

0..* / VALUE

The text that Enterprise Architect should assign to the Note.

Learn more