@@ -1737,6 +1737,29 @@ static metac_storageclasses_t ParseStorageClasses(metac_parser_t* self)
17371737 return result ;
17381738}
17391739
1740+ bool NextIsStmt (metac_parser_t * self , int32_t offset )
1741+ {
1742+ metac_token_t * peek = MetaCParser_PeekToken (self , offset );
1743+ metac_token_t * peek2 = MetaCParser_PeekToken (self , offset + 1 );
1744+ metac_token_enum_t tok = peek -> TokenType ;
1745+
1746+ return (tok == tok_kw_if ||
1747+ tok == tok_kw_while ||
1748+ tok == tok_kw_do ||
1749+ (tok == tok_at && peek2 -> IdentifierKey == run_key ) ||
1750+ tok == tok_kw_for ||
1751+ tok == tok_kw_switch ||
1752+ (tok == tok_identifier && peek2 -> TokenType == tok_colon ) ||
1753+ tok == tok_kw_goto ||
1754+ tok == tok_kw_break ||
1755+ tok == tok_kw_continue ||
1756+ tok == tok_kw_case ||
1757+ tok == tok_kw_default ||
1758+ tok == tok_kw_return ||
1759+ tok == tok_kw__yield );
1760+ }
1761+
1762+
17401763metac_decl_t * MetaCParser_ParseDecl (metac_parser_t * self , metac_decl_t * parent )
17411764{
17421765 metac_storageclasses_t stc = storageclass_none ;
@@ -1750,7 +1773,7 @@ metac_decl_t* MetaCParser_ParseDecl(metac_parser_t* self, metac_decl_t* parent)
17501773
17511774 decl_type_t * type = 0 ;
17521775
1753- #ifndef NO_PREPROCESSOR
1776+ #if !defined( NO_PREPROCESSOR ) && 0
17541777 decl_preproc_t * preProcDecl = AllocNewDecl (decl_preproc , & result );
17551778 preProcDecl -> DirectiveKind = pp_invalid ;
17561779
@@ -1884,11 +1907,11 @@ metac_decl_t* MetaCParser_ParseDecl(metac_parser_t* self, metac_decl_t* parent)
18841907 // typedefs are exactly like variables
18851908 decl_variable_t * var ;
18861909 MetaCParser_Match (self , tok_kw_typedef );
1887- var = (decl_variable_t * )MetaCParser_ParseDecl (self , (metac_decl_t * ) typdef );
1910+ var = cast (decl_variable_t * ) MetaCParser_ParseDecl (self , (metac_decl_t * ) typdef );
18881911
18891912 MetaCParser_Match (self , tok_semicolon );
18901913
1891- typdef -> Type = var -> VarType ;
1914+ typdef -> Type = var -> VarType ;
18921915 typdef -> Identifier = var -> VarIdentifier ;
18931916 assert (typdef -> Type -> Hash != 0 );
18941917 hash = CRC32C_VALUE (hash , typdef -> Type -> Hash );
0 commit comments