]> code.delx.au - gnu-emacs/commitdiff
(yylex): Accept string literals with newlines in them.
authorGerd Moellmann <gerd@gnu.org>
Mon, 10 Jul 2000 20:36:58 +0000 (20:36 +0000)
committerGerd Moellmann <gerd@gnu.org>
Mon, 10 Jul 2000 20:36:58 +0000 (20:36 +0000)
(process_pp_line): Handle case of string literal with newline
in it in replacement text, which counts as continuing the
replacement text in GNU C.

lib-src/ebrowse.c

index 8ebe5ff8991653857d8871cd004d9757f721e922..8dcd830793efb06a400c35608131d1cce5df3b9d 100644 (file)
@@ -1462,7 +1462,7 @@ do {                                              \
 int
 process_pp_line ()
 {
-  int in_comment = 0;
+  int in_comment = 0, in_string = 0;
   int c;
   char *p = yytext;
 
@@ -1501,7 +1501,7 @@ process_pp_line ()
        }
     }
   
-  while (c && (c != '\n' || in_comment))
+  while (c && (c != '\n' || in_comment || in_string))
     {
       if (c == '\\')
        GET (c);
@@ -1515,13 +1515,15 @@ process_pp_line ()
          if (GET (c) == '/')
            in_comment = 0;
        }
+      else if (c == '"')
+       in_string = !in_string;
       
       if (c == '\n')
        INCREMENT_LINENO;
 
       GET (c);
     }
-  
+
   return c;
 }
 
@@ -1579,6 +1581,7 @@ yylex ()
                   else switch (c)
                     {
                     case '\n':
+                     INCREMENT_LINENO;
                     case 'a':
                     case 'b':
                     case 'f':
@@ -1641,7 +1644,7 @@ yylex ()
                   else
                     yyerror ("newline in string constant");
                   INCREMENT_LINENO;
-                  goto end_string;
+                  break;
 
                 default:
                   break;