aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authors-over-42023-06-13 15:29:47 -0400
committers-over-42023-06-13 15:29:47 -0400
commit0410bab11f4be35c22916935509a62a7e7bd8bd2 (patch)
tree51efa093abbdc1be32bc7e23e4d358ec1da347be
parentd1438b178e922f7eca9c9f63c475d62d75323518 (diff)
ok
-rw-r--r--Makefile4
-rw-r--r--examples/hello.halk4
-rwxr-xr-xhalkbin31144 -> 30992 bytes
-rw-r--r--src/include/util.h3
-rw-r--r--src/lexer.c8
-rw-r--r--src/util.c21
6 files changed, 12 insertions, 28 deletions
diff --git a/Makefile b/Makefile
index 6628a8b..e45eff1 100644
--- a/Makefile
+++ b/Makefile
@@ -13,10 +13,10 @@ $(name): $(objects)
install:
make
- cp ./$(name) $(HOME)/.local/bin/$(name)
+ cp ./$(name) /usr/local/bin/$(name)
uninstall:
- rm -f $(HOME)/.local/bin/$(name)
+ rm -f /usr/local/bin/$(name)
clean:
rm -f ./$(name) ./src/*.o
diff --git a/examples/hello.halk b/examples/hello.halk
index 0bd40fe..b0999cc 100644
--- a/examples/hello.halk
+++ b/examples/hello.halk
@@ -1,8 +1,6 @@
-
-:str:hello = 'qwertyuiopasdfghjklzxcvbnm1234567890lakjsdhfpqiuelljaksdfbvvvviu3o4448y5o23ilfn';
+**
:str:hello = 'hello, ';
-
:void:greeting. :str:to = { ` functions declared the same way as variables, but with a . after
the name, followed by arguments `
diff --git a/halk b/halk
index 316ecc6..4c55148 100755
--- a/halk
+++ b/halk
Binary files differ
diff --git a/src/include/util.h b/src/include/util.h
index a8efe7a..63ee8bb 100644
--- a/src/include/util.h
+++ b/src/include/util.h
@@ -7,10 +7,9 @@
#include <stdio.h>
+void die(const char* fmt, ...);
void log_inf(const char* fmt, ...);
void log_raw(const char* fmt, ...);
void log_war(const char* fmt, ...);
-void log_err(const char* fmt, ...);
-void die(const char* fmt, ...);
#endif
diff --git a/src/lexer.c b/src/lexer.c
index 553a794..aca05e3 100644
--- a/src/lexer.c
+++ b/src/lexer.c
@@ -155,7 +155,13 @@ token_t* lexer_get_next_token(lexer_t* lexer) {
return token_init(TOKEN_EOF, lexer_get_c_as_string(lexer));
break;
default:
- return token_init(TOKEN_UNKNOWN, lexer_get_c_as_string(lexer));
+ return lexer_next_token(
+ lexer,
+ token_init(
+ TOKEN_UNKNOWN,
+ lexer_get_c_as_string(lexer)
+ )
+ );
}
}
diff --git a/src/util.c b/src/util.c
index 5bdabfa..b4a2e15 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3,7 +3,7 @@
void die(const char* fmt, ...) {
va_list ap;
- fprintf(stderr, "== FATAL ERROR ==\n");
+ fprintf(stderr, "== ERROR ==\n");
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
@@ -61,22 +61,3 @@ void log_war(const char* fmt, ...) {
fprintf(stderr, "\n");
}
-
-void log_err(const char* fmt, ...) {
- va_list ap;
-
- fprintf(stderr, "== ERROR ==");
-
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
-
- if (fmt[0] && fmt[strlen(fmt) - 1] == ':') {
- fputc(' ', stderr);
- perror(NULL);
- } else {
- fputc('\n', stderr);
- }
-
- fprintf(stderr, "\n");
-}