Handle build, test and doc flags in depends and depopts

To be documented.
Ref: #1231
Syntax is for example:
```
depends: [ "a" {>= "3"}
           "b" {build}
           "c" {build & test & < "4"} ]
```
The keywords need to be leading.