def consume(self, cwd=None):
        """ Converts the lexer tokens into valid statements. This process
        also checks command syntax.
        """
        first_pass = Grammar.overall.parseString(self.string)
        lowered = { key.lower(): val for key, val in first_pass.iteritems() }

        self.commands = ['\n'.join(self._get('commands', lowered))]
        self.job_options = self._get('job_options', lowered)
        self.global_options = self._get('options', lowered)

        self.files = self._get('files', lowered)
        self.paths = self._get('paths', lowered)

        self.files = self._parse(self.files, Grammar.file, True)
        self.paths = self._parse(self.paths, Grammar.path, True)
        self.job_options = self._parse(self.job_options, Grammar.line)

        try:
            command_lines = self._parse(self.commands, Grammar.command_lines)[0]
        except IndexError:
            raise ValueError('Did you write any commands?')

        self.commands = []
        for command_line in command_lines:
            comments, command = command_line
            self.commands.append([comments.asList(),
                self._parse([''.join(command)], Grammar.command)])

        self.job_options = [opt.asList() for opt in self.job_options]

        self.paths = ctf.get_paths(self.paths)
        self.files = ctf.get_files(self.files)

        self.paths.reverse()
        self.files.reverse()
        self.commands.reverse()

        return ctf.get_command_templates(self.commands, self.files[:],
            self.paths[:], self.job_options)