diff --git a/FrontEnd/lexer.ts b/FrontEnd/lexer.ts index 64758ca..619bf50 100644 --- a/FrontEnd/lexer.ts +++ b/FrontEnd/lexer.ts @@ -204,6 +204,22 @@ export function tokenize(sourceCode: string): Token[] { } } + if (src[0] === "'") { + src.shift(); // Consume the opening double quote + let string = ""; + + while (src.length > 0 && src[0] !== "'") { + string += src.shift(); + } + + if (src[0] === "'") { + src.shift(); // Consume the closing double quote + return getToken(string, TokenType.String, line_cnt); + } else { + throw `SyntaxError:line:${line_cnt}: missing terminating ''' character.`; + } + } + return null; } diff --git a/feat.avenger b/feat.avenger index f908449..7f5fdde 100644 --- a/feat.avenger +++ b/feat.avenger @@ -1,10 +1,2 @@ -# Old for loop -wakandaForEach(i in 10 to 20 step 2){ - vision(i); -} -vision(); - -# New for loop -wakandaFor(newAvenger i = 0; i < 20; i = i + 1){ - vision(i); -} \ No newline at end of file +newAvenger string = '"HELLO WORLD!!!"'; +vision(string); \ No newline at end of file