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

GetExpectedTermSet() public méthode

public GetExpectedTermSet ( ) : StringSet
Résultat StringSet
    public StringSet GetExpectedTermSet() {
      if (CurrentParserState == null)
        return new StringSet(); 
      //See note about multi-threading issues in ComputeReportedExpectedSet comments.
      if (CurrentParserState.ReportedExpectedSet == null)
        CurrentParserState.ReportedExpectedSet = CoreParser.ComputeGroupedExpectedSetForState(Language.Grammar, CurrentParserState);
      //Filter out closing braces which are not expected based on previous input.
      // While the closing parenthesis ")" might be expected term in a state in general, 
      // if there was no opening parenthesis in preceding input then we would not
      //  expect a closing one. 
      var expectedSet = FilterBracesInExpectedSet(CurrentParserState.ReportedExpectedSet);
      return expectedSet;
    }
    

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::GetExpectedTermSet