Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@ertrzyiks
Copy link

It is impossible to get final result of parsing when tokenizer does not emit 'end' event. Side effect of this fix is additional token of type 'eof' emitted on the end of parsing (which was original idea anyway).

This is what i need, but doesnt work in current version.

module.exports.parseStream = function (stream, done) {
    var p = new MyParser();

    p.on('end', function () {
        done(null, p.getParsingResult());
    });

    stream.on('data', function (data) {
        p.write(data);
    });

    stream.on('end', function () {
        p.end();
    });
};

Note that done function can not be called on stream end, because its not end of tokenizing/parsing process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.