summaryrefslogtreecommitdiff
path: root/py/lexer.h
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-05-25 12:04:27 +1000
committerDamien George <damien@micropython.org>2022-05-25 13:04:45 +1000
commit5956466c0ee08f7a08d274de65ff2d0ffc901137 (patch)
tree3df151037dc9f5b3ec69117c2153af2d11c938ef /py/lexer.h
parent26b1d31eda292d9cd5cfc68f14ce8055256fade8 (diff)
py/builtin: Clean up and simplify import_stat and builtin_open config.
The following changes are made: - If MICROPY_VFS is enabled then mp_vfs_import_stat and mp_vfs_open are automatically used for mp_import_stat and mp_builtin_open respectively. - If MICROPY_PY_IO is enabled then "open" is automatically included in the set of builtins, and points to mp_builtin_open_obj. This helps to clean up and simplify the most common port configuration. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/lexer.h')
-rw-r--r--py/lexer.h19
1 files changed, 5 insertions, 14 deletions
diff --git a/py/lexer.h b/py/lexer.h
index e16b9a8ce..8295dec0f 100644
--- a/py/lexer.h
+++ b/py/lexer.h
@@ -189,24 +189,15 @@ typedef struct _mp_lexer_t {
mp_lexer_t *mp_lexer_new(qstr src_name, mp_reader_t reader);
mp_lexer_t *mp_lexer_new_from_str_len(qstr src_name, const char *str, size_t len, size_t free_len);
-void mp_lexer_free(mp_lexer_t *lex);
-void mp_lexer_to_next(mp_lexer_t *lex);
-
-/******************************************************************/
-// platform specific import function; must be implemented for a specific port
-// TODO tidy up, rename, or put elsewhere
-
-typedef enum {
- MP_IMPORT_STAT_NO_EXIST,
- MP_IMPORT_STAT_DIR,
- MP_IMPORT_STAT_FILE,
-} mp_import_stat_t;
-
-mp_import_stat_t mp_import_stat(const char *path);
+// If MICROPY_READER_POSIX or MICROPY_READER_VFS aren't enabled then
+// this function must be implemented by the port.
mp_lexer_t *mp_lexer_new_from_file(const char *filename);
#if MICROPY_HELPER_LEXER_UNIX
mp_lexer_t *mp_lexer_new_from_fd(qstr filename, int fd, bool close_fd);
#endif
+void mp_lexer_free(mp_lexer_t *lex);
+void mp_lexer_to_next(mp_lexer_t *lex);
+
#endif // MICROPY_INCLUDED_PY_LEXER_H