MCPcopy Index your code
hub / github.com/BloombergGraphics/whatiscode / collectRegex

Function collectRegex

scripts/libs/esprima.js:1258–1300  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1256 }
1257
1258 function collectRegex() {
1259 var pos, loc, regex, token;
1260
1261 skipComment();
1262
1263 pos = index;
1264 loc = {
1265 start: {
1266 line: lineNumber,
1267 column: index - lineStart
1268 }
1269 };
1270
1271 regex = scanRegExp();
1272
1273 loc.end = {
1274 line: lineNumber,
1275 column: index - lineStart
1276 };
1277
1278 /* istanbul ignore next */
1279 if (!extra.tokenize) {
1280 // Pop the previous token, which is likely '/' or '/='
1281 if (extra.tokens.length > 0) {
1282 token = extra.tokens[extra.tokens.length - 1];
1283 if (token.range[0] === pos && token.type === 'Punctuator') {
1284 if (token.value === '/' || token.value === '/=') {
1285 extra.tokens.pop();
1286 }
1287 }
1288 }
1289
1290 extra.tokens.push({
1291 type: 'RegularExpression',
1292 value: regex.literal,
1293 regex: regex.regex,
1294 range: [pos, index],
1295 loc: loc
1296 });
1297 }
1298
1299 return regex;
1300 }
1301
1302 function isIdentifierName(token) {
1303 return token.type === Token.Identifier ||

Callers 2

advanceSlashFunction · 0.85
parsePrimaryExpressionFunction · 0.85

Calls 2

skipCommentFunction · 0.85
scanRegExpFunction · 0.85

Tested by

no test coverage detected