about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-05-15 15:38:15 +0200
committerBaitinq <[email protected]>2025-05-15 15:38:15 +0200
commit9a99f558ed2cc55e0dba2db06a1ba13949c99748 (patch)
treed36428e23e9573f14ad50c3e178d65487bd315bc /src
parentBootstrap: Tokenizer: Continue implementing (diff)
downloadpry-lang-9a99f558ed2cc55e0dba2db06a1ba13949c99748.tar.gz
pry-lang-9a99f558ed2cc55e0dba2db06a1ba13949c99748.tar.bz2
pry-lang-9a99f558ed2cc55e0dba2db06a1ba13949c99748.zip
Bootstrap: Tokenizer: Tokenize keywords
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/tokenizer.src85
1 files changed, 81 insertions, 4 deletions
diff --git a/src/bootstrap/tokenizer.src b/src/bootstrap/tokenizer.src
index 21cbf7e..ffc7e96 100644
--- a/src/bootstrap/tokenizer.src
+++ b/src/bootstrap/tokenizer.src
@@ -113,16 +113,93 @@ let tokenizer_next = () => *i8 {
 	};
 
 	if tokenizer_accept_string("import") {
-		return "import";
+	    return "import";
+	};
+	if tokenizer_accept_string("let") {
+	    return "let";
+	};
+	if tokenizer_accept_string("extern") {
+	    return "extern";
+	};
+	if tokenizer_accept_string("if") {
+	    return "if";
+	};
+	if tokenizer_accept_string("while") {
+	    return "while";
+	};
+	if tokenizer_accept_string("return") {
+	    return "return";
+	};
+	if tokenizer_accept_string("break") {
+	    return "break";
+	};
+	if tokenizer_accept_string("true") {
+	    return "bool:true";
+	};
+	if tokenizer_accept_string("false") {
+	    return "bool:false";
+	};
+
+	if tokenizer_accept_string("=>") {
+	    return "=>";
+	};
+	if tokenizer_accept_string(";") {
+	    return ";";
+	};
+	if tokenizer_accept_string(",") {
+	    return ",";
+	};
+	if tokenizer_accept_string(":") {
+	    return ":";
+	};
+	if tokenizer_accept_string("(") {
+	    return "(";
+	};
+	if tokenizer_accept_string(")") {
+	    return ")";
+	};
+	if tokenizer_accept_string("{") {
+	    return "{";
+	};
+	if tokenizer_accept_string("}") {
+	    return "}";
+	};
+	if tokenizer_accept_string("=") {
+	    return "=";
+	};
+	if tokenizer_accept_string("+") {
+	    return "+";
+	};
+	if tokenizer_accept_string("-") {
+	    return "-";
+	};
+	if tokenizer_accept_string("*") {
+	    return "*";
+	};
+	if tokenizer_accept_string("/") {
+	    return "/";
+	};
+	if tokenizer_accept_string("%") {
+	    return "%";
+	};
+	if tokenizer_accept_string("!") {
+	    return "!";
+	};
+	if tokenizer_accept_string("<") {
+	    return "<";
+	};
+	if tokenizer_accept_string(">") {
+	    return ">";
 	};
 
 	let c = (*(buf + offset));
 
 	offset = offset + 1;
 
-	let t = malloc(2);
-	(*(t + 0)) = c;
-	(*(t + 1)) = '\0';
+	let t = malloc(13);
+	memcpy(t, "identifier:", 11);
+	(*(t + 11)) = c;
+	(*(t + 12)) = '\0';
 
 	return t;
 };