comparison lwasm/symbol.c @ 254:c7a41b4c89b3 2.x

Added struct support to LWASM
author lost
date Sat, 19 Dec 2009 06:38:43 +0000
parents a58f49a77441
children
comparison
equal deleted inserted replaced
253:c537a3a723fc 254:c7a41b4c89b3
60 // first check if the symbol is valid 60 // first check if the symbol is valid
61 // the following characters are allowed in a symbol: 61 // the following characters are allowed in a symbol:
62 // [a-zA-Z0-9._$?@] and any byte value larger than 0x7F 62 // [a-zA-Z0-9._$?@] and any byte value larger than 0x7F
63 // although symbols should be restricted to the 7 bit range 63 // although symbols should be restricted to the 7 bit range
64 // symbols must start with [a-zA-Z._] 64 // symbols must start with [a-zA-Z._]
65 if (!strchr(sym, '$')) 65 if ((flags & SYMBOL_NOCHECK) == 0 && !strchr(sym, '$'))
66 { 66 {
67 if (!strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._@?", *sym)) 67 if (!strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._@?", *sym))
68 { 68 {
69 register_error(as, l, 1, "Bad symbol: %s", sym); 69 register_error(as, l, 1, "Bad symbol: %s", sym);
70 return -1; 70 return -1;
77 } 77 }
78 } 78 }
79 79
80 for (p = sym; *p; p++) 80 for (p = sym; *p; p++)
81 { 81 {
82 if (!strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._$?@0123456789", *sym)) 82 if ((flags & SYMBOL_NOCHECK == 0) && !strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._$?@0123456789", *sym))
83 { 83 {
84 register_error(as, l, 1, "Bad symbol: %s", sym); 84 register_error(as, l, 1, "Bad symbol: %s", sym);
85 return -1; 85 return -1;
86 } 86 }
87 // flag local symbols while we're at it... 87 // flag local symbols while we're at it...