예제 #1
0
 IEnumerable <CsvLine> InsideQuotedField()
 {
     if (_csvLayout.IsEscape(_currentChar, Peek()))
     {
         TransitionTo(Escaped);
         // skip the escape character
     }
     else if (_currentChar == _csvLayout.Quote)
     {
         // there are 2 possibilities:
         // - either the quote is just part of the field
         //   (e.g. "foo,"bar "baz"", foobar")
         // - or the quote is actually the end of this field
         // => start capturing after the quote; check for delimiter
         TransitionTo(AfterSecondQuote);
         _tentative.Clear();
         _tentative.Append(_currentChar);
     }
     else
     {
         _field.Append(_currentChar);
     }
     yield break;
 }