public void ParseNext(IFileReader reader, IRowParsingContext rowParsingContext) { ResetParsingState(); ParsingResult parsingResult = ParsingResult.Match; char currentChar = '\0'; do { if (currentText.Length >= ParsingBufferMaxSize) { ParsingBufferOverflowException ex = new ParsingBufferOverflowException(); if (rowParsingContext != null) { ex.ColumnIndex = rowParsingContext.ColumnCount; } throw ex; } if (parsingResult != ParsingResult.Miss) { currentChar = reader.GetNextChar(); if (reader.IsEOF) { break; } else if (rowParsingContext != null) { rowParsingContext.Append(currentChar); } } if (this.currentParsingState != null) { parsingResult = currentParsingState.ProcessCharacter(this, currentChar); } else { // We should not get into this state for our parsing. // It would mean our graph of states is not connected properly. throw new FieldParsingException(MessageStrings.BadParsingGraphError); } } while (parsingResult != ParsingResult.Done); }
public void ParseNext(IFileReader reader, IRowParsingContext rowParsingContext) { ResetParsingState(); ParsingResult parsingResult = ParsingResult.Match; char currentChar = '\0'; do { if (currentText.Length >= ParsingBufferMaxSize) { ParsingBufferOverflowException ex = new ParsingBufferOverflowException(); if (rowParsingContext != null) { ex.ColumnIndex = rowParsingContext.ColumnCount; } throw ex; } if (parsingResult != ParsingResult.Miss) { currentChar = reader.GetNextChar(); if (reader.IsEOF) { break; } else if (rowParsingContext != null) { rowParsingContext.Append(currentChar); } } if (this.currentParsingState != null) { parsingResult = currentParsingState.ProcessCharacter(this, currentChar); } else { // We should not get into this state for our parsing. // It would mean our graph of states is not connected properly. throw new FieldParsingException(MessageStrings.BadParsingGraphError); } }while (parsingResult != ParsingResult.Done); }