changeset 193:716879fc6790

Allow $ to be a local symbol and allow symbols with $ to start with a digit
author lost
date Sun, 22 Mar 2009 17:25:19 +0000
parents bfd0fb0a85c2
children 0d916bcebb90
files lwasm/symbol.c
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/symbol.c	Sun Mar 22 16:28:40 2009 +0000
+++ b/lwasm/symbol.c	Sun Mar 22 17:25:19 2009 +0000
@@ -62,16 +62,19 @@
 	// [a-zA-Z0-9._$?@] and any byte value larger than 0x7F
 	// although symbols should be restricted to the 7 bit range
 	// symbols must start with [a-zA-Z._]
-	if (!strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._@?", *sym))
+	if (!strchr(sym, '$'))
 	{
-		register_error(as, l, 1, "Bad symbol: %s", sym);
-		return -1;
-	}
+		if (!strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._@?", *sym))
+		{
+			register_error(as, l, 1, "Bad symbol: %s", sym);
+			return -1;
+		}
 	
-	if (*sym == '@' && isdigit(sym[1]))
-	{
-		register_error(as, l, 1, "Bad symbol: %s", sym);
-		return -1;
+		if (*sym == '@' && isdigit(sym[1]))
+		{
+			register_error(as, l, 1, "Bad symbol: %s", sym);
+			return -1;
+		}
 	}
 	
 	for (p = sym; *p; p++)
@@ -82,7 +85,7 @@
 			return -1;
 		}
 		// flag local symbols while we're at it...
-		if (*p == '?' || *p == '@')
+		if (*p == '?' || *p == '@' || *p == '$')
 			scontext = as -> context;
 	}