Brazil declares emergency as caterpillars attack crops