@@ -5,22 +5,22 @@ class JsonParser {
55 init(input) {
66 this.input = input;
77 this.pos = 0;
8- this.len = length (input);
8+ this.len = len (input);
99 }
1010
11- func peek() {
11+ peek() {
1212 if (this.pos >= this.len) return "";
1313 return substr(this.input, this.pos, 1);
1414 }
1515
16- func consume() {
16+ consume() {
1717 if (this.pos >= this.len) return "";
1818 let c = substr(this.input, this.pos, 1);
1919 this.pos = this.pos + 1;
2020 return c;
2121 }
2222
23- func parse() {
23+ parse() {
2424 this.skipWhitespace();
2525 let c = this.peek();
2626
@@ -31,7 +31,7 @@ class JsonParser {
3131 return this.parseString();
3232 }
3333
34- func skipWhitespace() {
34+ skipWhitespace() {
3535 while (this.pos < this.len) {
3636 let c = this.peek();
3737 if (c == " " || c == "\n" || c == "\t") {
@@ -42,7 +42,7 @@ class JsonParser {
4242 }
4343 }
4444
45- func parseObject() {
45+ parseObject() {
4646 this.consume(); // {
4747 let obj = {};
4848 this.skipWhitespace();
@@ -66,7 +66,7 @@ class JsonParser {
6666 return obj;
6767 }
6868
69- func parseArray() {
69+ parseArray() {
7070 this.consume(); // [
7171 let arr = [];
7272 this.skipWhitespace();
@@ -84,7 +84,7 @@ class JsonParser {
8484 return arr;
8585 }
8686
87- func parseString() {
87+ parseString() {
8888 this.consume(); // "
8989 let res = "";
9090 while (this.peek() != "\"") {
@@ -104,7 +104,7 @@ func main() {
104104 }
105105 json_str = json_str + "]}";
106106
107- print("JSON Length: " + to_string(length (json_str)));
107+ print("JSON Length: " + to_string(len (json_str)));
108108
109109 let start = time();
110110
@@ -115,7 +115,7 @@ func main() {
115115
116116 // Check result
117117 let users = res["users"];
118- print("Parsed " + to_string(length (users)) + " users");
118+ print("Parsed " + to_string(len (users)) + " users");
119119 print("Time: " + to_string(elapsed));
120120}
121121
0 commit comments