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

Commit ed1164d

Browse files
authored
Merge pull request #41 from SahilK-027/main
🐞 Fix functionality of != operator
2 parents 64d10b5 + 13e2aa3 commit ed1164d

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

FrontEnd/lexer.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,6 @@ export function tokenize(sourceCode: string): Token[] {
288288
tokens.push(getToken(src.shift(), TokenType.CloseBracket, line_cnt));
289289
} else if (src[0] === ";") {
290290
tokens.push(getToken(src.shift(), TokenType.Semicolon, line_cnt));
291-
} else if (src[0] === "!") {
292-
tokens.push(getToken(src.shift(), TokenType.NotOperator, line_cnt));
293291
} else if (src[0] === ":") {
294292
tokens.push(getToken(src.shift(), TokenType.Colon, line_cnt));
295293
} else if (src[0] === ",") {
@@ -361,10 +359,6 @@ export function tokenize(sourceCode: string): Token[] {
361359
tokens.push(
362360
getToken(src.shift(), TokenType.Semicolon, line_cnt),
363361
);
364-
} else if (src[0] === "!") {
365-
tokens.push(
366-
getToken(src.shift(), TokenType.NotOperator, line_cnt),
367-
);
368362
} else if (src[0] === ":") {
369363
tokens.push(getToken(src.shift(), TokenType.Colon, line_cnt));
370364
} else if (src[0] === ",") {
@@ -432,6 +426,10 @@ export function tokenize(sourceCode: string): Token[] {
432426
let backtick = "`";
433427
throw `SyntaxError:line:${line_cnt}: missing closing ${backtick} character for template interpolation.`;
434428
}
429+
} else if (src[0] === "!") {
430+
tokens.push(
431+
getToken(src.shift(), TokenType.NotOperator, line_cnt),
432+
);
435433
} else {
436434
throw `SyntaxError:line:${line_cnt}: Unrecognised character ${
437435
src[0]

feat.avenger

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
newAvenger i = 27;
2-
newEternal PI = 3.142;
3-
newAvenger template = `The value of i is: @{i} and the value of PI is @{PI}`;
4-
vision(template);
5-
vision(`Hello how are you. @{ }`);
6-
vision(`The value of 22/7 is @{22/7}`);
1+
vision(1 != 1);

0 commit comments

Comments
 (0)