Refactoring

The editor provides two refactoring tools: Rename and Extract. These two tools can be configured to use the linked UI mode or use dialogs (see the Preferences section).

The Rename refactoring allows one to rename an identifier definition (local rule, dynamic grammar variable, or macro) and all its references. In the case of local rule, all the references to the rule in semantic tags are also changed to reflect the rule renaming:

The Extract refactoring allows one to create a new rule from a selected expansion. For example, if the following expansion is selected:

running the refactoring (in linked UI mode) produces the following:

Modifying the rule reference updates automatically the rule definition. If the selected expansion contains semantic tags, the tool deduces (in a conservative way) the semantic slots to be defined by the new rule and their propagation in the rule referencing it.

When the selected expansion contains dynamic grammar directives, a new macro is created instead of a new rule. For example, with the following selection:

the refactoring (in linked UI mode) produces the following:

These two refactorings are accessible using either key sequences (see shortcuts) or the context menu:


Copyright © 2007,2008,2009,2010,2011 Nu Echo Inc.