aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-06-29 21:23:03 -0400
committerCohenArthur <arthur.cohen@embecosm.com>2023-07-07 13:05:01 +0000
commitbfea515f429aec89917353b0035ddce0bda7637c (patch)
tree22dec5e30c053428818653e5481498bdc59ec1c7
parent5ca1ed0397314d47e7ecd937000ec096f8274a60 (diff)
downloadgcc-bfea515f429aec89917353b0035ddce0bda7637c.zip
gcc-bfea515f429aec89917353b0035ddce0bda7637c.tar.gz
gcc-bfea515f429aec89917353b0035ddce0bda7637c.tar.bz2
Create MacroInvocLexerBase
gcc/rust/ChangeLog: * expand/rust-macro-invoc-lexer.h (class MacroInvocLexerBase): New. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
-rw-r--r--gcc/rust/expand/rust-macro-invoc-lexer.h27
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 0923c18..1eabb03 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: