Irony.Parsing.ParsingContext.AddParserError C# (CSharp) Méthode

AddParserError() public méthode

public AddParserError ( string message ) : void
message string
Résultat void
    public void AddParserError(string message, params object[] args) {
      var location = CurrentParserInput == null? Source.Location : CurrentParserInput.Span.Location;
      HasErrors = true; 
      AddParserMessage(ParserErrorLevel.Error, location, message, args);
    }
    public void AddParserMessage(ParserErrorLevel level, SourceLocation location, string message, params object[] args) {

Usage Example

Exemple #1
0
        // 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
All Usage Examples Of Irony.Parsing.ParsingContext::AddParserError