Example #1
0
 public SyntaxError(
     bool endOfInput,
     [NotNull] string text,
     [NotNull] string errorText,
     [NotNull] ITextContext context,
     [CanBeNull] SyntaxError innerError = null)
 {
     if (text == null)
     {
         throw new ArgumentNullException(nameof(text));
     }
     if (errorText == null)
     {
         throw new ArgumentNullException(nameof(errorText));
     }
     if (context == null)
     {
         throw new ArgumentNullException(nameof(context));
     }
     EndOfInput = endOfInput;
     Text       = text;
     ErrorText  = errorText;
     Context    = context;
     if (innerError != null)
     {
         InnerError = innerError;
     }
 }
Example #2
0
 private ReadResult([NotNull] SyntaxError error)
 {
     if (error == null)
     {
         throw new ArgumentNullException(nameof(error));
     }
     Error      = error;
     Text       = string.Empty;
     ErrorText  = error.ErrorText;
     EndOfInput = error.EndOfInput;
     Success    = false;
     Text       = error.Text;
 }
Example #3
0
 public static ReadResult <T> FromSyntaxError([NotNull] SyntaxError error)
 {
     return(new ReadResult <T>(error));
 }