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 7ee083c26e3ccc4b014d093d053bef0c49c61424
Author: swagtoy <m...@ow.swag.toys>
AuthorDate: Sat Nov 16 18:17:48 2024 -0500
Lexer: some basic parsing (untested heh)
---
escript/include/lexer.h | 1 -
escript/src/lexer.c | 22 ++++++++++++++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/escript/include/lexer.h b/escript/include/lexer.h
index 8d24d5a..b767a02 100644
--- a/escript/include/lexer.h
+++ b/escript/include/lexer.h
@@ -82,7 +82,6 @@ union Escript_Token_Data
struct Escript_Token_String const d_string; // it hurts!!
int const d_int;
double const d_double;
-
};
diff --git a/escript/src/lexer.c b/escript/src/lexer.c
index 410424b..4719b8e 100644
--- a/escript/src/lexer.c
+++ b/escript/src/lexer.c
@@ -7,7 +7,7 @@
#include <stdio.h>
#include <string.h>
#include "lexer.h"
-
+#include <ctype.h>
#define at(i) lex->current[i]
@@ -50,11 +50,29 @@ next_nb(struct Escript_Lexer* lex)
return 0;
}
+#define PRINTABLE_ASCII(x) (isupper(x) || islower(x))
+
+void
+lex_keyword(struct Escript_Lexer* lex)
+{
+ while (PRINTABLE_ASCII(at(0)) && !eol(lex, 0))
+ {
+ next_char(lex, 0);
+ }
+}
+
int
escript_lexer_step(struct Escript_Lexer* lex)
{
next_nb(lex);
- putchar(lex->current[0]);
+ switch (at(0))
+ {
+ case '$': // variable sigil
+
+ default: // Raw keyword or something
+ lex_keyword(lex);
+ putchar(lex->current[0]);
+ }
next_char(lex, 0);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.