From f3880eaf5e07f5a32273f3f346fbc530e7b0aba4 Mon Sep 17 00:00:00 2001 From: phcoder Date: Mon, 15 Jun 2009 21:05:50 +0000 Subject: [PATCH] 2009-06-15 Vladimir Serbinenko 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 --- script/sh/lexer.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/script/sh/lexer.c b/script/sh/lexer.c index d3577d44c..47939c96d 100644 --- a/script/sh/lexer.c +++ b/script/sh/lexer.c @@ -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 {