handling of C++ names.
This commit is contained in:
parent
e3de25fea4
commit
62faed57a5
3 changed files with 27 additions and 6 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
Eof = -1,
|
Eof = -1,
|
||||||
Strsize = 4096,
|
Strsize = 65536,
|
||||||
Hashsize = 128,
|
Hashsize = 128,
|
||||||
Maxarg = 512,
|
Maxarg = 512,
|
||||||
NFD = 100,
|
NFD = 100,
|
||||||
|
|
|
||||||
|
|
@ -348,7 +348,6 @@ bqsymbol(void)
|
||||||
char *p;
|
char *p;
|
||||||
Lsym *s;
|
Lsym *s;
|
||||||
|
|
||||||
symbol[0] = 0;
|
|
||||||
p = symbol;
|
p = symbol;
|
||||||
while((c = lexc()) != '`'){
|
while((c = lexc()) != '`'){
|
||||||
if(c == Eof)
|
if(c == Eof)
|
||||||
|
|
@ -361,6 +360,7 @@ bqsymbol(void)
|
||||||
sysfatal("overflow in bqsymbol");
|
sysfatal("overflow in bqsymbol");
|
||||||
*p = 0;
|
*p = 0;
|
||||||
|
|
||||||
|
fprint(2, "bq: %s\n", symbol);
|
||||||
s = look(symbol);
|
s = look(symbol);
|
||||||
if(s == 0)
|
if(s == 0)
|
||||||
s = enter(symbol, Tid);
|
s = enter(symbol, Tid);
|
||||||
|
|
@ -601,7 +601,19 @@ numsym(char first)
|
||||||
error("%d <eof> eating symbols", line);
|
error("%d <eof> eating symbols", line);
|
||||||
if(c == '\n')
|
if(c == '\n')
|
||||||
line++;
|
line++;
|
||||||
if(c != '_' && c != '$' && c <= '~' && !isalnum(c)) { /* checking against ~ lets UTF names through */
|
/* allow :: in name */
|
||||||
|
if(c == ':'){
|
||||||
|
c = lexc();
|
||||||
|
if(c == ':'){
|
||||||
|
*p++ = ':';
|
||||||
|
*p++ = ':';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
unlexc(c);
|
||||||
|
unlexc(':');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(c != '_' && c != '$' && c < Runeself && !isalnum(c)) {
|
||||||
unlexc(c);
|
unlexc(c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ unique(char *buf, Symbol *s)
|
||||||
int i, renamed;
|
int i, renamed;
|
||||||
|
|
||||||
renamed = 0;
|
renamed = 0;
|
||||||
strcpy(buf, s->name);
|
strcpy(buf, s->xname);
|
||||||
for(;;) {
|
for(;;) {
|
||||||
l = look(buf);
|
l = look(buf);
|
||||||
if(l == 0 || (l->lexval == Tid && l->v->set == 0))
|
if(l == 0 || (l->lexval == Tid && l->v->set == 0))
|
||||||
|
|
@ -36,9 +36,10 @@ unique(char *buf, Symbol *s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(renamed && !quiet)
|
if(renamed && !quiet)
|
||||||
print("\t%s=%s %c/%L\n", s->name, buf, s->type, s->loc);
|
print("\t%s=%s %c/%L\n", s->xname, buf, s->type, s->loc);
|
||||||
if(l == 0)
|
if(l == 0)
|
||||||
l = enter(buf, Tid);
|
l = enter(buf, Tid);
|
||||||
|
s->aux = l;
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,23 +117,31 @@ addvarsym(Fhdr *fp)
|
||||||
if(l->v->store.comt == 0)
|
if(l->v->store.comt == 0)
|
||||||
l->v->store.fmt = 'X';
|
l->v->store.fmt = 'X';
|
||||||
|
|
||||||
/* Enter as list of { name, type, value, file } */
|
/* Enter as list of { name, type, value, file, xname } */
|
||||||
list = al(TSTRING);
|
list = al(TSTRING);
|
||||||
tl->store.u.l = list;
|
tl->store.u.l = list;
|
||||||
list->store.u.string = strnode(buf);
|
list->store.u.string = strnode(buf);
|
||||||
list->store.fmt = 's';
|
list->store.fmt = 's';
|
||||||
|
|
||||||
list->next = al(TINT);
|
list->next = al(TINT);
|
||||||
list = list->next;
|
list = list->next;
|
||||||
list->store.fmt = 'c';
|
list->store.fmt = 'c';
|
||||||
list->store.u.ival = s.type;
|
list->store.u.ival = s.type;
|
||||||
|
|
||||||
list->next = al(TINT);
|
list->next = al(TINT);
|
||||||
list = list->next;
|
list = list->next;
|
||||||
list->store.fmt = 'X';
|
list->store.fmt = 'X';
|
||||||
list->store.u.ival = v;
|
list->store.u.ival = v;
|
||||||
|
|
||||||
list->next = al(TSTRING);
|
list->next = al(TSTRING);
|
||||||
list = list->next;
|
list = list->next;
|
||||||
list->store.fmt = 's';
|
list->store.fmt = 's';
|
||||||
list->store.u.string = file;
|
list->store.u.string = file;
|
||||||
|
|
||||||
|
list->next = al(TSTRING);
|
||||||
|
list = list->next;
|
||||||
|
list->store.fmt = 's';
|
||||||
|
list->store.u.string = strnode(s.xname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*tail = nil;
|
*tail = nil;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue