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

Function scanIdentifier

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

Source from the content-addressed store, hash-verified

3042 }
3043
3044 function scanIdentifier() {
3045 var start, id, type;
3046
3047 start = index;
3048
3049 // Backslash (char #92) starts an escaped character.
3050 id = (source.charCodeAt(index) === 92) ? getEscapedIdentifier() : getIdentifier();
3051
3052 // There is no keyword or literal with only one character.
3053 // Thus, it must be an identifier.
3054 if (id.length === 1) {
3055 type = Token.Identifier;
3056 } else if (isKeyword(id)) {
3057 type = Token.Keyword;
3058 } else if (id === 'null') {
3059 type = Token.NullLiteral;
3060 } else if (id === 'true' || id === 'false') {
3061 type = Token.BooleanLiteral;
3062 } else {
3063 type = Token.Identifier;
3064 }
3065
3066 return {
3067 type: type,
3068 value: id,
3069 lineNumber: lineNumber,
3070 lineStart: lineStart,
3071 range: [start, index]
3072 };
3073 }
3074
3075
3076 // 7.7 Punctuators

Callers 1

advanceFunction · 0.85

Calls 3

getEscapedIdentifierFunction · 0.85
getIdentifierFunction · 0.85
isKeywordFunction · 0.85

Tested by

no test coverage detected