def parse(self, fileData=None, context=None):
        self.reset()
        if context is not None:
            self.context = context

        if fileData is not None:
            self.filedata = fileData

        for index, line in enumerate(self.filedata):
            line = line.strip()
            # Use 1-indexed line numbers that users will recognize
            index = index + 1

            if line.startswith('#') or not line:
                # empty lines are handled just like comments, and empty
                # lines and comments are always looked up in the
                # unmodified filedata, so we store only the index
                self.appendNoOpByText(line,
                    modified=False, index=index, context=self.context)
                continue

            # non-empty, non-comment lines must be parsed 
            try:
                verb, nouns = line.split(None, 1)
            except:
                raise CMError('%s: Invalid statement "%s"'
                              %(CMLocation(index, self.context), line))

            if verb == VersionOperation.key:
                nouns = nouns.split('#')[0].strip()
                self.setVersion(VersionOperation(text=nouns,
                    modified=False, index=index, context=self.context))

            elif verb == SearchOperation.key:
                # Handle it if quoted, but it doesn't need to be
                try:
                    nouns = ' '.join(shlex.split(nouns, comments=True))
                except ValueError, e:
                    raise CMError('%s: %s' %(
                        CMLocation(index, self.context), str(e)))
                try:
                    searchOp = SearchLabel(text=nouns,
                       modified=False, index=index, context=self.context)
                except errors.ParseError:
                    try:
                        searchOp = SearchTrove(text=nouns,
                           modified=False, index=index, context=self.context)
                    except cmdline.TroveSpecError, e:
                        raise CMError('%s: %s' %(
                            CMLocation(index, self.context), str(e)))
                self.appendOp(searchOp)

            elif verb == IncludeOperation.key:
                # Handle it if quoted, but it doesn't need to be
                try:
                    nouns = ' '.join(shlex.split(nouns, comments=True))
                except ValueError, e:
                    raise CMError('%s: %s' %(
                        CMLocation(index, self.context), str(e)))
                try:
                    includeOp = IncludeOperation(text=nouns,
                       modified=False, index=index, context=self.context)
                except cmdline.TroveSpecError, e:
                    raise CMError('%s: %s' %(
                        CMLocation(index, self.context), str(e)))
                self.appendOp(includeOp)

            elif verb in opMap:
                try:
                    self.appendOpByName(verb,
                        text=shlex.split(nouns, comments=True),
                        modified=False, index=index, context=self.context)
                except __HOLE__, e:
                    raise CMError('%s: %s' %(
                        CMLocation(index, self.context), str(e)))

            else:
                raise CMError(
                    '%s: Unrecognized command "%s"' %(
                    CMLocation(index, self.context), verb))
dataset/ETHPy150Open sassoftware/conary/conary/conaryclient/cml.py/CML.parse