code: func Parse(ast *parser.Node) (stages []Stage, metaArgs []ArgCommand, err error) {
  	for _, n := range ast.Children {
  		cmd, err := ParseInstruction(n)
  		if err != nil {
  			return nil, nil, &parseError{inner: err, node: n}
  		}
  		if len(stages) == 0 {
  			// meta arg case
  			if a, isArg := cmd.(*ArgCommand); isArg {
  				metaArgs = append(metaArgs, *a)
  				continue
  			}
  		}
  		switch c := cmd.(type) {
  		case *Stage:
  			stages = append(stages, *c)
  		case Command:
  			stage, err := CurrentStage(stages)
  			if err != nil {
  				return nil, nil, err
  			}
  			stage.AddCommand(c)
  		default:
  			return nil, nil, errors.Errorf("%T is not a command type", cmd)
  		}
  
  	}
  	return stages, metaArgs, nil
  }
docs: // Parse a Dockerfile into a collection of buildable stages.
  // metaArgs is a collection of ARG instructions that occur before the first FROM.