This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository eshell.
View the commit online.
commit c783321c9eb46cb1a06e564eb90f2ff90f028b35
Author: swagtoy <m...@ow.swag.toys>
AuthorDate: Thu Nov 21 14:31:16 2024 -0500
lexer: Fix licensing + stringify functions
---
LICENSE | 2 +-
escript/include/escript.h | 2 ++
escript/include/lexer.h | 4 +++-
escript/src/lexer.c | 8 +++++---
escript/src/stringify.c | 28 ++++++++++++++++++++++++++++
5 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/LICENSE b/LICENSE
index a1e8ca3..9cb8d62 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2024 swagtoy
+Copyright (c) 2024 Hyland B. (swagtoy)
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
diff --git a/escript/include/escript.h b/escript/include/escript.h
index 64ed043..7a151c4 100644
--- a/escript/include/escript.h
+++ b/escript/include/escript.h
@@ -1,4 +1,6 @@
/* Escript - escript.h
+ * ---
+ * Copyright (c) 2024 Hyland B. (swagtoy)
* Licensed under BSD 2-Clause
*/
diff --git a/escript/include/lexer.h b/escript/include/lexer.h
index 049c97e..b54b6c2 100644
--- a/escript/include/lexer.h
+++ b/escript/include/lexer.h
@@ -1,4 +1,6 @@
-/* Escript - escript.h
+/* Escript - lexer.h
+ * ---
+ * Copyright (c) 2024 Hyland B. (swagtoy)
* Licensed under BSD 2-Clause
*/
diff --git a/escript/src/lexer.c b/escript/src/lexer.c
index 9282f8c..079ab9f 100644
--- a/escript/src/lexer.c
+++ b/escript/src/lexer.c
@@ -1,7 +1,7 @@
-/* Eshell - lexer.c
- * Licensed under BSD 2-Clause
+/* Escript - lexer.c
* ---
- * Lexer for Escript.
+ * Copyright (c) 2024 Hyland B. (swagtoy)
+ * Licensed under BSD 2-Clause
*/
#include <stdio.h>
@@ -82,6 +82,8 @@ lex_identifier(struct Escript_Lexer* lex)
return res;
}
+
+
char const* const
escript_token_info_str(struct Escript_Token* token)
{
diff --git a/escript/src/stringify.c b/escript/src/stringify.c
new file mode 100644
index 0000000..c46e6ba
--- /dev/null
+++ b/escript/src/stringify.c
@@ -0,0 +1,28 @@
+/* Escript - stringify.c
+ * ---
+ * Copyright (c) 2024 Hyland B. (swagtoy)
+ * Licensed under BSD 2-Clause
+ */
+
+/*
+ * Stringification utilities. Typically these return, uhh, strings.
+ */
+
+#include "lexer.h"
+
+char const* const
+escript_lexer_token_to_string(struct Escript_Token* token)
+{
+#define STR_TOK(x, ret) case ELEX_ ## x: return ref;
+ switch (token->token)
+ {
+ STR_TOK(WHILE, "while")
+ STR_TOK(IF, "if")
+ STR_TOK(UNLESS, "unless")
+ STR_TOK(DO, "do")
+ STR_TOK(FUN, "fun")
+ STR_TOK(TYPE, "type")
+ default: return "";
+ }
+#undef STRINGIFY
+}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.