1 #include <stdlib.h>
2 
3 #include "py/lexer.h"
4 #include "py/runtime.h"
5 #include "py/mperrno.h"
6 #include "memzip.h"
7 
mp_lexer_new_from_file(const char * filename)8 mp_lexer_t *mp_lexer_new_from_file(const char *filename)
9 {
10     void *data;
11     size_t len;
12 
13     if (memzip_locate(filename, &data, &len) != MZ_OK) {
14         mp_raise_OSError(MP_ENOENT);
15     }
16 
17     return mp_lexer_new_from_str_len(qstr_from_str(filename), (const char *)data, (mp_uint_t)len, 0);
18 }
19 
20