def buildDo(self, command, tokens, index):
        """ do kind [part ...] [as name [part ...]] [at context] [via inode]
               [to data][by source]
               [with data] [from source]
               [per data] [for source]
               [cum data] [qua source]

            deed:
                name [part ...]

            kind:
                name [part ...]

            context:
                (native, benter, enter, recur, exit, precur, renter, rexit)

            inode:
                indirect

            data:
                direct

            source:
                [(value, fields) in] indirect



            do controller pid depth   --> controllerPIDDepth
            do arbiter switch heading  --> arbiterSwitchHeading

            do controller pid depth with foobar 1
            do controller pid depth from value in .max.depth


        """
        self.verifyCurrentContext(tokens, index) #currentStore, currentFramer, currentFrame exist

        try:
            kind = "" # deed class key in registry
            name = "" #specific name of deed instance
            inode = None
            parts = []
            parms = odict()
            inits = odict()
            ioinits = odict()
            prerefs = odict([('inits', odict()),
                             ('ioinits', odict()),
                             ('parms', odict()) ])
            connective = None
            context = self.currentContext

            while index < len(tokens):
                if (tokens[index] in ['as', 'at', 'via', 'to', 'by', 'with', 'from',
                                      'per', 'for', 'cum', 'qua']): # end of parts
                    break
                parts.append(tokens[index])
                index += 1 #eat token

            if parts:
                kind = "".join([part.capitalize() for part in parts]) #camel case

            while index < len(tokens): #options
                connective = tokens[index]
                index += 1

                if connective == 'as':
                    parts = []
                    while index < len(tokens): # kind parts end when connective
                        if tokens[index] in ['as', 'at', 'to','by', 'with', 'from', 'per', 'for']: # end of parts
                            break
                        parts.append(tokens[index])
                        index += 1 #eat token

                    name =  "".join([part.capitalize() for part in parts]) #camel case
                    if not name:
                        msg = "ParseError: Building verb '%s'. Missing name for connective 'as'" % (command)
                        raise excepting.ParseError(msg, tokens, index)

                elif connective in ['at']:
                    context = tokens[index]
                    index += 1
                    if context not in ActionContextValues:
                        msg = ("ParseError: Building verb '{0}'. Invalid context"
                        " '{1} for connective 'as'".format(command, context))
                        raise excepting.ParseError(msg, tokens, index)
                    context = ActionContextValues[context]

                elif connective in ['via']:
                    inode, index = self.parseIndirect(tokens, index, node=True)

                elif connective in ['to', 'with']:
                    data, index = self.parseDirect(tokens, index)
                    parms.update(data)

                elif connective in ['by', 'from']:
                    srcFields, index = self.parseFields(tokens, index)
                    srcPath, index = self.parseIndirect(tokens, index)
                    prerefs['parms'][srcPath] = srcFields

                elif connective in ['per']:
                    data, index = self.parseDirect(tokens, index)
                    ioinits.update(data)

                elif connective in ['for']:
                    srcFields, index = self.parseFields(tokens, index)
                    srcPath, index = self.parseIndirect(tokens, index)
                    prerefs['ioinits'][srcPath] = srcFields

                elif connective in ['cum']:
                    data, index = self.parseDirect(tokens, index)
                    inits.update(data)

                elif connective in ['qua']:
                    srcFields, index = self.parseFields(tokens, index)
                    srcPath, index = self.parseIndirect(tokens, index)
                    prerefs['inits'][srcPath] = srcFields

                else:
                    msg = ("Error building {0}. Invalid connective"
                          " '{1}'.".format(command, connective))
                    raise excepting.ParseError(msg, tokens, index)

        except __HOLE__:
            msg = "Error building %s. Not enough tokens." % (command,)
            raise excepting.ParseError(msg, tokens, index)

        if index != len(tokens):
            msg = "Error building %s. Unused tokens." % (command,)
            raise excepting.ParseError(msg, tokens, index)

        if not kind:
            msg = "ParseError: Building verb '%s'. Missing kind for Doer." %\
                                (command)
            raise excepting.ParseError(msg, tokens, index)

        if kind not in doing.Doer.Registry: # class registration not exist
            msg = "ParseError: Building verb '%s'. No Deed of kind '%s' in registry" %\
                (command, kind)
            raise excepting.ParseError(msg, tokens, index)

        if inode:
            ioinits.update(inode=inode)  # via argument takes precedence over others
        if name:
            inits['name'] = name
        act = acting.Act(   actor=kind,
                            registrar=doing.Doer,
                            inits=inits,
                            ioinits=ioinits,
                            parms=parms,
                            prerefs=prerefs,
                            human=self.currentHuman,
                            count=self.currentCount)

        #context = self.currentContext
        if context == NATIVE:
            context = RECUR #what is native for this command

        if not self.currentFrame.addByContext(act, context):
            msg = "Error building %s. Bad context '%s'." % (command, context)
            raise excepting.ParseError(msg, tokens, index)

        console.profuse("     Added {0} '{1}' with parms '{2}'\n".format(
            ActionContextNames[context], act.actor, act.parms))

        return True
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.buildDo