}
#endif /* GDB_SELF_TEST */
- /* Return the token's string value as a string. */
- std::string get_string () const
- {
- return std::string (current_string_val);
- }
-
/* Storage for use while parsing. */
auto_obstack obstack;
if (current_token != IDENT)
error (_("'}', '..', or identifier expected"));
- std::string name = get_string ();
+ std::string name (current_string_val);
lex ();
operation_up expr;
case COMPLETE:
{
bool is_complete = current_token == COMPLETE;
- auto struct_op = new rust_structop (std::move (lhs), get_string ());
+ auto struct_op = new rust_structop (std::move (lhs),
+ std::string (current_string_val));
lex ();
if (is_complete)
{
the compiler does emit the "&str" type in the DWARF, just "str"
itself isn't always available -- but it's handy if this works
seamlessly. */
- if (current_token == IDENT && get_string () == "str")
+ if (current_token == IDENT && current_string_val == "str")
{
lex ();
return rust_slice_type ("&str", get_type ("u8"), get_type ("usize"));
if (current_token != IDENT)
error (_("identifier expected"));
- std::string path = get_string ();
+ std::string path (current_string_val);
bool saw_ident = true;
lex ();
if (current_token == IDENT)
{
- path = path + "::" + get_string ();
+ path += "::";
+ /* There isn't an appropriate operator+ for string_view
+ until C++26. */
+ path.append (current_string_val);
lex ();
saw_ident = true;
}
std::vector<std::pair<std::string, operation_up>> field_v;
size_t len = current_string_val.length ();
- operation_up str = make_operation<string_operation> (get_string ());
+ operation_up str
+ = make_operation<string_operation> (std::string (current_string_val));
operation_up addr
= make_operation<rust_unop_addr_operation> (std::move (str));
field_v.emplace_back ("data_ptr", std::move (addr));
break;
case BYTESTRING:
- result = make_operation<string_operation> (get_string ());
+ result
+ = make_operation<string_operation> (std::string (current_string_val));
lex ();
break;
const char *value, int kind)
{
rust_lex_test_one (parser, input, kind);
- SELF_CHECK (parser->get_string () == value);
+ SELF_CHECK (parser->current_string_val == value);
}
/* Helper to test that a string parses as a given token sequence. */