comparison trunk/src/Parser.d @ 111:ab1135da30c3

- Renamed class Argument to Parameter.
author aziz
date Sun, 08 Jul 2007 19:37:03 +0000
parents 2fb631daaaae
children 004d98df65af
comparison
equal deleted inserted replaced
110:2fb631daaaae 111:ab1135da30c3
11 import Statements; 11 import Statements;
12 import Expressions; 12 import Expressions;
13 import Types; 13 import Types;
14 14
15 15
16 class Argument 16 class Parameter
17 { 17 {
18 StorageClass stc; 18 StorageClass stc;
19 Type type; 19 Type type;
20 string ident; 20 string ident;
21 Expression assignExpr; 21 Expression assignExpr;
1114 errorIfNot(T.Identifier); 1114 errorIfNot(T.Identifier);
1115 1115
1116 return t; 1116 return t;
1117 } 1117 }
1118 1118
1119 Argument[] parseParameters() 1119 Parameter[] parseParameters()
1120 out(args) 1120 out(args)
1121 { 1121 {
1122 if (args.length > 1) 1122 if (args.length > 1)
1123 foreach (arg; args[0..$-1]) 1123 foreach (arg; args[0..$-1])
1124 { 1124 {
1134 { 1134 {
1135 nT(); 1135 nT();
1136 return null; 1136 return null;
1137 } 1137 }
1138 1138
1139 Argument[] args; 1139 Parameter[] args;
1140 StorageClass stc; 1140 StorageClass stc;
1141 1141
1142 while (1) 1142 while (1)
1143 { 1143 {
1144 stc = StorageClass.In; 1144 stc = StorageClass.In;
1147 case T.In: stc = StorageClass.In; nT(); goto default; 1147 case T.In: stc = StorageClass.In; nT(); goto default;
1148 case T.Out: stc = StorageClass.Out; nT(); goto default; 1148 case T.Out: stc = StorageClass.Out; nT(); goto default;
1149 case T.Ref: stc = StorageClass.Ref; nT(); goto default; 1149 case T.Ref: stc = StorageClass.Ref; nT(); goto default;
1150 case T.Lazy: stc = StorageClass.Lazy; nT(); goto default; 1150 case T.Lazy: stc = StorageClass.Lazy; nT(); goto default;
1151 case T.Ellipses: 1151 case T.Ellipses:
1152 args ~= new Argument(StorageClass.Variadic, null, null, null); 1152 args ~= new Parameter(StorageClass.Variadic, null, null, null);
1153 break; 1153 break;
1154 default: 1154 default:
1155 string ident; 1155 string ident;
1156 auto type = parseDeclarator(ident); 1156 auto type = parseDeclarator(ident);
1157 1157
1163 } 1163 }
1164 1164
1165 if (token.type == T.Ellipses) 1165 if (token.type == T.Ellipses)
1166 { 1166 {
1167 stc |= StorageClass.Variadic; 1167 stc |= StorageClass.Variadic;
1168 args ~= new Argument(stc, type, ident, assignExpr); 1168 args ~= new Parameter(stc, type, ident, assignExpr);
1169 nT(); 1169 nT();
1170 break; 1170 break;
1171 } 1171 }
1172 1172
1173 args ~= new Argument(stc, type, ident, assignExpr); 1173 args ~= new Parameter(stc, type, ident, assignExpr);
1174 if (token.type == T.Comma) 1174 if (token.type == T.Comma)
1175 { 1175 {
1176 nT(); 1176 nT();
1177 continue; 1177 continue;
1178 } 1178 }