comparison trunk/src/Parser.d @ 74:30b0fb85dda9

- Implemented parseCmpExpression(). - Added stub for parseShiftExpressiont().
author aziz
date Sun, 01 Jul 2007 19:01:00 +0000
parents 11572f4a138c
children 3f976d9e0833
comparison
equal deleted inserted replaced
73:11572f4a138c 74:30b0fb85dda9
176 return e; 176 return e;
177 } 177 }
178 178
179 Expression parseCmpExpression() 179 Expression parseCmpExpression()
180 { 180 {
181 return new Expression; 181 TOK operator = lx.token.type;
182
183 auto e = parseShiftExpression();
184
185 switch (operator)
186 {
187 case T.Equal, T.NotEqual:
188 nT();
189 e = new EqualExpression(e, parseShiftExpression(), operator);
190 break;
191 case T.Not:
192 Token t;
193 lx.peek(t);
194 if (t.type != T.Is)
195 break;
196 nT();
197 operator = T.NotIdentity;
198 goto LNotIdentity;
199 case T.Identity:
200 operator = T.Identity;
201 LNotIdentity:
202 nT();
203 e = new IsExpression(e, parseShiftExpression(), operator);
204 break;
205 case T.LessEqual, T.Less, T.GreaterEqual, T.Greater,
206 T.Unordered, T.UorE, T.UorG, T.UorGorE,
207 T.UorL, T.UorLorE, T.LorEorG, T.LorG:
208 nT();
209 e = new RelExpression(e, parseShiftExpression(), operator);
210 break;
211 case T.In:
212 nT();
213 e = new InExpression(e, parseShiftExpression(), operator);
214 break;
215 default:
216 }
217 return e;
218 }
219
220 Expression parseShiftExpression()
221 {
222 return new Expression();
182 } 223 }
183 224
184 void error(MID id, ...) 225 void error(MID id, ...)
185 { 226 {
186 errors ~= new Information(Information.Type.Parser, id, lx.loc, arguments(_arguments, _argptr)); 227 errors ~= new Information(Information.Type.Parser, id, lx.loc, arguments(_arguments, _argptr));