Handle EOFs while parsing change delimiter tag
diff --git a/lib/src/scanner.dart b/lib/src/scanner.dart
index 2f12698..8c7665c 100644
--- a/lib/src/scanner.dart
+++ b/lib/src/scanner.dart
@@ -113,7 +113,8 @@
   }
   
   String _readWhile(bool test(int charCode)) {
-    int start = _offset;  
+    if (_c == _EOF) return '';      
+    int start = _offset;
     while (_peek() != _EOF && test(_peek())) {
       _read();
     }
@@ -272,7 +273,6 @@
     }    
   }  
 
-  //TODO EOF handling
   // Open delimiter characters have already been read.
   void _parseChangeDelimiterTag(int start) {
     
diff --git a/test/parser_test.dart b/test/parser_test.dart
index 3d53902..8d4137e 100644
--- a/test/parser_test.dart
+++ b/test/parser_test.dart
@@ -248,6 +248,74 @@
      ]));     
    });
    
+  parseFail(source) {
+     try {
+       var parser = new Parser(source, 'foo', '{{ }}', lenient: false);
+       parser.parse();
+       fail('Did not throw.');
+       return null;
+     } catch (ex, st) {
+       if (ex is! TemplateException) {
+        print(ex);
+        print(st);
+       }
+       return ex;
+     }
+   }
+   
+   test('parse eof', () {
+     expectTemplateEx(ex) => expect(ex is TemplateException, isTrue);
+     
+     expectTemplateEx(parseFail('{{#foo}}{{bar}}{{/foo}'));
+     expectTemplateEx(parseFail('{{#foo}}{{bar}}{{/foo'));
+     expectTemplateEx(parseFail('{{#foo}}{{bar}}{{/'));
+     expectTemplateEx(parseFail('{{#foo}}{{bar}}{{'));
+     expectTemplateEx(parseFail('{{#foo}}{{bar}}{'));
+     expectTemplateEx(parseFail('{{#foo}}{{bar}}'));
+     expectTemplateEx(parseFail('{{#foo}}{{bar}'));
+     expectTemplateEx(parseFail('{{#foo}}{{bar'));
+     expectTemplateEx(parseFail('{{#foo}}{{'));
+     expectTemplateEx(parseFail('{{#foo}}{'));
+     expectTemplateEx(parseFail('{{#foo}}'));
+     expectTemplateEx(parseFail('{{#foo}'));
+     expectTemplateEx(parseFail('{{#'));
+     expectTemplateEx(parseFail('{{'));
+     expectTemplateEx(parseFail('{{ # foo }}{{ bar }}{{ / foo }'));
+     expectTemplateEx(parseFail('{{ # foo }}{{ bar }}{{ / foo '));
+     expectTemplateEx(parseFail('{{ # foo }}{{ bar }}{{ / foo'));
+     expectTemplateEx(parseFail('{{ # foo }}{{ bar }}{{ / '));
+     expectTemplateEx(parseFail('{{ # foo }}{{ bar }}{{ /'));
+     expectTemplateEx(parseFail('{{ # foo }}{{ bar }}{{ '));
+     expectTemplateEx(parseFail('{{ # foo }}{{ bar }}{{'));
+     expectTemplateEx(parseFail('{{ # foo }}{{ bar }}{'));
+     expectTemplateEx(parseFail('{{ # foo }}{{ bar }}'));
+     expectTemplateEx(parseFail('{{ # foo }}{{ bar }'));
+     expectTemplateEx(parseFail('{{ # foo }}{{ bar '));
+     expectTemplateEx(parseFail('{{ # foo }}{{ bar'));
+     expectTemplateEx(parseFail('{{ # foo }}{{ '));
+     expectTemplateEx(parseFail('{{ # foo }}{{'));
+     expectTemplateEx(parseFail('{{ # foo }}{'));
+     expectTemplateEx(parseFail('{{ # foo }}'));
+     expectTemplateEx(parseFail('{{ # foo }'));
+     expectTemplateEx(parseFail('{{ # foo '));
+     expectTemplateEx(parseFail('{{ # foo'));
+     expectTemplateEx(parseFail('{{ # '));
+     expectTemplateEx(parseFail('{{ #'));
+     expectTemplateEx(parseFail('{{ '));
+     expectTemplateEx(parseFail('{{'));
+     
+     expectTemplateEx(parseFail('{{= || || =}'));
+     expectTemplateEx(parseFail('{{= || || ='));
+     expectTemplateEx(parseFail('{{= || || '));
+     expectTemplateEx(parseFail('{{= || ||'));
+     expectTemplateEx(parseFail('{{= || |'));
+     expectTemplateEx(parseFail('{{= || '));
+     expectTemplateEx(parseFail('{{= ||'));
+     expectTemplateEx(parseFail('{{= |'));
+     expectTemplateEx(parseFail('{{= '));
+     expectTemplateEx(parseFail('{{='));
+   });
+   
   });
   
 }
\ No newline at end of file