index.html 13 KB

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