Eclipse plugin
Ary Manzana
ary at esperanto.org.ar
Wed Nov 1 03:00:54 PST 2006
Walter Bright wrote:
> I deliberately avoided using things like exceptions in it to make it
> easy to port, but I didn't think about the goto's.
It's ok, you make an excellent use of them. But later in the development
process I will need a hand with "Parser::isBasicType",
"Parser::parseBasicType" and "Parser::parseDeclDefs(bool)". Just take a
look at this:
---
int Parser::isBasicType(Token **pt)
{
// This code parallels parseBasicType()
Token *t = *pt;
Token *t2;
int parens;
switch (t->value)
{
CASE_BASIC_TYPES:
t = peek(t);
break;
case TOKidentifier:
t = peek(t);
if (t->value == TOKnot)
{
goto L4;
}
goto L3;
while (1)
{
L2:
t = peek(t);
L3:
if (t->value == TOKdot)
{
Ldot:
t = peek(t);
if (t->value != TOKidentifier)
goto Lfalse;
t = peek(t);
if (t->value != TOKnot)
goto L3;
L4:
t = peek(t);
if (t->value != TOKlparen)
goto Lfalse;
if (!skipParens(t, &t))
goto Lfalse;
}
else
break;
}
break;
case TOKdot:
goto Ldot;
case TOKtypeof:
/* typeof(exp).identifier...
*/
t = peek(t);
if (t->value != TOKlparen)
goto Lfalse;
if (!skipParens(t, &t))
goto Lfalse;
goto L2;
default:
goto Lfalse;
}
*pt = t;
return TRUE;
Lfalse:
return FALSE;
}
---
I was thinking of sending a feature request to Java just for this tiny
function :-P
More information about the Digitalmars-d
mailing list