// Override this method to perform custom error processing public virtual void ReportParseError(ParsingContext context) { string error = null; if (context.CurrentParserInput.Term == this.SyntaxError) { error = context.CurrentParserInput.Token.Value as string; //scanner error } else if (context.CurrentParserInput.Term == this.Indent) { error = Resources.ErrUnexpIndent; } else if (context.CurrentParserInput.Term == this.Eof && context.OpenBraces.Count > 0) { if (context.OpenBraces.Count > 0) { //report unclosed braces/parenthesis var openBrace = context.OpenBraces.Peek(); error = string.Format(Resources.ErrNoClosingBrace, openBrace.Text); } else { error = Resources.ErrUnexpEof; } } else { var expectedTerms = context.GetExpectedTermSet(); error = ConstructParserErrorMessage(context, expectedTerms); } context.AddParserError(error); }//method
// Override this method to perform custom error processing public virtual void ReportParseError(ParsingContext context) { string error = null; if (context.CurrentParserInput.Term == this.SyntaxError) error = context.CurrentParserInput.Token.Value as string; //scanner error else if (context.CurrentParserInput.Term == this.Indent) error = Resources.ErrUnexpIndent; else if (context.CurrentParserInput.Term == this.Eof && context.OpenBraces.Count > 0) { if (context.OpenBraces.Count > 0) { //report unclosed braces/parenthesis var openBrace = context.OpenBraces.Peek(); error = string.Format(Resources.ErrNoClosingBrace, openBrace.Text); } else error = Resources.ErrUnexpEof; }else { var expectedTerms = context.GetExpectedTermSet(); error = ConstructParserErrorMessage(context, expectedTerms); } context.AddParserError(error); }