From: Owen Avery Date: Fri, 30 Jun 2023 01:23:03 +0000 (-0400) Subject: gccrs: Create MacroInvocLexerBase X-Git-Tag: basepoints/gcc-15~2396 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ecba694eef9ea63e7412491ca753c817bb9d1a6;p=thirdparty%2Fgcc.git gccrs: Create MacroInvocLexerBase gcc/rust/ChangeLog: * expand/rust-macro-invoc-lexer.h (class MacroInvocLexerBase): New. Signed-off-by: Owen Avery --- 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: