STMT_TYPE_MENUENTRY,
STMT_TYPE_IF,
STMT_TYPE_BLOCK,
+ STMT_TYPE_CONDITIONAL,
} type;
int (*exec)(struct grub2_script *,
struct grub2_statement *);
struct grub2_statements *statements;
};
-struct grub2_statement_if {
+struct grub2_statement_conditional {
struct grub2_statement st;
struct grub2_statement *condition;
- struct grub2_statements *true_case;
- struct grub2_statements *false_case;
+ struct grub2_statements *statements;
+};
+
+struct grub2_statement_if {
+ struct grub2_statement st;
+ struct grub2_statements *conditionals;
+ struct grub2_statements *else_case;
};
struct grub2_statement_block {
struct list symtab;
struct discover_context *ctx;
struct discover_boot_option *opt;
+ unsigned int n_options;
};
struct grub2_parser {
struct grub2_statement *create_statement_menuentry(struct grub2_parser *parser,
struct grub2_argv *argv, struct grub2_statements *stmts);
+struct grub2_statement *create_statement_conditional(
+ struct grub2_parser *parser, struct grub2_statement *condition,
+ struct grub2_statements *statements);
+
struct grub2_statement *create_statement_if(struct grub2_parser *parser,
- struct grub2_statement *condition,
- struct grub2_statements *true_case,
- struct grub2_statements *false_case);
+ struct grub2_statement *conditional,
+ struct grub2_statements *elifs,
+ struct grub2_statements *else_case);
struct grub2_statement *create_statement_block(struct grub2_parser *parser,
struct grub2_statements *stmts);
int statement_simple_execute(struct grub2_script *script,
struct grub2_statement *statement);
+int statement_block_execute(struct grub2_script *script,
+ struct grub2_statement *statement);
int statement_if_execute(struct grub2_script *script,
struct grub2_statement *statement);
int statement_menuentry_execute(struct grub2_script *script,