diff options
author | John Hodge <tpg@ucc.asn.au> | 2018-12-30 15:08:38 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2018-12-30 15:08:38 +0800 |
commit | 44d040f6d4325f713b9fefeadb1ee533a0fd5294 (patch) | |
tree | 5224110d351c7b7158c72d2119e19f0f6041dcf0 /src/macro_rules | |
parent | 852050a97d8304d30d1ea51b7acacf1ece387973 (diff) | |
download | mrust-44d040f6d4325f713b9fefeadb1ee533a0fd5294.tar.gz |
Parse/Macro - Handle `crate` as a visibility specifier
Diffstat (limited to 'src/macro_rules')
-rw-r--r-- | src/macro_rules/eval.cpp | 4 | ||||
-rw-r--r-- | src/macro_rules/mod.cpp | 1 |
2 files changed, 3 insertions, 2 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: |