From 6a05b0674c7a27599b0f222e2e7d88e4fa16c59c Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 17 Oct 2014 00:22:31 +0400 Subject: [PATCH] Simplified StateInline --- lib/parser_ref.js | 2 +- lib/rules_inline/state_inline.js | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/parser_ref.js b/lib/parser_ref.js index 7aa9039..f010c0c 100644 --- a/lib/parser_ref.js +++ b/lib/parser_ref.js @@ -57,7 +57,7 @@ module.exports = function parse_reference(str, parser, options, env) { } // ensure that the end of the line is empty - pos = state.skipSpaces(pos); + while (pos < max && state.src.charCodeAt(pos) === 0x20/* space */) { pos++; } if (pos < max && state.src.charCodeAt(pos) !== 0x0A) { return -1; } label = normalizeReference(str.slice(1, labelEnd)); diff --git a/lib/rules_inline/state_inline.js b/lib/rules_inline/state_inline.js index 40be36a..b361664 100644 --- a/lib/rules_inline/state_inline.js +++ b/lib/rules_inline/state_inline.js @@ -42,11 +42,5 @@ StateInline.prototype.push = function (token) { this.pendingLevel = this.level; }; -StateInline.prototype.skipSpaces = function skipSpaces(pos) { - for (var max = this.src.length; pos < max; pos++) { - if (this.src.charCodeAt(pos) !== 0x20/* space */) { break; } - } - return pos; -}; module.exports = StateInline;