Implement tokenisation

This commit is contained in:
2025-08-09 12:13:55 +01:00
parent 657f0922bb
commit 3e8a9d6789
10 changed files with 550 additions and 0 deletions

20
lib/include/stream.h Normal file
View File

@@ -0,0 +1,20 @@
#ifndef STREAM_H
#define STREAM_H
#include <stdint.h>
#define STREAM_GET_BYTE(stream, out) stream->get_byte(stream, out)
#define STREAM_PEEK_BYTE(stream, out) stream->peek_byte(stream, out)
typedef enum {
STREAM_STATUS_OK,
STREAM_STATUS_ERROR,
STREAM_STATUS_END,
} stream_status_t;
typedef struct stream {
stream_status_t (*get_byte)(struct stream *s, uint8_t *out);
stream_status_t (*peek_byte)(struct stream *s, uint8_t *out);
} stream_t;
#endif