Disable tests for strdup/strndup on __hpux__
[official-gcc.git] / gcc / rust / expand / rust-macro-invoc-lexer.cc
blob321f0f97a76b2d576ad7ba41c87b1b37608c87cb
1 #include "rust-macro-invoc-lexer.h"
3 namespace Rust {
5 const_TokenPtr
6 MacroInvocLexer::peek_token (int n)
8 if ((offs + n) >= token_stream.size ())
9 return Token::make (END_OF_FILE, Location ());
11 return token_stream.at (offs + n)->get_tok_ptr ();
14 // Advances current token to n + 1 tokens ahead of current position.
15 void
16 MacroInvocLexer::skip_token (int n)
18 offs += (n + 1);
21 void
22 MacroInvocLexer::split_current_token (TokenId new_left __attribute__ ((unused)),
23 TokenId new_right
24 __attribute__ ((unused)))
26 // FIXME
27 gcc_unreachable ();
30 std::vector<std::unique_ptr<AST::Token>>
31 MacroInvocLexer::get_token_slice (size_t start_idx, size_t end_idx) const
33 std::vector<std::unique_ptr<AST::Token>> slice;
35 rust_assert (end_idx < token_stream.size ());
37 for (size_t i = start_idx; i < end_idx; i++)
38 slice.emplace_back (token_stream[i]->clone_token ());
40 return slice;
43 } // namespace Rust