MCPcopy Index your code
hub / github.com/reactjs/react-rails / collectRegex

Function collectRegex

lib/assets/javascripts/JSXTransformer.js:9691–9732  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9689 }
9690
9691 function collectRegex() {
9692 var pos, loc, regex, token;
9693
9694 skipComment();
9695
9696 pos = index;
9697 loc = {
9698 start: {
9699 line: lineNumber,
9700 column: index - lineStart
9701 }
9702 };
9703
9704 regex = extra.scanRegExp();
9705 loc.end = {
9706 line: lineNumber,
9707 column: index - lineStart
9708 };
9709
9710 if (!extra.tokenize) {
9711 /* istanbul ignore next */
9712 // Pop the previous token, which is likely '/' or '/='
9713 if (extra.tokens.length > 0) {
9714 token = extra.tokens[extra.tokens.length - 1];
9715 if (token.range[0] === pos && token.type === 'Punctuator') {
9716 if (token.value === '/' || token.value === '/=') {
9717 extra.tokens.pop();
9718 }
9719 }
9720 }
9721
9722 extra.tokens.push({
9723 type: 'RegularExpression',
9724 value: regex.literal,
9725 regex: regex.regex,
9726 range: [pos, index],
9727 loc: loc
9728 });
9729 }
9730
9731 return regex;
9732 }
9733
9734 function filterTokenLocation() {
9735 var i, entry, token, tokens = [];

Callers

nothing calls this directly

Calls 1

skipCommentFunction · 0.85

Tested by

no test coverage detected