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

Function scanRegExpFlags

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

Source from the content-addressed store, hash-verified

3821 }
3822
3823 function scanRegExpFlags() {
3824 var ch, str, flags, restore;
3825
3826 str = '';
3827 flags = '';
3828 while (index < length) {
3829 ch = source[index];
3830 if (!isIdentifierPart(ch.charCodeAt(0))) {
3831 break;
3832 }
3833
3834 ++index;
3835 if (ch === '\\' && index < length) {
3836 ch = source[index];
3837 if (ch === 'u') {
3838 ++index;
3839 restore = index;
3840 ch = scanHexEscape('u');
3841 if (ch) {
3842 flags += ch;
3843 for (str += '\\u'; restore < index; ++restore) {
3844 str += source[restore];
3845 }
3846 } else {
3847 index = restore;
3848 flags += 'u';
3849 str += '\\u';
3850 }
3851 throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');
3852 } else {
3853 str += '\\';
3854 throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');
3855 }
3856 } else {
3857 flags += ch;
3858 str += ch;
3859 }
3860 }
3861
3862 return {
3863 value: flags,
3864 literal: str
3865 };
3866 }
3867
3868 function scanRegExp() {
3869 var start, body, flags, value;

Callers 1

scanRegExpFunction · 0.85

Calls 3

isIdentifierPartFunction · 0.85
scanHexEscapeFunction · 0.85
throwErrorTolerantFunction · 0.85

Tested by

no test coverage detected