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

Function getEscapedIdentifier

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

Source from the content-addressed store, hash-verified

2976 }
2977
2978 function getEscapedIdentifier() {
2979 var ch, id;
2980
2981 ch = source.charCodeAt(index++);
2982 id = String.fromCharCode(ch);
2983
2984 // '\u' (char #92, char #117) denotes an escaped character.
2985 if (ch === 92) {
2986 if (source.charCodeAt(index) !== 117) {
2987 throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
2988 }
2989 ++index;
2990 ch = scanHexEscape('u');
2991 if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) {
2992 throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
2993 }
2994 id = ch;
2995 }
2996
2997 while (index < length) {
2998 ch = source.charCodeAt(index);
2999 if (!isIdentifierPart(ch)) {
3000 break;
3001 }
3002 ++index;
3003 id += String.fromCharCode(ch);
3004
3005 // '\u' (char #92, char #117) denotes an escaped character.
3006 if (ch === 92) {
3007 id = id.substr(0, id.length - 1);
3008 if (source.charCodeAt(index) !== 117) {
3009 throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3010 }
3011 ++index;
3012 ch = scanHexEscape('u');
3013 if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) {
3014 throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3015 }
3016 id += ch;
3017 }
3018 }
3019
3020 return id;
3021 }
3022
3023 function getIdentifier() {
3024 var start, ch;

Callers 2

getIdentifierFunction · 0.85
scanIdentifierFunction · 0.85

Calls 4

throwErrorFunction · 0.85
scanHexEscapeFunction · 0.85
isIdentifierStartFunction · 0.85
isIdentifierPartFunction · 0.85

Tested by

no test coverage detected