Fix white space.

This commit is contained in:
kai
2012-03-06 07:28:29 +01:00
parent 86cd51962c
commit 8a20415cd1
70 changed files with 12946 additions and 12946 deletions

View File

@@ -1,6 +1,6 @@
// Compiler implementation of the D programming language
// Copyright (c) 1999-2011 by Digital Mars
// Copyright (c) 1999-2011 by Digital Mars
// All Rights Reserved
// written by Walter Bright
// http://www.digitalmars.com
@@ -68,9 +68,9 @@ Parser::Parser(Module *module, unsigned char *base, unsigned length, int doDocCo
//nextToken(); // start up the scanner
}
Dsymbols *Parser::parseModule()
Dsymbols *Parser::parseModule()
{
Dsymbols *decldefs;
Dsymbols *decldefs;
// ModuleDeclation leads off
if (token.value == TOKmodule)
@@ -103,14 +103,14 @@ Dsymbols *Parser::parseModule()
}
else
{
Identifiers *a = NULL;
Identifiers *a = NULL;
Identifier *id;
id = token.ident;
while (nextToken() == TOKdot)
{
if (!a)
a = new Identifiers();
a = new Identifiers();
a->push(id);
nextToken();
if (token.value != TOKidentifier)
@@ -138,21 +138,21 @@ Lerr:
while (token.value != TOKsemicolon && token.value != TOKeof)
nextToken();
nextToken();
return new Dsymbols();
return new Dsymbols();
}
Dsymbols *Parser::parseDeclDefs(int once)
Dsymbols *Parser::parseDeclDefs(int once)
{ Dsymbol *s;
Dsymbols *decldefs;
Dsymbols *a;
Dsymbols *aelse;
Dsymbols *decldefs;
Dsymbols *a;
Dsymbols *aelse;
enum PROT prot;
StorageClass stc;
Condition *condition;
unsigned char *comment;
//printf("Parser::parseDeclDefs()\n");
decldefs = new Dsymbols();
decldefs = new Dsymbols();
do
{
comment = token.blockComment;
@@ -396,10 +396,10 @@ Dsymbols *Parser::parseDeclDefs(int once)
if (token.value == TOKlparen)
{
nextToken();
if (token.value == TOKint32v && token.uns64value > 0)
if (token.value == TOKint32v && token.uns64value > 0)
n = (unsigned)token.uns64value;
else
{ error("positive integer expected, not %s", token.toChars());
{ error("positive integer expected, not %s", token.toChars());
n = 1;
}
nextToken();
@@ -445,7 +445,7 @@ Dsymbols *Parser::parseDeclDefs(int once)
nextToken();
if (token.value == TOKidentifier)
s = new DebugSymbol(loc, token.ident);
else if (token.value == TOKint32v || token.value == TOKint64v)
else if (token.value == TOKint32v || token.value == TOKint64v)
s = new DebugSymbol(loc, (unsigned)token.uns64value);
else
{ error("identifier or integer expected, not %s", token.toChars());
@@ -466,7 +466,7 @@ Dsymbols *Parser::parseDeclDefs(int once)
nextToken();
if (token.value == TOKidentifier)
s = new VersionSymbol(loc, token.ident);
else if (token.value == TOKint32v || token.value == TOKint64v)
else if (token.value == TOKint32v || token.value == TOKint64v)
s = new VersionSymbol(loc, (unsigned)token.uns64value);
else
{ error("identifier or integer expected, not %s", token.toChars());
@@ -528,43 +528,43 @@ void Parser::composeStorageClass(StorageClass stc)
}
#endif
/***********************************************
* Parse storage class, lexer is on '@'
*/
#if DMDV2
StorageClass Parser::parseAttribute()
{
nextToken();
StorageClass stc = 0;
if (token.value != TOKidentifier)
{
error("identifier expected after @, not %s", token.toChars());
}
else if (token.ident == Id::property)
stc = STCproperty;
else if (token.ident == Id::safe)
stc = STCsafe;
else if (token.ident == Id::trusted)
stc = STCtrusted;
else if (token.ident == Id::system)
stc = STCsystem;
else if (token.ident == Id::disable)
stc = STCdisable;
else
error("valid attribute identifiers are @property, @safe, @trusted, @system, @disable not @%s", token.toChars());
return stc;
}
#endif
/***********************************************
* Parse storage class, lexer is on '@'
*/
#if DMDV2
StorageClass Parser::parseAttribute()
{
nextToken();
StorageClass stc = 0;
if (token.value != TOKidentifier)
{
error("identifier expected after @, not %s", token.toChars());
}
else if (token.ident == Id::property)
stc = STCproperty;
else if (token.ident == Id::safe)
stc = STCsafe;
else if (token.ident == Id::trusted)
stc = STCtrusted;
else if (token.ident == Id::system)
stc = STCsystem;
else if (token.ident == Id::disable)
stc = STCdisable;
else
error("valid attribute identifiers are @property, @safe, @trusted, @system, @disable not @%s", token.toChars());
return stc;
}
#endif
/********************************************
* Parse declarations after an align, protection, or extern decl.
*/
Dsymbols *Parser::parseBlock()
Dsymbols *Parser::parseBlock()
{
Dsymbols *a = NULL;
Dsymbols *a = NULL;
//printf("parseBlock()\n");
switch (token.value)
@@ -721,7 +721,7 @@ Condition *Parser::parseDebugCondition()
if (token.value == TOKidentifier)
id = token.ident;
else if (token.value == TOKint32v || token.value == TOKint64v)
else if (token.value == TOKint32v || token.value == TOKint64v)
level = (unsigned)token.uns64value;
else
error("identifier or integer expected, not %s", token.toChars());
@@ -750,7 +750,7 @@ Condition *Parser::parseVersionCondition()
nextToken();
if (token.value == TOKidentifier)
id = token.ident;
else if (token.value == TOKint32v || token.value == TOKint64v)
else if (token.value == TOKint32v || token.value == TOKint64v)
level = (unsigned)token.uns64value;
#if DMDV2
/* Allow:
@@ -1137,7 +1137,7 @@ EnumDeclaration *Parser::parseEnum()
else if (token.value == TOKlcurly)
{
//printf("enum definition\n");
e->members = new Dsymbols();
e->members = new Dsymbols();
nextToken();
unsigned char *comment = token.blockComment;
while (token.value != TOKrcurly)
@@ -1264,7 +1264,7 @@ Dsymbol *Parser::parseAggregate()
{
//printf("aggregate definition\n");
nextToken();
Dsymbols *decl = parseDeclDefs(0);
Dsymbols *decl = parseDeclDefs(0);
if (token.value != TOKrcurly)
error("} expected following member declarations in aggregate");
nextToken();
@@ -1286,7 +1286,7 @@ Dsymbol *Parser::parseAggregate()
if (tpl)
{ // Wrap a template around the aggregate declaration
Dsymbols *decldefs = new Dsymbols();
Dsymbols *decldefs = new Dsymbols();
decldefs->push(a);
TemplateDeclaration *tempdecl =
new TemplateDeclaration(loc, id, tpl, constraint, decldefs);
@@ -1305,44 +1305,44 @@ BaseClasses *Parser::parseBaseClasses()
for (; 1; nextToken())
{
bool prot = false;
enum PROT protection = PROTpublic;
bool prot = false;
enum PROT protection = PROTpublic;
switch (token.value)
{
case TOKprivate:
prot = true;
prot = true;
protection = PROTprivate;
nextToken();
break;
nextToken();
break;
case TOKpackage:
prot = true;
prot = true;
protection = PROTpackage;
nextToken();
break;
nextToken();
break;
case TOKprotected:
prot = true;
prot = true;
protection = PROTprotected;
nextToken();
break;
nextToken();
break;
case TOKpublic:
prot = true;
prot = true;
protection = PROTpublic;
nextToken();
break;
}
//if (prot && !global.params.useDeprecated)
//error("use of base class protection is deprecated");
if (token.value == TOKidentifier)
{
BaseClass *b = new BaseClass(parseBasicType(), protection);
baseclasses->push(b);
if (token.value != TOKcomma)
break;
}
else
{
error("base classes expected instead of %s", token.toChars());
return NULL;
nextToken();
break;
}
//if (prot && !global.params.useDeprecated)
//error("use of base class protection is deprecated");
if (token.value == TOKidentifier)
{
BaseClass *b = new BaseClass(parseBasicType(), protection);
baseclasses->push(b);
if (token.value != TOKcomma)
break;
}
else
{
error("base classes expected instead of %s", token.toChars());
return NULL;
}
}
return baseclasses;
@@ -1378,7 +1378,7 @@ TemplateDeclaration *Parser::parseTemplateDeclaration()
TemplateDeclaration *tempdecl;
Identifier *id;
TemplateParameters *tpl;
Dsymbols *decldefs;
Dsymbols *decldefs;
Loc loc = this->loc;
nextToken();
@@ -1575,7 +1575,7 @@ Dsymbol *Parser::parseMixin()
Identifier *id;
Type *tqual;
Objects *tiargs;
Identifiers *idents;
Identifiers *idents;
//printf("parseMixin()\n");
nextToken();
@@ -1606,7 +1606,7 @@ Dsymbol *Parser::parseMixin()
nextToken();
}
idents = new Identifiers();
idents = new Identifiers();
while (1)
{
tiargs = NULL;
@@ -1699,7 +1699,7 @@ Import *Parser::parseImport(Array *decldefs, int isstatic)
{ Import *s;
Identifier *id;
Identifier *aliasid = NULL;
Identifiers *a;
Identifiers *a;
Loc loc;
//printf("Parser::parseImport()\n");
@@ -1724,7 +1724,7 @@ Import *Parser::parseImport(Array *decldefs, int isstatic)
while (token.value == TOKdot)
{
if (!a)
a = new Identifiers();
a = new Identifiers();
a->push(id);
nextToken();
if (token.value != TOKidentifier)
@@ -2183,7 +2183,7 @@ Type *Parser::parseDeclarator(Type *t, Identifier **pident, TemplateParameters *
* Return array of Declaration *'s.
*/
Dsymbols *Parser::parseDeclarations()
Dsymbols *Parser::parseDeclarations()
{
StorageClass storage_class;
StorageClass stc;
@@ -2191,7 +2191,7 @@ Dsymbols *Parser::parseDeclarations()
Type *t;
Type *tfirst;
Identifier *ident;
Dsymbols *a;
Dsymbols *a;
enum TOK tok = TOKreserved;
unsigned char *comment = token.blockComment;
enum LINK link = linkage;
@@ -2253,7 +2253,7 @@ Dsymbols *Parser::parseDeclarations()
break;
}
a = new Dsymbols();
a = new Dsymbols();
/* Look for auto initializers:
* storage_class identifier = initializer;
@@ -2340,7 +2340,7 @@ Dsymbols *Parser::parseDeclarations()
a->push(v);
else
{
Dsymbols *ax = new Dsymbols();
Dsymbols *ax = new Dsymbols();
ax->push(v);
Dsymbol *s = new LinkDeclaration(link, ax);
a->push(s);
@@ -2374,14 +2374,14 @@ Dsymbols *Parser::parseDeclarations()
}
else
{
Dsymbols *ax = new Dsymbols();
Dsymbols *ax = new Dsymbols();
ax->push(f);
s = new LinkDeclaration(link, ax);
}
if (tpl) // it's a function template
{
// Wrap a template around the aggregate declaration
Dsymbols *decldefs = new Dsymbols();
Dsymbols *decldefs = new Dsymbols();
decldefs->push(s);
TemplateDeclaration *tempdecl =
new TemplateDeclaration(loc, s->ident, tpl, NULL, decldefs);
@@ -2405,7 +2405,7 @@ Dsymbols *Parser::parseDeclarations()
a->push(v);
else
{
Dsymbols *ax = new Dsymbols();
Dsymbols *ax = new Dsymbols();
ax->push(v);
Dsymbol *s = new LinkDeclaration(link, ax);
a->push(s);
@@ -2625,7 +2625,7 @@ Initializer *Parser::parseInitializer()
is = new StructInitializer(loc);
nextToken();
comma = 2;
comma = 2;
while (1)
{
switch (token.value)
@@ -2649,8 +2649,8 @@ Initializer *Parser::parseInitializer()
continue;
case TOKcomma:
if (comma == 2)
error("expression expected, not ','");
if (comma == 2)
error("expression expected, not ','");
nextToken();
comma = 2;
continue;
@@ -2664,8 +2664,8 @@ Initializer *Parser::parseInitializer()
break;
default:
if (comma == 1)
error("comma expected separating field initializers");
if (comma == 1)
error("comma expected separating field initializers");
value = parseInitializer();
is->addInit(NULL, value);
comma = 1;
@@ -2714,7 +2714,7 @@ Initializer *Parser::parseInitializer()
ia = new ArrayInitializer(loc);
nextToken();
comma = 2;
comma = 2;
while (1)
{
switch (token.value)
@@ -2751,8 +2751,8 @@ Initializer *Parser::parseInitializer()
continue;
case TOKcomma:
if (comma == 2)
error("expression expected, not ','");
if (comma == 2)
error("expression expected, not ','");
nextToken();
comma = 2;
continue;
@@ -2955,10 +2955,10 @@ Statement *Parser::parseStatement(int flags)
{
Statements *as = new Statements();
as->reserve(a->dim);
for (size_t i = 0; i < a->dim; i++)
for (size_t i = 0; i < a->dim; i++)
{
Dsymbol *d = (Dsymbol *)a->data[i];
s = new ExpStatement(loc, d);
s = new ExpStatement(loc, d);
as->push(s);
}
s = new CompoundDeclarationStatement(loc, as);
@@ -2966,7 +2966,7 @@ Statement *Parser::parseStatement(int flags)
else if (a->dim == 1)
{
Dsymbol *d = (Dsymbol *)a->data[0];
s = new ExpStatement(loc, d);
s = new ExpStatement(loc, d);
}
else
assert(0);
@@ -2982,7 +2982,7 @@ Statement *Parser::parseStatement(int flags)
{ Dsymbol *d;
d = parseAggregate();
s = new ExpStatement(loc, d);
s = new ExpStatement(loc, d);
break;
}
@@ -2990,7 +2990,7 @@ Statement *Parser::parseStatement(int flags)
{ Dsymbol *d;
d = parseEnum();
s = new ExpStatement(loc, d);
s = new ExpStatement(loc, d);
break;
}
@@ -2999,20 +2999,20 @@ Statement *Parser::parseStatement(int flags)
if (t->value == TOKlparen)
{ // mixin(string)
Expression *e = parseAssignExp();
check(TOKsemicolon);
if (e->op == TOKmixin)
{
CompileExp *cpe = (CompileExp *)e;
s = new CompileStatement(loc, cpe->e1);
}
else
{
s = new ExpStatement(loc, e);
}
check(TOKsemicolon);
if (e->op == TOKmixin)
{
CompileExp *cpe = (CompileExp *)e;
s = new CompileStatement(loc, cpe->e1);
}
else
{
s = new ExpStatement(loc, e);
}
break;
}
Dsymbol *d = parseMixin();
s = new ExpStatement(loc, d);
s = new ExpStatement(loc, d);
break;
}
@@ -3049,7 +3049,7 @@ Statement *Parser::parseStatement(int flags)
if (!(flags & PSsemi))
error("use '{ }' for an empty statement, not a ';'");
nextToken();
s = new ExpStatement(loc, (Expression *)NULL);
s = new ExpStatement(loc, (Expression *)NULL);
break;
case TOKdo:
@@ -3367,7 +3367,7 @@ Statement *Parser::parseStatement(int flags)
s = new ScopeStatement(loc, s);
// Keep cases in order by building the case statements backwards
for (size_t i = cases.dim; i; i--)
for (size_t i = cases.dim; i; i--)
{
exp = (Expression *)cases.data[i - 1];
s = new CaseStatement(loc, exp, s);
@@ -3506,7 +3506,7 @@ Statement *Parser::parseStatement(int flags)
case TOKtry:
{ Statement *body;
Catches *catches = NULL;
Catches *catches = NULL;
Statement *finalbody = NULL;
nextToken();
@@ -3536,7 +3536,7 @@ Statement *Parser::parseStatement(int flags)
handler = parseStatement(0);
c = new Catch(loc, t, id, handler);
if (!catches)
catches = new Catches();
catches = new Catches();
catches->push(c);
}
@@ -3975,12 +3975,12 @@ int Parser::isDeclarator(Token **pt, int *haveId, enum TOK endtok)
case TOKrbracket:
case TOKassign:
case TOKcomma:
case TOKdotdotdot:
case TOKdotdotdot:
case TOKsemicolon:
case TOKlcurly:
case TOKin:
case TOKout:
case TOKbody:
case TOKout:
case TOKbody:
// The !parens is to disallow unnecessary parentheses
if (!parens && (endtok == TOKreserved || endtok == t->value))
{ *pt = t;
@@ -4726,7 +4726,7 @@ Expression *Parser::parsePostExp(Expression *e)
nextToken();
if (token.value == TOKrbracket)
{ // array[]
inBrackets--;
inBrackets--;
e = new SliceExp(loc, e, NULL, NULL);
nextToken();
}
@@ -4747,8 +4747,8 @@ Expression *Parser::parsePostExp(Expression *e)
{
nextToken();
while (1)
{
Expression *arg = parseAssignExp();
{
Expression *arg = parseAssignExp();
arguments->push(arg);
if (token.value == TOKrbracket)
break;
@@ -5384,7 +5384,7 @@ Expressions *Parser::parseArguments()
nextToken();
if (token.value != endtok)
{
while (token.value != TOKeof)
while (token.value != TOKeof)
{
arg = parseAssignExp();
arguments->push(arg);
@@ -5436,7 +5436,7 @@ Expression *Parser::parseNewExp(Expression *thisexp)
else
{
nextToken();
Dsymbols *decl = parseDeclDefs(0);
Dsymbols *decl = parseDeclDefs(0);
if (token.value != TOKrcurly)
error("class member expected");
nextToken();
@@ -5522,7 +5522,7 @@ enum PREC precedence[TOKMAX];
void initPrecedence()
{
for (size_t i = 0; i < TOKMAX; i++)
for (size_t i = 0; i < TOKMAX; i++)
precedence[i] = PREC_zero;
precedence[TOKtype] = PREC_expr;
@@ -5675,7 +5675,7 @@ void initPrecedence()
precedence[TOKcomma] = PREC_expr;
precedence[TOKdeclaration] = PREC_expr;
#if IN_LLVM
// Need to set precedence for TOKgep as well, as expToCBuffer expects it.
precedence[TOKgep] = PREC_primary;