changeset 223:436b36214e35

Fixed lack of error when there are extraneous characters at the end of the operand.
author lost
date Mon, 11 May 2009 06:09:49 +0000
parents 7803d2d09993
children 2e5a32d56e60 cf6d9ed87f58
files ChangeLog lwasm/parse.c
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat May 09 16:39:17 2009 +0000
+++ b/ChangeLog	Mon May 11 06:09:49 2009 +0000
@@ -17,6 +17,9 @@
     generated by lwasm [LWASM]
 [b] Fixed segfault in "extern" pseudo op and allowed a symbol list as the
     operand just like "export" [LWASM]
+[b] Fixed lack of error when there are extraneous characters at the end
+    of the operand. This did not cause incorrect code generation for correct
+    code but would silently generate incorrect code for some easy errors
 [+] 8 bit immediate operands can now be external references [LWASM]
 
 Version 2.3
--- a/lwasm/parse.c	Sat May 09 16:39:17 2009 +0000
+++ b/lwasm/parse.c	Mon May 11 06:09:49 2009 +0000
@@ -184,6 +184,10 @@
 		if (instab[opnum].fn)
 		{
 			(instab[opnum].fn)(as, l, &p2, opnum);
+			
+			// if we didn't end on a "space" character or EOL, throw error
+			if (*p2 && !isspace(*p2))
+				register_error(as, l, 1, "Bad operand");
 		}
 		else
 		{