Skip to content

Commit f9518dd

Browse files
committed
jimp: get rid of the dependency on stb_c_lexer.h
1 parent 2fd1199 commit f9518dd

File tree

3 files changed

+216
-1035
lines changed

3 files changed

+216
-1035
lines changed

jimp.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
typedef struct {
1010
const char *name;
11-
long age;
11+
double age;
1212
const char *location;
13-
long body_count;
13+
double body_count;
1414
} Person;
1515

1616
typedef struct {
@@ -55,9 +55,9 @@ bool parse_people(Jimp *jimp, People *ps)
5555
void print_person(const Person *p)
5656
{
5757
printf("name = %s\n", p->name);
58-
printf("age = %ld\n", p->age);
58+
printf("age = %lf\n", p->age);
5959
printf("location = %s\n", p->location);
60-
printf("body_count = %ld\n", p->body_count);
60+
printf("body_count = %lf\n", p->body_count);
6161
}
6262

6363
typedef struct {
@@ -78,9 +78,10 @@ int main()
7878
if (!read_entire_file(file_path, &sb)) return 1;
7979
Jimp jimp = {
8080
.file_path = file_path,
81+
.start = sb.items,
82+
.end = sb.items + sb.count,
83+
.point = sb.items,
8184
};
82-
static char string_store[1024];
83-
stb_c_lexer_init(&jimp.l, sb.items, sb.items + sb.count, string_store, sizeof(string_store));
8485

8586
People ps = {0};
8687
Numbers xs = {0};
@@ -91,7 +92,7 @@ int main()
9192
} else if (strcmp(jimp.member, "number") == 0) {
9293
if (!jimp_array_begin(&jimp)) return 1;
9394
while (jimp_array_item(&jimp)) {
94-
long x = 0;
95+
double x = 0;
9596
if (!jimp_number(&jimp, &x)) return 1;
9697
da_append(&xs, x);
9798
}

0 commit comments

Comments
 (0)