comparison lwasm/parse.c @ 157:745721e13970

allow : after symbol at line start
author lost
date Sat, 31 Jan 2009 05:29:15 +0000
parents 427e268e876b
children 99300be2d3bd
comparison
equal deleted inserted replaced
156:d8d3cee39bc5 157:745721e13970
66 // if we start with a non-space character, it's a symbol 66 // if we start with a non-space character, it's a symbol
67 if (!isspace(*p)) 67 if (!isspace(*p))
68 { 68 {
69 // we have a symbol specified here 69 // we have a symbol specified here
70 // parse it out and record it for later use 70 // parse it out and record it for later use
71 for (p2 = p; *p2 && !isspace(*p2); p2++) 71 for (p2 = p; *p2 && !isspace(*p2) && *p2 != ':'; p2++)
72 /* do nothing */ ; 72 /* do nothing */ ;
73 73
74 sym = lwasm_alloc((p2 - p) + 1); 74 sym = lwasm_alloc((p2 - p) + 1);
75 sym[p2 - p] = '\0'; 75 sym[p2 - p] = '\0';
76 memcpy(sym, p, p2 - p); 76 memcpy(sym, p, p2 - p);
77 77
78 p = p2; 78 p = p2;
79 if (!*sym)
80 {
81 register_error(as, l, 1, "Invalid symbol");
82 lwasm_free(sym);
83 sym = NULL;
84 }
85 if (*p == ':')
86 p++;
79 } 87 }
80 l -> sym = sym; 88 l -> sym = sym;
81 89
82 // now skip any whitespace to find the opcode 90 // now skip any whitespace to find the opcode
83 while (*p && isspace(*p)) 91 while (*p && isspace(*p))