mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
Convert parse errors to exceptions.
Parser no longer prints an error, but instead returns an exception ID and message.
This commit is contained in:
10
py/lexer.h
10
py/lexer.h
@@ -124,8 +124,6 @@ typedef void (*mp_lexer_stream_close_t)(void*);
|
||||
typedef struct _mp_lexer_t mp_lexer_t;
|
||||
|
||||
void mp_token_show(const mp_token_t *tok);
|
||||
void mp_token_show_error_prefix(const mp_token_t *tok);
|
||||
bool mp_token_show_error(const mp_token_t *tok, const char *msg);
|
||||
|
||||
mp_lexer_t *mp_lexer_new(const char *src_name, void *stream_data, mp_lexer_stream_next_char_t stream_next_char, mp_lexer_stream_close_t stream_close);
|
||||
mp_lexer_t *mp_lexer_new_from_str_len(const char *src_name, const char *str, uint len, uint free_len);
|
||||
@@ -134,12 +132,8 @@ void mp_lexer_free(mp_lexer_t *lex);
|
||||
void mp_lexer_to_next(mp_lexer_t *lex);
|
||||
const mp_token_t *mp_lexer_cur(const mp_lexer_t *lex);
|
||||
bool mp_lexer_is_kind(mp_lexer_t *lex, mp_token_kind_t kind);
|
||||
/* unused
|
||||
bool mp_lexer_is_str(mp_lexer_t *lex, const char *str);
|
||||
bool mp_lexer_opt_kind(mp_lexer_t *lex, mp_token_kind_t kind);
|
||||
bool mp_lexer_opt_str(mp_lexer_t *lex, const char *str);
|
||||
*/
|
||||
bool mp_lexer_show_error(mp_lexer_t *lex, const char *msg);
|
||||
|
||||
bool mp_lexer_show_error_pythonic_prefix(mp_lexer_t *lex);
|
||||
bool mp_lexer_show_error_pythonic(mp_lexer_t *lex, const char *msg);
|
||||
|
||||
// used to import a module; must be implemented for a specific port
|
||||
|
||||
Reference in New Issue
Block a user