summaryrefslogtreecommitdiffstats
path: root/discover/grub2/parser.y
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-09-17 09:36:11 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-09-24 13:14:59 +0800
commite8a50ad2461a8efaa4d71ea19692a1b63a0f9bc2 (patch)
tree74d2c13c671e05ff686031e8e80076547c548292 /discover/grub2/parser.y
parentd808f5d2ec8e232d736a5f811d647df91e2a5b43 (diff)
downloadtalos-petitboot-e8a50ad2461a8efaa4d71ea19692a1b63a0f9bc2.tar.gz
talos-petitboot-e8a50ad2461a8efaa4d71ea19692a1b63a0f9bc2.zip
discover/grub2: Add function support
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/grub2/parser.y')
-rw-r--r--discover/grub2/parser.y14
1 files changed, 14 insertions, 0 deletions
diff --git a/discover/grub2/parser.y b/discover/grub2/parser.y
index 550c374..bcf5935 100644
--- a/discover/grub2/parser.y
+++ b/discover/grub2/parser.y
@@ -95,6 +95,9 @@ statement: TOKEN_EOL {
"fi" TOKEN_EOL {
$$ = create_statement_if(parser, $3, $6, $9);
}
+ | "function" TOKEN_DELIM word TOKEN_DELIM '{' statements '}' {
+ $$ = create_statement_function(parser, $3, $6);
+ }
| "menuentry" TOKEN_DELIM words TOKEN_DELIM
'{' statements '}'
TOKEN_EOL {
@@ -181,6 +184,17 @@ struct grub2_statement *create_statement_block(struct grub2_parser *parser,
return &stmt->st;
}
+struct grub2_statement *create_statement_function(struct grub2_parser *parser,
+ struct grub2_word *name, struct grub2_statements *body)
+{
+ struct grub2_statement_function *stmt =
+ talloc(parser, struct grub2_statement_function);
+ stmt->st.exec = statement_function_execute;
+ stmt->name = name;
+ stmt->body = body;
+ return &stmt->st;
+}
+
void statement_append(struct grub2_statements *stmts,
struct grub2_statement *stmt)
{
OpenPOWER on IntegriCloud