Mercurial > projects > dil
comparison trunk/src/dil/lexer/Lexer.d @ 764:4579e8505d5e
Fixed unittests and removed dil.File.
Fixed Converter.UTF16toUTF8().
Fixed an encode() function in dil.Unicode.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sat, 16 Feb 2008 03:28:39 +0100 |
parents | f26f13b5a3a3 |
children | 5e3ef1b2011c |
comparison
equal
deleted
inserted
replaced
763:f26f13b5a3a3 | 764:4579e8505d5e |
---|---|
2738 src ~= pair.tokenText; | 2738 src ~= pair.tokenText; |
2739 } | 2739 } |
2740 else | 2740 else |
2741 src ~= pair.tokenText ~ " "; | 2741 src ~= pair.tokenText ~ " "; |
2742 | 2742 |
2743 auto lx = new Lexer(src, ""); | 2743 auto lx = new Lexer(new SourceText("", src)); |
2744 auto token = lx.getTokens(); | 2744 auto token = lx.getTokens(); |
2745 | 2745 |
2746 uint i; | 2746 uint i; |
2747 assert(token == lx.head); | 2747 assert(token == lx.head); |
2748 assert(token.next.kind == TOK.Newline); | 2748 assert(token.next.kind == TOK.Newline); |
2757 } | 2757 } |
2758 | 2758 |
2759 unittest | 2759 unittest |
2760 { | 2760 { |
2761 Stdout("Testing method Lexer.peek()\n"); | 2761 Stdout("Testing method Lexer.peek()\n"); |
2762 string sourceText = "unittest { }"; | 2762 auto sourceText = new SourceText("", "unittest { }"); |
2763 auto lx = new Lexer(sourceText, null); | 2763 auto lx = new Lexer(sourceText, null); |
2764 | 2764 |
2765 auto next = lx.head; | 2765 auto next = lx.head; |
2766 lx.peek(next); | 2766 lx.peek(next); |
2767 assert(next.kind == TOK.Newline); | 2767 assert(next.kind == TOK.Newline); |
2772 lx.peek(next); | 2772 lx.peek(next); |
2773 assert(next.kind == TOK.RBrace); | 2773 assert(next.kind == TOK.RBrace); |
2774 lx.peek(next); | 2774 lx.peek(next); |
2775 assert(next.kind == TOK.EOF); | 2775 assert(next.kind == TOK.EOF); |
2776 | 2776 |
2777 lx = new Lexer("", null); | 2777 lx = new Lexer(new SourceText("", "")); |
2778 next = lx.head; | 2778 next = lx.head; |
2779 lx.peek(next); | 2779 lx.peek(next); |
2780 assert(next.kind == TOK.Newline); | 2780 assert(next.kind == TOK.Newline); |
2781 lx.peek(next); | 2781 lx.peek(next); |
2782 assert(next.kind == TOK.EOF); | 2782 assert(next.kind == TOK.EOF); |