aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/mode/scheme/index.html
diff options
context:
space:
mode:
authorPushkar Joshi2012-02-24 12:08:49 -0800
committerPushkar Joshi2012-02-24 12:08:49 -0800
commit03ca7a5ed13c25faaa9100bb666e062fd15335e6 (patch)
treec51112223ceb9121cd595a60335eb2795215590f /imports/codemirror/mode/scheme/index.html
parentfcb12cc09eb3cd3b42bd215877ba18f449275b75 (diff)
parent053fc63a2950c7a5ee4ebf98033b64d474a3c46e (diff)
downloadninja-03ca7a5ed13c25faaa9100bb666e062fd15335e6.tar.gz
Merge branch 'pentool' into brushtool
Conflicts: imports/codemirror/mode/scheme/scheme.js js/tools/BrushTool.js
Diffstat (limited to 'imports/codemirror/mode/scheme/index.html')
-rwxr-xr-ximports/codemirror/mode/scheme/index.html64
1 files changed, 64 insertions, 0 deletions
diff --git a/imports/codemirror/mode/scheme/index.html b/imports/codemirror/mode/scheme/index.html
new file mode 100755
index 00000000..2a6105fa
--- /dev/null
+++ b/imports/codemirror/mode/scheme/index.html
@@ -0,0 +1,64 @@
1<!doctype html>
2<html>
3 <head>
4 <title>CodeMirror: Scheme mode</title>
5 <link rel="stylesheet" href="../../lib/codemirror.css">
6 <script src="../../lib/codemirror.js"></script>
7 <script src="scheme.js"></script>
8 <style>.CodeMirror {background: #f8f8f8;}</style>
9 <link rel="stylesheet" href="../../doc/docs.css">
10 </head>
11 <body>
12 <h1>CodeMirror: Scheme mode</h1>
13 <form><textarea id="code" name="code">
14; See if the input starts with a given symbol.
15(define (match-symbol input pattern)
16 (cond ((null? (remain input)) #f)
17 ((eqv? (car (remain input)) pattern) (r-cdr input))
18 (else #f)))
19
20; Allow the input to start with one of a list of patterns.
21(define (match-or input pattern)
22 (cond ((null? pattern) #f)
23 ((match-pattern input (car pattern)))
24 (else (match-or input (cdr pattern)))))
25
26; Allow a sequence of patterns.
27(define (match-seq input pattern)
28 (if (null? pattern)
29 input
30 (let ((match (match-pattern input (car pattern))))
31 (if match (match-seq match (cdr pattern)) #f))))
32
33; Match with the pattern but no problem if it does not match.
34(define (match-opt input pattern)
35 (let ((match (match-pattern input (car pattern))))
36 (if match match input)))
37
38; Match anything (other than '()), until pattern is found. The rather
39; clumsy form of requiring an ending pattern is needed to decide where
40; the end of the match is. If none is given, this will match the rest
41; of the sentence.
42(define (match-any input pattern)
43 (cond ((null? (remain input)) #f)
44 ((null? pattern) (f-cons (remain input) (clear-remain input)))
45 (else
46 (let ((accum-any (collector)))
47 (define (match-pattern-any input pattern)
48 (cond ((null? (remain input)) #f)
49 (else (accum-any (car (remain input)))
50 (cond ((match-pattern (r-cdr input) pattern))
51 (else (match-pattern-any (r-cdr input) pattern))))))
52 (let ((retval (match-pattern-any input (car pattern))))
53 (if retval
54 (f-cons (accum-any) retval)
55 #f))))))
56</textarea></form>
57 <script>
58 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
59 </script>
60
61 <p><strong>MIME types defined:</strong> <code>text/x-scheme</code>.</p>
62
63 </body>
64</html>