diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2023-06-29 21:23:03 -0400 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:49:32 +0100 |
commit | 1ecba694eef9ea63e7412491ca753c817bb9d1a6 (patch) | |
tree | a74f5f64878a384db58ef336f2368c81fef0d16f /gcc | |
parent | 05ef8df6827f2528ff81a0faec9054fdd5a103ff (diff) | |
download | gcc-1ecba694eef9ea63e7412491ca753c817bb9d1a6.zip gcc-1ecba694eef9ea63e7412491ca753c817bb9d1a6.tar.gz gcc-1ecba694eef9ea63e7412491ca753c817bb9d1a6.tar.bz2 |
gccrs: Create MacroInvocLexerBase
gcc/rust/ChangeLog:
* expand/rust-macro-invoc-lexer.h
(class MacroInvocLexerBase): New.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/expand/rust-macro-invoc-lexer.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/rust/expand/rust-macro-invoc-lexer.h b/gcc/rust/expand/rust-macro-invoc-lexer.h index ba13385..4ea31d7 100644 --- a/gcc/rust/expand/rust-macro-invoc-lexer.h +++ b/gcc/rust/expand/rust-macro-invoc-lexer.h @@ -22,6 +22,33 @@ #include "rust-ast.h" namespace Rust { +template <class T> class MacroInvocLexerBase +{ +public: + MacroInvocLexerBase (std::vector<T> stream) + : offs (0), token_stream (std::move (stream)) + {} + + // Advances current token to n + 1 tokens ahead of current position. + void skip_token (int n) { offs += (n + 1); } + + // Skips the current token. + void skip_token () { skip_token (0); } + + std::string get_filename () const + { + // FIXME + gcc_unreachable (); + return "FIXME"; + } + + size_t get_offs () const { return offs; } + +protected: + size_t offs; + std::vector<T> token_stream; +}; + class MacroInvocLexer { public: |