bi0qaw / skript-three-features

A list of features/ideas for skript three
0 stars 0 forks source link

Multiline Strings #2

Open bi0qaw opened 4 years ago

bi0qaw commented 4 years ago

Multiline strings should be supported.

Syntax should be something like this:

"""
Some
Multilinne
String
"""

And when used in a line of code:

set {text} to \
    """
    Some
    Multiline
    String
    """

The \ tells the parse that the code continues on the next line. Indentation should be supported as well:

set [text] to \
    """
    Some
        Indented
    String
    """
Olyno commented 4 years ago

It's good idea. I just don't like the python-likes syntax multiline string 😅

bi0qaw commented 4 years ago

An alternative could be a section style syntax:

set [text] to multiline text:
    Some
    Multiline
    String

But in this case it is not very easy to see that it is supposed to be a string.

Olyno commented 4 years ago

Why not using "`" symbol like javascript or typescript insead of current string symbol?

bi0qaw commented 4 years ago

Where would you put them?

set [text] to \
    `
    Some
    Multiline
    String
    `

This looks a bit weird to me

Olyno commented 4 years ago
set {_text} to `
    Some
    Multiline
    String
    `

and Skript could interpret this as "Add all lines from the first ` to the next ` and don't execute them"

bensku commented 4 years ago

JEP 355 for Java's approach of this might be useful read. Not that Skript should necessarily follow it, but many different styles of multiline text literals are covered there.