43 lines
691 B
C
43 lines
691 B
C
/*
|
|
* Copyright 2023 Oleg Borodin <borodin@unix7.org>
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <fcntl.h>
|
|
|
|
#include <massert.h>
|
|
#include <rcache.h>
|
|
#include <jlexer.h>
|
|
|
|
int main(void) {
|
|
|
|
int fd = open("test.json", O_RDONLY);
|
|
|
|
MASSERT(fd > 0);
|
|
|
|
rcache_t cache;
|
|
|
|
rcache_init(&cache, fd);
|
|
|
|
jlexer_t lexer;
|
|
|
|
jlexer_init(&lexer, &cache);
|
|
|
|
char token[1024];
|
|
int type = 0;
|
|
|
|
while ((type = jlexer_gettoken(&lexer, token)) != JLEXTOK_END) {
|
|
printf("%d: %s\n", type, token);
|
|
}
|
|
printf("%d: %s\n", type, token);
|
|
|
|
rcache_destroy(&cache);
|
|
|
|
return 0;
|
|
}
|