def parseFramerNeedGoal(self, statePath, stateField, tokens, index):
        """
        Parse required goal for special framer need such as
           elapsed or recurred

        method must be wrapped in appropriate try excepts
        """
        goalPath = None #default
        goalField = None #default
        direct = False

        goal = tokens[index]
        #parse required goal
        try:
            goal = Convert2StrBoolCoordNum(tokens[index]) #goal is quoted string, boolean, or number
            index += 1 #eat token
            direct = True

        except __HOLE__: #means text is not (quoted string, bool, or number) so indirect
            if goal == 'goal': #means goal inferred by relative statePath
                index += 1 #eat token

                #now create goal path as inferred from state path
                #check if statePath can be interpreted  as  framer state relative
                chunks = statePath.strip('.').split('.')
                try:
                    if ((chunks[0] == 'framer') and
                         (chunks[2] == 'state')): #framer relative
                        chunks[2] = 'goal' # .framer.me.state becomes .framer.me.goal

                    else:
                        msg = "ParseError: Goal = 'goal' without framer state path '%s'" %\
                            (statePath)
                        raise excepting.ParseError(msg, tokens, index)

                except IndexError:
                    msg = "ParseError: Goal = 'goal' without framer state path '%s'" %\
                        (statePath)
                    raise excepting.ParseError(msg, tokens, index)

                goalPath = ".".join(chunks)
                goalField = stateField #goal field is the same as the given state field

            else: #not 'goal' so parse as indirect
                #is 'field in' clause present
                goalField, index = self.parseField(tokens, index)
                goalPath, index =  self.parseIndirect(tokens, index)

        return (direct, goal, goalPath, goalField, index)
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.parseFramerNeedGoal