Skip to content

Action Menus

Menus are used to bind actions of your language, such as transformations, to a menu in the IDE. Menus are defined using the menu keyword under a menus section in an ESV file, and can themselves contain submenus, actions, and separators.

menu : $String $MenuOptions
  $MenuContribs

A menu has zero or more $MenuContrib, which are: action, submenu, or separator.

Actions

Actions (sometimes called builders) are defined under a menu or submenu with syntax:

action : $String = $StrategoCall $MenuOptions

Submenus allow grouping of actions in nested menus. Their syntax is:

submenu : $String $MenuOptions
  $MenuContribs
end

Separators

Separators allow inserting a separator in a menu list using the syntax:

separator

The menu options specify the behavior of the menu item. The following modifiers are supported:

Modifier Description
(source) Action is performed on the parsed AST instead of the default analyzed AST.
(openeditor) The result should be opened in a new editor.
(realtime)
(meta)

Example

An example menu:

menus

  menu: "Generate"
    action: "To normal form" = to-normal-form (source)
    submenu: "To Java"
      action: "Abstract" = to-java-abstract (openeditor)
      action: "Concrete" = to-java-concrete
    end

Last update: April 19, 2024
Created: April 19, 2024