Hi,
I know that ASSIGNMENT_WORD in parse.y is for assignments like x=10.
But in the grammar rules. I don't see any difference between them in
terms of actions to take. Where is the code that deals with them
differently?
Also, why parse x=10 as a single token. Why not parse it as three
tokens "x" "=" "10"? Is it because one wants to control the complexity
of the grammar? Thanks.
https://github.com/mfragkoulis/bash/blob/master/parse.y#L710
simple_command_element: WORD
{ $$.word = $1; $$.redirect = 0; }
| ASSIGNMENT_WORD
{ $$.word = $1; $$.redirect = 0; }
https://github.com/mfragkoulis/bash/blob/master/parse.y#L3098
if (token_to_read == WORD || token_to_read == ASSIGNMENT_WORD)
{
yylval.word = word_desc_to_read;
word_desc_to_read = (WORD_DESC *)NULL;
}
https://github.com/mfragkoulis/bash/blob/master/parse.y#L5748
case WORD:
case ASSIGNMENT_WORD:
if (yylval.word)
t = savestring (yylval.word->word);
break;
https://github.com/mfragkoulis/bash/blob/master/parse.y#L6030
if (tok != WORD && tok != ASSIGNMENT_WORD)
--
Regards,
Peng
[Prev in Thread]
Current Thread
[Next in Thread]
What is the purpose of ASSIGNMENT_WORD?,
Peng Yu<=