diff options
author | Tom Tromey <tom@tromey.com> | 2019-03-24 21:30:56 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-04-04 19:55:11 -0600 |
commit | 5776fca307b8af3d852525b77e9b917a9aa97370 (patch) | |
tree | ac923aa97349376a076996f5f8db12b44e728cb5 /gdb/parse.c | |
parent | 8621b685bfdcb8773b8177fb2b89e45499902868 (diff) | |
download | binutils-gdb-5776fca307b8af3d852525b77e9b917a9aa97370.tar.gz |
Move lexptr and prev_lexptr to parser_state
This removes the lexptr and prev_lexptr globals, in favor of members
of parser_state. prev_lexptr could be isolated to each parser, but
since every parser uses it, that did not seem necessary.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* rust-exp.y (struct rust_parser) <lex_hex, lex_escape,
lex_operator, push_back>: New methods.
Update all rules.
(rust_parser::lex_hex, lex_escape): Rename and update.
(rust_parser::lex_string, rust_parser::lex_identifier): Update.
(rust_parser::lex_operator): Rename and update.
(rust_parser::lex_number, rustyylex, rustyyerror)
(rust_lex_test_init, rust_lex_test_sequence)
(rust_lex_test_push_back, rust_lex_tests): Update.
* parser-defs.h (struct parser_state) <parser_state>: Add "input"
parameter.
<lexptr, prev_lexptr>: New members.
(lexptr, prev_lexptr): Don't declare.
* parse.c (lexptr, prev_lexptr): Remove globals.
(parse_exp_in_context): Update.
* p-exp.y (yylex, yyerror): Update.
* m2-exp.y (parse_number, yylex, yyerror): Update.
* go-exp.y (lex_one_token, yyerror): Update.
* f-exp.y (match_string_literal, yylex, yyerror): Update.
* d-exp.y (lex_one_token, yyerror): Update.
* c-exp.y (scan_macro_expansion, finished_macro_expansion)
(lex_one_token, yyerror): Update.
* ada-lex.l (YY_INPUT): Update.
(rewind_to_char): Update.
* ada-exp.y (yyerror): Update.
Diffstat (limited to 'gdb/parse.c')
-rw-r--r-- | gdb/parse.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/gdb/parse.c b/gdb/parse.c index 617ff70d67e..5692e23386b 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -69,8 +69,6 @@ const struct exp_descriptor exp_descriptor_standard = innermost_block_tracker innermost_block; int arglist_len; static struct type_stack type_stack; -const char *lexptr; -const char *prev_lexptr; /* True if parsing an expression to attempt completion. */ int parse_completion; @@ -1112,16 +1110,13 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc, const struct language_defn *lang = NULL; int subexp; - lexptr = *stringptr; - prev_lexptr = NULL; - type_stack.elements.clear (); expout_last_struct = -1; expout_tag_completion_type = TYPE_CODE_UNDEF; expout_completion_name.reset (); innermost_block.reset (tracker_types); - if (lexptr == 0 || *lexptr == 0) + if (*stringptr == 0 || **stringptr == 0) error_no_arg (_("expression to compute")); std::vector<int> funcalls; @@ -1184,7 +1179,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc, to the value matching SELECTED_FRAME as set by get_current_arch. */ parser_state ps (lang, get_current_arch (), expression_context_block, - expression_context_pc, comma); + expression_context_pc, comma, *stringptr); scoped_restore_current_language lang_saver; set_language (lang->la_language); @@ -1223,7 +1218,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc, if (expressiondebug) dump_prefix_expression (result.get (), gdb_stdlog); - *stringptr = lexptr; + *stringptr = ps.lexptr; return result; } |