A New String Syntax. Rock-String
new idea on string syntax
in this syntax
- No escape sequence. String content is always literal. (no more toothpick syndrome or escape hell of passing command from program to shell or problem of regex searching regex.)
- Syntax designed so you do not need escape sequence.
- Has ways to embed non-printable chars or any unicode. (e.g. newline, tab, no-break space, right-to-left mark.)
- Can embed expression, so you don't need the typical printf or format or other template system.
- Simple grammar, only one single syntax. No use of different delimiters or triple quote.
most basic string syntax
"some"
and this
s"some"s
prefixed with a letter, or up to 20 random letters of a to z or 0 to 9. e.g.
jqvjt"some"jqvjt
when 2 strings are separated by whitespace, they are joined. e.g.
"aa" "bb"
is same as
"aabb"
to include a QUOTATION MARK, e.g.
ss"he said: "something""ss
embed expression is for example
x = 4
"i have" x "cats"
a character can be represented by
char(n)
the argument is the unicode char id in decimal. e.g.
- tab is
char(9)
- linefeed is
char(10)
- no-break space is
char(160)
so the typical JavaScript "a\nb"
is
"a" char(10) "b"
- function char(n) can take multiple args to represent multiple chars as a string.
- char(name) can also be made to take a string of unicode char name, so it is easier to read.