diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-03-12 12:43:43 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-03-12 12:43:43 +0800 |
commit | 5a907d042ea463e6f86985aaa66a1f2a46e3406a (patch) | |
tree | bf0b26b5536913cd2bc763dcf8e3d34f2f71d51b /src/parse/root.cpp | |
parent | 40fca6696bd7c201010e4533a2435ae32f59eecd (diff) | |
download | mrust-5a907d042ea463e6f86985aaa66a1f2a46e3406a.tar.gz |
Parse - Hackily handle `struct Foo(pub ())`
Diffstat (limited to 'src/parse/root.cpp')
-rw-r--r-- | src/parse/root.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parse/root.cpp b/src/parse/root.cpp index 970e2cfc..d40e1f95 100644 --- a/src/parse/root.cpp +++ b/src/parse/root.cpp @@ -44,13 +44,13 @@ AST::MetaItem Parse_MetaItem(TokenStream& lex); void Parse_ModRoot(TokenStream& lex, AST::Module& mod, AST::MetaItems& mod_attrs); //::AST::Path Parse_Publicity(TokenStream& lex) -bool Parse_Publicity(TokenStream& lex) +bool Parse_Publicity(TokenStream& lex, bool allow_restricted=true) { Token tok; if( LOOK_AHEAD(lex) == TOK_RWORD_PUB ) { GET_TOK(tok, lex); - if( LOOK_AHEAD(lex) == TOK_PAREN_OPEN ) + if( allow_restricted && LOOK_AHEAD(lex) == TOK_PAREN_OPEN ) { auto path = AST::Path("", {}); // Restricted publicity. @@ -541,7 +541,7 @@ AST::Struct Parse_Struct(TokenStream& lex, const AST::MetaItems& meta_items) SET_ATTRS(lex, item_attrs); PUTBACK(tok, lex); - bool is_pub = Parse_Publicity(lex); + bool is_pub = Parse_Publicity(lex, /*allow_restricted=*/false); // HACK: Disable `pub(restricted)` syntax in tuple structs, due to ambiguity refs.push_back( AST::TupleItem( mv$(item_attrs), is_pub, Parse_Type(lex) ) ); if( GET_TOK(tok, lex) != TOK_COMMA ) |