Mercurial > hg > index.cgi
comparison lwasm/pseudo.c @ 76:da74ccf4278c
Fixed bug parsing octal constants under cescapes pragma
author | lost@l-w.ca |
---|---|
date | Wed, 20 Apr 2011 21:12:54 -0600 |
parents | 3d50022e16e7 |
children | 16a72d9b6eb6 |
comparison
equal
deleted
inserted
replaced
75:3d50022e16e7 | 76:da74ccf4278c |
---|---|
215 /* escape sequence */ | 215 /* escape sequence */ |
216 | 216 |
217 (*p)++; | 217 (*p)++; |
218 if (!**p) | 218 if (!**p) |
219 break; | 219 break; |
220 | 220 |
221 switch (**p) | 221 switch (**p) |
222 { | 222 { |
223 /* octal sequence or NUL */ | 223 /* octal sequence or NUL */ |
224 /* skip the "0", then skip up to two more digits */ | 224 /* skip the "0", then skip up to two more digits */ |
225 case '0': | 225 case '0': |
226 case '1': | 226 case '1': |
227 case '2': | 227 case '2': |
228 case '3': | 228 case '3': |
229 (*p)++; | 229 wch = **p; |
230 wch -= 0x30; | 230 wch -= 0x30; |
231 if (**p >= '0' && **p <= '9') | 231 if ((*p)[1] >= '0' && (*p)[1] < '8') |
232 { | 232 { |
233 (*p)++; | |
233 wch *= 8; | 234 wch *= 8; |
234 wch += **p - 0x30; | 235 wch += **p - 0x30; |
236 } | |
237 if ((*p)[1] >= '0' && (*p)[1] < '8') | |
238 { | |
235 (*p)++; | 239 (*p)++; |
236 } | |
237 if (**p >= '0' && **p <= '9') | |
238 { | |
239 wch *= 8; | 240 wch *= 8; |
240 wch += **p -0x30; | 241 wch += **p -0x30; |
241 } | 242 } |
242 break; | 243 break; |
243 | 244 |