Exemple #1
0
    def read_source(self):
        """Read the source."""

        errors = False
        try:
            # Strip comments and dangling commas from view buffer
            # Read view buffer as JSON
            # Dump data to Python dict
            self.json = json.read_json_from_view(self.view)

        except Exception:
            errors = True
            error_msg(self.errors["view2json"], traceback.format_exc())
        return errors
Exemple #2
0
    def read_source(self):
        """Read the source."""

        errors = False
        ext_tbl = self.settings.get("yaml_strip_tabs_from", [])
        filename = self.view.file_name()
        self.strip_tabs = False
        if filename is not None:
            for ext in ext_tbl:
                m = re.match("^(.*)\\." + re.escape(ext) + "$", filename, re.IGNORECASE)
                if m is not None:
                    self.strip_tabs = True
                    break
        try:
            # Ensure view buffer is in a UTF8 format.
            # Wrap string in a file structure so it can be accessed by readPlist
            # Read view buffer as PLIST and dump to Python dict
            self.json = json.read_json_from_view(self.view)
        except Exception:
            errors = True
            error_msg(self.errors["view2json"], traceback.format_exc())
        return errors