Skip to content

Commit 2691b54

Browse files
powerboat9P-E-P
authored andcommitted
Use MacroInvocLexerBase in ProcMacroInvocLexer
gcc/rust/ChangeLog: * expand/rust-proc-macro-invoc-lexer.cc (ProcMacroInvocLexer::skip_token): Remove. * expand/rust-proc-macro-invoc-lexer.h: Include "rust-macro-invoc-lexer.h". (class ProcMacroInvocLexer): Extend MacroInvocLexerBase. Signed-off-by: Owen Avery <[email protected]>
1 parent 2b1d37c commit 2691b54

File tree

2 files changed

+3
-28
lines changed

2 files changed

+3
-28
lines changed

gcc/rust/expand/rust-proc-macro-invoc-lexer.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ ProcMacroInvocLexer::peek_token (int n)
3030
return token_stream.at (offs + n);
3131
}
3232

33-
// Advances current token to n + 1 tokens ahead of current position.
34-
void
35-
ProcMacroInvocLexer::skip_token (int n)
36-
{
37-
offs += (n + 1);
38-
}
39-
4033
void
4134
ProcMacroInvocLexer::split_current_token (TokenId new_left, TokenId new_right)
4235
{

gcc/rust/expand/rust-proc-macro-invoc-lexer.h

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020
#define RUST_PROC_MACRO_INVOC_LEXER_H
2121

2222
#include "rust-lex.h"
23+
#include "rust-macro-invoc-lexer.h"
2324

2425
namespace Rust {
25-
class ProcMacroInvocLexer
26+
class ProcMacroInvocLexer : public MacroInvocLexerBase<const_TokenPtr>
2627
{
2728
public:
2829
ProcMacroInvocLexer (std::vector<const_TokenPtr> stream)
29-
: offs (0), token_stream (std::move (stream))
30+
: MacroInvocLexerBase (std::move (stream))
3031
{}
3132

3233
// Returns token n tokens ahead of current position.
@@ -35,29 +36,10 @@ class ProcMacroInvocLexer
3536
// Peeks the current token.
3637
const_TokenPtr peek_token () { return peek_token (0); }
3738

38-
// Advances current token to n + 1 tokens ahead of current position.
39-
void skip_token (int n);
40-
41-
// Skips the current token.
42-
void skip_token () { skip_token (0); }
43-
4439
// Splits the current token into two. Intended for use with nested generics
4540
// closes (i.e. T<U<X>> where >> is wrongly lexed as one token). Note that
4641
// this will only work with "simple" tokens like punctuation.
4742
void split_current_token (TokenId new_left, TokenId new_right);
48-
49-
std::string get_filename () const
50-
{
51-
// FIXME
52-
rust_unreachable ();
53-
return "FIXME";
54-
}
55-
56-
size_t get_offs () const { return offs; }
57-
58-
private:
59-
size_t offs;
60-
std::vector<const_TokenPtr> token_stream;
6143
};
6244
} // namespace Rust
6345

0 commit comments

Comments
 (0)