diff options
author | Tom Tromey <tom@tromey.com> | 2019-03-24 22:50:14 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-04-04 19:55:11 -0600 |
commit | 2a61252965c91540133bece7deb92eb22e3cf929 (patch) | |
tree | 5774206de4966e8835801e71da5c6661b368dcec /gdb/d-exp.y | |
parent | 43476f0b1b628352ad8e3064e50128cb3461d3d0 (diff) | |
download | gdb-2a61252965c91540133bece7deb92eb22e3cf929.zip gdb-2a61252965c91540133bece7deb92eb22e3cf929.tar.gz gdb-2a61252965c91540133bece7deb92eb22e3cf929.tar.bz2 |
Move completion parsing to parser_state
This moves the globals and functions related to parsing for completion
to parser_state. A new structure is introduced in order to return
completion results from the parse back to
parse_expression_for_completion.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* rust-exp.y (rust_parser::lex_identifier, rustyylex)
(rust_parser::convert_ast_to_expression, rust_parse)
(rust_lex_test_completion, rust_lex_tests): Update.
* parser-defs.h (struct expr_completion_state): New.
(struct parser_state) <parser_state>: Add completion parameter.
<mark_struct_expression, mark_completion_tag>: New methods.
<parse_completion, m_completion_state>: New members.
(prefixify_expression, null_post_parser): Update.
(mark_struct_expression, mark_completion_tag): Don't declare.
* parse.c (parse_completion, expout_last_struct)
(expout_tag_completion_type, expout_completion_name): Remove
globals.
(parser_state::mark_struct_expression)
(parser_state::mark_completion_tag): Now methods.
(prefixify_expression): Add last_struct parameter.
(prefixify_subexp): Likewise.
(parse_exp_1): Update.
(parse_exp_in_context): Add cstate parameter. Update.
(parse_expression_for_completion): Create an
expr_completion_state.
(null_post_parser): Add "completion" parameter.
* p-exp.y: Update rules.
(yylex): Update.
* language.h (struct language_defn) <la_post_parser>: Add
"completing" parameter.
* go-exp.y: Update rules.
(lex_one_token): Update.
* expression.h (parse_completion): Don't declare.
* d-exp.y: Update rules.
(lex_one_token): Update rules.
* c-exp.y: Update rules.
(lex_one_token): Update.
* ada-lang.c (resolve): Add "parse_completion" parameter.
(resolve_subexp): Likewise.
(ada_resolve_function): Likewise.
Diffstat (limited to 'gdb/d-exp.y')
-rw-r--r-- | gdb/d-exp.y | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gdb/d-exp.y b/gdb/d-exp.y index c14c2d6..4d51cfd 100644 --- a/gdb/d-exp.y +++ b/gdb/d-exp.y @@ -338,7 +338,7 @@ PostfixExpression: PrimaryExpression | PostfixExpression '.' COMPLETE { struct stoken s; - mark_struct_expression (pstate); + pstate->mark_struct_expression (); write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); s.ptr = ""; s.length = 0; @@ -349,7 +349,7 @@ PostfixExpression: write_exp_string (pstate, $3); write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } | PostfixExpression '.' IDENTIFIER COMPLETE - { mark_struct_expression (pstate); + { pstate->mark_struct_expression (); write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); write_exp_string (pstate, $3); write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } @@ -1107,7 +1107,7 @@ lex_one_token (struct parser_state *par_state) /* Might be a floating point number. */ if (pstate->lexptr[1] < '0' || pstate->lexptr[1] > '9') { - if (parse_completion) + if (pstate->parse_completion) last_was_structop = 1; goto symbol; /* Nope, must be a symbol. */ } @@ -1308,7 +1308,7 @@ lex_one_token (struct parser_state *par_state) return NAME_OR_INT; } - if (parse_completion && *pstate->lexptr == '\0') + if (pstate->parse_completion && *pstate->lexptr == '\0') saw_name_at_eof = 1; return IDENTIFIER; |