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/ada-lex.l | |
parent | 8621b685bfdcb8773b8177fb2b89e45499902868 (diff) | |
download | gdb-5776fca307b8af3d852525b77e9b917a9aa97370.zip gdb-5776fca307b8af3d852525b77e9b917a9aa97370.tar.gz gdb-5776fca307b8af3d852525b77e9b917a9aa97370.tar.bz2 |
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/ada-lex.l')
-rw-r--r-- | gdb/ada-lex.l | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l index 43bd25c..f7fac27 100644 --- a/gdb/ada-lex.l +++ b/gdb/ada-lex.l @@ -73,13 +73,13 @@ static void rewind_to_char (int); #undef YY_INPUT #define YY_INPUT(BUF, RESULT, MAX_SIZE) \ - if ( *lexptr == '\000' ) \ + if ( *pstate->lexptr == '\000' ) \ (RESULT) = YY_NULL; \ else \ { \ - *(BUF) = *lexptr; \ + *(BUF) = *pstate->lexptr; \ (RESULT) = 1; \ - lexptr += 1; \ + pstate->lexptr += 1; \ } static int find_dot_all (const char *); @@ -628,9 +628,9 @@ processAttribute (const char *str) static void rewind_to_char (int ch) { - lexptr -= yyleng; - while (toupper (*lexptr) != toupper (ch)) - lexptr -= 1; + pstate->lexptr -= yyleng; + while (toupper (*pstate->lexptr) != toupper (ch)) + pstate->lexptr -= 1; yyrestart (NULL); } |