fix: lexer nextchar return unavailave chunk
This commit is contained in:
parent
18d4c9d9b2
commit
0eda62ca1c
7
lexer.c
7
lexer.c
|
@ -8,9 +8,6 @@ Cursor cursor = {
|
||||||
};
|
};
|
||||||
|
|
||||||
char* nextchar(void){
|
char* nextchar(void){
|
||||||
if (cursor.chunk >= page.len){
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (page.chunks[cursor.chunk][cursor.offset+1] == '\0'){
|
if (page.chunks[cursor.chunk][cursor.offset+1] == '\0'){
|
||||||
cursor.chunk++;
|
cursor.chunk++;
|
||||||
cursor.offset = 0;
|
cursor.offset = 0;
|
||||||
|
@ -18,6 +15,10 @@ char* nextchar(void){
|
||||||
cursor.offset++;
|
cursor.offset++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cursor.chunk >= page.len){
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return &page.chunks[cursor.chunk][cursor.offset];
|
return &page.chunks[cursor.chunk][cursor.offset];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue