public SyntaxCheckException(String message, SyntaxErrorType errorType, TextDocument document, Int32 offset, Int32 length, Exception innerException = null) : base(message, innerException) { _errorType = errorType; _doc = document ?? throw new ArgumentNullException("document"); _errorOffset = offset; _errorLength = length; }
/// <summary> /// Creates a new lexical error token. /// </summary> /// <param name="errorType">The type of the error.</param> /// <param name="span">The location of the error.</param> public ErrorToken(SyntaxErrorType errorType, Span span) : base(TokenType.LexicalError, span) { if (errorType < SyntaxErrorType.InvalidEscapedIdentifier || errorType > SyntaxErrorType.InvalidDecimalLiteral) { throw new ArgumentOutOfRangeException("errorType"); } _SyntaxError = new SyntaxError(errorType, span); }
static public string GetErrorMessage(SyntaxErrorType type) { int index = (int)type; string message = "Unknown error."; if (index <= ErrorMessages.GetUpperBound(0)) { message = ErrorMessages[index]; } return(message); }
/// <summary> /// Constructs a new syntax error. /// </summary> /// <param name="type">The type of the syntax error.</param> /// <param name="span">The location of the syntax error.</param> public SyntaxError(SyntaxErrorType type, Span span) { Debug.Assert(System.Enum.IsDefined(typeof(SyntaxErrorType), type)); _Type = type; _Span = span; }