diff src/symbol.c @ 40:d2cee0c335e7

adjusted symbol rules to accept symbols starting with @ but not @<digit>
author lost
date Sat, 03 Jan 2009 19:41:39 +0000
parents 538e15927776
children b9856da2674a
line wrap: on
line diff
--- a/src/symbol.c	Sat Jan 03 19:20:44 2009 +0000
+++ b/src/symbol.c	Sat Jan 03 19:41:39 2009 +0000
@@ -29,6 +29,11 @@
 #include "lwasm.h"
 #include "util.h"
 
+/*
+Note that this function may accept symbols that the expression evaluator doesn't
+recognize because the expression evaluator must avoid all ambiguity in order
+to achieve predictable results. The checks here are simply a fuzz check.
+*/
 int lwasm_register_symbol(asmstate_t *as, lwasm_line_t *l, char *sym, int val)
 {
 	lwasm_symbol_ent_t *se, *se2;
@@ -47,6 +52,12 @@
 		return -1;
 	}
 	
+	if (*sym == '@' && isdigit(sym[1]))
+	{
+		register_error(as, l, 1, "Bad symbol: %s", sym);
+		return -1;
+	}
+	
 	for (p = sym; *p; p++)
 	{
 		if (!strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._$?@0123456789", *sym) && (unsigned char)*sym < 0x80)