diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-02-16 12:01:28 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-02-17 10:20:13 +0100 |
commit | c1e72db48a0fa36966f2517cbf45fa2b758af268 (patch) | |
tree | af8bdb51ac35038c8d6804e5ce0921981a80de94 /gcc/rust/parse/rust-parse-impl.h | |
parent | d81ba63f4829c12b89e87564c398e95879c89db1 (diff) | |
download | gcc-c1e72db48a0fa36966f2517cbf45fa2b758af268.zip gcc-c1e72db48a0fa36966f2517cbf45fa2b758af268.tar.gz gcc-c1e72db48a0fa36966f2517cbf45fa2b758af268.tar.bz2 |
macrorule: Add location information
Diffstat (limited to 'gcc/rust/parse/rust-parse-impl.h')
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index ef0ad40..7483818 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -1678,23 +1678,25 @@ template <typename ManagedTokenSource> AST::MacroRule Parser<ManagedTokenSource>::parse_macro_rule () { + Location locus = lexer.peek_token ()->get_locus (); + // parse macro matcher AST::MacroMatcher matcher = parse_macro_matcher (); if (matcher.is_error ()) - return AST::MacroRule::create_error (); + return AST::MacroRule::create_error (locus); if (!skip_token (MATCH_ARROW)) { // skip after somewhere? - return AST::MacroRule::create_error (); + return AST::MacroRule::create_error (locus); } // parse transcriber (this is just a delim token tree) Location token_tree_loc = lexer.peek_token ()->get_locus (); AST::MacroTranscriber transcriber (parse_delim_token_tree (), token_tree_loc); - return AST::MacroRule (std::move (matcher), std::move (transcriber)); + return AST::MacroRule (std::move (matcher), std::move (transcriber), locus); } // Parses a macro matcher (part of a macro rule definition). |