Mercurial > hg > index.cgi
comparison lwasm/lwasm.c @ 326:d399df78e1ab
Allow trailing ' or " on ascii constants
Allow for 'c' or "cc" instead of just 'c and "cc for ascii constants. This
adds additional compatibility for some unusual source files while not
causing well formed files to fail.
author | Tom LeMense <tlemense@yahoo.com> |
---|---|
date | Fri, 11 Apr 2014 21:50:47 -0600 |
parents | bc25269d96bc |
children | 30b2bad9b5eb |
comparison
equal
deleted
inserted
replaced
325:6821f4855702 | 326:d399df78e1ab |
---|---|
400 return NULL; | 400 return NULL; |
401 if (!*((*p)+1)) | 401 if (!*((*p)+1)) |
402 return NULL; | 402 return NULL; |
403 v = (unsigned char)**p << 8 | (unsigned char)*((*p)+1); | 403 v = (unsigned char)**p << 8 | (unsigned char)*((*p)+1); |
404 (*p) += 2; | 404 (*p) += 2; |
405 | |
406 if (**p == '"') | |
407 (*p)++; | |
408 | |
405 return lw_expr_build(lw_expr_type_int, v); | 409 return lw_expr_build(lw_expr_type_int, v); |
406 } | 410 } |
407 | 411 |
408 if (**p == '\'') | 412 if (**p == '\'') |
409 { | 413 { |
413 if (!**p) | 417 if (!**p) |
414 return NULL; | 418 return NULL; |
415 | 419 |
416 v = (unsigned char)**p; | 420 v = (unsigned char)**p; |
417 (*p)++; | 421 (*p)++; |
422 | |
423 if (**p == '\'') | |
424 (*p)++; | |
425 | |
418 return lw_expr_build(lw_expr_type_int, v); | 426 return lw_expr_build(lw_expr_type_int, v); |
419 } | 427 } |
420 | 428 |
421 if (**p == '&') | 429 if (**p == '&') |
422 { | 430 { |