]> granicus.if.org Git - flex/commitdiff
scanner: Check for 0 bracecount when EOL ends quoted literal.
authorDemi Obenour <demiobenour@gmail.com>
Wed, 3 May 2017 17:45:11 +0000 (13:45 -0400)
committerWill Estes <westes575@gmail.com>
Wed, 3 May 2017 20:13:39 +0000 (16:13 -0400)
This can happen in the case of // comments (which Flex doesn't handle
specially).

src/scan.l

index abe47f42eabaadc8ecc4470553da85ae6911729d..66db8645ceeb5b3dabf53fc312c6f2533405fa8d 100644 (file)
@@ -919,7 +919,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0';  /* chop trailing brace */
        {NL}    {
                ++linenum;
                ACTION_ECHO;
-               if (bracelevel == 0 || (doing_codeblock && indented_code)) {
+               if (bracelevel <= 0 || (doing_codeblock && indented_code)) {
             if ( doing_rule_action )
                 add_action( "\tYY_BREAK]""]\n" );
 
@@ -964,7 +964,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0';  /* chop trailing brace */
 <ACTION_STRING,CHARACTER_CONSTANT>{
         (\\\n)*         ACTION_ECHO;
        \\(\\\n)*.      ACTION_ECHO;
-       {NL}    ++linenum; ACTION_ECHO; BEGIN(ACTION);
+       {NL}    ++linenum; ACTION_ECHO; if (bracelevel <= 0) { BEGIN(SECT2); } else { BEGIN(ACTION); }
         .      ACTION_ECHO;
 }