From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 87648 invoked by alias); 27 Apr 2018 19:13:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 87627 invoked by uid 89); 27 Apr 2018 19:13:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*f:sk:2018032, parse.c, parsec, UD:parse.c X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Apr 2018 19:13:05 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 3A327117810; Fri, 27 Apr 2018 15:13:04 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id YpIPkpeycvfs; Fri, 27 Apr 2018 15:13:04 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id EFD741177FC; Fri, 27 Apr 2018 15:13:03 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 4473383055; Fri, 27 Apr 2018 12:13:02 -0700 (PDT) Date: Fri, 27 Apr 2018 19:13:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA] Add inclusive range support for Rust Message-ID: <20180427191302.niioyc6dunzhai6o@adacore.com> References: <20180329201609.13699-1-tom@tromey.com> <20180425165205.cwkvthuotlpaq67z@adacore.com> <87d0yl7mfp.fsf@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87d0yl7mfp.fsf@tromey.com> User-Agent: NeoMutt/20170113 (1.7.2) X-SW-Source: 2018-04/txt/msg00579.txt.bz2 > Instead of the Rust syntax or with notation (I find the notation a bit > easy to miss at times) I went with the wordier: > > case LOW_BOUND_DEFAULT_EXCLUSIVE: > fputs_filtered ("ExclusiveRange '..EXP'", stream); > break; > > And likewise for print_subexp_standard: > > if (range_type == NONE_BOUND_DEFAULT_EXCLUSIVE > || range_type == LOW_BOUND_DEFAULT_EXCLUSIVE) > fputs_filtered ("EXCLUSIVE_", stream); > fputs_filtered ("RANGE(", stream); > > I think it's fine to be wordy here because these dumpers are only gdb > debugging aids; users won't ordinarily see this output. That looks good to me. > Joel> Just a note to refer to my earlier email asking about the meaning > Joel> the previously existing enums (inclusive or exclusive), and perhaps > Joel> a suggestion to adjust the documentation above to make it unequivocal > Joel> by using the mathematical notation for each and everyone of them. > > I wrote comments like so: > > enum range_type > { > /* Neither the low nor the high bound was given -- so this refers to > the entire available range. */ > BOTH_BOUND_DEFAULT, > /* The low bound was not given and the high bound is inclusive. */ > LOW_BOUND_DEFAULT, > /* The high bound was not given and the low bound in inclusive. */ > HIGH_BOUND_DEFAULT, > /* Both bounds were given and both are inclusive. */ > NONE_BOUND_DEFAULT, > /* The low bound was not given and the high bound is exclusive. */ > NONE_BOUND_DEFAULT_EXCLUSIVE, > /* Both bounds were given. The low bound is inclusive and the high > bound is exclusive. */ > LOW_BOUND_DEFAULT_EXCLUSIVE, > }; Good idea! I think it's much clearer. > 2018-04-26 Tom Tromey > > PR rust/22545: > * rust-lang.c (rust_inclusive_range_type_p): New function. > (rust_range): Handle inclusive ranges. > (rust_compute_range): Likewise. > * rust-exp.y (struct rust_op) : New field. > (DOTDOTEQ): New constant. > (range_expr): Add "..=" productions. > (operator_tokens): Add "..=" token. > (ast_range): Add "inclusive" parameter. > (convert_ast_to_expression) : Handle inclusive > ranges. > * parse.c (operator_length_standard) : Handle new > bounds values. > * expression.h (enum range_type) LOW_BOUND_DEFAULT_EXCLUSIVE>: New constants. > Update comments. > * expprint.c (print_subexp_standard): Handle new bounds values. > (dump_subexp_body_standard): Likewise. > > 2018-04-26 Tom Tromey > > PR rust/22545: > * gdb.rust/simple.exp: Add inclusive range tests. The patch looks good to me, so you can go ahead and push. Thanks Tom! -- Joel