OK for master then. Thanks!
> On Sun, Sep 13, 2026, at 7:48 AM, Jose E. Marchesi wrote: >> Hello Pietro. >> Thanks for the patch. >> >>> The scanner builds list of lines from the source code. Then it >>> iterates over the list concatenating the lines that end with >>> backslashes with the following line. >>> >>> Instead of iterating over all lines skip a backslash if it preceeds a >>> newline. >> >> I suppose this change is motivated by having to keep the original source >> physical line structure for multi-line diagnostics, right. >> >> Makes sense, but see a note below. > > Yeah, but I never liked that function. I just never had an excuse to get rid > of it before. > >>> gcc/algol68/ChangeLog: >>> >>> * a68-parser-scanner.cc (concatenate_lines): Delete. >>> (read_source_file): Stop calling concatenate_lines. >>> (next_char): Skip backslash at the end of lines. >>> (include_files): Stop calling concatenate_lines. >>> >>> gcc/testsuite/ChangeLog: >>> >>> * algol68/compile/backslash-1.a68: New test. >>> >>> Signed-off-by: Pietro Monteiro <[email protected]> >>> --- >>> gcc/algol68/a68-parser-scanner.cc | 40 ++----------------- >>> gcc/testsuite/algol68/compile/backslash-1.a68 | 6 +++ >>> 2 files changed, 10 insertions(+), 36 deletions(-) >>> create mode 100644 gcc/testsuite/algol68/compile/backslash-1.a68 >>> >>> diff --git a/gcc/algol68/a68-parser-scanner.cc >>> b/gcc/algol68/a68-parser-scanner.cc >>> index 30c23996dcd..8bdd2de7057 100644 >>> --- a/gcc/algol68/a68-parser-scanner.cc >>> +++ b/gcc/algol68/a68-parser-scanner.cc >>> @@ -285,38 +285,6 @@ unworthy (LINE_T *u, char *v, char ch) >>> a68_scan_error (u, v, A68 (edit_line)); >>> } >>> >>> -/* Concatenate lines that terminate in '\' with next line. */ >>> - >>> -static void >>> -concatenate_lines (LINE_T * top) >>> -{ >>> - LINE_T *q; >>> - /* Work from bottom backwards. */ >>> - for (q = top; q != NO_LINE && NEXT (q) != NO_LINE; FORWARD (q)) >>> - ; >>> - >>> - for (; q != NO_LINE; BACKWARD (q)) >>> - { >>> - char *z = STRING (q); >>> - size_t len = strlen (z); >>> - >>> - if (len >= 2 >>> - && z[len - 2] == BACKSLASH_CHAR >>> - && z[len - 1] == NEWLINE_CHAR >>> - && NEXT (q) != NO_LINE >>> - && STRING (NEXT (q)) != NO_TEXT) >>> - { >>> - z[len - 2] = '\0'; >>> - len += (int) strlen (STRING (NEXT (q))); >>> - z = (char *) xmalloc (len + 1); >>> - a68_bufcpy (z, STRING (q), len + 1); >>> - a68_bufcat (z, STRING (NEXT (q)), len + 1); >>> - STRING (NEXT (q))[0] = '\0'; >>> - STRING (q) = z; >>> - } >>> - } >>> -} >>> - >>> /* Read source file FILENAME and make internal copy. */ >>> >>> static bool >>> @@ -400,9 +368,6 @@ read_source_file (const char *filename) >>> ? upper_postlude : supper_postlude, >>> &ref_l, &line_num, "postlude"); >>> >>> - /* Concatenate lines that end with \. */ >>> - concatenate_lines (TOP_LINE (&A68_JOB)); >>> - >>> /* Include files. */ >>> include_files (TOP_LINE (&A68_JOB)); >>> >>> @@ -428,6 +393,10 @@ next_char (LINE_T **ref_l, char **ref_s, bool >>> allow_typo, >>> if (*ref_l == NO_LINE) >>> return STOP_CHAR; >>> >>> + /* Skip backslash at the end of lines. */ >>> + if ((*ref_s)[0] == BACKSLASH_CHAR && (*ref_s)[1] == NEWLINE_CHAR) >>> + (*ref_s)++; >>> + >>> if ((*ref_s)[0] == NEWLINE_CHAR || (*ref_s)[0] == '\0') >>> { >>> /* Go to new line. */ >>> @@ -1133,7 +1102,6 @@ include_files (LINE_T *top) >>> /* Conclude and go find another include directive, if any. */ >>> NEXT (t) = s; >>> PREVIOUS (s) = t; >>> - concatenate_lines (top); >>> if (fclose (fp) != 0) >>> gcc_unreachable (); >>> make_pass = true; >>> diff --git a/gcc/testsuite/algol68/compile/backslash-1.a68 >>> b/gcc/testsuite/algol68/compile/backslash-1.a68 >>> new file mode 100644 >>> index 00000000000..e386d6e9c83 >>> --- /dev/null >>> +++ b/gcc/testsuite/algol68/compile/backslash-1.a68 >>> @@ -0,0 +1,6 @@ >>> +begin >>> + string foobar = "foo bar"; >>> + string fubar = "foo \ >>> +ar"; >> >> Is the test missing a "b"? > > Yes. Should I move this test to the execute directory? I don’t think running > it gains us much. > I could also have a simpler compile test. The assert is s a bit misleading > here. > >>> + assert (foobar = fubar) >>> +end > > Thanks for the review, > Pietro
