cue icon indicating copy to clipboard operation
cue copied to clipboard

Multiline string rejects line terminator elision

Open infogulch opened this issue 1 year ago • 1 comments

What version of CUE are you using (cue version)?

$ cue version
cue version v0.10.0

go version go1.23.0
      -buildmode exe
       -compiler gc
       -trimpath true
     CGO_ENABLED 0
          GOARCH amd64
            GOOS linux
         GOAMD64 v1
cue.lang.version v0.10.0

Does this issue reproduce with the latest stable release?

Yes

What did you do?

Tried to evaluate the string from the spec under String and byte sequence literals:

"""
    lily:
    out of the water
    out of itself

    bass
    picking \
    bugs
    off the moon
        — Nick Virgilio, Selected Haiku, 1988
    """

What did you expect to see?

According to the spec page it should be equivalent to:

"lily:\nout of the water\nout of itself\n\n" +
"bass\npicking bugs\noff the moon\n" +
"    — Nick Virgilio, Selected Haiku, 1988"

What did you see instead?

cannot get syntax for "-": unknown escape sequence:
    -:7:14

Notes

Here's a playground with this issue: https://cuelang.org/play/?id=7uimnxuUVGR#w=function&i=cue&f=eval&o=cue

A smaller reproduction case: https://cuelang.org/play/?id=hxhDZo_g4zz#w=function&i=cue&f=eval&o=cue

infogulch avatar Sep 29 '24 04:09 infogulch

Ah this seems related to https://github.com/cue-lang/cue/issues/2317

infogulch avatar Oct 02 '24 00:10 infogulch

Yes; this is #2317. Line continuations with backslashes are not implemented right now.

mvdan avatar May 13 '25 00:05 mvdan