MCPcopy
hub / github.com/mobxjs/mobx / advance

Function advance

docs/assets/getting-started-assets/javascripts/JSXTransformer.js:4387–4452  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4385 }
4386
4387 function advance() {
4388 var ch
4389
4390 if (!state.inJSXChild) {
4391 skipComment()
4392 }
4393
4394 if (index >= length) {
4395 return {
4396 type: Token.EOF,
4397 lineNumber: lineNumber,
4398 lineStart: lineStart,
4399 range: [index, index]
4400 }
4401 }
4402
4403 if (state.inJSXChild) {
4404 return advanceJSXChild()
4405 }
4406
4407 ch = source.charCodeAt(index)
4408
4409 // Very common: ( and ) and ;
4410 if (ch === 40 || ch === 41 || ch === 58) {
4411 return scanPunctuator()
4412 }
4413
4414 // String literal starts with single quote (#39) or double quote (#34).
4415 if (ch === 39 || ch === 34) {
4416 if (state.inJSXTag) {
4417 return scanJSXStringLiteral()
4418 }
4419 return scanStringLiteral()
4420 }
4421
4422 if (state.inJSXTag && isJSXIdentifierStart(ch)) {
4423 return scanJSXIdentifier()
4424 }
4425
4426 if (ch === 96) {
4427 return scanTemplate()
4428 }
4429 if (isIdentifierStart(ch)) {
4430 return scanIdentifier()
4431 }
4432
4433 // Dot (.) char #46 can also start a floating-point number, hence the need
4434 // to check the next character.
4435 if (ch === 46) {
4436 if (isDecimalDigit(source.charCodeAt(index + 1))) {
4437 return scanNumericLiteral()
4438 }
4439 return scanPunctuator()
4440 }
4441
4442 if (isDecimalDigit(ch)) {
4443 return scanNumericLiteral()
4444 }

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…