All of lore.kernel.org
 help / color / mirror / Atom feed
* parser eats '=' after variable names
@ 2008-02-09 21:15 Robert Millan
  2008-02-10  9:55 ` Bean
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Millan @ 2008-02-09 21:15 UTC (permalink / raw)
  To: grub-devel


It seems that the parser eats the extra '=' when used after a variable
evaluation:

grub> set a=a
grub> echo $a
a
grub> echo $a=

grub>

This breaks e.g. variable comparison via "test $a=b".  Does someone have an
idea on how to fix it?  I assume it involves the bison stuff which is highly
confusing to me... :-/

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: parser eats '=' after variable names
  2008-02-09 21:15 parser eats '=' after variable names Robert Millan
@ 2008-02-10  9:55 ` Bean
  2008-02-10 12:10   ` Robert Millan
  0 siblings, 1 reply; 4+ messages in thread
From: Bean @ 2008-02-10  9:55 UTC (permalink / raw)
  To: The development of GRUB 2

On Feb 10, 2008 5:15 AM, Robert Millan <rmh@aybabtu.com> wrote:
>
> It seems that the parser eats the extra '=' when used after a variable
> evaluation:
>
> grub> set a=a
> grub> echo $a
> a
> grub> echo $a=
>
> grub>
>
> This breaks e.g. variable comparison via "test $a=b".  Does someone have an
> idea on how to fix it?  I assume it involves the bison stuff which is highly
> confusing to me... :-/

This problem is caused by the lexer, the token is broken when a
variable is found. so $a will be a token, and =b will be another one.
I have written a patch some time ago, it works by constructing a
GRUB_PARSER_TOKEN_VAR inside grub_script_yylex2, and return it to the
parser.

-- 
Bean



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: parser eats '=' after variable names
  2008-02-10  9:55 ` Bean
@ 2008-02-10 12:10   ` Robert Millan
  2008-02-10 12:16     ` Bean
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Millan @ 2008-02-10 12:10 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, Feb 10, 2008 at 05:55:25PM +0800, Bean wrote:
> On Feb 10, 2008 5:15 AM, Robert Millan <rmh@aybabtu.com> wrote:
> >
> > It seems that the parser eats the extra '=' when used after a variable
> > evaluation:
> >
> > grub> set a=a
> > grub> echo $a
> > a
> > grub> echo $a=
> >
> > grub>
> >
> > This breaks e.g. variable comparison via "test $a=b".  Does someone have an
> > idea on how to fix it?  I assume it involves the bison stuff which is highly
> > confusing to me... :-/
> 
> This problem is caused by the lexer, the token is broken when a
> variable is found. so $a will be a token, and =b will be another one.
> I have written a patch some time ago, it works by constructing a
> GRUB_PARSER_TOKEN_VAR inside grub_script_yylex2, and return it to the
> parser.

Ah, I thought all your lexer changes had been committed.  Do you remember
the mail subject?

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: parser eats '=' after variable names
  2008-02-10 12:10   ` Robert Millan
@ 2008-02-10 12:16     ` Bean
  0 siblings, 0 replies; 4+ messages in thread
From: Bean @ 2008-02-10 12:16 UTC (permalink / raw)
  To: The development of GRUB 2

On Feb 10, 2008 8:10 PM, Robert Millan <rmh@aybabtu.com> wrote:
>
> On Sun, Feb 10, 2008 at 05:55:25PM +0800, Bean wrote:
> > On Feb 10, 2008 5:15 AM, Robert Millan <rmh@aybabtu.com> wrote:
> > >
> > > It seems that the parser eats the extra '=' when used after a variable
> > > evaluation:
> > >
> > > grub> set a=a
> > > grub> echo $a
> > > a
> > > grub> echo $a=
> > >
> > > grub>
> > >
> > > This breaks e.g. variable comparison via "test $a=b".  Does someone have an
> > > idea on how to fix it?  I assume it involves the bison stuff which is highly
> > > confusing to me... :-/
> >
> > This problem is caused by the lexer, the token is broken when a
> > variable is found. so $a will be a token, and =b will be another one.
> > I have written a patch some time ago, it works by constructing a
> > GRUB_PARSER_TOKEN_VAR inside grub_script_yylex2, and return it to the
> > parser.
>
> Ah, I thought all your lexer changes had been committed.  Do you remember
> the mail subject?

The parser part have been committed, but the lexer part is not. the
patch is very old, i think it can't be applied directly.


-- 
Bean



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-02-10 12:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-09 21:15 parser eats '=' after variable names Robert Millan
2008-02-10  9:55 ` Bean
2008-02-10 12:10   ` Robert Millan
2008-02-10 12:16     ` Bean

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.