diff options
author | John Hodge <tpg@mutabah.net> | 2018-07-29 12:47:44 +0100 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2018-07-29 12:47:44 +0100 |
commit | c971a6fa8375598ecf9c99ee6b086e8cf957f568 (patch) | |
tree | f7f431cbac52e6b25d311bedd503b6584c51bd37 /src/macro_rules | |
parent | 5d4bf9e96d795623f1b32b2f1f2e57c4f74419fe (diff) | |
download | mrust-c971a6fa8375598ecf9c99ee6b086e8cf957f568.tar.gz |
All - Initial work on supporting 1.29 as a target version
Diffstat (limited to 'src/macro_rules')
-rw-r--r-- | src/macro_rules/eval.cpp | 4 | ||||
-rw-r--r-- | src/macro_rules/parse.cpp | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/macro_rules/eval.cpp b/src/macro_rules/eval.cpp index a393ba46..cda51ebe 100644 --- a/src/macro_rules/eval.cpp +++ b/src/macro_rules/eval.cpp @@ -1189,7 +1189,8 @@ namespace } if(lex.consume_if(TOK_AT)) continue; - if( lex.consume_if(TOK_TRIPLE_DOT) ) + // ... or ..= + if( lex.consume_if(TOK_TRIPLE_DOT) || lex.consume_if(TOK_DOUBLE_DOT_EQUAL) ) { switch(lex.next()) { @@ -1491,6 +1492,7 @@ namespace case TOK_DOUBLE_AMP: case TOK_DOUBLE_PIPE: case TOK_DOUBLE_DOT: + case TOK_DOUBLE_DOT_EQUAL: case TOK_TRIPLE_DOT: lex.consume(); break; diff --git a/src/macro_rules/parse.cpp b/src/macro_rules/parse.cpp index b3b1014e..00cf7cf7 100644 --- a/src/macro_rules/parse.cpp +++ b/src/macro_rules/parse.cpp @@ -49,8 +49,7 @@ public: switch( GET_TOK(tok, lex) ) { // TODO: Allow any reserved word - case TOK_RWORD_TYPE: - case TOK_RWORD_PUB: + case TOK_RWORD_PUB ... TOK_RWORD_UNSIZED: case TOK_IDENT: { ::std::string name = tok.type() == TOK_IDENT ? mv$(tok.str()) : FMT(tok); GET_CHECK_TOK(tok, lex, TOK_COLON); @@ -200,10 +199,13 @@ public: default: throw ParseError::Unexpected(lex, tok); } - + } + else if( tok.type() == TOK_RWORD_CRATE ) + { + ret.push_back( MacroExpansionEnt( (1<<30) | 0 ) ); } //else if( tok.type() == TOK_IDENT || tok_is_rword(tok.type()) ) - else if( tok.type() == TOK_IDENT || tok.type() == TOK_RWORD_TYPE || tok.type() == TOK_RWORD_PUB ) + else if( tok.type() == TOK_IDENT || tok.type() >= TOK_RWORD_PUB ) { // Look up the named parameter in the list of param names for this arm auto name = tok.type() == TOK_IDENT ? tok.str() : FMT(tok); @@ -222,10 +224,6 @@ public: } ret.push_back( MacroExpansionEnt(idx) ); } - else if( tok.type() == TOK_RWORD_CRATE ) - { - ret.push_back( MacroExpansionEnt( (1<<30) | 0 ) ); - } else { throw ParseError::Unexpected(lex, tok); |