* grub-core/script/yylex.l: Ugly fix for "\\\n ".

* tests/grub_script_echo1.in: Add tests.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-05-08 23:20:02 +02:00
parent df760f778a
commit eea1e26e52
3 changed files with 55 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2012-05-08 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/script/yylex.l: Ugly fix for "\\\n ".
* tests/grub_script_echo1.in: Add tests.
2012-05-08 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.in: Ignore empty devicetree directory.

View File

@ -139,7 +139,8 @@ SPECIAL \?|\#|\*|\@
VARIABLE ${NAME}|$\{{NAME}\}|${DIGITS}|$\{{DIGITS}\}|${SPECIAL}|$\{{SPECIAL}\}
WORD ({CHAR}|{DQSTR}|{SQSTR}|{ESC}|{VARIABLE}|{I18NSTR})+
MULTILINE {WORD}?((\"{DQCHR}*)|(\$\"{DQCHR}*)|(\'{SQCHR}*)|(\\\n))
MULTILINE {WORD}?((\"{DQCHR}*)|(\$\"{DQCHR}*)|(\'{SQCHR}*))
POS_MULTILINE {WORD}?\\\n
%x SPLIT
%x DQUOTE
@ -190,6 +191,26 @@ MULTILINE {WORD}?((\"{DQCHR}*)|(\$\"{DQCHR}*)|(\'{SQCHR}*)|(\\\n))
return GRUB_PARSER_TOKEN_BAD;
}
{POS_MULTILINE} {
if (yyg->yy_c_buf_p + 1 == &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
{
if (grub_lexer_unput (yytext, yyscanner))
return GRUB_PARSER_TOKEN_BAD;
}
else
{
RECORD;
yypush_buffer_state (YY_CURRENT_BUFFER, yyscanner);
if (grub_lexer_resplit (yytext, yyscanner))
{
yypop_buffer_state (yyscanner);
return GRUB_PARSER_TOKEN_WORD;
}
yyextra->lexerstate->resplit = 1;
}
}
{NAME} { RECORD; return GRUB_PARSER_TOKEN_NAME; }
{WORD} {
RECORD;

View File

@ -144,5 +144,33 @@ echo "one\
echo "one\
two"
echo one \
two
echo one x\
two
echo one x\
"x" two
echo one x\
'x' two
echo one x\
\\ two
echo one x\
\
x
echo one x\
echo one x\
;
echo one x\
$var
if test x$grubshell = xyes; then insmod regexp; fi
echo /boot/grub/i386-pc/normal.mod