What about looping left to right, but matchers have a priority score? For instance, DirectoryInstance would have a higher priority than any command, since it is often used inside of commands.