openrat-cms

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

index.html (2024B)


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