Code Templates

Revision as of 11:37, 29 January 2008 by Paulb (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Construction.png Not Ready for Review: This Page is Under Development!

This page is used to refine the specification for a code template mechanism in future releases of EiffelStudio.

Initial Design Descisions

For now XML has been chosen to describe code templates because is it structured, easy to read (programmatically) and can be converted with relative ease using transformation scripts.

The information discussed here is by no means final or reflects any work current under way. It's used to formualize a schema, part of which may be in the release of 6.2 under use in the Contract Editor Tool.

Schema

<code_templates format="1.0.0">
  <code_template>
 
    <metadata>
      <title>Completion title</title>
      <description>Code template description, for completion tooltip and other UI.</description>
      <author>Eiffel Software</author>
      <shortcut>shortcut</shortcut>
      <categories>
        <category>contract</category>
        <category>code</category>
        <category>class</category>
      </categories>
    </metadata>
 
    <references>
      <reference>
        <library location="$ISE_LIBRARY/base/base.ecf"/>
      </reference>
      <reference>
        <library id="6D7FF712-BBA5-4AC0-AABF-2D9880493A01"/>
      </reference>
      <reference>
        <assembly>mscorlib.dll</assembly>
        <version>2.0.54727</version>
      </reference>
      <reference>
        <assembly>System.dll</assembly>
      </reference>
    </references>
 
    <declarations>
      <choice id="opt">
        <description>Choice declaration.</description>
        <choices>
          <item>do</item>
          <item>once</item>
          <item>deferred</item>
        </choices>
      </choice>
 
      <literal id="var" editable="true">
        <description>Editable literal.</description>
        <default>default value</default>
      </literal>
 
      <literal id="var2" editable="false">
        <description>Function evaluation, non-editable but can be editable.</description>
        <default>CLASS_NAME</default>
        <function name="builtin_function">
          <arg type="STRING_32">make</arg>
          <arg>default to string</arg>
          <arg type="INTEGER_32">-12</arg>
        </function>
      </literal>
 
      <object id="list" conforms="LIST [ANY]" editable="true">
        <description>Variable that is of a Eiffel list type structure, containing a for_all call.</description>
      </object>
    </declarations>
 
    <templates>
      <template><![CDATA[${list}_contains_attached_items: not ${list}.has (Void)${cursor}]]></template>
    </templates>
 
  </code_template>
</code_templates>