Implement tokenisation
This commit is contained in:
20
lib/include/stream.h
Normal file
20
lib/include/stream.h
Normal 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
|
||||
Reference in New Issue
Block a user