aboutsummaryrefslogtreecommitdiff
path: root/lib/Lexer/Lexer.cc
diff options
context:
space:
mode:
author_ov4 <hausemasterstream@gmail.com>2026-03-03 07:22:19 +0000
committer_ov4 <hausemasterstream@gmail.com>2026-03-03 07:22:19 +0000
commitcc7b9b34e99fa17357e14ac69f5fb2d1535b5512 (patch)
tree40f093ef98c062a14a3b839ad2337646437645e9 /lib/Lexer/Lexer.cc
parent1b524f75401a6318fbaf3fee0bfcbe59348f2e51 (diff)
Added all built-in functions
Diffstat (limited to 'lib/Lexer/Lexer.cc')
-rw-r--r--lib/Lexer/Lexer.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/Lexer/Lexer.cc b/lib/Lexer/Lexer.cc
index 040c3e8..ef3a920 100644
--- a/lib/Lexer/Lexer.cc
+++ b/lib/Lexer/Lexer.cc
@@ -15,15 +15,24 @@ int Lexer::gettok() {
LastChar = getchar();
}
- if (LastChar == '"') {
+ if (LastChar == '"' || LastChar == '\'') {
+ char QuoteType = LastChar;
StringVal = "";
+
LastChar = getchar();
- while (LastChar != '"' && LastChar != EOF) {
+
+ while (LastChar != QuoteType && LastChar != EOF && LastChar != '\n') {
StringVal += LastChar;
LastChar = getchar();
}
- if (LastChar == '"') LastChar = getchar();
- return tok_string_literal;
+
+ if (LastChar == QuoteType) {
+ LastChar = getchar();
+ } else {
+ fprintf(stderr, "Error: Unterminated string or char literal\n");
+ }
+
+ return tok_string_literal;
}
if (isalpha(LastChar)) {
@@ -73,6 +82,7 @@ int Lexer::gettok() {
if (IdentifierStr == "LENGTH") return tok_length;
if (IdentifierStr == "MID") return tok_mid;
if (IdentifierStr == "RIGHT") return tok_right;
+ if (IdentifierStr == "LEFT") return tok_left;
if (IdentifierStr == "LCASE") return tok_lcase;
if (IdentifierStr == "UCASE") return tok_ucase;