]> git.ozlabs.org Git - petitboot/blobdiff - discover/grub2/parser-api.c
discover/grub2: Handle var tokens in lexer
[petitboot] / discover / grub2 / parser-api.c
index 9ccf15eb94ffefdf7fe53ae96f3def672edaab2d..765bd873e2fa4d333062fb5ce9484647593c2db2 100644 (file)
@@ -68,13 +68,23 @@ void statement_append(struct grub2_statements *stmts,
        list_add_tail(&stmts->list, &stmt->list);
 }
 
-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 *word = talloc(parser, struct grub2_word);
+       word->type = GRUB2_WORD_TEXT;
        word->text = talloc_strdup(word, text);
-       word->expand = expand;
-       word->split = split;
+       word->next = NULL;
+       return word;
+}
+
+struct grub2_word *create_word_var(struct grub2_parser *parser,
+               const char *name, bool split)
+{
+       struct grub2_word *word = talloc(parser, struct grub2_word);
+       word->type = GRUB2_WORD_VAR;
+       word->var.name = talloc_strdup(word, name);
+       word->var.split = split;
        word->next = NULL;
        return word;
 }