2009-06-15 Vladimir Serbinenko <phcoder@gmail.com>

Fix handling of string like \"hello\" and "a
	b"

	* script/sh/lexer.c (check_textstate): accept GRUB_PARSER_STATE_ESC
	(grub_script_yylex): fix parsing of quoting, escaping and newline
This commit is contained in:
phcoder 2009-06-15 21:05:50 +00:00
parent 3148bc1cbd
commit f3880eaf5e
1 changed files with 8 additions and 1 deletions

View File

@ -185,11 +185,18 @@ grub_script_yylex (union YYSTYPE *yylval, struct grub_parser_param *parsestate)
break;
grub_dprintf ("scripting", "token=`\\n'\n");
recordchar (state, '\n');
if (state->state != GRUB_PARSER_STATE_ESC)
if (state->state != GRUB_PARSER_STATE_ESC
&& state->state != GRUB_PARSER_STATE_DQUOTE
&& state->state != GRUB_PARSER_STATE_QUOTE)
{
state->tokenonhold = '\n';
break;
}
if (state->state == GRUB_PARSER_STATE_DQUOTE
|| state->state == GRUB_PARSER_STATE_QUOTE)
yylval->arg = grub_script_arg_add (parsestate, yylval->arg,
GRUB_SCRIPT_ARG_TYPE_STR,
"\n");
}
else
{