]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Make the Rust parser pure
authorTom Tromey <tom@tromey.com>
Sat, 2 Jun 2018 04:20:23 +0000 (22:20 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 20 Jul 2018 15:40:18 +0000 (09:40 -0600)
commit56ba65a04713fd8ff23908d4c57f75427317b8bb
tree729f93fba1764164bed0c8a82ea7590c93f3fe63
parent3ba174474d3cc063d6b7abf0bfdd6021bbaf8a90
Make the Rust parser pure

This makes the Rust parser a pure parser and removes all the
(non-constant) globals from rust-exp.y.  This seemed like a nice
simplification to me and I think it should probably be applied to all
the parsers.  Perhaps it would be good to go even one step farther and
have all parsers derive from parser_state.

Tested on x86-64 Fedora 26.

gdb/ChangeLog
2018-07-20  Tom Tromey  <tom@tromey.com>

* rust-exp.y: Now a pure parser.  Update all rules.
(%union): Move earlier.
(current_parser, work_obstack): Remove globals.
(rust_parser, ~rust_parser): Update.
(class rust_parser) <copy_name, concat3, crate_name, super_name,
lex_character, lex_number, lex_string, lex_identifier,
rust_lookup_type, convert_params_to_types, convert_ast_to_type,
convert_name, convert_params_to_expression,
convert_ast_to_expression, ast_basic_type, ast_operation,
ast_compound_assignment, rust_op, ast_literal, ast_dliteral,
ast_structop, ast_structop_anonymous, ast_unary, ast_cast,
ast_call_ish, ast_path, ast_string, ast_struct, ast_range,
ast_array_type, ast_slice_type, ast_reference_type,
ast_pointer_type, ast_function_type, ast_tuple_type>: New methods.
(rust_parse): Update.
(rustyyerror, rustyylex): Add parser parameter.
(rust_lex_test_one, rust_lex_int_test, rust_lex_exception_test)
(rust_lex_stringish_test, rust_lex_test_sequence)
(rust_lex_test_trailing_dot, rust_lex_test_completion)
(rust_lex_test_push_back, rust_lex_tests): Update.
gdb/ChangeLog
gdb/rust-exp.y