diff options
author | Nivesh Rajbhandari | 2012-02-20 11:14:44 -0800 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-02-20 11:14:44 -0800 |
commit | abf78e2d7a97d295ce5a1c425fd359d47379137e (patch) | |
tree | d08c91bd2aef31e6325e0b499b2ffc390018bec6 /imports/codemirror/mode/scheme/index.html | |
parent | e80a79bff57fecf3aa9b869d8ed2de5fd815287c (diff) | |
parent | e23708721a71ca4c71365f5f8e8ac7d6113926db (diff) | |
download | ninja-abf78e2d7a97d295ce5a1c425fd359d47379137e.tar.gz |
Merge branch 'refs/heads/ninja-internal' into ToolFixes
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> | ||