X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=JSDOC%2FTextStream.vala;h=f5bb7258fce7e3965ceb9fc1f595af5dd86f1873;hb=53b1092ed504e2d0fbd10d508b4b2b505a4eeff0;hp=4ebddae4477b6149bf53198199dbdbc7c1ceca62;hpb=b153432f56262d2ab4c27155969941af3f2174fb;p=gnome.introspection-doc-generator diff --git a/JSDOC/TextStream.vala b/JSDOC/TextStream.vala index 4ebddae..f5bb725 100644 --- a/JSDOC/TextStream.vala +++ b/JSDOC/TextStream.vala @@ -27,7 +27,7 @@ namespace JSDOC { this.text = text; - this.length = text.char_count() + this.length = text.length; // text.char_count(); this.cursor = 0; } @@ -37,38 +37,41 @@ namespace JSDOC { if (this.cursor+n < 0 || this.cursor+n >= this.length) { return '\0'; } - return this.text[this.cursor+n]; - }, + return this.text[this.cursor+n]; // this.text.get_char(this.cursor+n); + } public bool lookEOF(int n = 0) { - if (this.cursor+n < 0 || this.cursor+n >= this.length)) { + if (this.cursor+n < 0 || this.cursor+n >= this.length) { return true; } - return false - }, + return false; + } - - public char next(int n = 1, out bool eof) + /** + * @param n - number of characters to return.. + */ + public string next(int n = 1) { - eof = false; + if (n < 1) { //?? eof??? - return '\0'; + return "\0"; } - char pulled; - for (var i = 0; i < n; i++) { + string pulled = ""; + var i = 0; + while (i < n) { if (this.cursor+i < this.length) { - pulled += this.text.get_char(this.cursor+i); + var add = this.text[this.cursor+i]; //this.text.get_char(this.cursor+i).to_string(); + pulled += add.to_string(); + i += 1;// add.length; } else { - eof =true; - return '\0'; - + return ""; } } - this.cursor += n; + this.cursor += pulled.length; return pulled; }