         "\"\"\""
     ] [
         "\""
-    ] if parse-long-string unescape-string ;
+    ] if (parse-multiline-string) unescape-string ;

        lexer get advance-char
    ] if ;

DEFER: (parse-long-string)

: parse-found-token ( i string token -- )
    [ lexer-before % ] dip
    CHAR: \ = [
        lexer get [ next-char , ] [ next-char , ] bi (parse-long-string)
    ] [
        dup rest-begins? [
            end-string-parse
        ] [
            lexer get next-char , (parse-long-string)
        ] if
    ] if ;

ERROR: trailing-characters string ;

: (parse-long-string) ( string -- )
    lexer get still-parsing? [
        dup first find-next-token [
            parse-found-token
        ] [
            drop lexer get next-line%
            (parse-long-string)
        ] if*
    ] [
        unexpected-eof
    ] if ;

PRIVATE>

: parse-long-string ( string -- string' )
    [ (parse-long-string) ] "" make ;

: parse-multiline-string ( -- string )
    lexer get rest-of-line "\"\"" head? [

        lexer get (>>column)
    ] bi ;

: rest-of-line ( lexer -- seq )
    [ line-text>> ] [ column>> ] bi tail-slice ;

