Commit 79cc5312 by Nathan Sidwell Committed by Nathan Sidwell

spew.c (frob_id): New static function.

	* spew.c (frob_id): New static function.
	(frob_opname): Use it.
	(yylex): Use it.

From-SVN: r36719
parent e88b0282
2000-10-05 Nathan Sidwell <nathan@codesourcery.com>
* spew.c (frob_id): New static function.
(frob_opname): Use it.
(yylex): Use it.
2000-10-01 Mark Mitchell <mark@codesourcery.com> 2000-10-01 Mark Mitchell <mark@codesourcery.com>
* decl.c (lang_mark_false_label_stack): Remove. * decl.c (lang_mark_false_label_stack): Remove.
......
...@@ -120,6 +120,7 @@ static SPEW_INLINE void feed_input PARAMS ((struct unparsed_text *)); ...@@ -120,6 +120,7 @@ static SPEW_INLINE void feed_input PARAMS ((struct unparsed_text *));
static SPEW_INLINE void end_input PARAMS ((void)); static SPEW_INLINE void end_input PARAMS ((void));
static SPEW_INLINE void snarf_block PARAMS ((const char *, int)); static SPEW_INLINE void snarf_block PARAMS ((const char *, int));
static tree snarf_defarg PARAMS ((void)); static tree snarf_defarg PARAMS ((void));
static int frob_id PARAMS ((int, int, tree *));
/* The list of inline functions being held off until we reach the end of /* The list of inline functions being held off until we reach the end of
the current class declaration. */ the current class declaration. */
...@@ -776,48 +777,14 @@ yylex () ...@@ -776,48 +777,14 @@ yylex ()
break; break;
case IDENTIFIER: case IDENTIFIER:
{
int peek;
scan_tokens (1); scan_tokens (1);
if (nth_token (1)->yychar == SCOPE) peek = nth_token (1)->yychar;
{ yychr = frob_id (yychr, peek, &nth_token (0)->yylval.ttype);
/* Don't interfere with the setting from an 'aggr' prefix. */ break;
old_looking_for_typename = looking_for_typename; }
looking_for_typename = 1;
}
else if (nth_token (1)->yychar == '<')
looking_for_template = 1;
trrr = lookup_name (nth_token (0)->yylval.ttype, -2);
if (trrr)
{
yychr = identifier_type (trrr);
switch (yychr)
{
case TYPENAME:
case SELFNAME:
case NSNAME:
case PTYPENAME:
lastiddecl = trrr;
/* If this got special lookup, remember it. In these
cases, we know it can't be a declarator-id. */
if (got_scope || got_object)
nth_token (0)->yylval.ttype = trrr;
break;
case PFUNCNAME:
case IDENTIFIER:
lastiddecl = trrr;
break;
default:
my_friendly_abort (101);
}
}
else
lastiddecl = NULL_TREE;
got_scope = NULL_TREE;
/* and fall through to... */
case IDENTIFIER_DEFN: case IDENTIFIER_DEFN:
case TYPENAME: case TYPENAME:
case TYPENAME_DEFN: case TYPENAME_DEFN:
...@@ -938,27 +905,40 @@ yyungetc (ch, rescan) ...@@ -938,27 +905,40 @@ yyungetc (ch, rescan)
} }
} }
/* ID is an operator name. Duplicate the hackery in yylex to determine what /* Lexer hackery to determine what *IDP really is. */
it really is. */
tree frob_opname (id) static int
tree id; frob_id (yyc, peek, idp)
int yyc;
int peek;
tree *idp;
{ {
tree trrr; tree trrr;
int old_looking_for_typename = 0;
if (yychar == '<') if (peek == SCOPE)
{
/* Don't interfere with the setting from an 'aggr' prefix. */
old_looking_for_typename = looking_for_typename;
looking_for_typename = 1;
}
else if (peek == '<')
looking_for_template = 1; looking_for_template = 1;
trrr = lookup_name (id, -2); trrr = lookup_name (*idp, -2);
if (trrr) if (trrr)
{ {
switch (identifier_type (trrr)) yyc = identifier_type (trrr);
switch(yyc)
{ {
case TYPENAME: case TYPENAME:
case SELFNAME: case SELFNAME:
case NSNAME: case NSNAME:
case PTYPENAME: case PTYPENAME:
/* If this got special lookup, remember it. In these
cases, we know it can't be a declarator-id. */
if (got_scope || got_object) if (got_scope || got_object)
id = trrr; *idp = trrr;
/* FALLTHROUGH */
case PFUNCNAME: case PFUNCNAME:
case IDENTIFIER: case IDENTIFIER:
lastiddecl = trrr; lastiddecl = trrr;
...@@ -970,8 +950,19 @@ tree frob_opname (id) ...@@ -970,8 +950,19 @@ tree frob_opname (id)
else else
lastiddecl = NULL_TREE; lastiddecl = NULL_TREE;
got_scope = NULL_TREE; got_scope = NULL_TREE;
got_object = NULL_TREE; looking_for_typename = old_looking_for_typename;
looking_for_template = 0; looking_for_template = 0;
return yyc;
}
/* ID is an operator name. Duplicate the hackery in yylex to determine what
it really is. */
tree frob_opname (id)
tree id;
{
frob_id (0, yychar, &id);
got_object = NULL_TREE;
return id; return id;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment