Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JEkwM-0006YV-Mf for mharc-grub-devel@gnu.org; Tue, 15 Jan 2008 07:30:50 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JEkwK-0006UQ-Fu for grub-devel@gnu.org; Tue, 15 Jan 2008 07:30:48 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JEkwI-0006QN-Hp for grub-devel@gnu.org; Tue, 15 Jan 2008 07:30:47 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JEkwI-0006QG-DU for grub-devel@gnu.org; Tue, 15 Jan 2008 07:30:46 -0500 Received: from py-out-1112.google.com ([64.233.166.183]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JEkwI-00022j-2w for grub-devel@gnu.org; Tue, 15 Jan 2008 07:30:46 -0500 Received: by py-out-1112.google.com with SMTP id u52so2768025pyb.1 for ; Tue, 15 Jan 2008 04:30:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=FkWjvdYnrdLs1Ol8kN8Hvaool1O7V2zwRwZBIc03q6A=; b=Bt2QlDTWkjEwLwUbOz+rSzEJqJBU24QIZ2xxr9MAhEYo4n0FThh+RK4jUwE/BaW8aykV4s1SMGOXHoKrkw8sVZFgn2+iMzaOBxaEXhW5d+BbwWpydh97/e4sKbGqIPJCnr1UikDweqYKfKTQ0Bnrxi6S+RIw3vkSB+NgoXUMZkA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=k6aMqYMIMyicOOljPDEOFQsWH9YZ6CgRaZzfpQZes1zVg7vAdVvy0wN4OPhZmN7uUfM+MStzAv4EHQMFmD7avB5yIbyea1jI2ZfPAgfz06ZeJUxl1W4OrYfoKOYkZH4+aTF0407v1gSo1uOYlPEZMeNbc7b85OsMiTnCxJLRQLI= Received: by 10.35.92.18 with SMTP id u18mr9124387pyl.38.1200400245415; Tue, 15 Jan 2008 04:30:45 -0800 (PST) Received: by 10.35.110.12 with HTTP; Tue, 15 Jan 2008 04:30:45 -0800 (PST) Message-ID: Date: Tue, 15 Jan 2008 20:30:45 +0800 From: Bean To: "The development of GRUB 2" In-Reply-To: <8763xv4a7t.fsf@xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <87ir1xftyi.fsf@xs4all.nl> <8763xv4a7t.fsf@xs4all.nl> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Subject: Re: [PATCH] Bug fix for parser X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jan 2008 12:30:49 -0000 > > if grub_error is set, it will effect the parser, caused menu not to be > > showed, etc. > > Right, but do you want to see a menu if not everything is correctly executed? the problem is that it's not always an error when grub_errno is set, for example, the test command use it to report whether or not two strings equals. > >> I do not like the name "script_1". > > > > what do you suggest ? > > Hopefully someone else knows a better name? :-) how about script_init for the old script, and script here. > >> > commandblock: '{' > >> > { > >> > grub_script_lexer_ref (state->lexerstate); > >> > - grub_script_lexer_record_start (state->lexerstate); > >> > >> Ehm? Can you explain this? If I am not mistaken, this will result in > >> a memory leak. > > > > I split commandblock from menuentry, now it's a standalone statement. > > Ah ok, so there is a grub_script_lexer_record_start elsewhere that > forfills the same role? yes, the grub_script_lexer_record_start is in menuentry. > >> What was the problem here? > > > > I don't like the idea of deref in another statement, and now we can > > use {} separately. > > Of deref? Can you explain? The idea of commandblock was that this > structure might show up more often. But I have no objections for now > if a bug is fixed this way. in the old implementation, commandblock: '{' { grub_script_lexer_ref (state->lexerstate); } newlines commands '}' { grub_script_lexer_deref (state->lexerstate); grub_script_lexer_record_start (state->lexerstate); $$ = $4; } ; menuentry: "menuentry" argument newlines commandblock { char *menu_entry; menu_entry = grub_script_lexer_record_stop (state->lexerstate); $$ = grub_script_create_cmdmenu (state, $2, menu_entry, 0); } it calls grub_script_lexer_record_start in commandblock, and grub_script_lexer_record_stop in menuentry, but now it's both inside menuentry. i think it's better this way. besides, if you use commandblock alone in old implemenation, it will cause problem becuase there is no matching grub_script_lexer_record_stop. > > Btw, does this patch incorporate the previous patch you sent in > regarding scripting? I didn't include the fix on the lexer, for example. ${AA}${BB} should expand to one token instead of two. I think it's better to use a separate patch. -- Bean