aboutsummaryrefslogtreecommitdiff
path: root/reader.h
diff options
context:
space:
mode:
Diffstat (limited to 'reader.h')
-rw-r--r--reader.h98
1 files changed, 0 insertions, 98 deletions
diff --git a/reader.h b/reader.h
deleted file mode 100644
index 07c3672..0000000
--- a/reader.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copyright (C) 2025 Aryadev Chavali
-
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License Version 2 for
- * details.
-
- * You may distribute and modify this code under the terms of the GNU General
- * Public License Version 2, which you should have received a copy of along with
- * this program. If not, please go to <https://www.gnu.org/licenses/>.
-
- * Created: 2025-04-16
- * Description: Parsing Lisp!
- */
-
-#ifndef READER_H
-#define READER_H
-
-#include "./lisp.h"
-#include "./memory.h"
-#include "./vec.h"
-
-#define INPUT_CHUNK_SIZE 512
-static const char SYM_CHARS[] =
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
- "¬!£$%^&*_-+={[]}:@~#<,>.?/";
-
-typedef struct
-{
- const char *name;
- u64 offset;
- sv_t str;
-} input_t;
-
-void input_from_sv(context_t *ctx, input_t *inp, const char *name, sv_t sv);
-void input_from_fp(context_t *ctx, input_t *input, const char *name, FILE *fp);
-bool input_eof(input_t *input);
-
-typedef struct
-{
- u64 col, line;
-} pos_t;
-
-pos_t input_offset_to_pos(input_t *inp);
-
-typedef enum
-{
- PERR_OK = 0,
- PERR_EOF,
- PERR_UNEXPECTED_CHAR,
- PERR_EXPECTED_CLOSE_BRACKET,
- PERR_EXPECTED_SPEECH_MARK,
- PERR_UNEXPECTED_READER_MACRO_SYMBOL,
- PERR_EXPECTED_BOOLEAN,
-} perr_t;
-
-static inline const char *perr_to_cstr(perr_t perr)
-{
- switch (perr)
- {
- case PERR_OK:
- return "OK";
- break;
- case PERR_EOF:
- return "EOF";
- break;
- case PERR_UNEXPECTED_CHAR:
- return "UNEXPECTED_CHAR";
- break;
- case PERR_EXPECTED_CLOSE_BRACKET:
- return "EXPECTED_CLOSE_BRACKET";
- break;
- case PERR_EXPECTED_SPEECH_MARK:
- return "EXPECTED_SPEECH_MARK";
- break;
- case PERR_UNEXPECTED_READER_MACRO_SYMBOL:
- return "UNEXPECTED_READER_MACRO_SYMBOL";
- break;
- case PERR_EXPECTED_BOOLEAN:
- return "EXPECTED_BOOLEAN";
- break;
- }
- assert(false && "perr_to_cstr: unreachable");
- return "";
-}
-
-typedef struct
-{
- lisp_t *result;
- perr_t error;
-} pres_t;
-
-perr_t parse(context_t *ctx, input_t *str, lisp_t **ret);
-perr_t parse_all(context_t *ctx, input_t *str, vec_t *vec);
-
-int print_perror(FILE *fp, input_t *inp, perr_t error);
-
-#endif