-
Notifications
You must be signed in to change notification settings - Fork 3
Terminator Actions
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.
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,bwill be treated as a terminator action, because the sequencea bcannot be extended to any longer valid sequence. However, if the syntax is specified asa b|a b* c,bin this context is not a terminator action, asa b b cis a valid extension ofa 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 asa b!|a b c,bafterawill act as a terminator action, thusa b cis not a valid sequence. -
Explicitly through DSLAction. If a method is annotated with DSLAction having
terminatorset totrue, wherever this action occurs it terminates the sequence. This overrides any other non-terminating possibilities specified through the syntax. If methodbis annotated and hasterminatorset totrue, the syntax specificationa b* cwill allow the sequencesa banda c, but nota b b c, becausebacts as a terminator. -
Automatically through its return type. If in the GenerateEmbeddedDSL annotation
nonVoidTerminatorsis set totrue, any action with a non-voidreturn type will be treated as a terminator action in the sense of the above bullet point, unless such an action explicitly hasterminatorset tofalsein its DSLAction annotation.