2006-05-20 Marco Gerards <marco@gnu.org>

* normal/lexer.c (grub_script_yylex): Don't filter out newlines.

	* normal/parser.y (commandblock): Defined as <cmd>.  A subroutine
	for `menuentry'.
	(script): Accept leading newlines.
	(newlines): New rule to describe 0 or more newlines.
	(commands): Accept `command' with trailing newline.  Fixed the
	order in which arguments were passed to `grub_script_add_cmd'.
	Accept commands separated by newlines.
	(function): Changed to accept newlines.
	(menuentry) Rewritten.

	* normal/script.c (grub_script_create_cmdmenu): Add new entries in
	front of the list, instead of to the end.
This commit is contained in:
marco_g 2006-05-20 11:10:22 +00:00
parent 577b405042
commit 7dc4f874a6
3 changed files with 51 additions and 30 deletions

View file

@ -1,7 +1,7 @@
/* script.c -- Functions to create an in memory description of the script. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005 Free Software Foundation, Inc.
* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -253,16 +253,14 @@ grub_script_add_cmd (struct grub_parser_param *state,
cmdblock->cmd.exec = grub_script_execute_cmdblock;
cmdblock->cmd.next = 0;
cmdblock->cmdlist = cmd;
cmd->next = 0;
}
else
{
struct grub_script_cmd **last;
for (last = &cmdblock->cmdlist; *last; last = &(*last)->next);
*last = cmd;
cmd->next = cmdblock->cmdlist;
cmdblock->cmdlist = cmd;
}
cmd->next = 0;
return (struct grub_script_cmd *) cmdblock;
}