diff options
author | Jose Antonio Marquez | 2012-01-27 12:05:17 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-01-27 12:05:17 -0800 |
commit | 3a754133dbc138390503341fd2e9beba3e43aa4b (patch) | |
tree | cdeae7d7dd9a30d7b4fab5afb7efad68d4ec7508 /imports/codemirror/mode/scheme/index.html | |
parent | b89a7ee8b956c96a1dcee995ea840feddc5d4b27 (diff) | |
download | ninja-3a754133dbc138390503341fd2e9beba3e43aa4b.tar.gz |
Merged old FileIO
Diffstat (limited to 'imports/codemirror/mode/scheme/index.html')
-rwxr-xr-x | imports/codemirror/mode/scheme/index.html | 64 |
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> | ||