File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -277,15 +277,16 @@ struct MacroTranscriber
277
277
{
278
278
private:
279
279
DelimTokenTree token_tree;
280
-
281
- // TODO: should store location information?
280
+ Location locus;
282
281
283
282
public:
284
- MacroTranscriber (DelimTokenTree token_tree)
285
- : token_tree (std::move (token_tree))
283
+ MacroTranscriber (DelimTokenTree token_tree, Location locus )
284
+ : token_tree (std::move (token_tree)), locus (locus)
286
285
{}
287
286
288
287
std::string as_string () const { return token_tree.as_string (); }
288
+
289
+ Location get_locus () const { return locus; }
289
290
};
290
291
291
292
// A macro rule? Matcher and transcriber pair?
@@ -310,7 +311,8 @@ struct MacroRule
310
311
{
311
312
// FIXME: Once #928 is merged, give location to MacroMatcher
312
313
return MacroRule (MacroMatcher::create_error (Location ()),
313
- MacroTranscriber (DelimTokenTree::create_empty ()));
314
+ MacroTranscriber (DelimTokenTree::create_empty (),
315
+ Location ()));
314
316
}
315
317
316
318
std::string as_string () const ;
Original file line number Diff line number Diff line change @@ -1691,7 +1691,8 @@ Parser<ManagedTokenSource>::parse_macro_rule ()
1691
1691
}
1692
1692
1693
1693
// parse transcriber (this is just a delim token tree)
1694
- AST::MacroTranscriber transcriber (parse_delim_token_tree ());
1694
+ Location token_tree_loc = lexer.peek_token ()->get_locus ();
1695
+ AST::MacroTranscriber transcriber (parse_delim_token_tree (), token_tree_loc);
1695
1696
1696
1697
return AST::MacroRule (std::move (matcher), std::move (transcriber));
1697
1698
}
You can’t perform that action at this time.
0 commit comments