23 lines
397 B
C
23 lines
397 B
C
#include "read.h"
|
|
|
|
#include "parse.h"
|
|
#include "token.h"
|
|
|
|
#include <assert.h>
|
|
|
|
void read(am_t *am, stream_t *stream)
|
|
{
|
|
parse_ctx_t ctx;
|
|
token_t token;
|
|
|
|
parse_init(am, &ctx);
|
|
|
|
while (ctx.state != PARSE_STATE_DONE) {
|
|
const token_status_t token_status = token_read(stream, &token);
|
|
assert(token_status == TOKEN_OK);
|
|
|
|
parse_proc(&ctx, &token);
|
|
assert(ctx.state != PARSE_STATE_ERROR);
|
|
}
|
|
}
|