diff options
author | John Hodge <tpg@mutabah.net> | 2016-06-12 21:44:29 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-06-12 21:44:29 +0800 |
commit | ec8ade6675dcfac39c74cbf06871247f532a558f (patch) | |
tree | 05e0b0aa14a2b6a16a32719d8bc18524053db62c | |
parent | 1e702d1fb104b6b4a040945d8b18a7afdb216b5e (diff) | |
download | mrust-ec8ade6675dcfac39c74cbf06871247f532a558f.tar.gz |
Parse - Don't stick a () after return/break/continue
-rw-r--r-- | src/parse/expr.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/parse/expr.cpp b/src/parse/expr.cpp index f01272f6..fbc43dcf 100644 --- a/src/parse/expr.cpp +++ b/src/parse/expr.cpp @@ -205,6 +205,21 @@ ExprNodeP Parse_ExprBlockLine(TokenStream& lex, bool *add_silence) return rv;
}
+ case TOK_RWORD_RETURN:
+ case TOK_RWORD_CONTINUE:
+ case TOK_RWORD_BREAK: {
+ PUTBACK(tok, lex);
+ auto ret = Parse_Stmt(lex);
+ if( GET_TOK(tok, lex) != TOK_SEMICOLON ) {
+ CHECK_TOK(tok, TOK_BRACE_CLOSE);
+ PUTBACK(tok, lex);
+ }
+ else {
+ // return/continue/break don't need silencing
+ }
+ return ret;
+ }
+
case TOK_MACRO:
// If a braced macro invocation is the first part of a statement, don't expect a semicolon
if( LOOK_AHEAD(lex) == TOK_BRACE_OPEN || (lex.lookahead(0) == TOK_IDENT && lex.lookahead(1) == TOK_BRACE_OPEN) ) {
|