add pic_parse
This commit is contained in:
parent
6b2d6a98eb
commit
c764d28878
|
@ -116,6 +116,7 @@ void pic_vec_extend_ip(pic_state *, struct pic_vector *, int);
|
|||
|
||||
int pic_parse_file(pic_state *, FILE *file, pic_value *);
|
||||
int pic_parse_cstr(pic_state *, const char *, pic_value *);
|
||||
pic_value pic_parse(pic_state *, const char *);
|
||||
|
||||
pic_value pic_apply(pic_state *pic, struct pic_proc *, pic_value);
|
||||
pic_value pic_apply_argv(pic_state *pic, struct pic_proc *, size_t, ...);
|
||||
|
|
13
src/parse.y
13
src/parse.y
|
@ -431,3 +431,16 @@ pic_parse_cstr(pic_state *pic, const char *str, pic_value *v)
|
|||
|
||||
return r;
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_parse(pic_state *pic, const char *src)
|
||||
{
|
||||
pic_value vs;
|
||||
int r;
|
||||
|
||||
r = pic_parse_cstr(pic, src, &vs);
|
||||
if (r != 1) {
|
||||
return pic_undef_value();
|
||||
}
|
||||
return pic_car(pic, vs);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue