summaryrefslogtreecommitdiffstats
path: root/discover/grub2/grub2.h
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-09-13 14:50:19 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-09-24 13:14:59 +0800
commitfb5a2b71f85614114663c86dbba62c5c491a11b9 (patch)
treeecacb9cc23f8507441b716da5431d59f0752e631 /discover/grub2/grub2.h
parent44e9d1d04a3120476ac50a14bfa34fbd091190c9 (diff)
downloadtalos-petitboot-fb5a2b71f85614114663c86dbba62c5c491a11b9.tar.gz
talos-petitboot-fb5a2b71f85614114663c86dbba62c5c491a11b9.zip
discover/grub2: Handle var tokens in lexer
Rather than post-processing to expand variables, use the lexer to identify variable tokens as a type of grub2_word. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/grub2/grub2.h')
-rw-r--r--discover/grub2/grub2.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/discover/grub2/grub2.h b/discover/grub2/grub2.h
index 07a1e6c..cbd69dc 100644
--- a/discover/grub2/grub2.h
+++ b/discover/grub2/grub2.h
@@ -1,16 +1,23 @@
#ifndef GRUB2_H
#define GRUB2_H
-#include <regex.h>
#include <stdbool.h>
#include <list/list.h>
struct grub2_script;
struct grub2_word {
- const char *text;
- bool expand;
- bool split;
+ enum {
+ GRUB2_WORD_TEXT,
+ GRUB2_WORD_VAR,
+ } type;
+ union {
+ char *text;
+ struct {
+ const char *name;
+ bool split;
+ } var;
+ };
struct grub2_word *next;
struct list_item argv_list;
};
@@ -61,7 +68,6 @@ struct grub2_statement_block {
struct grub2_script {
struct grub2_statements *statements;
struct list environment;
- regex_t var_re;
};
struct grub2_parser {
@@ -85,8 +91,11 @@ struct grub2_statement *create_statement_if(struct grub2_parser *parser,
struct grub2_statement *create_statement_block(struct grub2_parser *parser,
struct grub2_statements *stmts);
-struct grub2_word *create_word(struct grub2_parser *parser, const char *text,
- bool expand, bool split);
+struct grub2_word *create_word_text(struct grub2_parser *parser,
+ const char *text);
+
+struct grub2_word *create_word_var(struct grub2_parser *parser,
+ const char *name, bool split);
struct grub2_argv *create_argv(struct grub2_parser *parser);
OpenPOWER on IntegriCloud