4 Editor

4.1 Code Editor

The code editor provides structure editing on each fragment form. Many of the following menu items have keyboard shortcuts associated with them. A complete list of these can be found in the appendix.

4.1.1 Edit Menu

Undo
Initiating this command will undo the latest performed editing operation in the code editor. All editing operations performed in a session can be undone.
Redo
Initiating this command will redo the latest performed editing operation in the code editor. All undone editing operations performed in a session can be redone until a new editing operation is performed.
Cut
The current selection is removed from the fragment form. If the current selection may be deleted (e.g. a statement or a declaration) it will disappear. If the current selection may not be deleted (e.g. the expression part of an if-statement) a nonterminal of appropriate syntactic category will be inserted instead of the current selection. The deleted fragment part will be put onto a clipboard and can later be pasted into the same or another fragment form.
Copy
The current selection is copied onto the clipboard, and can later be pasted into the same or another fragment.
Paste
Whenever the current selection and the structure on the clipboard are of exchangeable syntactic categories, Paste is enabled. Paste will replace the current selection with the structure currently on the clipboard. The content of the clipboard will not be changed.
Paste Before
Like Paste, but preceeded by an Insert Before operation.
Paste After
Like Paste, but preceeded by an Insert After operation.
Clear
Same as Cut but nothing is put on the clipboard.
Select All
Selects all the code in the window in structure editing mode and the all the code in the textediting area in text editing mode.
Textedit
This command enters text editing mode on the current selection. See also Text editing in Editor tutorial.
Please note that text editing is only fully available if a parser for the supported language has been generated. If a parser is not available only lexems can be edited textually, i.e. name declarations, name applications, strings and constants. In that case, there is no check that the lexems are legal.
External Textedit
Like Textedit but here an external texteditor is used. This facility is only available in Unix versions. The environment variable EDITOR is recognized by Sif. When this command is invoked the current selection is inserted in the external editor. When the external editing has finished, by saving the results, the resulting text is inserted instead of the current selection. Parse errors are detected in the same way as in the internal texteditor.
E.g. emacs can be used by setting EDITOR to /usr/local/bin/emacsclient and starting emacs as a server in the following way: emacs -f server-start.
Parse Text
Exits text editing mode and parses the edited text according to the syntactic category of the current selection before entering text editing mode. See also Text editing in Editor tutorial.
Revert Text Editing
Exits text editing mode and reestablishes the situation before text editing was entered. Alternatively the <esc> key can be used.
Insert Before/Insert After
Whenever the current selection is one or more list elements, these entries will enable you to insert a nonterminal of same syntactic category as the list elements either before or after the current selection, respectively. If the list elements are on separate lines before/after means above/below, respectively. If the list elements are on the same line before/after means left/right respectively. An alternative to Insert After is the <cr> key.
Remove Optionals
Removes all nonterminals representing optional productions from the current selection.
Show Optionals
Inserts all nonterminals representing optional productions in the current selection.
Find...
Makes it possible to search for a substring of a lexem, i.e. a name definition, a name application or a string in A dialog pops up. See Searching An especiallly useful facility is the browser of search hits, that collects all the search hits for easy overview and access. If the current selection is a name declaration, when the this command is activated, all applications of this name will be searched for in the selected scope. Using this facility, it is possible to search for applications of a name in the entire dependency graph.
Replace...
Extends the search dialog with a replace text field.
Open Subeditor
A subeditor on the current selection is opened, i.e. a code editor where the current selection is the root. Shift-double-click can also be used.
Form Write Protection
If checked it is not possible to modify the fragment form. Is automatically set if group write protection or global write protection is set.

4.2 Editing and contractions

Structure editing on parts of the document that contain contractions is done exactly as described above. You can for example cut, copy and paste constructs that contain contractions. When text editing constructs that contain contractions, some parser technical information is included in the contractions before the text editor is activated. This information is necessary to avoid loosing contractions during text editing. A contraction in text editing mode looks like:

<<@4711: Descriptor>>

where @4711 is an internal address of the sub-AST that is contracted, i.e. not presented, and Descriptor is the syntactic category of the contracted sub-AST.

Do not modify the contents of contractions during text editing. Likevise if the contraction contents is commented out during text editing, the corresponding code will be lost.

4.2.1 Expand Menu

This menu is a pop-up menu, that is activated by the Pop-up Menu Button on the mouse (See basic user interface principles).

The content of the Expand menu is dependent on the current selection. If the current selection is a nonterminal, the Expand menu will contain an entry for each language construct that can replace this nonterminal. If the current selection is an optional or list nonterminal, the Expand menu will contain an empty entry as well. This entry enables you to remove that nonterminal.

4.2.2 SLOTs Menu

This menu is only present in the menu bar if the current fragment group is a BETA fragment group. The menu makes use of the fragment clipboard that is used as an intermediate store for fragment forms that are 'moved around' between fragment groups. The fragment clipboard is also used in the Fragment menu.

Make DoPart SLOT...
Substitutes the current selection with a SLOT definition and the removed part of the document is inserted in an DoPart fragment form, that is stored in the fragment clipboard. The name of the SLOT is prompted for. The default name is the name of the enclosing pattern.
Make Descriptor SLOT...
Substitutes the current selection with a SLOT definition and the removed part of the document is inserted in an Descriptor fragment form, that is stored in the fragment clipboard. The name of the SLOT is prompted for. The default name is the name of the enclosing pattern.
Make Attributes SLOT...
Substitutes the current selection with a SLOT definition and the removed part of the document is inserted in an Attributes fragment form, that is stored in the fragment clipboard. The name of the SLOT is prompted for. The default name is the name of the enclosing pattern.
Create Implementation File
In a standard file dialog an implementation file can be created. It will be created as a body file to the current fragment group selected in the browser. The ORIGIN and BODY properties are automatically inserted in the respective files.
Select Implementation File
Like Create Implementation File, but an existing file is chosen in the dialog.
Set Current as Implementation File
The current fragment group selected in the browser is set to be the implementation file. If this file is set the Make SLOT commands and the Hide Implementation... command will automatically paste the created fragment forms that correspond to the SLOTs into the implementation file.
Unset Implementation File
The file set in Set Current as Implementation File is unset.
Set SLOT Name Prefix...
When one of the Make SLOT commands or the Hide Implementation... command is used the default name in the dialog for the SLOT name will be the text set by this command, followed by the name of the enclosing pattern (if any).
Unset SLOT Name Prefix
Clears the text set in Set SLOT Name Prefix...
Hide Implementation...
For each DoPart in the current selection in the code editor the user is asked whether it should be hidden into the implementation file by making it into a SLOT and moving the DoPart into a fragment form in the implementation file.


Mjolner Integrated Development Tool - Reference Manual
© 1991-2004 Mjølner Informatics
[Modified: Monday March 11th 2002 at 16:16]