Sha256: d2e54b3c2c7c702a7f2f1af936eb0b33a5cfb0e28d1a98f9deb1577c7bad8186

Contents?: true

Size: 848 Bytes

Versions: 10

Compression:

Stored size: 848 Bytes

Contents

/**
  @constructor
*/
JSDOC.TextStream = function(text) {
  if (typeof(text) == "undefined") text = "";
  text = ""+text;
  this.text = text;
  this.cursor = 0;
}

JSDOC.TextStream.prototype.look = function(n) {
  if (typeof n == "undefined") n = 0;
  
  if (this.cursor+n < 0 || this.cursor+n >= this.text.length) {
    var result = new String("");
    result.eof = true;
    return result;
  }
  return this.text.charAt(this.cursor+n);
}

JSDOC.TextStream.prototype.next = function(n) {
  if (typeof n == "undefined") n = 1;
  if (n < 1) return null;
  
  var pulled = "";
  for (var i = 0; i < n; i++) {
    if (this.cursor+i < this.text.length) {
      pulled += this.text.charAt(this.cursor+i);
    }
    else {
      var result = new String("");
      result.eof = true;
      return result;
    }
  }

  this.cursor += n;
  return pulled;
}

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sproutcore-0.9.14 jsdoc/app/lib/JSDOC/TextStream.js
sproutcore-0.9.15 jsdoc/app/lib/JSDOC/TextStream.js
sproutcore-0.9.16 jsdoc/app/lib/JSDOC/TextStream.js
sproutcore-0.9.18 jsdoc/app/lib/JSDOC/TextStream.js
sproutcore-0.9.19 jsdoc/app/lib/JSDOC/TextStream.js
sproutcore-0.9.17 jsdoc/app/lib/JSDOC/TextStream.js
sproutcore-0.9.21 jsdoc/app/lib/JSDOC/TextStream.js
sproutcore-0.9.20 jsdoc/app/lib/JSDOC/TextStream.js
sproutcore-0.9.23 jsdoc/app/lib/JSDOC/TextStream.js
sproutcore-0.9.22 jsdoc/app/lib/JSDOC/TextStream.js