diff options
author | John Hodge <tpg@mutabah.net> | 2015-03-25 21:37:29 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2015-03-25 21:37:29 +0800 |
commit | 66880a641295734c437feb4eb32fb60bf5cd9af5 (patch) | |
tree | 723f47d10888e737548031b0d183cf30c0393121 /src/parse/root.cpp | |
parent | 56601285b24450168e8b1853ae9c8b65f4576cb0 (diff) | |
download | mrust-66880a641295734c437feb4eb32fb60bf5cd9af5.tar.gz |
Macros updated with concat!, stringify!, and $crate
Diffstat (limited to 'src/parse/root.cpp')
-rw-r--r-- | src/parse/root.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/parse/root.cpp b/src/parse/root.cpp index 759c65ac..39776689 100644 --- a/src/parse/root.cpp +++ b/src/parse/root.cpp @@ -825,6 +825,18 @@ void Parse_Use(TokenStream& lex, ::std::function<void(AST::Path, ::std::string)> Token tok;
AST::Path path = AST::Path( AST::Path::TagAbsolute() );
+ // Leading :: is allowed and ignored for the $crate feature
+ if( LOOK_AHEAD(lex) == TOK_DOUBLE_COLON ) {
+ GET_TOK(tok, lex);
+ // HACK! mrustc emits $crate as `::"crate-name"`
+ if( LOOK_AHEAD(lex) == TOK_STRING )
+ {
+ GET_CHECK_TOK(tok, lex, TOK_STRING);
+ path.set_crate(tok.str());
+ GET_CHECK_TOK(tok, lex, TOK_DOUBLE_COLON);
+ }
+ }
+
switch( GET_TOK(tok, lex) )
{
case TOK_RWORD_SELF:
|