# Path: lems/base/base.py
# class LEMSBase(object):
#     """
#     Base object for PyLEMS.
#     """
# 
#     def copy(self):
#         return copy.deepcopy(self)
# 
#     def toxml(self):
#         return ""
# 
# Path: lems/base/errors.py
# class ParseError(LEMSError):
#     """
#     Exception class to signal errors found during parsing.
#     """
# 
#     pass
# 
# Path: lems/base/util.py
# def make_id():
#     global id_counter
#     id_counter = id_counter + 1
#     return "__id_{0}__".format(id_counter)


import xml.etree.ElementTree as xe
from lems.base.base import LEMSBase
from lems.base.errors import ParseError
from lems.model.fundamental import *
from lems.model.component import *
from lems.model.dynamics import *
from lems.model.structure import *
from lems.model.simulation import *
from lems.base.util import make_id

        self.process_nested_tags(xml)

    def raise_error(self, message, *params, **key_params):
        """
        Raise a parse error.
        """

        s = "Parser error in "

        self.xml_node_stack.reverse()
        if len(self.xml_node_stack) > 1:
            node = self.xml_node_stack[0]
            s += "<{0}".format(node.tag)
            if "name" in node.lattrib:
                s += ' name="{0}"'.format(node.lattrib["name"])
            if "id" in node.lattrib:
                s += ' id="{0}"'.format(node.lattrib["id"])
            s += ">"

        for node in self.xml_node_stack[1:]:
            s += ".<{0}".format(node.tag)
            if "name" in node.lattrib:
                s += ' name="{0}"'.format(node.lattrib["name"])
            if "id" in node.lattrib:
                s += ' id="{0}"'.format(node.lattrib["id"])
            s += ">"

        s += ":\n  " + message


# Path: lems/base/base.py
# class LEMSBase(object):
#     """
#     Base object for PyLEMS.
#     """
# 
#     def copy(self):
#         return copy.deepcopy(self)
# 
#     def toxml(self):
#         return ""
# 
# Path: lems/base/errors.py
# class ParseError(LEMSError):
#     """
#     Exception class to signal errors found during parsing.
#     """
# 
#     pass
# 
# Path: lems/base/util.py
# def make_id():
#     global id_counter
#     id_counter = id_counter + 1
#     return "__id_{0}__".format(id_counter)


# Path: lems/parser/LEMS.py
import xml.etree.ElementTree as xe
from lems.base.base import LEMSBase
from lems.base.errors import ParseError
from lems.model.fundamental import *
from lems.model.component import *
from lems.model.dynamics import *
from lems.model.structure import *
from lems.model.simulation import *
from lems.base.util import make_id


        self.process_nested_tags(xml)

    def raise_error(self, message, *params, **key_params):
        """
        Raise a parse error.
        """

        s = "Parser error in "

        self.xml_node_stack.reverse()
        if len(self.xml_node_stack) > 1:
            node = self.xml_node_stack[0]
            s += "<{0}".format(node.tag)
            if "name" in node.lattrib:
                s += ' name="{0}"'.format(node.lattrib["name"])
            if "id" in node.lattrib:
                s += ' id="{0}"'.format(node.lattrib["id"])
            s += ">"

        for node in self.xml_node_stack[1:]:
            s += ".<{0}".format(node.tag)
            if "name" in node.lattrib:
                s += ' name="{0}"'.format(node.lattrib["name"])
            if "id" in node.lattrib:
                s += ' id="{0}"'.format(node.lattrib["id"])
            s += ">"

        s += ":\n  " + message


        raise ParseError(s, *params, **key_params)