private static Result <Lexemes, LexicalError> GetError(string input, bool throwOnError, int characterPosition) { var lexicalError = new LexicalError(input, characterPosition); if (throwOnError) { throw new LexicalException(lexicalError); } return(Result.Error(lexicalError)); }
/// <summary> /// Initializes a new instance of the <see cref="LexicalException" /> class. /// </summary> /// <param name="lexicalError">The lexical error.</param> public LexicalException(LexicalError lexicalError) : base(lexicalError.GetMessage()) { this.LexicalError = lexicalError; }