changeset 157:745721e13970

allow : after symbol at line start
author lost
date Sat, 31 Jan 2009 05:29:15 +0000
parents d8d3cee39bc5
children f0527dc3804d
files lwasm/parse.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/parse.c	Sat Jan 31 04:57:45 2009 +0000
+++ b/lwasm/parse.c	Sat Jan 31 05:29:15 2009 +0000
@@ -68,7 +68,7 @@
 	{
 		// we have a symbol specified here
 		// parse it out and record it for later use
-		for (p2 = p; *p2 && !isspace(*p2); p2++)
+		for (p2 = p; *p2 && !isspace(*p2) && *p2 != ':'; p2++)
 			/* do nothing */ ;
 		
 		sym = lwasm_alloc((p2 - p) + 1);
@@ -76,6 +76,14 @@
 		memcpy(sym, p, p2 - p);
 		
 		p = p2;
+		if (!*sym)
+		{
+			register_error(as, l, 1, "Invalid symbol");
+			lwasm_free(sym);
+			sym = NULL;
+		}
+		if (*p == ':')
+			p++;
 	}
 	l -> sym = sym;