MCPcopy Index your code
hub / github.com/csev/py4e / tokenStringFactory

Function tokenStringFactory

tools/pythonauto/static/codemirrorepl/python.js:162–195  ·  view source on GitHub ↗
(delimiter)

Source from the content-addressed store, hash-verified

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

Callers 1

tokenBaseFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected