diff options
author | John Hodge <tpg@mutabah.net> | 2016-03-10 09:33:34 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-03-10 09:33:34 +0800 |
commit | 874994e677c48689036587033831af56f78797c8 (patch) | |
tree | 3bf94cf6bb51343d7f612c2798f8fa8d28dd4ee5 /src/expand/macro_rules.cpp | |
parent | 1e8587f474adb1c37147da8d25c4fb364f8fde1c (diff) | |
download | mrust-874994e677c48689036587033831af56f78797c8.tar.gz |
Expand - Macro cleanup, add cfg! macro (stubbed)
Diffstat (limited to 'src/expand/macro_rules.cpp')
-rw-r--r-- | src/expand/macro_rules.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/expand/macro_rules.cpp b/src/expand/macro_rules.cpp index 5a8e02c4..fac987ff 100644 --- a/src/expand/macro_rules.cpp +++ b/src/expand/macro_rules.cpp @@ -10,19 +10,17 @@ class CMacroRulesExpander: { bool expand_early() const override { return true; } - ::std::unique_ptr<TokenStream> expand(const ::std::string& ident, const TokenTree& tt, AST::Module& mod) override + ::std::unique_ptr<TokenStream> expand(Span sp, const ::std::string& ident, const TokenTree& tt, AST::Module& mod) override { - if( ident == "" ) { - throw ::std::runtime_error( "ERROR: macro_rules! requires an identifier" ); - } + if( ident == "" ) + ERROR(sp, E0000, "macro_rules! requires an identifier" ); TTStream lex(tt); auto mac = Parse_MacroRules(lex); // TODO: Place into current module using `ident` as the name mod.add_macro( false, ident, mac ); - static TokenTree empty_tt; - return box$( TTStream(empty_tt) ); + return box$( TTStreamO(TokenTree()) ); } }; |