Make cp-name-parser.y a pure parser
authorTom Tromey <tom@tromey.com>
Thu, 24 May 2018 03:46:59 +0000 (21:46 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 1 Jun 2018 16:46:48 +0000 (10:46 -0600)
commit49265499d81d40ed07b71481749f35f209521f5a
tree8c527d50e302bca938855e2f47d10be3dd8242d9
parent55b6c9849624fc105539e08222fb8ff128a5f7e2
Make cp-name-parser.y a pure parser

This changes cp-name-parser.y to be a pure parser.

Originally I had thought that doing this would mean that gdb would
always require Bison.  However, I've learned that Byacc supports some
of the Bison extensions in this area.  So, the new code ought to work
reasonably well with both.

Note that the Byacc documentations says:

    %pure-parser
        Most variables (other than yydebug and yynerrs) are allocated
        on the stack within yyparse, making the parser reasonably
        reentrant.

In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.

gdb/ChangeLog
2018-06-01  Tom Tromey  <tom@tromey.com>

* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
gdb/ChangeLog
gdb/cp-name-parser.y
This page took 0.027368 seconds and 4 git commands to generate.