Handle standalone lines for comments and change delimiter tags - most tests passing now
diff --git a/lib/src/parser.dart b/lib/src/parser.dart
index 3002362..bdcb65c 100644
--- a/lib/src/parser.dart
+++ b/lib/src/parser.dart
@@ -24,7 +24,6 @@
   //final List<List<String>> arguments;
 }
 
-// Note change delimiter tags are parsed out before they reach this stage.
 class TagType {
   const TagType(this.name);
   final String name;
@@ -37,6 +36,7 @@
   static const TagType unescapedVariable = const TagType('unescapedVariable');
   static const TagType partial = const TagType('partial');
   static const TagType comment = const TagType('comment');
+  static const TagType changeDelimiter = const TagType('changeDelimiter');
 }
 
 const _tagTypeMap = const {
@@ -138,6 +138,7 @@
         break;
       
       case TagType.comment:
+      case TagType.changeDelimiter:
         // Ignore.
         break;
         
@@ -237,6 +238,15 @@
             partialIndent: precedingWhitespace == null
               ? ''
               : precedingWhitespace.value);
+        
+      } else if (_peek() != null && _peek().type == TokenType.changeDelimiter) {
+        // Need to handle standalone lines for change delimiter tags too.
+        // The change delimiter token actually represents the entire tag which
+        // was already parsed in the scanner.
+        var token = _read();
+        tag = new Tag(TagType.changeDelimiter, token.value, token.start, token.end);
+        tagNode = null;
+        _currentDelimiters = token.value;
       }
       
       var followingWhitespace =
@@ -248,12 +258,17 @@
         _appendTextToken(precedingLineEnd);
       }
       
+      const standaloneTypes = const [
+        TagType.openSection,
+        TagType.closeSection,
+        TagType.openInverseSection,
+        TagType.partial,
+        TagType.comment,
+        TagType.changeDelimiter]; 
+      
       if (tag != null &&
           (_peek() == null || _peek().type == TokenType.lineEnd) &&
-          const [TagType.openSection,
-            TagType.closeSection,
-            TagType.openInverseSection,
-            TagType.partial].contains(tag.type)) {
+          standaloneTypes.contains(tag.type)) {
                 
         // This is a tag on a "standalone line", so do not create text nodes
         // for whitespace, or the following newline.
diff --git a/lib/src/scanner2.dart b/lib/src/scanner2.dart
index 5eac510..d5af146 100644
--- a/lib/src/scanner2.dart
+++ b/lib/src/scanner2.dart
@@ -83,7 +83,7 @@
         var ws = _readWhile(_isWhitespace);
         
         if (_peek() == _EQUAL) {
-          _scanChangeDelimiterTag(start);
+          _parseChangeDelimiterTag(start);
           
         } else {
           // Scan standard mustache tag.
@@ -273,7 +273,7 @@
   }  
 
   // Open delimiter characters and = have already been read.
-  void _scanChangeDelimiterTag(int start) {
+  void _parseChangeDelimiterTag(int start) {
     
     _expect(_EQUAL);
     
diff --git a/test/all.dart b/test/all.dart
index d75c7cc..d319eac 100644
--- a/test/all.dart
+++ b/test/all.dart
@@ -1,7 +1,10 @@
 import 'mustache_specs.dart' as specs;
 import 'mustache_test.dart' as test;
+import 'parser_test.dart' as parser;
 
 main() {
   specs.main();
   test.main();
+  parser.main();
 }
+
diff --git a/test/mustache_test.dart b/test/mustache_test.dart
index 4d9ceca..055f4fe 100644
--- a/test/mustache_test.dart
+++ b/test/mustache_test.dart
@@ -516,7 +516,7 @@
 
       // A lambda's return value should parse with the default delimiters.
       
-      var template = '{{= | | =}}Hello, (|&lambda|)!';
+      var template = '{{= | | =}}\nHello, (|&lambda|)!';
       
       //function() { return "|planet| => {{planet}}" }
       var values = {'planet': 'world',
diff --git a/test/parser_test.dart b/test/parser_test.dart
index b6e4612..a1c5495 100644
--- a/test/parser_test.dart
+++ b/test/parser_test.dart
@@ -211,6 +211,19 @@
        new TextNode('def', 15, 18)
      ]));
    });
+
+   test('parse change delimiters', () {
+     var source = '{{= | | =}}<|#lambda|-|/lambda|>';
+     var parser = new Parser(source, 'foo', '{{ }}', lenient: false);
+     var nodes = parser.parse();
+     expect(nodes[1].delimiters, equals('| |'));
+     expect(nodes, orderedEquals([
+       new TextNode('<', 11, 12),
+       new SectionNode('lambda', 12, 21, '| |'),
+       new TextNode('>', 31, 32),
+     ]));     
+     expect(nodes[1].children.first, new TextNode('-', 21, 22));
+   });   
    
   });