Skip to content
Malte Isberner edited this page Jan 19, 2014 · 1 revision

A terminator action is an action with a return type that is not part of the embedded DSL. This means that it immediately terminates the embedded DSL sequence.

Specifying Terminator Actions

Terminator actions can be specified in various ways:

  • Implicitly through the syntax specification. If an action is the last action in a sequence that cannot be extended by any further actions, this action is automatically treated as a terminator action in this context. For example, in the syntax specification a b, b will be treated as a terminator action, because the sequence a b cannot be extended to any longer valid sequence. However, if the syntax is specified as a b|a b* c, b in this context is not a terminator action, as a b b c is a valid extension of a b.
  • Explicitly through the syntax specification. If a regular expression is followed by the terminator operator !, as soon as it could be matched the sequence must be terminated. This overrides any other non-terminating possibilities. If the syntax is specified as a b!|a b c, b after a will act as a terminator action, thus a b c is not a valid sequence.
  • Explicitly through DSLAction. If a method is annotated with DSLAction having terminator set to true, wherever this action occurs it terminates the sequence. This overrides any other non-terminating possibilities specified through the syntax. If method b is annotated and has terminator set to true, the syntax specification a b* c will allow the sequences a b and a c, but not a b b c, because b acts as a terminator.
  • Automatically through its return type. If in the GenerateEmbeddedDSL annotation nonVoidTerminators is set to true, any action with a non-void return type will be treated as a terminator action in the sense of the above bullet point, unless such an action explicitly has terminator set to false in its DSLAction annotation.

Clone this wiki locally