]> git.ozlabs.org Git - petitboot/blobdiff - discover/grub2/parser.y
discover/grub2: Allow EOF as a statement terminator
[petitboot] / discover / grub2 / parser.y
index 3a5a142f57b106153c8915f011aa349b345d62e2..292ce0725b6af6bdffecc8ddad80c9e11f660460 100644 (file)
@@ -60,6 +60,7 @@ static void yyerror(struct grub2_parser *, char const *s);
 %token TOKEN_EOL
 %token TOKEN_DELIM
 %token <word> TOKEN_WORD
 %token TOKEN_EOL
 %token TOKEN_DELIM
 %token <word> TOKEN_WORD
+%token TOKEN_EOF 0
 
 %start script
 %debug
 
 %start script
 %debug
@@ -70,10 +71,12 @@ script:     statements {
                parser->script->statements = $1;
        }
 
                parser->script->statements = $1;
        }
 
+eol:   TOKEN_EOL | TOKEN_EOF;
+
 statements: /* empty */ {
                $$ = create_statements(parser);
        }
 statements: /* empty */ {
                $$ = create_statements(parser);
        }
-       | statements statement TOKEN_EOL {
+       | statements statement eol {
                statement_append($1, $2);
                $$ = $1;
        }
                statement_append($1, $2);
                $$ = $1;
        }