openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

index.html (13198B)


      1 <!doctype html>
      2 
      3 <title>CodeMirror: Eiffel mode</title>
      4 <meta charset="utf-8"/>
      5 <link rel=stylesheet href="../../doc/docs.css">
      6 
      7 <link rel="stylesheet" href="../../lib/codemirror.css">
      8 <link rel="stylesheet" href="../../theme/neat.css">
      9 <script src="../../lib/codemirror.js"></script>
     10 <script src="eiffel.js"></script>
     11 <style>
     12       .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
     13       .cm-s-default span.cm-arrow { color: red; }
     14     </style>
     15 <div id=nav>
     16   <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
     17 
     18   <ul>
     19     <li><a href="../../index.html">Home</a>
     20     <li><a href="../../doc/manual.html">Manual</a>
     21     <li><a href="https://github.com/codemirror/codemirror">Code</a>
     22   </ul>
     23   <ul>
     24     <li><a href="../index.html">Language modes</a>
     25     <li><a class=active href="#">Eiffel</a>
     26   </ul>
     27 </div>
     28 
     29 <article>
     30 <h2>Eiffel mode</h2>
     31 <form><textarea id="code" name="code">
     32 note
     33     description: "[
     34         Project-wide universal properties.
     35         This class is an ancestor to all developer-written classes.
     36         ANY may be customized for individual projects or teams.
     37         ]"
     38 
     39     library: "Free implementation of ELKS library"
     40     status: "See notice at end of class."
     41     legal: "See notice at end of class."
     42     date: "$Date: 2013-01-25 11:49:00 -0800 (Fri, 25 Jan 2013) $"
     43     revision: "$Revision: 712 $"
     44 
     45 class
     46     ANY
     47 
     48 feature -- Customization
     49 
     50 feature -- Access
     51 
     52     generator: STRING
     53             -- Name of current object's generating class
     54             -- (base class of the type of which it is a direct instance)
     55         external
     56             "built_in"
     57         ensure
     58             generator_not_void: Result /= Void
     59             generator_not_empty: not Result.is_empty
     60         end
     61 
     62     generating_type: TYPE [detachable like Current]
     63             -- Type of current object
     64             -- (type of which it is a direct instance)
     65         do
     66             Result := {detachable like Current}
     67         ensure
     68             generating_type_not_void: Result /= Void
     69         end
     70 
     71 feature -- Status report
     72 
     73     conforms_to (other: ANY): BOOLEAN
     74             -- Does type of current object conform to type
     75             -- of `other' (as per Eiffel: The Language, chapter 13)?
     76         require
     77             other_not_void: other /= Void
     78         external
     79             "built_in"
     80         end
     81 
     82     same_type (other: ANY): BOOLEAN
     83             -- Is type of current object identical to type of `other'?
     84         require
     85             other_not_void: other /= Void
     86         external
     87             "built_in"
     88         ensure
     89             definition: Result = (conforms_to (other) and
     90                                         other.conforms_to (Current))
     91         end
     92 
     93 feature -- Comparison
     94 
     95     is_equal (other: like Current): BOOLEAN
     96             -- Is `other' attached to an object considered
     97             -- equal to current object?
     98         require
     99             other_not_void: other /= Void
    100         external
    101             "built_in"
    102         ensure
    103             symmetric: Result implies other ~ Current
    104             consistent: standard_is_equal (other) implies Result
    105         end
    106 
    107     frozen standard_is_equal (other: like Current): BOOLEAN
    108             -- Is `other' attached to an object of the same type
    109             -- as current object, and field-by-field identical to it?
    110         require
    111             other_not_void: other /= Void
    112         external
    113             "built_in"
    114         ensure
    115             same_type: Result implies same_type (other)
    116             symmetric: Result implies other.standard_is_equal (Current)
    117         end
    118 
    119     frozen equal (a: detachable ANY; b: like a): BOOLEAN
    120             -- Are `a' and `b' either both void or attached
    121             -- to objects considered equal?
    122         do
    123             if a = Void then
    124                 Result := b = Void
    125             else
    126                 Result := b /= Void and then
    127                             a.is_equal (b)
    128             end
    129         ensure
    130             definition: Result = (a = Void and b = Void) or else
    131                         ((a /= Void and b /= Void) and then
    132                         a.is_equal (b))
    133         end
    134 
    135     frozen standard_equal (a: detachable ANY; b: like a): BOOLEAN
    136             -- Are `a' and `b' either both void or attached to
    137             -- field-by-field identical objects of the same type?
    138             -- Always uses default object comparison criterion.
    139         do
    140             if a = Void then
    141                 Result := b = Void
    142             else
    143                 Result := b /= Void and then
    144                             a.standard_is_equal (b)
    145             end
    146         ensure
    147             definition: Result = (a = Void and b = Void) or else
    148                         ((a /= Void and b /= Void) and then
    149                         a.standard_is_equal (b))
    150         end
    151 
    152     frozen is_deep_equal (other: like Current): BOOLEAN
    153             -- Are `Current' and `other' attached to isomorphic object structures?
    154         require
    155             other_not_void: other /= Void
    156         external
    157             "built_in"
    158         ensure
    159             shallow_implies_deep: standard_is_equal (other) implies Result
    160             same_type: Result implies same_type (other)
    161             symmetric: Result implies other.is_deep_equal (Current)
    162         end
    163 
    164     frozen deep_equal (a: detachable ANY; b: like a): BOOLEAN
    165             -- Are `a' and `b' either both void
    166             -- or attached to isomorphic object structures?
    167         do
    168             if a = Void then
    169                 Result := b = Void
    170             else
    171                 Result := b /= Void and then a.is_deep_equal (b)
    172             end
    173         ensure
    174             shallow_implies_deep: standard_equal (a, b) implies Result
    175             both_or_none_void: (a = Void) implies (Result = (b = Void))
    176             same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b))
    177             symmetric: Result implies deep_equal (b, a)
    178         end
    179 
    180 feature -- Duplication
    181 
    182     frozen twin: like Current
    183             -- New object equal to `Current'
    184             -- `twin' calls `copy'; to change copying/twinning semantics, redefine `copy'.
    185         external
    186             "built_in"
    187         ensure
    188             twin_not_void: Result /= Void
    189             is_equal: Result ~ Current
    190         end
    191 
    192     copy (other: like Current)
    193             -- Update current object using fields of object attached
    194             -- to `other', so as to yield equal objects.
    195         require
    196             other_not_void: other /= Void
    197             type_identity: same_type (other)
    198         external
    199             "built_in"
    200         ensure
    201             is_equal: Current ~ other
    202         end
    203 
    204     frozen standard_copy (other: like Current)
    205             -- Copy every field of `other' onto corresponding field
    206             -- of current object.
    207         require
    208             other_not_void: other /= Void
    209             type_identity: same_type (other)
    210         external
    211             "built_in"
    212         ensure
    213             is_standard_equal: standard_is_equal (other)
    214         end
    215 
    216     frozen clone (other: detachable ANY): like other
    217             -- Void if `other' is void; otherwise new object
    218             -- equal to `other'
    219             --
    220             -- For non-void `other', `clone' calls `copy';
    221             -- to change copying/cloning semantics, redefine `copy'.
    222         obsolete
    223             "Use `twin' instead."
    224         do
    225             if other /= Void then
    226                 Result := other.twin
    227             end
    228         ensure
    229             equal: Result ~ other
    230         end
    231 
    232     frozen standard_clone (other: detachable ANY): like other
    233             -- Void if `other' is void; otherwise new object
    234             -- field-by-field identical to `other'.
    235             -- Always uses default copying semantics.
    236         obsolete
    237             "Use `standard_twin' instead."
    238         do
    239             if other /= Void then
    240                 Result := other.standard_twin
    241             end
    242         ensure
    243             equal: standard_equal (Result, other)
    244         end
    245 
    246     frozen standard_twin: like Current
    247             -- New object field-by-field identical to `other'.
    248             -- Always uses default copying semantics.
    249         external
    250             "built_in"
    251         ensure
    252             standard_twin_not_void: Result /= Void
    253             equal: standard_equal (Result, Current)
    254         end
    255 
    256     frozen deep_twin: like Current
    257             -- New object structure recursively duplicated from Current.
    258         external
    259             "built_in"
    260         ensure
    261             deep_twin_not_void: Result /= Void
    262             deep_equal: deep_equal (Current, Result)
    263         end
    264 
    265     frozen deep_clone (other: detachable ANY): like other
    266             -- Void if `other' is void: otherwise, new object structure
    267             -- recursively duplicated from the one attached to `other'
    268         obsolete
    269             "Use `deep_twin' instead."
    270         do
    271             if other /= Void then
    272                 Result := other.deep_twin
    273             end
    274         ensure
    275             deep_equal: deep_equal (other, Result)
    276         end
    277 
    278     frozen deep_copy (other: like Current)
    279             -- Effect equivalent to that of:
    280             --      `copy' (`other' . `deep_twin')
    281         require
    282             other_not_void: other /= Void
    283         do
    284             copy (other.deep_twin)
    285         ensure
    286             deep_equal: deep_equal (Current, other)
    287         end
    288 
    289 feature {NONE} -- Retrieval
    290 
    291     frozen internal_correct_mismatch
    292             -- Called from runtime to perform a proper dynamic dispatch on `correct_mismatch'
    293             -- from MISMATCH_CORRECTOR.
    294         local
    295             l_msg: STRING
    296             l_exc: EXCEPTIONS
    297         do
    298             if attached {MISMATCH_CORRECTOR} Current as l_corrector then
    299                 l_corrector.correct_mismatch
    300             else
    301                 create l_msg.make_from_string ("Mismatch: ")
    302                 create l_exc
    303                 l_msg.append (generating_type.name)
    304                 l_exc.raise_retrieval_exception (l_msg)
    305             end
    306         end
    307 
    308 feature -- Output
    309 
    310     io: STD_FILES
    311             -- Handle to standard file setup
    312         once
    313             create Result
    314             Result.set_output_default
    315         ensure
    316             io_not_void: Result /= Void
    317         end
    318 
    319     out: STRING
    320             -- New string containing terse printable representation
    321             -- of current object
    322         do
    323             Result := tagged_out
    324         ensure
    325             out_not_void: Result /= Void
    326         end
    327 
    328     frozen tagged_out: STRING
    329             -- New string containing terse printable representation
    330             -- of current object
    331         external
    332             "built_in"
    333         ensure
    334             tagged_out_not_void: Result /= Void
    335         end
    336 
    337     print (o: detachable ANY)
    338             -- Write terse external representation of `o'
    339             -- on standard output.
    340         do
    341             if o /= Void then
    342                 io.put_string (o.out)
    343             end
    344         end
    345 
    346 feature -- Platform
    347 
    348     Operating_environment: OPERATING_ENVIRONMENT
    349             -- Objects available from the operating system
    350         once
    351             create Result
    352         ensure
    353             operating_environment_not_void: Result /= Void
    354         end
    355 
    356 feature {NONE} -- Initialization
    357 
    358     default_create
    359             -- Process instances of classes with no creation clause.
    360             -- (Default: do nothing.)
    361         do
    362         end
    363 
    364 feature -- Basic operations
    365 
    366     default_rescue
    367             -- Process exception for routines with no Rescue clause.
    368             -- (Default: do nothing.)
    369         do
    370         end
    371 
    372     frozen do_nothing
    373             -- Execute a null action.
    374         do
    375         end
    376 
    377     frozen default: detachable like Current
    378             -- Default value of object's type
    379         do
    380         end
    381 
    382     frozen default_pointer: POINTER
    383             -- Default value of type `POINTER'
    384             -- (Avoid the need to write `p'.`default' for
    385             -- some `p' of type `POINTER'.)
    386         do
    387         ensure
    388             -- Result = Result.default
    389         end
    390 
    391     frozen as_attached: attached like Current
    392             -- Attached version of Current
    393             -- (Can be used during transitional period to convert
    394             -- non-void-safe classes to void-safe ones.)
    395         do
    396             Result := Current
    397         end
    398 
    399 invariant
    400     reflexive_equality: standard_is_equal (Current)
    401     reflexive_conformance: conforms_to (Current)
    402 
    403 note
    404     copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
    405     license:   "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
    406     source: "[
    407             Eiffel Software
    408             5949 Hollister Ave., Goleta, CA 93117 USA
    409             Telephone 805-685-1006, Fax 805-685-6869
    410             Website http://www.eiffel.com
    411             Customer support http://support.eiffel.com
    412         ]"
    413 
    414 end
    415 
    416 </textarea></form>
    417     <script>
    418       var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
    419         mode: "text/x-eiffel",
    420         indentUnit: 4,
    421         lineNumbers: true,
    422         theme: "neat"
    423       });
    424     </script>
    425 
    426     <p><strong>MIME types defined:</strong> <code>text/x-eiffel</code>.</p>
    427  
    428  <p> Created by <a href="https://github.com/ynh">YNH</a>.</p>
    429   </article>