From 1ecba694eef9ea63e7412491ca753c817bb9d1a6 Mon Sep 17 00:00:00 2001 From: Owen Avery Date: Thu, 29 Jun 2023 21:23:03 -0400 Subject: [PATCH] gccrs: Create MacroInvocLexerBase gcc/rust/ChangeLog: * expand/rust-macro-invoc-lexer.h (class MacroInvocLexerBase): New. Signed-off-by: Owen Avery --- gcc/rust/expand/rust-macro-invoc-lexer.h | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/gcc/rust/expand/rust-macro-invoc-lexer.h b/gcc/rust/expand/rust-macro-invoc-lexer.h index ba13385b486b..4ea31d7bdde3 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 MacroInvocLexerBase +{ +public: + MacroInvocLexerBase (std::vector 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 token_stream; +}; + class MacroInvocLexer { public: -- 2.47.2