|
|
@ -57,3 +57,33 @@ module.exports = function text(state, silent) { |
|
|
|
|
|
|
|
return true; |
|
|
|
}; |
|
|
|
|
|
|
|
// Alternative implementation, for memory.
|
|
|
|
//
|
|
|
|
// It costs 10% of performance, but allows extend terminators list, if place it
|
|
|
|
// to `ParcerInline` property. Probably, will switch to it sometime, such
|
|
|
|
// flexibility required.
|
|
|
|
|
|
|
|
/* |
|
|
|
var TERMINATOR_RE = /[\n!#$%&*+\-:<=>@[\\\]^_`{}~]/; |
|
|
|
|
|
|
|
module.exports = function text(state, silent) { |
|
|
|
var pos = state.pos, |
|
|
|
idx = state.src.slice(pos).search(TERMINATOR_RE); |
|
|
|
|
|
|
|
// first char is terminator -> empty text
|
|
|
|
if (idx === 0) { return false; } |
|
|
|
|
|
|
|
// no terminator -> text till end of string
|
|
|
|
if (idx < 0) { |
|
|
|
if (!silent) { state.pending += state.src.slice(pos); } |
|
|
|
state.pos = state.src.length; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
if (!silent) { state.pending += state.src.slice(pos, pos + idx); } |
|
|
|
|
|
|
|
state.pos += idx; |
|
|
|
|
|
|
|
return true; |
|
|
|
};*/ |
|
|
|