|
|
|
@ -161,27 +161,23 @@ Parser.prototype._parse = function(data) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Parser.prototype._resTagged = function() {
|
|
|
|
|
var m;
|
|
|
|
|
if (m = RE_LITERAL.exec(this._buffer)) {
|
|
|
|
|
// non-BODY literal -- buffer it
|
|
|
|
|
this._buffer = this._buffer.replace(RE_LITERAL, LITPLACEHOLDER);
|
|
|
|
|
this._literallen = parseInt(m[1], 10);
|
|
|
|
|
} else {
|
|
|
|
|
var m = RE_TAGGED.exec(this._buffer),
|
|
|
|
|
tagnum = parseInt(m[1], 10),
|
|
|
|
|
type = m[2].toLowerCase(),
|
|
|
|
|
textCode = (m[3] ? parseTextCode(m[3], this._literals) : m[3]),
|
|
|
|
|
text = m[4];
|
|
|
|
|
} else if (m = RE_TAGGED.exec(this._buffer)) {
|
|
|
|
|
this._buffer = '';
|
|
|
|
|
|
|
|
|
|
this._literals = [];
|
|
|
|
|
|
|
|
|
|
this.emit('tagged', {
|
|
|
|
|
type: type,
|
|
|
|
|
tagnum: tagnum,
|
|
|
|
|
textCode: textCode,
|
|
|
|
|
text: text
|
|
|
|
|
type: m[2].toLowerCase(),
|
|
|
|
|
tagnum: parseInt(m[1], 10),
|
|
|
|
|
textCode: (m[3] ? parseTextCode(m[3], this._literals) : m[3]),
|
|
|
|
|
text: m[4]
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
this._buffer = '';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Parser.prototype._resUntagged = function() {
|
|
|
|
@ -282,9 +278,15 @@ Parser.prototype._resUntagged = function() {
|
|
|
|
|
Parser.prototype._resContinue = function() {
|
|
|
|
|
var m = RE_CONTINUE.exec(this._buffer),
|
|
|
|
|
textCode,
|
|
|
|
|
text = m[2];
|
|
|
|
|
text;
|
|
|
|
|
|
|
|
|
|
this._buffer = '';
|
|
|
|
|
|
|
|
|
|
if (!m)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
text = m[2];
|
|
|
|
|
|
|
|
|
|
if (m[1] !== undefined)
|
|
|
|
|
textCode = parseTextCode(m[1], this._literals);
|
|
|
|
|
|
|
|
|
|