summaryrefslogtreecommitdiff
path: root/src/include/synext_macro.hpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-06-08 12:37:51 +0800
committerJohn Hodge <tpg@mutabah.net>2016-06-08 12:37:51 +0800
commit40071822728499b9028400ddac3cd32fb884b2a0 (patch)
treebeabbf632622601b307beb8308f1098e9da91a15 /src/include/synext_macro.hpp
parentd91e9415d3a3cd4c9cc5bfcee548d6b3b98867f5 (diff)
downloadmrust-40071822728499b9028400ddac3cd32fb884b2a0.tar.gz
Expand format_args! - Parse and (partially) emit
Diffstat (limited to 'src/include/synext_macro.hpp')
-rw-r--r--src/include/synext_macro.hpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/include/synext_macro.hpp b/src/include/synext_macro.hpp
new file mode 100644
index 00000000..1aa7fef5
--- /dev/null
+++ b/src/include/synext_macro.hpp
@@ -0,0 +1,40 @@
+/*
+ */
+#pragma once
+#ifndef _SYNEXT_MACRO_HPP_
+#define _SYNEXT_MACRO_HPP_
+
+//#include "../common.hpp" // for mv$ and other things
+#include <string>
+#include <memory>
+#include <span.hpp>
+
+class TypeRef;
+namespace AST {
+ class Crate;
+ class Module;
+}
+class TokenTree;
+class TokenStream;
+
+
+
+class ExpandProcMacro
+{
+public:
+ virtual bool expand_early() const = 0;
+
+ virtual ::std::unique_ptr<TokenStream> expand(const Span& sp, const AST::Crate& crate, const ::std::string& ident, const TokenTree& tt, AST::Module& mod) = 0;
+};
+
+#define STATIC_MACRO(ident, _handler_class) \
+ struct register_##_handler_class##_c {\
+ register_##_handler_class##_c() {\
+ Register_Synext_Macro( ident, ::std::unique_ptr<ExpandProcMacro>(new _handler_class()) ); \
+ } \
+ } s_register_##_handler_class;
+
+extern void Register_Synext_Macro(::std::string name, ::std::unique_ptr<ExpandProcMacro> handler);
+
+#endif
+