projects
/
gnome.introspection-doc-generator
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JSDOC/Packer.vala
[gnome.introspection-doc-generator]
/
JSDOC
/
TextStream.vala
diff --git
a/JSDOC/TextStream.vala
b/JSDOC/TextStream.vala
index
cc0c364
..
f5bb725
100644
(file)
--- a/
JSDOC/TextStream.vala
+++ b/
JSDOC/TextStream.vala
@@
-20,43
+20,60
@@
namespace JSDOC {
string text;
int cursor;
string text;
int cursor;
+ int length;
public TextStream (string text = "")
{
this.text = text;
public TextStream (string text = "")
{
this.text = text;
+ this.length = text.length; // text.char_count();
this.cursor = 0;
}
this.cursor = 0;
}
- public
TextStreamChar look(int n = 0) {
-
-
- if (this.cursor+n < 0 || this.cursor+n >= this.
text.
length) {
- return
new TextStreamChar('\0', true)
;
+ public
char look(int n = 0)
+ {
+
+ if (this.cursor+n < 0 || this.cursor+n >= this.length) {
+ return
'\0'
;
}
}
- return
new TextStreamChar(this.text[this.cursor+n], false
);
- }
,
-
- public
TextStreamChar? next(int n = 1
)
+ return
this.text[this.cursor+n]; // this.text.get_char(this.cursor+n
);
+ }
+
+ public
bool lookEOF(int n = 0
)
{
{
-
- if (n < 1) {
- return null;
+ if (this.cursor+n < 0 || this.cursor+n >= this.length) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @param n - number of characters to return..
+ */
+ public string next(int n = 1)
+ {
+
+ if (n < 1) { //?? eof???
+ return "\0";
}
}
- var pulled = "";
- for (var i = 0; i < n; i++) {
- if (this.cursor+i < this.text.length) {
- pulled += this.text.charAt(this.cursor+i);
+ string pulled = "";
+ var i = 0;
+ while (i < n) {
+ if (this.cursor+i < this.length) {
+ 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 {
} else {
- return
new TextStreamChar('\0', true)
;
+ return
""
;
}
}
}
}
- this.cursor +=
n
;
- return
new TextStreamChar(pulled, false)
;
+ this.cursor +=
pulled.length
;
+ return
pulled
;
}
}
- });
\ No newline at end of file
+ }
+}
\ No newline at end of file