diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-12-30 15:18:17 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-12-30 15:18:17 +0800 |
commit | 7bf1481e25ea09b0f49da981f868403c56f45092 (patch) | |
tree | edc3cd40d2a1f10b64f6e34a584bfdb252836b38 /src/macro_rules/parse.cpp | |
parent | ae313aac223612b67402bd55cd31557ddc979585 (diff) | |
download | mrust-7bf1481e25ea09b0f49da981f868403c56f45092.tar.gz |
macro_rules - Fix a few edge cases
Diffstat (limited to 'src/macro_rules/parse.cpp')
-rw-r--r-- | src/macro_rules/parse.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/macro_rules/parse.cpp b/src/macro_rules/parse.cpp index f5b0f0e4..b3b1014e 100644 --- a/src/macro_rules/parse.cpp +++ b/src/macro_rules/parse.cpp @@ -212,7 +212,10 @@ public: // TODO: `error-chain`'s quick_error macro has an arm which refers to an undefined metavar. // - Maybe emit a warning and use a marker index. WARNING(lex.point_span(), W0000, "Macro variable $" << name << " not found"); - idx = (1<<16)-1; // NOTE: Encoded as a u16 + // Emit the literal $ <name> + ret.push_back( MacroExpansionEnt(Token(TOK_DOLLAR)) ); + ret.push_back( MacroExpansionEnt(mv$(tok)) ); + continue ; } if( var_set_ptr ) { var_set_ptr->insert( ::std::make_pair(idx,true) ); |