diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-07-05 16:56:14 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-07-07 12:28:58 +0100 |
commit | ec5da37dbfbcc55183f7ea4658c8856b9335ad61 (patch) | |
tree | c1ae133b17d14f2c96f8d5b56774b6e09c9b79bb /gcc/rust/parse/rust-parse.h | |
parent | 29d594e263f0ccbcbd2babf43ff453c5188f4f2c (diff) | |
download | gcc-ec5da37dbfbcc55183f7ea4658c8856b9335ad61.zip gcc-ec5da37dbfbcc55183f7ea4658c8856b9335ad61.tar.gz gcc-ec5da37dbfbcc55183f7ea4658c8856b9335ad61.tar.bz2 |
Refactor Lexer to support an abstract InputSource class
This patch allows us to remove the fmemopen lex_string hack to support
parsing buffers. This will allow us to support mutliple sources such as
metadata imports etc. The patch here updates the parser to hold onto a
reference to the lexer rather than 'owning' the lexer which allows us to
decouple the move semantics here.
Fixes #1203 #1000
Diffstat (limited to 'gcc/rust/parse/rust-parse.h')
-rw-r--r-- | gcc/rust/parse/rust-parse.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/rust/parse/rust-parse.h b/gcc/rust/parse/rust-parse.h index fa88f8e..d799a56 100644 --- a/gcc/rust/parse/rust-parse.h +++ b/gcc/rust/parse/rust-parse.h @@ -662,7 +662,7 @@ private: public: // Construct parser with specified "managed" token source. - Parser (ManagedTokenSource tokenSource) : lexer (std::move (tokenSource)) {} + Parser (ManagedTokenSource &tokenSource) : lexer (tokenSource) {} // Parse items without parsing an entire crate. This function is the main // parsing loop of AST::Crate::parse_crate(). @@ -689,7 +689,7 @@ public: private: // The token source (usually lexer) associated with the parser. - ManagedTokenSource lexer; + ManagedTokenSource &lexer; // The error list. std::vector<Error> error_table; // The names of inline modules while parsing. |