private void HandleError(ScanningErrorException scanningErrorException, Exception originalException, ListenerExtender listenerExtender, int errorRertyCount) { RegisterError(listenerExtender.GherkinListener, scanningErrorException, originalException); var position = scanningErrorException.GetPosition(buffer); // if (position != null && // position.Line + SKIP_LINES_BEFORE_RETRY <= buffer.LineCount - 1 && // errorRertyCount < MAX_ERROR_RETRY) var lastProcessedEditorLine = listenerExtender.LastProcessedEditorLine; if (position != null) { lastProcessedEditorLine = Math.Max(position.Line, lastProcessedEditorLine); } if (lastProcessedEditorLine + SKIP_LINES_BEFORE_RETRY <= buffer.LineCount - 1 && errorRertyCount < MAX_ERROR_RETRY) { var restartLineNumber = lastProcessedEditorLine + SKIP_LINES_BEFORE_RETRY; DoScan( listenerExtender, restartLineNumber, errorRertyCount + 1); } }
private void RegisterError(IGherkinListener gherkinListener, ScanningErrorException scanningErrorException, Exception originalException) { var position = scanningErrorException.GetPosition(buffer); gherkinListener.Error( scanningErrorException.Message, position ?? buffer.EndPosition, originalException); }
private void HandleError(ScanningErrorException scanningErrorException, Exception originalException, ListenerExtender listenerExtender, int errorRertyCount) { RegisterError(listenerExtender.GherkinListener, scanningErrorException, originalException); var position = scanningErrorException.GetPosition(buffer); // if (position != null && // position.Line + SKIP_LINES_BEFORE_RETRY <= buffer.LineCount - 1 && // errorRertyCount < MAX_ERROR_RETRY) var lastProcessedEditorLine = listenerExtender.LastProcessedEditorLine; if (position != null) lastProcessedEditorLine = Math.Max(position.Line, lastProcessedEditorLine); if (lastProcessedEditorLine + SKIP_LINES_BEFORE_RETRY <= buffer.LineCount - 1 && errorRertyCount < MAX_ERROR_RETRY) { var restartLineNumber = lastProcessedEditorLine + SKIP_LINES_BEFORE_RETRY; DoScan( listenerExtender, restartLineNumber, errorRertyCount + 1); } }