Skip to contentSkip to conversation

parser eats '=' after variable names

DISCUSSION Robert Millan 2 participants 4 messages Feb 9, 2008 – Feb 10, 2008

lore
Share & tools
lore
#0 lore raw

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... :-/

Signature · 5 lines
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 /.)
#1 lore raw
Quoted 9 lines · Robert Millan

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=

Quoted 5 lines

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.

Signature · 1 line
Bean
#2 lore raw
Quoted 16 lines · Bean
Quoted 9 lines · Robert Millan

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=

Quoted 5 lines

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... :-/

Quoted 5 lines

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?

Signature · 5 lines
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 /.)
#3 lore raw
Quoted 18 lines · Robert Millan
Quoted 16 lines · Bean
Quoted 14 lines · Robert Millan

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... :-/

Quoted 8 lines
Quoted 5 lines

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.

Signature · 1 line
Bean