File tree 1 file changed +14
-8
lines changed
1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -2085,14 +2085,20 @@ auto Parser::parse_sizeof_expression(ExpressionAST*& yyast) -> bool {
2085
2085
return true ;
2086
2086
}
2087
2087
2088
- const auto after_sizeof_op = currentLocation ();
2088
+ auto lookat_sizeof_type_id = [&] {
2089
+ LookaheadParser lookahead{this };
2089
2090
2090
- SourceLocation lparenLoc;
2091
- TypeIdAST* typeId = nullptr ;
2092
- SourceLocation rparenLoc;
2091
+ SourceLocation lparenLoc;
2092
+ if (!match (TokenKind::T_LPAREN, lparenLoc)) return false ;
2093
+
2094
+ TypeIdAST* typeId = nullptr ;
2095
+ if (!parse_type_id (typeId)) return false ;
2096
+
2097
+ SourceLocation rparenLoc;
2098
+ if (!match (TokenKind::T_RPAREN, rparenLoc)) return false ;
2099
+
2100
+ lookahead.commit ();
2093
2101
2094
- if (match (TokenKind::T_LPAREN, lparenLoc) && parse_type_id (typeId) &&
2095
- match (TokenKind::T_RPAREN, rparenLoc)) {
2096
2102
auto ast = new (pool) SizeofTypeExpressionAST ();
2097
2103
yyast = ast;
2098
2104
@@ -2102,9 +2108,9 @@ auto Parser::parse_sizeof_expression(ExpressionAST*& yyast) -> bool {
2102
2108
ast->rparenLoc = rparenLoc;
2103
2109
2104
2110
return true ;
2105
- }
2111
+ };
2106
2112
2107
- rewind (after_sizeof_op) ;
2113
+ if ( lookat_sizeof_type_id ()) return true ;
2108
2114
2109
2115
auto ast = new (pool) SizeofExpressionAST ();
2110
2116
yyast = ast;
You can’t perform that action at this time.
0 commit comments