This class provides a text editor specialized for editing Esterel files. The editor is invoked automatically when opening any file with the ".strl" extension appended to its name. The EditEsterel class, which implements the editor, is derived from the EditProgram class, and therefore inherits all of its features. Its facility for tagging comments, strings, and keywords is inherited from this base class.
A somewhat complicated feature of the editor is its management of indenting. A line is automatically indented in response to a Tab character, and a selected region can be indented with the "Indent Region" command in the "Format" menu. Previous lines are used as a reference to determine how much indenting to do. There is no assurance that all correct Esterel code will be given reasonable indenting, but a reasonable coding style should result in good indenting. The indenting policy is illustrated below schematically for each Esterel construct by example, where "..." is an arbitrary section of code.
There is no indenting for module bodies:
module ...; ... endVarious simple constructs have indented bodies:
abort ... when ... await ... do ... end do ... upto ... do ... watching ... every ... do ... end if ... then ... end loop ... end loop ... each ... present ... then ... end repeat ... times ... end signal ... in ... end suspend ... when ... trap ... in ... end var ... in ... end weak abort ... when...Slightly more complicated constructs are handled similarly:
abort ... when ... do ... end do ... watching ... timeout ... end if ... then ... else ... end if ... then ... elsif ... then ... else ... end present ... then ... else ... end weak abort ... when ... do ... endCase and handle statements are treated specially. They are aligned with the preceding control statement.
abort ... when case ... do ... case case ... do ... end present case ... do ... case case ... do ... end trap ... in ... handle ... do ... handle ... handle ... do ... end trapAlso, parallel operators alone on a line are shifted to the left:
await ... do ... || ... endIncomplete statements have extra indenting on the subsequent lines, as in:
input A, B, C;