Mercurial > projects > dil
comparison trunk/src/dil/Token.d @ 497:0ffcc4ff82f3
Refactored a few things in the Lexer.
Fix: SpecialTokensEnd should be TOK.VERSION not TOK.Version.
Fixed assert statement in textSpan().
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sun, 09 Dec 2007 14:58:38 +0100 |
parents | 5a607597dc22 |
children | 41b7f9e439bd |
comparison
equal
deleted
inserted
replaced
496:5a607597dc22 | 497:0ffcc4ff82f3 |
---|---|
111 } | 111 } |
112 | 112 |
113 alias TOK.Abstract KeywordsBegin; | 113 alias TOK.Abstract KeywordsBegin; |
114 alias TOK.With KeywordsEnd; | 114 alias TOK.With KeywordsEnd; |
115 alias TOK.FILE SpecialTokensBegin; | 115 alias TOK.FILE SpecialTokensBegin; |
116 alias TOK.Version SpecialTokensEnd; | 116 alias TOK.VERSION SpecialTokensEnd; |
117 | 117 |
118 struct Token | 118 struct Token |
119 { | 119 { |
120 TOK type; /// The type of the token. | 120 TOK type; /// The type of the token. |
121 /// Pointers to the next and previous tokens (doubly-linked list.) | 121 /// Pointers to the next and previous tokens (doubly-linked list.) |
328 } | 328 } |
329 | 329 |
330 /// Return the source text enclosed by the left and right token. | 330 /// Return the source text enclosed by the left and right token. |
331 static char[] textSpan(Token* left, Token* right) | 331 static char[] textSpan(Token* left, Token* right) |
332 { | 332 { |
333 assert(left.end <= right.start); | 333 assert(left.end <= right.start || left is right ); |
334 return left.start[0 .. right.end - left.start]; | 334 return left.start[0 .. right.end - left.start]; |
335 } | 335 } |
336 | 336 |
337 new(size_t size) | 337 new(size_t size) |
338 { | 338 { |