From fd6e4e7ff613804d7fee5ce0a59cfa55a5ca6176 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 18 Mar 2017 19:01:40 +0800 Subject: Expand - add column! macro --- src/expand/file_line.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/expand/file_line.cpp b/src/expand/file_line.cpp index a485fe61..8dfb7e6d 100644 --- a/src/expand/file_line.cpp +++ b/src/expand/file_line.cpp @@ -27,6 +27,15 @@ class CExpanderLine: } }; +class CExpanderColumn: + public ExpandProcMacro +{ + ::std::unique_ptr expand(const Span& sp, const AST::Crate& crate, const ::std::string& ident, const TokenTree& tt, AST::Module& mod) override + { + return box$( TTStreamO(TokenTree(Token((uint64_t)sp.start_ofs, CORETYPE_U32))) ); + } +}; + class CExpanderModulePath: public ExpandProcMacro { @@ -44,5 +53,6 @@ class CExpanderModulePath: STATIC_MACRO("file", CExpanderFile); STATIC_MACRO("line", CExpanderLine); +STATIC_MACRO("column", CExpanderColumn); STATIC_MACRO("module_path", CExpanderModulePath); -- cgit v1.2.3