|
@ -85,21 +85,30 @@ function ParserInline() { |
|
|
ParserInline.prototype.skipToken = function (state) { |
|
|
ParserInline.prototype.skipToken = function (state) { |
|
|
var i, cached_pos, pos = state.pos, |
|
|
var i, cached_pos, pos = state.pos, |
|
|
rules = this.ruler.getRules(''), |
|
|
rules = this.ruler.getRules(''), |
|
|
len = rules.length; |
|
|
len = rules.length, |
|
|
|
|
|
maxNesting = state.md.options.maxNesting; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((cached_pos = state.cacheGet(pos)) > 0) { |
|
|
if ((cached_pos = state.cacheGet(pos)) > 0) { |
|
|
state.pos = cached_pos; |
|
|
state.pos = cached_pos; |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++) { |
|
|
if (state.level < maxNesting) { |
|
|
if (rules[i](state, true)) { |
|
|
for (i = 0; i < len; i++) { |
|
|
state.cacheSet(pos, state.pos); |
|
|
if (rules[i](state, true)) { |
|
|
return; |
|
|
state.cacheSet(pos, state.pos); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
state.pos++; |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
// If nesting level exceeded - skip tail to the end. That's not ordinary
|
|
|
|
|
|
// situation and we should not care about content.
|
|
|
|
|
|
state.pos = state.max; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
state.pos++; |
|
|
|
|
|
state.cacheSet(pos, state.pos); |
|
|
state.cacheSet(pos, state.pos); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -110,10 +119,17 @@ ParserInline.prototype.tokenize = function (state) { |
|
|
var ok, i, |
|
|
var ok, i, |
|
|
rules = this.ruler.getRules(''), |
|
|
rules = this.ruler.getRules(''), |
|
|
len = rules.length, |
|
|
len = rules.length, |
|
|
end = state.posMax; |
|
|
end = state.posMax, |
|
|
|
|
|
maxNesting = state.md.options.maxNesting; |
|
|
|
|
|
|
|
|
while (state.pos < end) { |
|
|
while (state.pos < end) { |
|
|
|
|
|
|
|
|
|
|
|
// If nesting level exceeded - skip tail to the end. That's not ordinary
|
|
|
|
|
|
// situation and we should not care about content.
|
|
|
|
|
|
if (state.level >= maxNesting) { |
|
|
|
|
|
state.pos = end; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
// Try all possible rules.
|
|
|
// Try all possible rules.
|
|
|
// On success, rule should:
|
|
|
// On success, rule should:
|
|
|
//
|
|
|
//
|
|
|