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)
{
-
- if (n < 1) {
- return null;
+ eof = false;
+ if (n < 1) { //?? eof???
+ return '\0';
}
- var pulled = "";
+ char pulled;
for (var i = 0; i < n; i++) {
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