private void ReportError(int ichMin, int ichLim, ErrId eid, params object[] args) { // REVIEW: Fix this so the error is marked as nested if appropriate! ErrorToken err = new ErrorToken(GetTextSpan(ichMin, ichLim), eid, args); _queue.Enqueue(err); }
public static string GetMsgFmt(this ErrId eid, out int carg) { carg = 0; switch (eid) { case ErrId.BadChar: carg = 1; return("Unexpected character '{0}'"); case ErrId.BadEscape: return("Unrecognized escape sequence"); case ErrId.CharConstEmpty: return("Empty character literal"); case ErrId.CharConstTooLong: return("Too many characters in character literal"); case ErrId.FloatOverflow: carg = 1; return("Floating-point constant is outside the range of type '{0}'"); case ErrId.IntOverflow: return("Integral constant is too large"); case ErrId.NewlineInConst: return("Newline in constant"); case ErrId.UnterminatedComment: return("End-of-input found in comment"); case ErrId.UnterminatedString: return("End-of-input found in string or character literal"); case ErrId.VerbatimLiteralExpected: return(@"Keyword, identifier, or string expected after verbatim specifier: @"); case ErrId.BadPreProcPos: return("Preprocessor directives must be on a new line"); case ErrId.EndOfPreLineExpected: return("Single-line comment or end-of-line expected"); case ErrId.IdentExpected: return("Identifier expected"); case ErrId.PreProcDirExpected: return("Preprocessor directive expected"); case ErrId.UniEscInPreProc: return("Unicode escapes not permitted in preprocessor directives"); default: Contracts.Assert(false, "Unknown error id: " + eid); return("Unknown error"); } }
/// <summary> /// エラーメッセージを表示 /// </summary> /// <param name="id">メッセージID</param> /// <param name="text">代替文字列</param> public static void ShowError(Window owner, ErrId id, params string[] words) { string message = _errorMessages[id]; for (int i = 0; i < words.Length; i++) { message = message.Replace("{" + i + "}", words[i]); } ShowError(owner, message); }
public static string GetMsg(this ErrId eid, params object[] args) { int carg; string fmt = eid.GetMsgFmt(out carg); Contracts.Assert(carg == Utils.Size(args)); if (carg == 0) { return(fmt); } string msg = string.Format(fmt, args); return(msg); }
public ErrorToken(TextSpan span, ErrId eid, params object[] args) : base(span, TokKind.Error) { Id = eid; Args = args; }
private void ReportError(ErrId eid, params object[] args) { ReportError(_ichMinTok, _cursor.IchCur, eid, args); }
/// <summary> /// Called to embed an error token in the stream. /// </summary> private void ReportError(ErrId eid) { ReportError(_ichMinTok, _cursor.IchCur, eid, null); }