comparison src/nabble/view/web/util/codemirror/js/parsedummy.js @ 0:7ecd1a4ef557

add content
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 Mar 2019 19:15:52 -0600
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:7ecd1a4ef557
1 var DummyParser = Editor.Parser = (function() {
2 function tokenizeDummy(source) {
3 while (!source.endOfLine()) source.next();
4 return "text";
5 }
6 function parseDummy(source) {
7 function indentTo(n) {return function() {return n;}}
8 source = tokenizer(source, tokenizeDummy);
9 var space = 0;
10
11 var iter = {
12 next: function() {
13 var tok = source.next();
14 if (tok.type == "whitespace") {
15 if (tok.value == "\n") tok.indentation = indentTo(space);
16 else space = tok.value.length;
17 }
18 return tok;
19 },
20 copy: function() {
21 var _space = space;
22 return function(_source) {
23 space = _space;
24 source = tokenizer(_source, tokenizeDummy);
25 return iter;
26 };
27 }
28 };
29 return iter;
30 }
31 return {make: parseDummy};
32 })();