this.cursor = 0;
}
- public char 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) {
- var result = new String("");
- result.eof = true;
- return result;
+ eof = true;
+ return '\0';
}
- return this.text.charAt(this.cursor+n);
+ return this.text[this.cursor+n];
},
- next : function(n) {
- if (typeof n == "undefined") n = 1;
- if (n < 1) return null;
+ public char next(int n = 1, out bool eof)
+ {
+ eof = false;
+ 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;
- }
+ var pulled = "";
+ for (var i = 0; i < n; i++) {
+ if (this.cursor+i < this.text.length) {
+ pulled += this.text.charAt(this.cursor+i);
+ } else {
+ eof =true;
+ return '\0';
+
+
}
-
- this.cursor += n;
- return pulled;
}
- });
\ No newline at end of file
+
+ this.cursor += n;
+ return pulled;
+
+ }
+ }
+}
\ No newline at end of file