diff options
Diffstat (limited to 'js/codemirror/mode/javascript/index.html')
-rw-r--r-- | js/codemirror/mode/javascript/index.html | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/js/codemirror/mode/javascript/index.html b/js/codemirror/mode/javascript/index.html deleted file mode 100644 index 2454c818..00000000 --- a/js/codemirror/mode/javascript/index.html +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | <!doctype html> | ||
2 | <html> | ||
3 | <head> | ||
4 | <title>CodeMirror 2: JavaScript mode</title> | ||
5 | <link rel="stylesheet" href="../../lib/codemirror.css"> | ||
6 | <script src="../../lib/codemirror.js"></script> | ||
7 | <script src="javascript.js"></script> | ||
8 | <link rel="stylesheet" href="../../theme/default.css"> | ||
9 | <link rel="stylesheet" href="../../css/docs.css"> | ||
10 | <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style> | ||
11 | </head> | ||
12 | <body> | ||
13 | <h1>CodeMirror 2: JavaScript mode</h1> | ||
14 | |||
15 | <div><textarea id="code" name="code"> | ||
16 | // Demo code (the actual new parser character stream implementation) | ||
17 | |||
18 | function StringStream(string) { | ||
19 | this.pos = 0; | ||
20 | this.string = string; | ||
21 | } | ||
22 | |||
23 | StringStream.prototype = { | ||
24 | done: function() {return this.pos >= this.string.length;}, | ||
25 | peek: function() {return this.string.charAt(this.pos);}, | ||
26 | next: function() { | ||
27 | if (this.pos < this.string.length) | ||
28 | return this.string.charAt(this.pos++); | ||
29 | }, | ||
30 | eat: function(match) { | ||
31 | var ch = this.string.charAt(this.pos); | ||
32 | if (typeof match == "string") var ok = ch == match; | ||
33 | else var ok = ch && match.test ? match.test(ch) : match(ch); | ||
34 | if (ok) {this.pos++; return ch;} | ||
35 | }, | ||
36 | eatWhile: function(match) { | ||
37 | var start = this.pos; | ||
38 | while (this.eat(match)); | ||
39 | if (this.pos > start) return this.string.slice(start, this.pos); | ||
40 | }, | ||
41 | backUp: function(n) {this.pos -= n;}, | ||
42 | column: function() {return this.pos;}, | ||
43 | eatSpace: function() { | ||
44 | var start = this.pos; | ||
45 | while (/\s/.test(this.string.charAt(this.pos))) this.pos++; | ||
46 | return this.pos - start; | ||
47 | }, | ||
48 | match: function(pattern, consume, caseInsensitive) { | ||
49 | if (typeof pattern == "string") { | ||
50 | function cased(str) {return caseInsensitive ? str.toLowerCase() : str;} | ||
51 | if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) { | ||
52 | if (consume !== false) this.pos += str.length; | ||
53 | return true; | ||
54 | } | ||
55 | } | ||
56 | else { | ||
57 | var match = this.string.slice(this.pos).match(pattern); | ||
58 | if (match && consume !== false) this.pos += match[0].length; | ||
59 | return match; | ||
60 | } | ||
61 | } | ||
62 | }; | ||
63 | </textarea></div> | ||
64 | |||
65 | <script> | ||
66 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { | ||
67 | lineNumbers: true, | ||
68 | matchBrackets: true | ||
69 | }); | ||
70 | </script> | ||
71 | |||
72 | <p>JavaScript mode supports a single configuration | ||
73 | option, <code>json</code>, which will set the mode to expect JSON | ||
74 | data rather than a JavaScript program.</p> | ||
75 | |||
76 | <p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>.</p> | ||
77 | </body> | ||
78 | </html> | ||