Add variable parsing in $"..." and fix several mismatches with bash.
* Makefile.util.def (grub_script_gettext): New test. * grub-core/script/execute.c (parse_string): New function. (gettext_append): Likewise. (grub_script_arglist_to_argv): Use gettext_append. * grub-core/script/yylex.l: Fix slash and newline handling in $"...". * tests/grub_script_gettext.in: New file.
This commit is contained in:
parent
9fdb2d7b11
commit
546fbe9b5a
5 changed files with 298 additions and 4 deletions
|
@ -139,7 +139,7 @@ SPECIAL \?|\#|\*|\@
|
|||
VARIABLE ${NAME}|$\{{NAME}\}|${DIGITS}|$\{{DIGITS}\}|${SPECIAL}|$\{{SPECIAL}\}
|
||||
WORD ({CHAR}|{DQSTR}|{SQSTR}|{ESC}|{VARIABLE}|{I18NSTR})+
|
||||
|
||||
MULTILINE {WORD}?((\"{DQCHR}*)|(\'{SQCHR}*)|(\\\n))
|
||||
MULTILINE {WORD}?((\"{DQCHR}*)|(\$\"{DQCHR}*)|(\'{SQCHR}*)|(\\\n))
|
||||
|
||||
%x SPLIT
|
||||
%x DQUOTE
|
||||
|
@ -289,7 +289,7 @@ MULTILINE {WORD}?((\"{DQCHR}*)|(\'{SQCHR}*)|(\\\n))
|
|||
}
|
||||
|
||||
<I18NQUOTE>{
|
||||
\\\\ { COPY ("\\", 1); }
|
||||
\\\\ { COPY ("\\\\", 2); }
|
||||
\\\" { COPY ("\"", 1); }
|
||||
\\\n { /* ignore */ }
|
||||
[^\"\\\n]+ { COPY (yytext, yyleng); }
|
||||
|
@ -297,6 +297,7 @@ MULTILINE {WORD}?((\"{DQCHR}*)|(\'{SQCHR}*)|(\\\n))
|
|||
yy_pop_state (yyscanner);
|
||||
ARG (GRUB_SCRIPT_ARG_TYPE_GETTEXT);
|
||||
}
|
||||
\\ { COPY ("\\", 1); }
|
||||
(.|\n) { COPY (yytext, yyleng); }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue