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

Function advance

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

Source from the content-addressed store, hash-verified

3969 }
3970
3971 function advance() {
3972 var ch;
3973
3974 if (!state.inJSXChild) {
3975 skipComment();
3976 }
3977
3978 if (index >= length) {
3979 return {
3980 type: Token.EOF,
3981 lineNumber: lineNumber,
3982 lineStart: lineStart,
3983 range: [index, index]
3984 };
3985 }
3986
3987 if (state.inJSXChild) {
3988 return advanceJSXChild();
3989 }
3990
3991 ch = source.charCodeAt(index);
3992
3993 // Very common: ( and ) and ;
3994 if (ch === 40 || ch === 41 || ch === 58) {
3995 return scanPunctuator();
3996 }
3997
3998 // String literal starts with single quote (#39) or double quote (#34).
3999 if (ch === 39 || ch === 34) {
4000 if (state.inJSXTag) {
4001 return scanJSXStringLiteral();
4002 }
4003 return scanStringLiteral();
4004 }
4005
4006 if (state.inJSXTag && isJSXIdentifierStart(ch)) {
4007 return scanJSXIdentifier();
4008 }
4009
4010 if (ch === 96) {
4011 return scanTemplate();
4012 }
4013 if (isIdentifierStart(ch)) {
4014 return scanIdentifier();
4015 }
4016
4017 // Dot (.) char #46 can also start a floating-point number, hence the need
4018 // to check the next character.
4019 if (ch === 46) {
4020 if (isDecimalDigit(source.charCodeAt(index + 1))) {
4021 return scanNumericLiteral();
4022 }
4023 return scanPunctuator();
4024 }
4025
4026 if (isDecimalDigit(ch)) {
4027 return scanNumericLiteral();
4028 }

Callers 2

lexFunction · 0.85
peekFunction · 0.85

Calls 13

skipCommentFunction · 0.85
advanceJSXChildFunction · 0.85
scanPunctuatorFunction · 0.85
scanJSXStringLiteralFunction · 0.85
scanStringLiteralFunction · 0.85
isJSXIdentifierStartFunction · 0.85
scanJSXIdentifierFunction · 0.85
scanTemplateFunction · 0.85
isIdentifierStartFunction · 0.85
scanIdentifierFunction · 0.85
isDecimalDigitFunction · 0.85
scanNumericLiteralFunction · 0.85

Tested by

no test coverage detected