about summary refs log tree commit diff stats
path: root/html/067random.cc.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-08-20 19:29:45 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-08-20 19:44:07 -0700
commit3369875ccd0e42a8639509a400d2d9cb1356d79a (patch)
tree20272a7d874d1d35f94aebe0c847a91e819dd9c4 /html/067random.cc.html
parent18261f194d34d6d8aa2f359052796c4f6d373c1b (diff)
downloadmu-3369875ccd0e42a8639509a400d2d9cb1356d79a.tar.gz
3233 - change how Mu escapes strings
Thanks Sam Putman for helping think through this idea.

When you encounter a backslash, strip it out and pass through any
following run of backslashes. If we 'escaped' a single following
character like C, then the character '\' would be the same as:

  '\\' escaped once
  '\\\\' escaped twice
  '\\\\\\\\' escaped thrice (8 backslashes)

..and so on, the number of backslashes doubling each time. Instead, our
approach is to make the character '\' the same as:

  '\\' escaped once
  '\\\' escaped twice
  '\\\\' escaped thrice

..and so on, the number of backslashes merely increasing by one each
time.

This approach only works as long as backslashes aren't also overloaded
to create special characters. So Mu doesn't follow C's approach of
overloading backslashes both to escape quote characters and also as a
notation for unprintable characters like '\n'.
Diffstat (limited to 'html/067random.cc.html')
0 files changed, 0 insertions, 0 deletions
='n133' href='#n133'>133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198