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 ad59bba21996d8c8af26215d469144ae5a27dbbe
Author: Swagtoy <m...@ow.swag.toys>
AuthorDate: Thu Nov 21 03:29:56 2024 -0500

    lexer: Useful debug hacks
    
    Well.. almost useful :/
---
 escript/src/lexer.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/escript/src/lexer.c b/escript/src/lexer.c
index 38de566..a18fb6f 100644
--- a/escript/src/lexer.c
+++ b/escript/src/lexer.c
@@ -82,14 +82,30 @@ lex_identifier(struct Escript_Lexer* lex)
 	return res;
 }
 
+char const* const
+escript_token_info_str(struct Escript_Token* token)
+{
+	Eina_Strbuf* const res = eina_strbuf_new();
+	eina_strbuf_append_printf(res,
+		"Token: %d\n"
+		"Data: yes"
+		,token->token);
+	return eina_strbuf_string_steal(res);
+}
+
 // Will clean this up later
 void
 escript_print_tokens(struct Escript_Lexer* lex)
 {
 	struct Escript_Token* token;
+	char* str;
+	puts("---");
 	EINA_INARRAY_FOREACH(lex->tokens, token)
 	{
-		
+		str = escript_token_info_str(token);
+		puts(str);
+		puts("---");
+		free(str);
 	}
 }
 
@@ -115,11 +131,21 @@ escript_lexer_step(struct Escript_Lexer* lex)
 			Eina_Strbuf* ident = lex_identifier(lex);
 			if (ident)
 			{
+#if 1 // ehehehe
 				printf("[%s]", eina_strbuf_string_get(ident));
+				if (strcmp(eina_strbuf_string_get(ident), "__plzdump") == 0)
+				{
+					putchar('\n');
+					escript_print_tokens(lex);
+					eina_strbuf_free(ident);
+					goto dont_skip_step;
+				}
+#endif 
 				token.token = ELEX_IDENTIFIER;
 				size_t len = eina_strbuf_length_get(ident);
 				token.data.d_string.str = eina_strbuf_string_steal(ident);
 				token.data.d_string.len = len;
+				
 				PUSH_TOKEN;
 				goto skip_step;
 			}
@@ -129,6 +155,7 @@ escript_lexer_step(struct Escript_Lexer* lex)
 		}
 		break;
 	}
+dont_skip_step:
 	step_char(lex, 0);
 skip_step:
 	return 0;

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

Reply via email to