aboutsummaryrefslogtreecommitdiff
path: root/gdb/parse.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-03-29 14:14:07 -0600
committerTom Tromey <tom@tromey.com>2018-04-27 13:20:13 -0600
commit6873858b7e464e114f9a877e216949ad8350b4cf (patch)
tree8812199c58f09c14b00dc50805d9b066f02d28bd /gdb/parse.c
parent632e107b32c0fe8aede62e070b00756e9fdd2c01 (diff)
downloadgdb-6873858b7e464e114f9a877e216949ad8350b4cf.zip
gdb-6873858b7e464e114f9a877e216949ad8350b4cf.tar.gz
gdb-6873858b7e464e114f9a877e216949ad8350b4cf.tar.bz2
Add inclusive range support for Rust
This is version 2 of the patch to add inclusive range support for Rust. I believe it addresses all review comments. Rust recently stabilized the inclusive range feature: https://github.com/rust-lang/rust/issues/28237 An inclusive range is an expression like "..= EXPR" or "EXPR ..= EXPR". It is like an ordinary range, except the upper bound is inclusive, not exclusive. This patch adds support for this feature to gdb. Regression tested on x86-64 Fedora 27. 2018-04-27 Tom Tromey <tom@tromey.com> 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) <inclusive>: New field. (DOTDOTEQ): New constant. (range_expr): Add "..=" productions. (operator_tokens): Add "..=" token. (ast_range): Add "inclusive" parameter. (convert_ast_to_expression) <case OP_RANGE>: Handle inclusive ranges. * parse.c (operator_length_standard) <case OP_RANGE>: Handle new bounds values. * expression.h (enum range_type) <NONE_BOUND_DEFAULT_EXCLUSIVE, LOW_BOUND_DEFAULT_EXCLUSIVE>: New constants. Update comments. * expprint.c (print_subexp_standard): Handle new bounds values. (dump_subexp_body_standard): Likewise. 2018-04-27 Tom Tromey <tom@tromey.com> PR rust/22545: * gdb.rust/simple.exp: Add inclusive range tests.
Diffstat (limited to 'gdb/parse.c')
-rw-r--r--gdb/parse.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/parse.c b/gdb/parse.c
index 1d53b5a..193abe8 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -995,6 +995,7 @@ operator_length_standard (const struct expression *expr, int endpos,
switch (range_type)
{
case LOW_BOUND_DEFAULT:
+ case LOW_BOUND_DEFAULT_EXCLUSIVE:
case HIGH_BOUND_DEFAULT:
args = 1;
break;
@@ -1002,6 +1003,7 @@ operator_length_standard (const struct expression *expr, int endpos,
args = 0;
break;
case NONE_BOUND_DEFAULT:
+ case NONE_BOUND_DEFAULT_EXCLUSIVE:
args = 2;
break;
}