comparison dmd/Parser.d @ 128:e6e542f37b94

Some more Array -> Vector conversions
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Sat, 04 Sep 2010 01:33:05 +0100
parents 1765f3ef917d
children 60bb0fe4563e
comparison
equal deleted inserted replaced
127:9ee9b55452cb 128:e6e542f37b94
260 error("Identifier expected following module"); 260 error("Identifier expected following module");
261 goto Lerr; 261 goto Lerr;
262 } 262 }
263 else 263 else
264 { 264 {
265 Array a = null; 265 Identifiers a = null;
266 Identifier id = token.ident; 266 Identifier id = token.ident;
267 while (nextToken() == TOK.TOKdot) 267 while (nextToken() == TOK.TOKdot)
268 { 268 {
269 if (!a) 269 if (!a)
270 a = new Array(); 270 a = new Identifiers();
271 a.push(cast(void*)id); 271 a.push(id);
272 nextToken(); 272 nextToken();
273 if (token.value != TOK.TOKidentifier) 273 if (token.value != TOK.TOKidentifier)
274 { error("Identifier expected following package"); 274 { error("Identifier expected following package");
275 goto Lerr; 275 goto Lerr;
276 } 276 }
2162 Import parseImport(Dsymbols decldefs, int isstatic) 2162 Import parseImport(Dsymbols decldefs, int isstatic)
2163 { 2163 {
2164 Import s; 2164 Import s;
2165 Identifier id; 2165 Identifier id;
2166 Identifier aliasid = null; 2166 Identifier aliasid = null;
2167 Array a; 2167 Identifiers a;
2168 Loc loc; 2168 Loc loc;
2169 2169
2170 //printf("Parser.parseImport()\n"); 2170 //printf("Parser.parseImport()\n");
2171 do 2171 do
2172 { 2172 {
2188 goto L1; 2188 goto L1;
2189 } 2189 }
2190 while (token.value == TOK.TOKdot) 2190 while (token.value == TOK.TOKdot)
2191 { 2191 {
2192 if (!a) 2192 if (!a)
2193 a = new Array(); 2193 a = new Identifiers();
2194 a.push(cast(void*)id); 2194 a.push(id);
2195 nextToken(); 2195 nextToken();
2196 if (token.value != TOK.TOKidentifier) 2196 if (token.value != TOK.TOKidentifier)
2197 { 2197 {
2198 error("identifier expected following package"); 2198 error("identifier expected following package");
2199 break; 2199 break;
3658 } 3658 }
3659 3659
3660 case TOK.TOKcase: 3660 case TOK.TOKcase:
3661 { Expression exp; 3661 { Expression exp;
3662 Statements statements; 3662 Statements statements;
3663 scope Array cases = new Array(); // array of Expression's 3663 scope cases = new Expressions(); // array of Expression's
3664 Expression last = null; 3664 Expression last = null;
3665 3665
3666 while (1) 3666 while (1)
3667 { 3667 {
3668 nextToken(); 3668 nextToken();
3669 exp = parseAssignExp(); 3669 exp = parseAssignExp();
3670 cases.push(cast(void*)exp); 3670 cases.push(exp);
3671 if (token.value != TOK.TOKcomma) 3671 if (token.value != TOK.TOKcomma)
3672 break; 3672 break;
3673 } 3673 }
3674 check(TOK.TOKcolon); 3674 check(TOK.TOKcolon);
3675 3675
3707 ///} 3707 ///}
3708 { 3708 {
3709 // Keep cases in order by building the case statements backwards 3709 // Keep cases in order by building the case statements backwards
3710 for (int i = cases.dim; i; i--) 3710 for (int i = cases.dim; i; i--)
3711 { 3711 {
3712 exp = cast(Expression)cases.data[i - 1]; 3712 exp = cases[i - 1];
3713 s = new CaseStatement(loc, exp, s); 3713 s = new CaseStatement(loc, exp, s);
3714 } 3714 }
3715 } 3715 }
3716 break; 3716 break;
3717 } 3717 }