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 84d60a5aed249485d4f9d35eb205cd701a05658b
Author: swagtoy <m...@ow.swag.toys>
AuthorDate: Sun Nov 24 18:08:17 2024 -0500

    lexer: WIP data stringification
---
 escript/include/stringify.h |  5 +++++
 escript/src/lexer.c         |  7 +++++--
 escript/src/stringify.c     | 19 +++++++++++++++++++
 3 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/escript/include/stringify.h b/escript/include/stringify.h
index e871542..23129e3 100644
--- a/escript/include/stringify.h
+++ b/escript/include/stringify.h
@@ -8,6 +8,11 @@
 #ifndef ESCRIPT_STRINGIFY_H
 #define ESCRIPT_STRINGIFY_H
 
+#include "lexer.h"
+
+char* const
+escript_lexer_data_to_string(struct Escript_Token* data, char* should_free);
+
 char const* const
 escript_lexer_token_to_string(enum Escript_Lex_Tokens token);
 
diff --git a/escript/src/lexer.c b/escript/src/lexer.c
index 4e1551f..0134e53 100644
--- a/escript/src/lexer.c
+++ b/escript/src/lexer.c
@@ -9,6 +9,7 @@
 #include <ctype.h>
 #include "lexer.h"
 #include "eina_inarray.h"
+#include "eina_strbuf.h"
 #include "stringify.h"
 
 #define at(i) lex->current[i]
@@ -109,10 +110,12 @@ char const* const
 escript_token_info_str(struct Escript_Token* token)
 {
 	Eina_Strbuf* const res = eina_strbuf_new();
+	char tofree;
 	eina_strbuf_append_printf(res,
 		"Token: %s\n"
-		"Data: yes"
-		,escript_lexer_token_to_string(token->token));
+		"Data: %s",
+		escript_lexer_token_to_string(token->token),
+		escript_lexer_value_to_string(token->data, &tofree));
 	return eina_strbuf_string_steal(res);
 }
 
diff --git a/escript/src/stringify.c b/escript/src/stringify.c
index 94d3797..51e7032 100644
--- a/escript/src/stringify.c
+++ b/escript/src/stringify.c
@@ -8,8 +8,27 @@
  * Stringification utilities. Typically these return, uhh, strings.
  */
 
+#include "stringify.h"
+#include "eina_strbuf.h"
 #include "lexer.h"
 
+char* const
+escript_lexer_data_to_string(struct Escript_Token* data, char* tofree)
+{
+	char* strdata = NULL;
+
+	*tofree = 0;
+	switch (data->token)
+	{
+	case ELEX_IDENTIFIER:
+		return data->data.d_string.str;
+	default:
+		break;
+	}
+	
+	return strdata;
+}
+
 char const* const
 escript_lexer_token_to_string(enum Escript_Lex_Tokens token)
 {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to