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 dbf6ff2783bf3c7880da38144a7ffb251cdaee70
Author: swagtoy <m...@ow.swag.toys>
AuthorDate: Sun Dec 1 19:19:18 2024 -0500

    lexer: Handle \n escape sequence
---
 escript/src/lexer.c | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/escript/src/lexer.c b/escript/src/lexer.c
index 12a1d1c..2fd3581 100644
--- a/escript/src/lexer.c
+++ b/escript/src/lexer.c
@@ -124,7 +124,22 @@ escript_token_info_str(struct Escript_Token* token)
 	return eina_strbuf_string_steal(res);
 }
 
-static inline Eina_Strbuf* const
+static inline int
+handle_escape_seq(struct Escript_Lexer* const lex, Eina_Strbuf* const buf, int i)
+{
+	switch (at(1))
+	{
+	case 'n':
+		eina_strbuf_append_char(buf, '\n');
+		break;
+	default:
+		return 0;
+	}
+	return 1;
+}
+
+// TODO Handle "warnings"
+static inline Eina_Strbuf*
 tokenize_string(struct Escript_Lexer* const lex, char const end)
 {
 	size_t i;
@@ -132,11 +147,23 @@ tokenize_string(struct Escript_Lexer* const lex, char const end)
 	Eina_Strbuf* buf = eina_strbuf_new();
 	for (i = 1; at(i) != end && !eol(lex, i); ++i)
 	{
-		if (at(i) != '\\') // todo
+		if (at(i) == '\\') // todo
+		{
+			++i;
+			if (handle_escape_seq(lex, buf, i) == 0)
+			{
+				// Ignore it
+				eina_strbuf_append_char(buf, '\\');
+				eina_strbuf_append_char(buf, at(i));
+			}
+		}
+		else
 			eina_strbuf_append_char(buf, at(i));
 	}
 	step_char(lex, i);
 	return buf;
+err:
+	
 }
 
 // Will clean this up later

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

Reply via email to