diff options
author | thing1 <thing1@seacrossedlovers.xyz> | 2024-10-07 12:59:43 +0100 |
---|---|---|
committer | thing1 <thing1@seacrossedlovers.xyz> | 2024-10-07 12:59:43 +0100 |
commit | ce61e41c6a14b84808aceb37d5118f23e3affaa0 (patch) | |
tree | 8e6b7bea499ddd598c7096ef85e2aa19e85498b6 /comp/lucas-standen-NEA/code2/tokenizer.c | |
parent | 69c8e84587d934545bdb9d21b292463428ebee93 (diff) |
added comments to all of zpy and made the compiler have useful error msgs and for the most part not segv fault
Diffstat (limited to 'comp/lucas-standen-NEA/code2/tokenizer.c')
-rw-r--r-- | comp/lucas-standen-NEA/code2/tokenizer.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/comp/lucas-standen-NEA/code2/tokenizer.c b/comp/lucas-standen-NEA/code2/tokenizer.c index c756c0c..0326057 100644 --- a/comp/lucas-standen-NEA/code2/tokenizer.c +++ b/comp/lucas-standen-NEA/code2/tokenizer.c @@ -11,9 +11,8 @@ typedef struct astNode { struct astNode *children[8]; } astNode; -int readuntil(char *src, char c, char *dst){ // returns how many chars read, will read until - // the end of an expression, not the first - // occurence +//# reads a block of code from src, until char, outputting to dst, it allows for brackets so it stays on the same depth +int readuntil(char *src, char c, char *dst){ int ptr = 0; int depth = 0; int i = 0; @@ -36,7 +35,7 @@ int readuntil(char *src, char c, char *dst){ // returns how many chars read, wil return i; } - +//# this function will converts one line of zpy into an astNode, which can be compiled astNode *tokenize(char *line){ // asume the first set of brackets have been stripped astNode *head = malloc(sizeof(astNode)); head->func = NULL; |