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 22f8a7ca9568a4ed5a367b6b59a8cad60107a21f
Author: swagtoy <m...@ow.swag.toys>
AuthorDate: Fri Nov 29 18:09:17 2024 -0500

    lexer: String tokenization (not complete)
---
 escript/src/lexer.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/escript/src/lexer.c b/escript/src/lexer.c
index 39dcc2b..60e65d2 100644
--- a/escript/src/lexer.c
+++ b/escript/src/lexer.c
@@ -54,7 +54,8 @@ step_char(struct Escript_Lexer* const lex, int step)
 	}
 }
 
-static inline int eol(struct Escript_Lexer* const lex, int step)
+static inline int
+eol(struct Escript_Lexer* const lex, int step)
 {
 	return (lex->current_len < step) ? 0 : ((lex->current_len - step) <= 0);
 }
@@ -123,6 +124,20 @@ escript_token_info_str(struct Escript_Token* token)
 	return eina_strbuf_string_steal(res);
 }
 
+static inline char*
+tokenize_string(struct Escript_Lexer* const lex, char const end)
+{
+	size_t i;
+	// This is probably slow?
+	Eina_Strbuf* const buf = eina_strbuf_new();
+	for (i = 0; at(i) != end && !eol(lex, 0); ++i)
+	{
+		if (at(i) != '\\') // todo
+			eina_strbuf_append_char(buf, at(i));
+	}
+	return eina_strbuf_string_steal(buf);
+}
+
 // Will clean this up later
 void
 escript_print_tokens(struct Escript_Lexer* lex)
@@ -158,6 +173,17 @@ escript_lexer_step(struct Escript_Lexer* lex)
 		PUSH_SIMPLE_TOKEN(ELEX_SIGIL);
 		break;
 	
+	case '"':
+		{
+			char* res = tokenize_string(lex, '"');
+			if (res != NULL)
+			{
+				free(res);
+			}
+			// else { BAD }
+		}
+		break;
+
 	default: // Raw keyword or something
 		{
 			Eina_Strbuf* ident = lex_identifier(lex);

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

Reply via email to