diff options
Diffstat (limited to 'tools/eslint/node_modules/remark-parse/lib/tokenize/code-inline.js')
-rw-r--r-- | tools/eslint/node_modules/remark-parse/lib/tokenize/code-inline.js | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/code-inline.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/code-inline.js deleted file mode 100644 index 9157412753..0000000000 --- a/tools/eslint/node_modules/remark-parse/lib/tokenize/code-inline.js +++ /dev/null @@ -1,120 +0,0 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:code-inline - * @fileoverview Tokenise inline code. - */ - -'use strict'; - -var whitespace = require('is-whitespace-character'); -var locate = require('../locate/code-inline'); - -module.exports = inlineCode; -inlineCode.locator = locate; - -var C_TICK = '`'; - -/* Tokenise inline code. */ -function inlineCode(eat, value, silent) { - var length = value.length; - var index = 0; - var queue = ''; - var tickQueue = ''; - var contentQueue; - var subqueue; - var count; - var openingCount; - var subvalue; - var character; - var found; - var next; - - while (index < length) { - if (value.charAt(index) !== C_TICK) { - break; - } - - queue += C_TICK; - index++; - } - - if (!queue) { - return; - } - - subvalue = queue; - openingCount = index; - queue = ''; - next = value.charAt(index); - count = 0; - - while (index < length) { - character = next; - next = value.charAt(index + 1); - - if (character === C_TICK) { - count++; - tickQueue += character; - } else { - count = 0; - queue += character; - } - - if (count && next !== C_TICK) { - if (count === openingCount) { - subvalue += queue + tickQueue; - found = true; - break; - } - - queue += tickQueue; - tickQueue = ''; - } - - index++; - } - - if (!found) { - if (openingCount % 2 !== 0) { - return; - } - - queue = ''; - } - - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true; - } - - contentQueue = ''; - subqueue = ''; - length = queue.length; - index = -1; - - while (++index < length) { - character = queue.charAt(index); - - if (whitespace(character)) { - subqueue += character; - continue; - } - - if (subqueue) { - if (contentQueue) { - contentQueue += subqueue; - } - - subqueue = ''; - } - - contentQueue += character; - } - - return eat(subvalue)({ - type: 'inlineCode', - value: contentQueue - }); -} |