From fa9f2fa5d1c4fe7dfc4e442df2ea0d263c700846 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 10 Sep 2015 17:49:50 +0800 Subject: [PATCH] JSDOC/TextStream.vala --- JSDOC/TextStream.vala | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/JSDOC/TextStream.vala b/JSDOC/TextStream.vala index cc0c364..599ed8b 100644 --- a/JSDOC/TextStream.vala +++ b/JSDOC/TextStream.vala @@ -29,18 +29,20 @@ namespace JSDOC { this.cursor = 0; } - public TextStreamChar look(int n = 0) { - + public char look(int n = 0, out bool eof) + { + eof = false; if (this.cursor+n < 0 || this.cursor+n >= this.text.length) { - return new TextStreamChar('\0', true); + eof = true; + return '\0'; } - return new TextStreamChar(this.text[this.cursor+n], false); + return this.text[this.cursor+n]; }, - public TextStreamChar? next(int n = 1) + public char next(int n = 1, out bool eof) { - + eof = false; if (n < 1) { return null; } @@ -50,13 +52,16 @@ namespace JSDOC { if (this.cursor+i < this.text.length) { pulled += this.text.charAt(this.cursor+i); } else { - return new TextStreamChar('\0', true); + eof =true; + return '\0'; + } } this.cursor += n; - return new TextStreamChar(pulled, false); + return pulled; } - }); \ No newline at end of file + } +} \ No newline at end of file -- 2.39.2