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

🐞 Fix functionality of != operator #41

Merged
merged 3 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions FrontEnd/lexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,6 @@ export function tokenize(sourceCode: string): Token[] {
tokens.push(getToken(src.shift(), TokenType.CloseBracket, line_cnt));
} else if (src[0] === ";") {
tokens.push(getToken(src.shift(), TokenType.Semicolon, line_cnt));
} else if (src[0] === "!") {
tokens.push(getToken(src.shift(), TokenType.NotOperator, line_cnt));
} else if (src[0] === ":") {
tokens.push(getToken(src.shift(), TokenType.Colon, line_cnt));
} else if (src[0] === ",") {
Expand Down Expand Up @@ -361,10 +359,6 @@ export function tokenize(sourceCode: string): Token[] {
tokens.push(
getToken(src.shift(), TokenType.Semicolon, line_cnt),
);
} else if (src[0] === "!") {
tokens.push(
getToken(src.shift(), TokenType.NotOperator, line_cnt),
);
} else if (src[0] === ":") {
tokens.push(getToken(src.shift(), TokenType.Colon, line_cnt));
} else if (src[0] === ",") {
Expand Down Expand Up @@ -432,6 +426,10 @@ export function tokenize(sourceCode: string): Token[] {
let backtick = "`";
throw `SyntaxError:line:${line_cnt}: missing closing ${backtick} character for template interpolation.`;
}
} else if (src[0] === "!") {
tokens.push(
getToken(src.shift(), TokenType.NotOperator, line_cnt),
);
} else {
throw `SyntaxError:line:${line_cnt}: Unrecognised character ${
src[0]
Expand Down
7 changes: 1 addition & 6 deletions feat.avenger
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
newAvenger i = 27;
newEternal PI = 3.142;
newAvenger template = `The value of i is: @{i} and the value of PI is @{PI}`;
vision(template);
vision(`Hello how are you. @{ }`);
vision(`The value of 22/7 is @{22/7}`);
vision(1 != 1);
Loading