Support line continuations within single-quoted strings?

Matlab does not support line continuations in either single-quoted character vectors or double-quoted strings. Is there a reason to enforce this in Octave, or can we diverge?

The current situation is quite mixed.

  • single-quoted strings
    No line continuations work.
x = 'abc \
def'   # fails
x = 'abc ...
def'   # fails
  • double-quoted strings
    One line continuation just works, the other works but with a warning.
x = "abc \
def"   # works
x = "abc ...
def"   # works with warning
warning: '...' continuations in double-quoted character strings are obsolete and will not be allowed in a future version of Octave; please use '\' instead

There seems to be several decisions to be made.

  1. Do we want to extend line continuations to single-quoted strings as an Octave extension?
  2. When do we want to deprecate and remove support for ‘…’ as a line continuation in double-quoted strings? There really can’t be many people using this so maybe for the 7.1 release?
  3. The syntax highlighter in the Octave Editor (Qscintilla) and here on Discourse incorrectly assume that line continuations work in single-quoted strings. If the answer to question #1 is “No”, we need to update the syntax grammar to not highlight the second line as a string, or better would be to highlight as an error.

Imho, we shouldn’t support line continuation in single quoted strings.
IIUC, the main (or single?) difference between double quoted and single quoted strings is the one escapes backslash character sequences and the other one does not. “\LF” is an escape sequence in my understanding and should only be interpreted as such in double quoted strings for consistency.

As much as I would like to avoid the change, I think we will eventually need to make Octave’s character strings (both single- and double-quoted) compatible with Matlab. People have been reporting missing string functions as compatibility issues for some time now.

Summing up what I believe is the consensus:

  1. NO, we will not extend line continuations to single-quoted strings
  2. YES, we will deprecate ... as a line continuation within double-quoted strings. This deprecation will begin with 7.1 release.
  3. YES, highlighting files for Qscintilla and for Discourse need to be updated.

I made that deprecation in this changeset: octave: cff933892ec2.

I filed a bug report about Qscintilla incorrectly highlighting single-quoted strings here: GNU Octave - Bugs: bug #59885, Qscintilla syntax file should not... [Savannah].

Created a new topic to address changing Discourse’s syntax highlighting here: Octave syntax highlighting incorrect for single-quoted strings.