MCPcopy
hub / github.com/BloombergGraphics/whatiscode / scanRegExp

Function scanRegExp

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

Source from the content-addressed store, hash-verified

1217 }
1218
1219 function scanRegExp() {
1220 scanning = true;
1221 var start, body, flags, value;
1222
1223 lookahead = null;
1224 skipComment();
1225 start = index;
1226
1227 body = scanRegExpBody();
1228 flags = scanRegExpFlags();
1229 value = testRegExp(body.value, flags.value);
1230 scanning = false;
1231 if (extra.tokenize) {
1232 return {
1233 type: Token.RegularExpression,
1234 value: value,
1235 regex: {
1236 pattern: body.value,
1237 flags: flags.value
1238 },
1239 lineNumber: lineNumber,
1240 lineStart: lineStart,
1241 start: start,
1242 end: index
1243 };
1244 }
1245
1246 return {
1247 literal: body.literal + flags.literal,
1248 value: value,
1249 regex: {
1250 pattern: body.value,
1251 flags: flags.value
1252 },
1253 start: start,
1254 end: index
1255 };
1256 }
1257
1258 function collectRegex() {
1259 var pos, loc, regex, token;

Callers 2

collectRegexFunction · 0.85
parsePrimaryExpressionFunction · 0.85

Calls 4

skipCommentFunction · 0.85
scanRegExpBodyFunction · 0.85
scanRegExpFlagsFunction · 0.85
testRegExpFunction · 0.85

Tested by

no test coverage detected