py/lexer: Provide generic mp_lexer_new_from_file based on mp_reader.

If a port defines MICROPY_READER_POSIX or MICROPY_READER_FATFS then
lexer.c now provides an implementation of mp_lexer_new_from_file using
the mp_reader_new_file function.
This commit is contained in:
Damien George
2016-11-16 16:25:06 +11:00
parent 511c083811
commit e5ef15a9d7
10 changed files with 16 additions and 151 deletions

View File

@@ -109,17 +109,13 @@ void user_init(void) {
system_init_done_cb(init_done);
}
mp_lexer_t *fat_vfs_lexer_new_from_file(const char *filename);
mp_import_stat_t fat_vfs_import_stat(const char *path);
#if !MICROPY_VFS_FAT
mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
#if MICROPY_VFS_FAT
return fat_vfs_lexer_new_from_file(filename);
#else
(void)filename;
return NULL;
#endif
}
#endif
mp_import_stat_t mp_import_stat(const char *path) {
#if MICROPY_VFS_FAT