1 //<script type="text/javscript">
10 public class TextStreamChar : Object {
13 public TextStreamChar(char val, bool eof=false) {
19 public class TextStream : Object {
24 public TextStream (string text = "")
32 public TextStreamChar look(int n = 0) {
35 if (this.cursor+n < 0 || this.cursor+n >= this.text.length) {
36 return new TextStreamChar('\0', true);
38 return new TextStreamChar(this.text[this.cursor+n], false);
41 public TextStreamChar? next(int n = 1)
49 for (var i = 0; i < n; i++) {
50 if (this.cursor+i < this.text.length) {
51 pulled += this.text.charAt(this.cursor+i);
53 return new TextStreamChar('\0', true);
59 return new TextStreamChar(pulled, false);