summaryrefslogtreecommitdiffstats
path: root/discover/grub2/grub2-parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'discover/grub2/grub2-parser.y')
-rw-r--r--discover/grub2/grub2-parser.y17
1 files changed, 15 insertions, 2 deletions
diff --git a/discover/grub2/grub2-parser.y b/discover/grub2/grub2-parser.y
index 527a61c..f99bbfd 100644
--- a/discover/grub2/grub2-parser.y
+++ b/discover/grub2/grub2-parser.y
@@ -331,14 +331,15 @@ struct grub2_parser *grub2_parser_create(struct discover_context *ctx)
return parser;
}
-void grub2_parser_parse(struct grub2_parser *parser, const char *filename,
+/* performs a parse on buf, setting parser->script->statements */
+int grub2_parser_parse(struct grub2_parser *parser, const char *filename,
char *buf, int len)
{
YY_BUFFER_STATE bufstate;
int rc;
if (!len)
- return;
+ return -1;
parser->script->filename = filename;
@@ -349,6 +350,18 @@ void grub2_parser_parse(struct grub2_parser *parser, const char *filename,
yy_delete_buffer(bufstate, parser->scanner);
+ parser->inter_word = false;
+
+ return rc;
+}
+
+void grub2_parser_parse_and_execute(struct grub2_parser *parser,
+ const char *filename, char *buf, int len)
+{
+ int rc;
+
+ rc = grub2_parser_parse(parser, filename, buf, len);
+
if (!rc)
script_execute(parser->script);
}
OpenPOWER on IntegriCloud