Nitra.ViewModels.TestSuiteVm.Run C# (CSharp) Méthode

Run() private méthode

private Run ( [ code, [ gold = null, int completionStartPos = -1, string completionPrefix = null, RecoveryAlgorithm recoveryAlgorithm = RecoveryAlgorithm.Smart ) : IParseResult
code [
gold [
completionStartPos int
completionPrefix string
recoveryAlgorithm RecoveryAlgorithm
Résultat IParseResult
    public IParseResult Run([NotNull] string code, [CanBeNull] string gold = null, int completionStartPos = -1, string completionPrefix = null, RecoveryAlgorithm recoveryAlgorithm = RecoveryAlgorithm.Smart)
    {
      var source = new SourceSnapshot(code);

      if (Language.StartRule == null)
        return null;

      try
      {
        var parseSession = new ParseSession(Language.StartRule,
          compositeGrammar:   Language.CompositeGrammar,
          completionPrefix:   completionPrefix,
          completionStartPos: completionStartPos,
          parseToEndOfString: true,
          dynamicExtensions:  DynamicExtensions,
          statistics:         Statistics);
        switch (recoveryAlgorithm)
        {
          case RecoveryAlgorithm.Smart: parseSession.OnRecovery = ParseSession.SmartRecovery; break;
          case RecoveryAlgorithm.Panic: parseSession.OnRecovery = ParseSession.PanicRecovery; break;
          case RecoveryAlgorithm.FirstError: parseSession.OnRecovery = ParseSession.FirsrErrorRecovery; break;
        }
        var parseResult = parseSession.Parse(source);
        this.Exception = null;
        return parseResult;
      }
      catch (Exception ex)
      {
        this.Exception = ex;
        return null;
      }
    }