refactor expect_syntax_error into expect_syntax_error_on_stmts