comparison lexer/Lexer.d @ 186:e1e170c2cd44

Fixed a error in the test program.
author Anders Johnsen <skabet@gmail.com>
date Fri, 25 Jul 2008 12:50:09 +0200
parents dc9bf56b7ace
children 75d0544ddc45
comparison
equal deleted inserted replaced
185:7b274cfdc1dc 186:e1e170c2cd44
225 return Token(Tok.StarAssign, Loc(position++ - 1), 2); 225 return Token(Tok.StarAssign, Loc(position++ - 1), 2);
226 return Token(Tok.Star, Loc(position - 1), 1); 226 return Token(Tok.Star, Loc(position - 1), 1);
227 } 227 }
228 Token slash() 228 Token slash()
229 { 229 {
230 int p = position;
230 switch(source[position]) 231 switch(source[position])
231 { 232 {
232 case '=': 233 case '=':
233 return Token(Tok.SlashAssign, Loc(position++ - 1), 2); 234 return Token(Tok.SlashAssign, Loc(position++ - 1), 2);
234 case '/': 235 case '/':
248 if(source[position-1] == '/') 249 if(source[position-1] == '/')
249 { 250 {
250 return this.next; 251 return this.next;
251 } 252 }
252 } 253 }
253 messages.report(UnexpectedEOFBlock,Loc(position)).fatal(ExitLevel.Lexer); 254 messages.report(UnexpectedEOFBlock,Loc(p)).fatal(ExitLevel.Lexer);
254 255
255 case '+': 256 case '+':
256 position += 2; 257 position += 2;
257 int nesting = 1; 258 int nesting = 1;
258 while(getNextChar != CharType.EOF) 259 while(getNextChar != CharType.EOF)
275 if(nesting == 0) 276 if(nesting == 0)
276 return this.next; 277 return this.next;
277 } 278 }
278 messages.report( 279 messages.report(
279 UnexpectedEOFBlock, 280 UnexpectedEOFBlock,
280 Loc(position)).fatal(ExitLevel.Lexer); 281 Loc(p)).fatal(ExitLevel.Lexer);
281 282
282 default: 283 default:
283 return Token(Tok.Slash, Loc(position - 1), 1); 284 return Token(Tok.Slash, Loc(position - 1), 1);
284 } 285 }
285 } 286 }