MCPcopy Create free account
hub / github.com/nwutils/nw-sample-apps / tokenStringFactory

Function tokenStringFactory

mini-code-edit/cm/mode/python/python.js:156–187  ·  view source on GitHub ↗
(delimiter)

Source from the content-addressed store, hash-verified

154 }
155
156 function tokenStringFactory(delimiter) {
157 while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
158 delimiter = delimiter.substr(1);
159 }
160 var singleline = delimiter.length == 1;
161 var OUTCLASS = 'string';
162
163 return function tokenString(stream, state) {
164 while (!stream.eol()) {
165 stream.eatWhile(/[^'"\\]/);
166 if (stream.eat('\\')) {
167 stream.next();
168 if (singleline && stream.eol()) {
169 return OUTCLASS;
170 }
171 } else if (stream.match(delimiter)) {
172 state.tokenize = tokenBase;
173 return OUTCLASS;
174 } else {
175 stream.eat(/['"]/);
176 }
177 }
178 if (singleline) {
179 if (parserConf.singleLineStringErrors) {
180 return ERRORCLASS;
181 } else {
182 state.tokenize = tokenBase;
183 }
184 }
185 return OUTCLASS;
186 };
187 }
188
189 function indent(stream, state, type) {
190 type = type || 'py';

Callers 1

tokenBaseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected