This commit is contained in:
Ingy döt Net 2013-10-27 22:24:23 +00:00
parent 6f050a029e
commit 776bba907c
3887 changed files with 59894 additions and 7280 deletions

View file

@ -0,0 +1,3 @@
auto strA = R"(this is
a newline-separated
raw string)";

View file

@ -0,0 +1,2 @@
"This is a valid string."
'As is this.'

View file

@ -0,0 +1,2 @@
X"00" *> Null character
X"48656C6C6F21" *> "Hello!"

View file

@ -0,0 +1,6 @@
HIGH-VALUE HIGH-VALUES *> Equivalent to (a string of) X"FF".
LOW-VALUE LOW-VALUES *> " " X"00".
NULL *> " " X"00".
QUOTE QUOTES *> " " double-quote character.
SPACE SPACES *> " " space.
ZERO ZEROS ZEROES *> " " zero.

View file

@ -0,0 +1,5 @@
"abcdef" == "abc\
\def"
"abc\ndef" == "abc\n\
\def"

View file

@ -0,0 +1,5 @@
{-# LANGUAGE QuasiQuotes #-}
import Text.RawString.QQ
"abc\ndef" == [r|abc
def|]

View file

@ -0,0 +1,12 @@
'a' // character literal
'\n' // also a character literal
"foo\nbar" // string literal
@"x\n" // same as "x\\n"
@"x
y" // same as "x\n y"
@"""Hi!""" // "" replaces \" to escape a literal quote mark
<#This string type can contain any symbols including "
and new lines. It does not support escape codes
like "\n".#> // same as "This string type can contain any symbols including \"\nand new lines. "
// + "It does not\nsupport escape codes\nlike \"\\n\"."
<#Test <# Inner #> end#> // same as "Test <# Inner #> end" (i.e. this string type support recursion.

View file

@ -0,0 +1,7 @@
'c' == "c" # character
'text' == "text"
' " '
" ' "
'\x20' == ' '
u'unicode string'
u'\u05d0' # unicode literal

View file

@ -0,0 +1 @@
r'\x20' == '\\x20'

View file

@ -0,0 +1,2 @@
''' single triple quote '''
""" double triple quote """