about summary refs log tree commit diff
path: root/src/readchar.c
diff options
context:
space:
mode:
authorNakidai <nakidai@disroot.org>2025-03-23 21:11:13 +0300
committerNakidai <nakidai@disroot.org>2025-03-23 21:11:13 +0300
commitad9d6a199db7c28f8b20f131dfb55a26e0e251de (patch)
treee5bb112cd902d9c09f5ad79ce98ba8a315d20bbb /src/readchar.c
parent159666bae6cc185a5abac154b85c49406f32f30c (diff)
download3cl-ad9d6a199db7c28f8b20f131dfb55a26e0e251de.tar.gz
3cl-ad9d6a199db7c28f8b20f131dfb55a26e0e251de.zip
Again...
Diffstat (limited to 'src/readchar.c')
-rw-r--r--src/readchar.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/readchar.c b/src/readchar.c
deleted file mode 100644
index 428b8fd..0000000
--- a/src/readchar.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "3cl.h"
-#include "readchar.h"
-
-#include <stdbool.h>
-#include <string.h>
-
-#include "utils.h"
-
-
-static const char *const space    = " \n\t";
-static const char *const brackets = "{[(?;)]}";
-static const char *const instr    = "^+-*~%=!$&<>@#:";
-static const char *const alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
-char ccl_readchar(struct CCL *ccl, struct CCLFrame *frame, enum CCLRCFlags flags)
-{
-    bool iscomment;
-
-    char chr;
-    while ((chr = ccl->code[frame->ep++]) != '\0')
-    {
-        if (iscomment && chr == '\n')
-            iscomment = false;
-        if (iscomment)
-            continue;
-        if (chr == '/')
-            iscomment = true;
-
-        if (strchr(space, chr))
-            continue;
-
-        if (strchr(brackets, chr))
-            if (!(flags & CCL_RC_BRACK) && flags & CCL_RC_DIE)
-                goto invalid;
-            else
-                goto ok;
-        else if (strchr(instr, chr))
-            if (!(flags & CCL_RC_IS) && flags & CCL_RC_DIE)
-                goto invalid;
-            else
-                goto ok;
-        else if (strchr(alphabet, chr))
-            if (!(flags & CCL_RC_ALP) && flags & CCL_RC_DIE)
-                goto invalid;
-            else
-                goto ok;
-        else if (chr == '_')
-            if (!(flags & CCL_RC_US) && flags & CCL_RC_DIE)
-                goto invalid;
-            else
-                goto ok;
-        else
-            goto invalid;
-    }
-ok:
-    return chr;
-invalid:
-    die(1, "Invalid symbol at %d", frame->ep);
-}