+2013-12-06 Pierre Muller <muller@sourceware.org>
+
+ Fix completion for pascal language.
+ * p-exp.y (exp : field_exp name): Do not call mark_struct_expression.
+ (exp : field_exp name COMPLETE): New rule.
+ (exp : SIZEOF): Set correct current_type.
+ (last_was_structop): Remove static variable.
+ (yylex): Remove saw_structop local variable.
+ Adapt code to removal of variables above.
+
2013-12-06 Joel Brobecker <brobecker@adacore.com>
* frame.c (get_prev_frame_1): Delete variable "this_id".
exp : field_exp name
- { mark_struct_expression ();
- write_exp_elt_opcode (STRUCTOP_STRUCT);
+ { write_exp_elt_opcode (STRUCTOP_STRUCT);
write_exp_string ($2);
write_exp_elt_opcode (STRUCTOP_STRUCT);
search_field = 0;
}
}
;
-
+exp : field_exp name COMPLETE
+ { mark_struct_expression ();
+ write_exp_elt_opcode (STRUCTOP_STRUCT);
+ write_exp_string ($2);
+ write_exp_elt_opcode (STRUCTOP_STRUCT); }
+ ;
exp : field_exp COMPLETE
{ struct stoken s;
mark_struct_expression ();
exp : SIZEOF '(' type ')' %prec UNARY
{ write_exp_elt_opcode (OP_LONG);
write_exp_elt_type (parse_type->builtin_int);
+ current_type = parse_type->builtin_int;
CHECK_TYPEDEF ($3);
write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
write_exp_elt_opcode (OP_LONG); }
;
exp : SIZEOF '(' exp ')' %prec UNARY
- { write_exp_elt_opcode (UNOP_SIZEOF); }
+ { write_exp_elt_opcode (UNOP_SIZEOF);
+ current_type = parse_type->builtin_int; }
exp : STRING
{ /* C strings are converted into array constants with
return uptokstart;
}
-/* This is set if the previously-returned token was a structure
- operator '.'. This is used only when parsing to
- do field name completion. */
-static int last_was_structop;
-
/* Read one token, getting characters through lexptr. */
static int
int explen, tempbufindex;
static char *tempbuf;
static int tempbufsize;
- int saw_structop = last_was_structop;
- last_was_structop = 0;
retry:
prev_lexptr = lexptr;
switch (c = *tokstart)
{
case 0:
- if (saw_structop && search_field)
+ if (search_field && parse_completion)
return COMPLETE;
else
return 0;
/* Might be a floating point number. */
if (lexptr[1] < '0' || lexptr[1] > '9')
{
- if (parse_completion)
- last_was_structop = 1;
goto symbol; /* Nope, must be a symbol. */
}
if (search_field && current_type)
is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
- if (is_a_field || parse_completion)
+ if (is_a_field)
sym = NULL;
else
sym = lookup_symbol (tmp, expression_context_block,
}
if (search_field && current_type)
is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
- if (is_a_field || parse_completion)
+ if (is_a_field)
sym = NULL;
else
sym = lookup_symbol (tmp, expression_context_block,
}
if (search_field && current_type)
is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
- if (is_a_field || parse_completion)
+ if (is_a_field)
sym = NULL;
else
sym = lookup_symbol (tmp, expression_context_block,