diff lwasm/pass1.c @ 344:0215a0fbf61b

Added assembly error system and additional checks for symbol syntax
author lost@starbug
date Thu, 25 Mar 2010 22:06:50 -0600
parents 7b4123dce741
children 7416c3f9c321
line wrap: on
line diff
--- a/lwasm/pass1.c	Thu Mar 25 20:51:34 2010 -0600
+++ b/lwasm/pass1.c	Thu Mar 25 22:06:50 2010 -0600
@@ -66,6 +66,7 @@
 		cl -> prev = as -> line_tail;
 		cl -> len = -1;
 		cl -> insn = -1;
+		cl -> err = NULL;
 		if (!as -> line_tail)
 		{
 			as -> line_head = cl;
@@ -165,6 +166,7 @@
 				if (*tok != ';' && *tok != '*')
 				{
 					// bad opcode; check for macro here
+					lwasm_register_error(as, cl, "Bad opcode");
 				}
 			}
 			else
@@ -175,6 +177,7 @@
 				if (*p1 && !isspace(*p1))
 				{
 					// flag bad operand error
+					lwasm_register_error(as, cl, "Bad operand (%s)", p1);
 				}
 			}
 		}
@@ -186,9 +189,10 @@
 			printf("\n");
 
 			// register symbol at line address
-			if (!register_symbol(as, cl -> sym, cl -> addr, symbol_flag_none))
+			if (!register_symbol(as, cl, cl -> sym, cl -> addr, symbol_flag_none))
 			{
 				// symbol error
+				lwasm_register_error(as, cl, "Bad symbol '%s'", cl -> sym);
 			}
 		}