[Pkg-javascript-commits] [node-expat] 163/371: Merge 'sh1mmer/master' (streams)
Jonas Smedegaard
dr at jones.dk
Sun Feb 28 09:59:58 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository node-expat.
commit 844aaf81d8a8a757afae5d286213a086936b5014
Merge: 1d3df37 0cda347
Author: Astro <astro at spaceboyz.net>
Date: Fri Jun 22 02:56:45 2012 +0200
Merge 'sh1mmer/master' (streams)
Conflicts:
lib/node-expat.js
expat-bench.js | 10 +
lib/node-expat.js | 83 +-
mystic-library.xml | 42160 +++++++++++++++++++++++++++++++++++++++++++++++++++
package.json | 2 +-
4 files changed, 42227 insertions(+), 28 deletions(-)
diff --cc lib/node-expat.js
index f2334a7,c57853b..d676c5a
--- a/lib/node-expat.js
+++ b/lib/node-expat.js
@@@ -1,51 -1,80 +1,80 @@@
var EventEmitter = require('events').EventEmitter;
var util = require('util');
+// Only support nodejs v0.6 and on so no need to look for older module location
+var expat = require('../build/Release/node_expat.node');
+ var Stream = require('stream').Stream;
- /**
- * Simple wrapper because EventEmitter has turned pure-JS as of node
- * 0.5.x.
- */
- exports.Parser = function(encoding) {
- this.parser = new expat.Parser(encoding);
-var expat = require('../build/Release/node-expat');
-
+ var Parser = function(encoding) {
+ var that = this;
- var that = this;
- this.parser.emit = function() {
- that.emit.apply(that, arguments);
- };
+ this.parser = new expat.Parser(encoding);
+ this.parser.emit = function() {
+ that.emit.apply(that, arguments);
+ };
+
+ //stream API
+ this.writable = true;
+ this.readable = true;
};
- util.inherits(exports.Parser, EventEmitter);
+ util.inherits(Parser, Stream);
- exports.Parser.prototype.parse = function(buf, isFinal) {
- return this.parser.parse(buf, isFinal);
+ Parser.prototype.parse = function(buf, isFinal) {
+ this.emit('data', buf);
+ return this.parser.parse(buf, isFinal);
};
- exports.Parser.prototype.setEncoding = function(encoding) {
- return this.parser.setEncoding(encoding);
+ Parser.prototype.setEncoding = function(encoding) {
+ return this.parser.setEncoding(encoding);
};
- exports.Parser.prototype.getError = function() {
- return this.parser.getError();
+ Parser.prototype.getError = function() {
+ return this.parser.getError();
+ };
+ Parser.prototype.stop = function() {
+ return this.parser.stop();
};
- exports.Parser.prototype.stop = function() {
- return this.parser.stop();
+ Parser.prototype.pause = function() {
+ return this.stop();
};
- exports.Parser.prototype.pause = function() {
- return this.stop();
+ Parser.prototype.resume = function() {
+ return this.parser.resume();
};
- exports.Parser.prototype.resume = function() {
- return this.parser.resume();
+
+ Parser.prototype.destroy = function() {
+ this.parser.stop();
+ this.end();
};
- exports.Parser.prototype.reset = function() {
+
+ Parser.prototype.destroySoon = function() {
+ this.destroy();
+ };
+
+ Parser.prototype.write = Parser.prototype.parse;
+
+ Parser.prototype.end = function() {
+ this.emit('close');
+ this.emit('end');
+ };
+
+ Parser.prototype.reset = function() {
return this.parser.reset();
};
- exports.Parser.prototype.getCurrentLineNumber = function() {
+ Parser.prototype.getCurrentLineNumber = function() {
return this.parser.getCurrentLineNumber();
};
- exports.Parser.prototype.getCurrentColumnNumber = function() {
+ Parser.prototype.getCurrentColumnNumber = function() {
return this.parser.getCurrentColumnNumber();
};
- exports.Parser.prototype.getCurrentByteIndex = function() {
+ Parser.prototype.getCurrentByteIndex = function() {
return this.parser.getCurrentByteIndex();
};
+
+ //Exports
+
+ exports.Parser = Parser;
+
+ exports.createParser = function(cb) {
+ var parser = new Parser();
+ if(cb) { parser.on('startElement', cb); }
+ return parser;
+ };
diff --cc package.json
index 0ea3510,0f6e1dc..09a2fad
--- a/package.json
+++ b/package.json
@@@ -18,7 -18,7 +18,7 @@@
, "email": "astro at spaceboyz.net"
, "web": "http://spaceboyz.net/~astro/"
}
- ,"contributors": ["Stephan Maka", "Derek Hammer", "Iein Valdez", "Peter Körner", "Camilo Aguilar", "Michael Weibel", "Alexey Zhuchkov", "Satyam Shekhar", "Dhruv Matani", "Andreas Botsikas"]
-,"contributors": ["Stephan Maka", "Derek Hammer", "Iein Valdez", "Peter Körner", "Camilo Aguilar", "Michael Weibel", "Alexey Zhuchkov", "Satyam Shekhar"]
++,"contributors": ["Stephan Maka", "Derek Hammer", "Iein Valdez", "Peter Körner", "Camilo Aguilar", "Michael Weibel", "Alexey Zhuchkov", "Satyam Shekhar", "Dhruv Matani", "Andreas Botsikas", "Tom Hughes-Croucher"]
,"licenses": [{ "type": "MIT" }]
,"engines": { "node": ">=0.4" }
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-expat.git
More information about the Pkg-javascript-commits
mailing list