Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
c72a5f8c
Commit
c72a5f8c
authored
Mar 14, 2017
by
Damien George
Browse files
bare-arm/main: Move lexer constructor to within NLR handler block.
And raise an exception when mp_lexer_new_from_file is called.
parent
33a77ea2
Changes
1
Hide whitespace changes
Inline
Side-by-side
bare-arm/main.c
View file @
c72a5f8c
...
...
@@ -6,15 +6,12 @@
#include
"py/compile.h"
#include
"py/runtime.h"
#include
"py/repl.h"
#include
"py/mperrno.h"
void
do_str
(
const
char
*
src
,
mp_parse_input_kind_t
input_kind
)
{
mp_lexer_t
*
lex
=
mp_lexer_new_from_str_len
(
MP_QSTR__lt_stdin_gt_
,
src
,
strlen
(
src
),
0
);
if
(
lex
==
NULL
)
{
return
;
}
nlr_buf_t
nlr
;
if
(
nlr_push
(
&
nlr
)
==
0
)
{
mp_lexer_t
*
lex
=
mp_lexer_new_from_str_len
(
MP_QSTR__lt_stdin_gt_
,
src
,
strlen
(
src
),
0
);
qstr
source_name
=
lex
->
source_name
;
mp_parse_tree_t
parse_tree
=
mp_parse
(
lex
,
input_kind
);
mp_obj_t
module_fun
=
mp_compile
(
&
parse_tree
,
source_name
,
MP_EMIT_OPT_NONE
,
true
);
...
...
@@ -35,7 +32,7 @@ int main(int argc, char **argv) {
}
mp_lexer_t
*
mp_lexer_new_from_file
(
const
char
*
filename
)
{
return
NULL
;
mp_raise_OSError
(
MP_ENOENT
)
;
}
mp_import_stat_t
mp_import_stat
(
const
char
*
path
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment