Mercurial
comparison .cms/lib/codemirror/mode/scheme/index.html @ 0:78edf6b517a0 draft
24.10
author | Coffee CMS <info@coffee-cms.ru> |
---|---|
date | Fri, 11 Oct 2024 22:40:23 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:78edf6b517a0 |
---|---|
1 <!doctype html> | |
2 | |
3 <title>CodeMirror: Scheme 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 <script src="../../lib/codemirror.js"></script> | |
9 <script src="scheme.js"></script> | |
10 <style>.CodeMirror {background: #f8f8f8;}</style> | |
11 <div id=nav> | |
12 <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a> | |
13 | |
14 <ul> | |
15 <li><a href="../../index.html">Home</a> | |
16 <li><a href="../../doc/manual.html">Manual</a> | |
17 <li><a href="https://github.com/codemirror/codemirror5">Code</a> | |
18 </ul> | |
19 <ul> | |
20 <li><a href="../index.html">Language modes</a> | |
21 <li><a class=active href="#">Scheme</a> | |
22 </ul> | |
23 </div> | |
24 | |
25 <article> | |
26 <h2>Scheme mode</h2> | |
27 <form><textarea id="code" name="code"> | |
28 ; See if the input starts with a given symbol. | |
29 (define (match-symbol input pattern) | |
30 (cond ((null? (remain input)) #f) | |
31 ((eqv? (car (remain input)) pattern) (r-cdr input)) | |
32 (else #f))) | |
33 | |
34 ; Allow the input to start with one of a list of patterns. | |
35 (define (match-or input pattern) | |
36 (cond ((null? pattern) #f) | |
37 ((match-pattern input (car pattern))) | |
38 (else (match-or input (cdr pattern))))) | |
39 | |
40 ; Allow a sequence of patterns. | |
41 (define (match-seq input pattern) | |
42 (if (null? pattern) | |
43 input | |
44 (let ((match (match-pattern input (car pattern)))) | |
45 (if match (match-seq match (cdr pattern)) #f)))) | |
46 | |
47 ; Match with the pattern but no problem if it does not match. | |
48 (define (match-opt input pattern) | |
49 (let ((match (match-pattern input (car pattern)))) | |
50 (if match match input))) | |
51 | |
52 ; Match anything (other than '()), until pattern is found. The rather | |
53 ; clumsy form of requiring an ending pattern is needed to decide where | |
54 ; the end of the match is. If none is given, this will match the rest | |
55 ; of the sentence. | |
56 (define (match-any input pattern) | |
57 (cond ((null? (remain input)) #f) | |
58 ((null? pattern) (f-cons (remain input) (clear-remain input))) | |
59 (else | |
60 (let ((accum-any (collector))) | |
61 (define (match-pattern-any input pattern) | |
62 (cond ((null? (remain input)) #f) | |
63 (else (accum-any (car (remain input))) | |
64 (cond ((match-pattern (r-cdr input) pattern)) | |
65 (else (match-pattern-any (r-cdr input) pattern)))))) | |
66 (let ((retval (match-pattern-any input (car pattern)))) | |
67 (if retval | |
68 (f-cons (accum-any) retval) | |
69 #f)))))) | |
70 </textarea></form> | |
71 <script> | |
72 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {}); | |
73 </script> | |
74 | |
75 <p><strong>MIME types defined:</strong> <code>text/x-scheme</code>.</p> | |
76 | |
77 </article> |