diff 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
line wrap: on
line diff
--- a/lwasm/lwasm.c	Fri Mar 21 23:49:23 2014 -0600
+++ b/lwasm/lwasm.c	Fri Apr 11 21:50:47 2014 -0600
@@ -402,6 +402,10 @@
 			return NULL;
 		v = (unsigned char)**p << 8 | (unsigned char)*((*p)+1);
 		(*p) += 2;
+		
+		if (**p == '"')
+			(*p)++;
+		
 		return lw_expr_build(lw_expr_type_int, v);
 	}
 	
@@ -415,6 +419,10 @@
 		
 		v = (unsigned char)**p;
 		(*p)++;
+		
+		if (**p == '\'')
+			(*p)++;
+		
 		return lw_expr_build(lw_expr_type_int, v);
 	}