rittenhop-dev/versions/5.94.2/node_modules/nearley/lib/stream.js

19 lines
385 B
JavaScript
Raw Normal View History

2024-09-23 19:40:12 -04:00
// Node-only
var Writable = require('stream').Writable;
var util = require('util');
function StreamWrapper(parser) {
Writable.call(this);
this._parser = parser;
}
util.inherits(StreamWrapper, Writable);
StreamWrapper.prototype._write = function write(chunk, encoding, callback) {
this._parser.feed(chunk.toString());
callback();
};
module.exports = StreamWrapper;