You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.0 KiB

  1. <!doctype html>
  2. <title>CodeMirror: Factor mode</title>
  3. <meta charset="utf-8"/>
  4. <link rel=stylesheet href="../../doc/docs.css">
  5. <link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
  6. <link rel="stylesheet" href="../../lib/codemirror.css">
  7. <script src="../../lib/codemirror.js"></script>
  8. <script src="../../addon/mode/simple.js"></script>
  9. <script src="factor.js"></script>
  10. <style>
  11. .CodeMirror {
  12. font-family: 'Droid Sans Mono', monospace;
  13. font-size: 14px;
  14. }
  15. </style>
  16. <div id=nav>
  17. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  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="#">Factor</a>
  26. </ul>
  27. </div>
  28. <article>
  29. <h2>Factor mode</h2>
  30. <form><textarea id="code" name="code">
  31. ! Copyright (C) 2008 Slava Pestov.
  32. ! See http://factorcode.org/license.txt for BSD license.
  33. ! A simple time server
  34. USING: accessors calendar calendar.format io io.encodings.ascii
  35. io.servers kernel threads ;
  36. IN: time-server
  37. : handle-time-client ( -- )
  38. now timestamp>rfc822 print ;
  39. : <time-server> ( -- threaded-server )
  40. ascii <threaded-server>
  41. "time-server" >>name
  42. 1234 >>insecure
  43. [ handle-time-client ] >>handler ;
  44. : start-time-server ( -- )
  45. <time-server> start-server drop ;
  46. MAIN: start-time-server
  47. </textarea>
  48. </form>
  49. <script>
  50. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  51. lineNumbers: true,
  52. lineWrapping: true,
  53. indentUnit: 2,
  54. tabSize: 2,
  55. autofocus: true,
  56. mode: "text/x-factor"
  57. });
  58. </script>
  59. <p/>
  60. <p>Simple mode that handles Factor Syntax (<a href="http://en.wikipedia.org/wiki/Factor_(programming_language)">Factor on WikiPedia</a>).</p>
  61. <p><strong>MIME types defined:</strong> <code>text/x-factor</code>.</p>
  62. </article>