diff options
Diffstat (limited to 'discover/grub2/parser.y')
-rw-r--r-- | discover/grub2/parser.y | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/discover/grub2/parser.y b/discover/grub2/parser.y index 0d02bc1..f49cecd 100644 --- a/discover/grub2/parser.y +++ b/discover/grub2/parser.y @@ -220,3 +220,28 @@ void word_append(struct grub2_word *w1, struct grub2_word *w2) w1->last->next = w2; w1->last = w2; } + +struct grub2_parser *grub2_parser_create(void *ctx) +{ + struct grub2_parser *parser; + + parser = talloc(ctx, struct grub2_parser); + yylex_init_extra(parser, &parser->scanner); + parser->script = create_script(parser); + + return parser; +} + +void grub2_parser_parse(struct grub2_parser *parser, char *buf, int len) +{ + YY_BUFFER_STATE bufstate; + + bufstate = yy_scan_bytes(buf, len - 1, parser->scanner); + + yyparse(parser); + + yy_delete_buffer(bufstate, parser->scanner); + + script_execute(parser->script); +} + |