=== modified file 'grub-core/script/execute.c' --- grub-core/script/execute.c 2012-02-04 11:21:21 +0000 +++ grub-core/script/execute.c 2012-02-10 22:24:15 +0000 @@ -26,6 +26,7 @@ #include #include #include +#include /* Max digits for a char is 3 (0xFF is 255), similarly for an int it is sizeof (int) * 3, and one extra for a possible -ve sign. */ @@ -312,8 +313,8 @@ struct grub_script_arg *arg = 0; struct grub_script_argv result = { 0, 0, 0 }; - auto int append (char *s, int escape_type); - int append (char *s, int escape_type) + auto int append (const char *s, int escape_type); + int append (const char *s, int escape_type) { int r; char *p = 0; @@ -379,12 +380,20 @@ break; case GRUB_SCRIPT_ARG_TYPE_TEXT: - if (grub_strlen (arg->str) && + if (arg->str[0] && grub_script_argv_append (&result, arg->str, grub_strlen (arg->str))) goto fail; break; + case GRUB_SCRIPT_ARG_TYPE_GETTEXT: + { + const char *t = _(arg->str); + if (grub_script_argv_append (&result, t, grub_strlen (t))) + goto fail; + } + break; + case GRUB_SCRIPT_ARG_TYPE_DQSTR: case GRUB_SCRIPT_ARG_TYPE_SQSTR: if (append (arg->str, 1)) === modified file 'grub-core/script/yylex.l' --- grub-core/script/yylex.l 2012-02-03 10:56:49 +0000 +++ grub-core/script/yylex.l 2012-02-10 22:20:27 +0000 @@ -131,15 +131,17 @@ SQCHR [^\'] DQCHR {ESC}|[^\\\"] DQSTR \"{DQCHR}*\" +I18NSTR \$\"{DQCHR}*\" SQSTR \'{SQCHR}*\' SPECIAL \?|\#|\*|\@ VARIABLE ${NAME}|$\{{NAME}\}|${DIGITS}|$\{{DIGITS}\}|${SPECIAL}|$\{{SPECIAL}\} -WORD ({CHAR}|{DQSTR}|{SQSTR}|{ESC}|{VARIABLE})+ +WORD ({CHAR}|{DQSTR}|{SQSTR}|{ESC}|{VARIABLE}|{I18NSTR})+ MULTILINE {WORD}?((\"{DQCHR}*)|(\'{SQCHR}*)|(\\\n)) %x SPLIT %x DQUOTE +%x I18NQUOTE %x SQUOTE %x VAR @@ -215,6 +217,10 @@ yy_push_state (SQUOTE, yyscanner); ARG (GRUB_SCRIPT_ARG_TYPE_TEXT); } + "\$\"" { + yy_push_state (I18NQUOTE, yyscanner); + ARG (GRUB_SCRIPT_ARG_TYPE_GETTEXT); + } \$ { yy_push_state (VAR, yyscanner); ARG (GRUB_SCRIPT_ARG_TYPE_TEXT); @@ -280,6 +286,18 @@ (.|\n) { COPY (yytext, yyleng); } } +{ + \\\\ { COPY ("\\", 1); } + \\\" { COPY ("\"", 1); } + \\\n { /* ignore */ } + [^\"\\\n]+ { COPY (yytext, yyleng); } + \" { + yy_pop_state (yyscanner); + ARG (GRUB_SCRIPT_ARG_TYPE_GETTEXT); + } + (.|\n) { COPY (yytext, yyleng); } +} + <> { yypop_buffer_state (yyscanner); yyextra->lexerstate->eof = 1; === modified file 'include/grub/script_sh.h' --- include/grub/script_sh.h 2011-11-11 19:34:37 +0000 +++ include/grub/script_sh.h 2012-02-10 20:30:33 +0000 @@ -53,6 +53,7 @@ { GRUB_SCRIPT_ARG_TYPE_VAR, GRUB_SCRIPT_ARG_TYPE_TEXT, + GRUB_SCRIPT_ARG_TYPE_GETTEXT, GRUB_SCRIPT_ARG_TYPE_DQVAR, GRUB_SCRIPT_ARG_TYPE_DQSTR, GRUB_SCRIPT_ARG_TYPE_SQSTR,