Skip to content
This repository was archived by the owner on Oct 13, 2024. It is now read-only.

Commit 5074967

Browse files
Merge pull request #32 from SahilK-027/main
This fixes #27
2 parents d3787bf + 3ace7b9 commit 5074967

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

FrontEnd/lexer.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,22 @@ export function tokenize(sourceCode: string): Token[] {
204204
}
205205
}
206206

207+
if (src[0] === "'") {
208+
src.shift(); // Consume the opening double quote
209+
let string = "";
210+
211+
while (src.length > 0 && src[0] !== "'") {
212+
string += src.shift();
213+
}
214+
215+
if (src[0] === "'") {
216+
src.shift(); // Consume the closing double quote
217+
return getToken(string, TokenType.String, line_cnt);
218+
} else {
219+
throw `SyntaxError:line:${line_cnt}: missing terminating ''' character.`;
220+
}
221+
}
222+
207223
return null;
208224
}
209225

feat.avenger

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
# Old for loop
2-
wakandaForEach(i in 10 to 20 step 2){
3-
vision(i);
4-
}
5-
vision();
6-
7-
# New for loop
8-
wakandaFor(newAvenger i = 0; i < 20; i = i + 1){
9-
vision(i);
10-
}
1+
newAvenger string = '"HELLO WORLD!!!"';
2+
vision(string);

0 commit comments

Comments
 (0)