mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-11 14:14:36 +08:00
- Updates stylelint to 13.8.0 - Updates ESLint to 7.14.0 - Updates @typescript-eslint to 4.9.0 DISABLE_THIRD_PARTY_CHECK=NPM update R=jacktfranklin@chromium.org Change-Id: I207e204607ede782710e042c17d6510c7f696905 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2566806 Reviewed-by: Jack Franklin <jacktfranklin@chromium.org> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
69 lines
1.3 KiB
JavaScript
69 lines
1.3 KiB
JavaScript
exports.tokenize = initializeContent
|
|
|
|
var markdownLineEnding = require('../character/markdown-line-ending')
|
|
|
|
var createSpace = require('../tokenize/factory-space')
|
|
|
|
function initializeContent(effects) {
|
|
var contentStart = effects.attempt(
|
|
this.parser.constructs.contentInitial,
|
|
afterContentStartConstruct,
|
|
paragraphInitial
|
|
)
|
|
|
|
var previous
|
|
|
|
return contentStart
|
|
|
|
function afterContentStartConstruct(code) {
|
|
if (code === null) {
|
|
effects.consume(code)
|
|
return
|
|
}
|
|
|
|
effects.enter('lineEnding')
|
|
effects.consume(code)
|
|
effects.exit('lineEnding')
|
|
return createSpace(effects, contentStart, 'linePrefix')
|
|
}
|
|
|
|
function paragraphInitial(code) {
|
|
effects.enter('paragraph')
|
|
return lineStart(code)
|
|
}
|
|
|
|
function lineStart(code) {
|
|
var token = effects.enter('chunkText', {
|
|
contentType: 'text',
|
|
previous: previous
|
|
})
|
|
|
|
if (previous) {
|
|
previous.next = token
|
|
}
|
|
|
|
previous = token
|
|
|
|
return data(code)
|
|
}
|
|
|
|
function data(code) {
|
|
if (code === null) {
|
|
effects.exit('chunkText')
|
|
effects.exit('paragraph')
|
|
effects.consume(code)
|
|
return
|
|
}
|
|
|
|
if (markdownLineEnding(code)) {
|
|
effects.consume(code)
|
|
effects.exit('chunkText')
|
|
return lineStart
|
|
}
|
|
|
|
// Data.
|
|
effects.consume(code)
|
|
return data
|
|
}
|
|
}
|