alliedmodders / sourcepawn

A small, statically typed scripting language.
Other
369 stars 63 forks source link

[Feature Request] Python style triple quote multi line string literals #785

Open sapphonie opened 2 years ago

sapphonie commented 2 years ago

Please. This is agonizing:

https://github.com/sapphonie/StAC-tf2/blob/master/scripting/stac/stac_stocks.sp#L762

<3

asherkin commented 2 years ago

This does seem like it would be a useful addition to have - I'd probably lean more on the side of a heredoc-style syntax with flexible indentation stripping similar to what PHP has in 7.3, as I think the Python style is a little annoying with the string content being on the same line as the identifiers and needing to be flush with the left edge (but triple quotes as the marker seems nice).

JoinedSenses commented 2 years ago

id also like to see the implementation of raw strings. i think at some point they were removed?

dvander commented 2 years ago

Agreed, Python triple-quote strings are very idiosyncratic, but some kind of block literal syntax would be great. And not difficult to implement.

assyrianic commented 2 years ago

not to necro this but can i suggest Golang's ` backtick quotes for doing raw strings?


fmt.Printf(`this
is
a raw string`)