Home
       Revert "cc1: Fix lexer for strings" - scc - simple c99 compiler
  HTML git clone git://git.simple-cc.org/scc
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit ec6ce1e2a23d42e52697de6cb108d81edd1c0c0e
   DIR parent 4ed4dac59ff781ba4bd54db585c2384595e175dc
  HTML Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
       Date:   Tue,  8 Oct 2024 15:05:02 +0200
       
       Revert "cc1: Fix lexer for strings"
       
       This reverts commit eb8960812d92714eb568df36e09d8c76af5cd46c.
       
       Diffstat:
         M src/cmd/cc/cc1/lex.c                |       9 ++++++---
       
       1 file changed, 6 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/src/cmd/cc/cc1/lex.c b/src/cmd/cc/cc1/lex.c
       @@ -649,13 +649,14 @@ static int
        string(void)
        {
                char *bp = yytext;
       -        int c;
       +        int c, esc;
        
                *bp++ = '"';
       +        esc = 0;
                for (++input->p; ; ++input->p) {
                        c = *input->p;
        
       -                if (c == '"')
       +                if (c == '"' && !esc)
                                break;
        
                        if (c == '\0') {
       @@ -663,7 +664,9 @@ string(void)
                                break;
                        }
        
       -                if (c == '\\' && !disescape)
       +                esc = (c == '\\' && !esc && disescape);
       +
       +                if (c == '\\' && !esc)
                                c = escape();
        
                        if (bp == &yytext[STRINGSIZ+1]) {