[PATCH 4/9] style: factor common bits about string scanning

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
* src/scan-gram.l: here.
---
 src/scan-gram.l | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/scan-gram.l b/src/scan-gram.l
index 3b03923a..ad254694 100644
--- a/src/scan-gram.l
+++ b/src/scan-gram.l
@@ -566,8 +566,6 @@ eqopt    ({sp}=)?
               _("POSIX Yacc does not support string literals"));
     RETURN_VALUE (STRING, last_string);
   }
-  <<EOF>>   unexpected_eof (token_start, "\"");
-  {eol}     unexpected_newline (token_start, "\"");
 }
 
 <SC_ESCAPED_TSTRING>
@@ -580,10 +578,15 @@ eqopt    ({sp}=)?
               _("POSIX Yacc does not support string literals"));
     RETURN_VALUE (TSTRING, last_string);
   }
+}
+
+<SC_ESCAPED_STRING,SC_ESCAPED_TSTRING>
+{
   <<EOF>>   unexpected_eof (token_start, "\"");
   "\n"      unexpected_newline (token_start, "\"");
 }
 
+
   /*----------------------------------------------------------.
   | Scanning a Bison character literal, decoding its escapes. |
   | The initial quote is already eaten.                       |
-- 
2.27.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.