9fans archive / 2007 / 04 / 524 /    prev next

From: "Russ Cox" <rsc@swt...>
Subject: Re: [9fans] scopes in kencc
Date: Thu, 26 Apr 2007 22:04:46 -0400

> where is it determined that LNAME is returned when *t is scanned
> rather than LTYPE (the way it is returned in the declaration of foo)?

grep shows that /sys/src/cmd/cc/lex.c is relevant,
since it contains

	s = lookup();
	if(s->macro) {
		...
	}
	yylval.sym = s;
	if(s->class == CTYPEDEF || s->class == CTYPESTR)
		return LTYPE;
	return s->lexical;

for the relevant bit of lexing.  you could trace back and 
see how s->class gets set.

russ