aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/mode
diff options
context:
space:
mode:
Diffstat (limited to 'imports/codemirror/mode')
-rwxr-xr-ximports/codemirror/mode/clike/clike.js249
-rwxr-xr-ximports/codemirror/mode/clike/index.html101
-rwxr-xr-ximports/codemirror/mode/clojure/clojure.js207
-rwxr-xr-ximports/codemirror/mode/clojure/index.html66
-rwxr-xr-ximports/codemirror/mode/coffeescript/LICENSE22
-rwxr-xr-ximports/codemirror/mode/coffeescript/coffeescript.js325
-rwxr-xr-ximports/codemirror/mode/coffeescript/index.html721
-rwxr-xr-ximports/codemirror/mode/css/css.js124
-rwxr-xr-ximports/codemirror/mode/css/index.html55
-rwxr-xr-ximports/codemirror/mode/diff/diff.css3
-rwxr-xr-ximports/codemirror/mode/diff/diff.js13
-rwxr-xr-ximports/codemirror/mode/diff/index.html99
-rwxr-xr-ximports/codemirror/mode/gfm/gfm.js108
-rwxr-xr-ximports/codemirror/mode/gfm/index.html47
-rwxr-xr-ximports/codemirror/mode/groovy/groovy.js210
-rwxr-xr-ximports/codemirror/mode/groovy/index.html71
-rwxr-xr-ximports/codemirror/mode/haskell/haskell.js242
-rwxr-xr-ximports/codemirror/mode/haskell/index.html60
-rwxr-xr-ximports/codemirror/mode/htmlembedded/htmlembedded.js68
-rwxr-xr-ximports/codemirror/mode/htmlembedded/index.html49
-rwxr-xr-ximports/codemirror/mode/htmlmixed/htmlmixed.js83
-rwxr-xr-ximports/codemirror/mode/htmlmixed/index.html51
-rwxr-xr-ximports/codemirror/mode/javascript/index.html77
-rwxr-xr-ximports/codemirror/mode/javascript/javascript.js360
-rwxr-xr-ximports/codemirror/mode/jinja2/index.html37
-rwxr-xr-ximports/codemirror/mode/jinja2/jinja2.js42
-rwxr-xr-ximports/codemirror/mode/lua/index.html72
-rwxr-xr-ximports/codemirror/mode/lua/lua.js140
-rwxr-xr-ximports/codemirror/mode/markdown/index.html339
-rwxr-xr-ximports/codemirror/mode/markdown/markdown.js242
-rwxr-xr-ximports/codemirror/mode/ntriples/index.html32
-rwxr-xr-ximports/codemirror/mode/ntriples/ntriples.js172
-rwxr-xr-ximports/codemirror/mode/pascal/LICENSE7
-rwxr-xr-ximports/codemirror/mode/pascal/index.html48
-rwxr-xr-ximports/codemirror/mode/pascal/pascal.js138
-rwxr-xr-ximports/codemirror/mode/perl/LICENSE19
-rwxr-xr-ximports/codemirror/mode/perl/index.html62
-rwxr-xr-ximports/codemirror/mode/perl/perl.js816
-rwxr-xr-ximports/codemirror/mode/php/index.html48
-rwxr-xr-ximports/codemirror/mode/php/php.js120
-rwxr-xr-ximports/codemirror/mode/plsql/index.html62
-rwxr-xr-ximports/codemirror/mode/plsql/plsql.js217
-rwxr-xr-ximports/codemirror/mode/python/LICENSE.txt21
-rwxr-xr-ximports/codemirror/mode/python/index.html122
-rwxr-xr-ximports/codemirror/mode/python/python.js333
-rwxr-xr-ximports/codemirror/mode/r/LICENSE24
-rwxr-xr-ximports/codemirror/mode/r/index.html73
-rwxr-xr-ximports/codemirror/mode/r/r.js141
-rwxr-xr-ximports/codemirror/mode/rpm/changes/changes.js19
-rwxr-xr-ximports/codemirror/mode/rpm/changes/index.html53
-rwxr-xr-ximports/codemirror/mode/rpm/spec/index.html99
-rwxr-xr-ximports/codemirror/mode/rpm/spec/spec.css5
-rwxr-xr-ximports/codemirror/mode/rpm/spec/spec.js66
-rwxr-xr-ximports/codemirror/mode/rst/index.html525
-rwxr-xr-ximports/codemirror/mode/rst/rst.js326
-rwxr-xr-ximports/codemirror/mode/ruby/LICENSE24
-rwxr-xr-ximports/codemirror/mode/ruby/index.html171
-rwxr-xr-ximports/codemirror/mode/ruby/ruby.js195
-rwxr-xr-ximports/codemirror/mode/rust/index.html48
-rwxr-xr-ximports/codemirror/mode/rust/rust.js411
-rwxr-xr-ximports/codemirror/mode/scheme/index.html64
-rwxr-xr-ximports/codemirror/mode/scheme/scheme.js202
-rwxr-xr-ximports/codemirror/mode/smalltalk/index.html55
-rwxr-xr-ximports/codemirror/mode/smalltalk/smalltalk.js139
-rwxr-xr-ximports/codemirror/mode/sparql/index.html40
-rwxr-xr-ximports/codemirror/mode/sparql/sparql.js143
-rwxr-xr-ximports/codemirror/mode/stex/index.html95
-rwxr-xr-ximports/codemirror/mode/stex/stex.js167
-rwxr-xr-ximports/codemirror/mode/tiddlywiki/index.html183
-rwxr-xr-ximports/codemirror/mode/tiddlywiki/tiddlywiki.css21
-rwxr-xr-ximports/codemirror/mode/tiddlywiki/tiddlywiki.js374
-rwxr-xr-ximports/codemirror/mode/velocity/index.html103
-rwxr-xr-ximports/codemirror/mode/velocity/velocity.js146
-rwxr-xr-ximports/codemirror/mode/xml/index.html44
-rwxr-xr-ximports/codemirror/mode/xml/xml.js252
-rwxr-xr-ximports/codemirror/mode/xmlpure/index.html59
-rwxr-xr-ximports/codemirror/mode/xmlpure/xmlpure.js485
-rwxr-xr-ximports/codemirror/mode/yaml/index.html67
-rwxr-xr-ximports/codemirror/mode/yaml/yaml.js95
79 files changed, 11414 insertions, 0 deletions
diff --git a/imports/codemirror/mode/clike/clike.js b/imports/codemirror/mode/clike/clike.js
new file mode 100755
index 00000000..69877efd
--- /dev/null
+++ b/imports/codemirror/mode/clike/clike.js
@@ -0,0 +1,249 @@
1CodeMirror.defineMode("clike", function(config, parserConfig) {
2 var indentUnit = config.indentUnit,
3 keywords = parserConfig.keywords || {},
4 blockKeywords = parserConfig.blockKeywords || {},
5 atoms = parserConfig.atoms || {},
6 hooks = parserConfig.hooks || {},
7 multiLineStrings = parserConfig.multiLineStrings;
8 var isOperatorChar = /[+\-*&%=<>!?|\/]/;
9
10 var curPunc;
11
12 function tokenBase(stream, state) {
13 var ch = stream.next();
14 if (hooks[ch]) {
15 var result = hooks[ch](stream, state);
16 if (result !== false) return result;
17 }
18 if (ch == '"' || ch == "'") {
19 state.tokenize = tokenString(ch);
20 return state.tokenize(stream, state);
21 }
22 if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
23 curPunc = ch;
24 return null
25 }
26 if (/\d/.test(ch)) {
27 stream.eatWhile(/[\w\.]/);
28 return "number";
29 }
30 if (ch == "/") {
31 if (stream.eat("*")) {
32 state.tokenize = tokenComment;
33 return tokenComment(stream, state);
34 }
35 if (stream.eat("/")) {
36 stream.skipToEnd();
37 return "comment";
38 }
39 }
40 if (isOperatorChar.test(ch)) {
41 stream.eatWhile(isOperatorChar);
42 return "operator";
43 }
44 stream.eatWhile(/[\w\$_]/);
45 var cur = stream.current();
46 if (keywords.propertyIsEnumerable(cur)) {
47 if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
48 return "keyword";
49 }
50 if (atoms.propertyIsEnumerable(cur)) return "atom";
51 return "word";
52 }
53
54 function tokenString(quote) {
55 return function(stream, state) {
56 var escaped = false, next, end = false;
57 while ((next = stream.next()) != null) {
58 if (next == quote && !escaped) {end = true; break;}
59 escaped = !escaped && next == "\\";
60 }
61 if (end || !(escaped || multiLineStrings))
62 state.tokenize = tokenBase;
63 return "string";
64 };
65 }
66
67 function tokenComment(stream, state) {
68 var maybeEnd = false, ch;
69 while (ch = stream.next()) {
70 if (ch == "/" && maybeEnd) {
71 state.tokenize = tokenBase;
72 break;
73 }
74 maybeEnd = (ch == "*");
75 }
76 return "comment";
77 }
78
79 function Context(indented, column, type, align, prev) {
80 this.indented = indented;
81 this.column = column;
82 this.type = type;
83 this.align = align;
84 this.prev = prev;
85 }
86 function pushContext(state, col, type) {
87 return state.context = new Context(state.indented, col, type, null, state.context);
88 }
89 function popContext(state) {
90 var t = state.context.type;
91 if (t == ")" || t == "]" || t == "}")
92 state.indented = state.context.indented;
93 return state.context = state.context.prev;
94 }
95
96 // Interface
97
98 return {
99 startState: function(basecolumn) {
100 return {
101 tokenize: null,
102 context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
103 indented: 0,