[Pkg-javascript-commits] [node-expat] 156/371: merging in 1.5.0 with stream tag

Jonas Smedegaard dr at jones.dk
Sun Feb 28 09:59:57 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 af2570d46e40930df88909a495edebdb230ab612
Merge: d72f5e0 c846650
Author: Tom Hughes-Croucher <tom.croucher at gmail.com>
Date:   Tue Jun 5 14:15:40 2012 -0700

    merging in 1.5.0 with stream tag

 bench.js          | 28 +++++++++++++++---
 lib/node-expat.js | 12 ++++++++
 node-expat.cc     | 85 +++++++++++++++++++++++++++++++++++++++++++++++++------
 package.json      | 23 ++++++++-------
 test.js           | 60 +++++++++++++++++++++++++++++++++++++--
 5 files changed, 182 insertions(+), 26 deletions(-)

diff --cc lib/node-expat.js
index 7d43305,76962b2..20319b1
--- a/lib/node-expat.js
+++ b/lib/node-expat.js
@@@ -1,72 -1,54 +1,84 @@@
  var EventEmitter = require('events').EventEmitter;
  var util = require('util');
 +var Stream = require('stream').Stream;
 +
  try {
 -	var expat = require('../build/Release/node-expat');
 +  var expat = require('../build/Release/node-expat');
  } catch(e) {
 -	var expat = require('../build/default/node-expat');
 +  var expat = require('../build/default/node-expat');
  }
  
 -/**
 - * 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 Parser = function(encoding) {
 +  var that = this;
 +
 +  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(Parser, Stream);
  
 -    var that = this;
 -    this.parser.emit = function() {
 -	that.emit.apply(that, arguments);
 -    };
 +Parser.prototype.parse = function(buf, isFinal) {
 +  this.emit('data', buf);
 +  return this.parser.parse(buf, isFinal);
  };
 -util.inherits(exports.Parser, EventEmitter);
  
 -exports.Parser.prototype.parse = function(buf, isFinal) {
 -    return this.parser.parse(buf, isFinal);
 +Parser.prototype.setEncoding = function(encoding) {
 +  return this.parser.setEncoding(encoding);
  };
  
 -exports.Parser.prototype.setEncoding = function(encoding) {
 -    return this.parser.setEncoding(encoding);
 +Parser.prototype.getError = function() {
 +  return this.parser.getError();
 +};
 +Parser.prototype.stop = function() {
 +  return this.parser.stop();
 +};
 +Parser.prototype.pause = function() {
 +  return this.stop();
 +};
 +Parser.prototype.resume = function() {
 +  return this.parser.resume();
  };
  
 -exports.Parser.prototype.getError = function() {
 -    return this.parser.getError();
 +Parser.prototype.destroy = function() {
 +  this.parser.stop();
 +  this.end();
  };
 -exports.Parser.prototype.stop = function() {
 -    return this.parser.stop();
 +
 +Parser.prototype.destroySoon = function() {
 +  this.destroy();
  };
 -exports.Parser.prototype.pause = function() {
 -    return this.stop();
 +
 +Parser.prototype.write = Parser.prototype.parse;
 +
 +Parser.prototype.end = function() {
 +  this.emit('close');
 +  this.emit('end');
  };
 -exports.Parser.prototype.resume = function() {
 -    return this.parser.resume();
 +
 +
 +//Exports
 +
 +exports.Parser = Parser;
 +
 +exports.createParser = function(cb) {
 +  var parser = new Parser();
 +  if(cb)  { parser.on('startElement', cb); }
 +  return parser;
  };
+ exports.Parser.prototype.reset = function() {
+     return this.parser.reset();
+ };
+ exports.Parser.prototype.getCurrentLineNumber = function() {
+     return this.parser.getCurrentLineNumber();
+ };
+ exports.Parser.prototype.getCurrentColumnNumber = function() {
+     return this.parser.getCurrentColumnNumber();
+ };
+ exports.Parser.prototype.getCurrentByteIndex = function() {
+     return this.parser.getCurrentByteIndex();
+ };
diff --cc package.json
index e63ea71,778aae6..0f6e1dc
--- a/package.json
+++ b/package.json
@@@ -1,7 -1,8 +1,8 @@@
  { "name": "node-expat"
- ,"version": "1.4.1-streams"
 -,"version": "1.5.0"
++,"version": "1.5.0-streams"
  ,"main": "./lib/node-expat"
  ,"description": "NodeJS binding for fast XML parsing."
+ ,"keywords": ["xml","sax","expat","libexpat","parse","parsing"]
  ,"scripts" : { "install": "node-waf configure build"
  	      ,"update": "node-waf build"
  	      ,"test": "vows --spec ./test.js"

-- 
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