/// <summary> /// Creates an warning and adds it to the error list. /// </summary> /// <param name="errorCode">Code ID of warning.</param> /// <param name="errorMsg">Description of warning.</param> private void Warning(ErrorCode errorCode, string errorMsg, int onlyOnPass) { if (_currentPass != onlyOnPass) return; // Only emit errors on the second pass. CompileError error = new CompileError(errorCode, errorMsg, ErrorAlertLevel.Warning, _currentToken.Line, _currentToken.Offset, _currentToken.File); _errorList.Add(error); if ((_compileFlags & CompileFlags.TreatWarningsAsErrors) != 0) throw new CompileBreakException(); }
/// <summary> /// Creates an error and adds it to the error list. /// </summary> /// <param name="errorCode">Code ID of error.</param> /// <param name="errorMsg">Description of error.</param> private void Error(ErrorCode errorCode, string errorMsg, bool fatal, int onlyOnPass) { if (_currentPass != onlyOnPass && onlyOnPass != -1) return; // Only emit errors on the second pass. CompileError error = new CompileError(errorCode, errorMsg, fatal ? ErrorAlertLevel.FatalError : ErrorAlertLevel.Error, _currentToken != null ? _currentToken.Line : 0, _currentToken != null ? _currentToken.Offset : 0, _currentToken != null ? _currentToken.File : ""); _errorList.Add(error); _errorsOccured = true; if (fatal == true) throw new CompileBreakException(); else ErrorPanicMode(); }
/// <summary> /// Creates an warning and adds it to the error list. /// </summary> /// <param name="errorCode">Code ID of warning.</param> /// <param name="errorMsg">Description of warning.</param> private void Warning(ErrorCode errorCode, string errorMsg) { CompileError error = new CompileError(errorCode, errorMsg, ErrorAlertLevel.Warning, _lexerLine, _lexerOffset, _file); _errorList.Add(error); if ((_compileFlags & CompileFlags.TreatWarningsAsErrors) != 0) throw new CompileBreakException(); }
/// <summary> /// Creates an error and adds it to the error list. /// </summary> /// <param name="errorCode">Code ID of error.</param> /// <param name="errorMsg">Description of error.</param> private void Error(ErrorCode errorCode, string errorMsg, bool fatal) { CompileError error = new CompileError(errorCode, errorMsg, fatal ? ErrorAlertLevel.FatalError : ErrorAlertLevel.Error, _lexerLine, _lexerOffset, _file); _errorList.Add(error); if (fatal == true) throw new CompileBreakException(); else ErrorPanicMode(); }
/// <summary> /// Creates an message and adds it to the error list. /// </summary> /// <param name="errorCode">Code ID of error.</param> /// <param name="errorMsg">Description of message.</param> private void Message(ErrorCode errorCode, string errorMsg) { CompileError error = new CompileError(errorCode, errorMsg, ErrorAlertLevel.Message, _currentToken.Line, _currentToken.Offset, _currentToken.File); _errorList.Add(error); if ((_compileFlags & CompileFlags.TreatMessagesAsErrors) != 0) throw new CompileBreakException(); }
/// <summary> /// Creates an error and adds it to the error list. /// </summary> /// <param name="errorCode">Code ID of error.</param> /// <param name="errorMsg">Description of error.</param> private void Error(ErrorCode errorCode, string errorMsg, bool fatal) { CompileError error = new CompileError(errorCode, errorMsg, fatal ? ErrorAlertLevel.FatalError : ErrorAlertLevel.Error, _currentToken.Line, _currentToken.Offset, _currentToken.File); _errorList.Add(error); if (fatal == true) throw new CompileBreakException(); }