]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/script/yylex.l: Ugly fix for "\\\n ".
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Tue, 8 May 2012 21:20:02 +0000 (23:20 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Tue, 8 May 2012 21:20:02 +0000 (23:20 +0200)
* tests/grub_script_echo1.in: Add tests.

ChangeLog
grub-core/script/yylex.l
tests/grub_script_echo1.in

index 21ed6ff7f01f169f869505b66b6d24cfafcfa1f7..da1e88c7ed0d3a8678811e4594902194b84dd5df 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index 3d6899a93e89a23b4e3aa6d4a1476fbfa2a5ca86..a8e66cfd4bd848b03f83a914e4ca9bfa39b67030 100644 (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;
index 82a1198c96316eb93299cb4da0f2ff0c8ee9c1b3..6209117953121b67c99d7c160053fc220990c079 100644 (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