def makeNeed(self, tokens, index):
        Negate = False

        kind = tokens[index]

        if kind == 'not':
            Negate = True
            index += 1 #eat token
            kind = tokens[index] #get a new kind

        if kind in ['always', 'done', 'status', 'update', 'change']: #special needs
            index += 1 #eat token
            method = 'make' + kind.capitalize() + 'Need'
            if not hasattr(self, method):
                msg = "ParseError: No parse method called '%s' for need %s" %\
                    (method, kind)
                raise excepting.ParseError(msg, tokens, index)

            act, index = getattr(self, method)(kind, tokens, index)

        elif kind in ['elapsed', 'recurred']: #simple needs, direct and indirect, state is always framer relative
            index +=1 #eat token
            act, index = self.makeFramerNeed(kind, tokens, index)

        else: #basic needs dynamic (boolean, direct, & indirect)
            #parse  optional field and required statepath
            statePath, stateField, index = self.parseNeedState(tokens, index)

            #parse optional comparison
            comparison, index = self.parseComparisonOpt(tokens,index)

            if not comparison: #no comparison so make a boolean need
                act = self.makeBoolenNeed(statePath, stateField)

            else: #valid comparison so required goal
                #parse required goal
                direct, goal, goalPath, goalField, index = \
                       self.parseNeedGoal(statePath, stateField, tokens, index)

                #parse optional tolerance
                tolerance, index = self.parseTolerance(tokens, index)

                if direct: #make a direct need
                    act = self.makeDirectNeed(statePath,
                                              stateField,
                                              comparison,
                                              goal,
                                              tolerance)

                else: #make an indirect need
                    act = self.makeIndirectNeed(statePath,
                                                stateField,
                                                comparison,
                                                goalPath,
                                                goalField,
                                                tolerance)

        if Negate:
            act = acting.Nact(actor=act.actor,
                              registrar=act.registrar,
                              parms=act.parms,
                              human=self.currentHuman,
                              count=self.currentCount)

        return (act, index)
Parse a need
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.makeNeed