diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/macro_rules/eval.cpp | 4 | ||||
-rw-r--r-- | src/macro_rules/mod.cpp | 1 | ||||
-rw-r--r-- | src/parse/root.cpp | 7 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/macro_rules/eval.cpp b/src/macro_rules/eval.cpp index 558f26b3..23ffab77 100644 --- a/src/macro_rules/eval.cpp +++ b/src/macro_rules/eval.cpp @@ -1824,7 +1824,7 @@ namespace bool consume_vis(TokenStreamRO& lex) { TRACE_FUNCTION; - if( lex.consume_if(TOK_INTERPOLATED_VIS) ) + if( lex.consume_if(TOK_INTERPOLATED_VIS) || lex.consume_if(TOK_RWORD_CRATE) ) { return true; } @@ -2065,7 +2065,7 @@ unsigned int Macro_InvokeRules_MatchPattern(const Span& sp, const MacroRules& ru DEBUG(i << " ExpectTok(" << *e << ") == " << tok); if( tok != *e ) { - ERROR(sp, E0000, "Expected token in match arm"); + ERROR(sp, E0000, "Expected token " << *e << " in match arm, got " << tok); break; } } diff --git a/src/macro_rules/mod.cpp b/src/macro_rules/mod.cpp index fcea5b25..3297a139 100644 --- a/src/macro_rules/mod.cpp +++ b/src/macro_rules/mod.cpp @@ -160,6 +160,7 @@ bool is_token_vis(eTokenType tt) { switch(tt) { case TOK_RWORD_PUB: + case TOK_RWORD_CRATE: case TOK_INTERPOLATED_VIS: return true; default: diff --git a/src/parse/root.cpp b/src/parse/root.cpp index 61218326..5fc90f0c 100644 --- a/src/parse/root.cpp +++ b/src/parse/root.cpp @@ -48,7 +48,6 @@ AST::Attribute Parse_MetaItem(TokenStream& lex); void Parse_ModRoot(TokenStream& lex, AST::Module& mod, AST::AttributeList& mod_attrs); bool Parse_MacroInvocation_Opt(TokenStream& lex, AST::MacroInvocation& out_inv); -//::AST::Path Parse_Publicity(TokenStream& lex) ::AST::Visibility Parse_Publicity(TokenStream& lex, bool allow_restricted/*=true*/) { Token tok; @@ -57,6 +56,12 @@ bool Parse_MacroInvocation_Opt(TokenStream& lex, AST::MacroInvocation& out_inv) GET_TOK(tok, lex); return tok.take_frag_vis(); } + if( LOOK_AHEAD(lex) == TOK_RWORD_CRATE ) + { + // TODO: Return a path that indicates the entire current crate + GET_TOK(tok, lex); + return true; + } if( LOOK_AHEAD(lex) == TOK_RWORD_PUB ) { GET_TOK(tok, lex); |