changeset 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 35f6d6a5510f
files lwasm/pseudo.c
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/pseudo.c	Wed Apr 13 19:01:53 2011 -0600
+++ b/lwasm/pseudo.c	Wed Apr 20 21:12:54 2011 -0600
@@ -217,7 +217,7 @@
 				(*p)++;
 				if (!**p)
 					break;
-		
+
 				switch (**p)
 				{
 					/* octal sequence or NUL */
@@ -226,16 +226,17 @@
 				case '1':
 				case '2':
 				case '3':
-					(*p)++;
+					wch = **p;
 					wch -= 0x30;
-					if (**p >= '0' && **p <= '9')
+					if ((*p)[1] >= '0' && (*p)[1] < '8')
 					{
+						(*p)++;
 						wch *= 8;
 						wch += **p - 0x30;
+					}
+					if ((*p)[1] >= '0' && (*p)[1] < '8')
+					{
 						(*p)++;
-					}
-					if (**p >= '0' && **p <= '9')
-					{
 						wch *= 8;
 						wch += **p -0x30;
 					}