summaryrefslogtreecommitdiff
path: root/src/expand/cfg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/expand/cfg.cpp')
-rw-r--r--src/expand/cfg.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/expand/cfg.cpp b/src/expand/cfg.cpp
new file mode 100644
index 00000000..546bb690
--- /dev/null
+++ b/src/expand/cfg.cpp
@@ -0,0 +1,26 @@
+
+#include <synext.hpp>
+#include <parse/tokentree.hpp>
+#include <parse/lex.hpp>
+
+class CCfgExpander:
+ public ExpandProcMacro
+{
+ bool expand_early() const override { return true; }
+
+ ::std::unique_ptr<TokenStream> expand(Span sp, const ::std::string& ident, const TokenTree& tt, AST::Module& mod) override
+ {
+ if( ident != "" ) {
+ ERROR(sp, E0000, "cfg! doesn't take an identifier");
+ }
+
+ DEBUG("cfg!()");
+
+ // TODO: Handle cfg!()
+
+ return box$( TTStreamO(TokenTree(TOK_RWORD_FALSE)) );
+ }
+};
+
+STATIC_MACRO("cfg", CCfgExpander);
+//STATIC_DECORATOR("cfg", CCfgHandler);