@author: Gautham Ganapathy @organization: LEMS (http://neuroml.org/lems/, https://github.com/organizations/LEMS) @contact: gautham@lisphacker.org
LEMS XML file format parser.
@author: Gautham Ganapathy @organization: LEMS (http://neuroml.org/lems/, https://github.com/organizations/LEMS) @contact: gautham@lisphacker.org
MAvdVlag: altered attributes for constants, state_variables, derived_variables, time_derivatives, conditional_derived_variable and exposures
Bases: tvb.dsl.NeuroML.lems.base.base.LEMSBase
LEMS XML file format parser class.
Counter generator for generating unique ids. @type: generator(int)
List of directories to search for included files. @type: list(str)
Whether to include LEMS definitions in <Include> elements @type: boolean
Model instance to be populated from the parsed file. @type: lems.model.model.Model
Parse a string containing LEMS XML text.
@param xmltext: String containing LEMS XML formatted text. @type xmltext: str
Parses <Assertion>
@param node: Node containing the <Assertion> element @type node: xml.etree.Element
Parses <Attachments>
@param node: Node containing the <Attachments> element @type node: xml.etree.Element
Parses <Case>
@param node: Node containing the <Case> element @type node: xml.etree.Element
@raise ParseError: When no condition or value is specified
Parses <Child>
@param node: Node containing the <Child> element @type node: xml.etree.Element
Parses <ChildInstance>
@param node: Node containing the <ChildInstance> element @type node: xml.etree.Element
Parses <Children>
@param node: Node containing the <Children> element @type node: xml.etree.Element
Parses <Component>
@param node: Node containing the <Component> element @type node: xml.etree.Element
Parses components defined directly by component name.
@param node: Node containing the <Component> element @type node: xml.etree.Element
@param type_: Type of this component. @type type_: string
@raise ParseError: Raised when the component does not have an id.
Parses <ComponentReference>
@param node: Node containing the <ComponentTypeRef> element @type node: xml.etree.Element
Parses <ComponentRequirement>
@param node: Node containing the <ComponentRequirement> element @type node: xml.etree.Element
Parses <ComponentType>
@param node: Node containing the <ComponentType> element @type node: xml.etree.Element
@raise ParseError: Raised when the component type does not have a name.
Parses <ConditionalDerivedVariable>
@param node: Node containing the <ConditionalDerivedVariable> element @type node: xml.etree.Element
@raise ParseError: Raised when no name or value is specified for the conditional derived variable.
Parses <Constant>
@param node: Node containing the <Constant> element @type node: xml.etree.Element
MV: fixed the symbol part. It was not there for constant parsing
Parses <DataDisplay>
@param node: Node containing the <DataDisplay> element @type node: xml.etree.Element
Parses <DataWriter>
@param node: Node containing the <DataWriter> element @type node: xml.etree.Element
Parses <DerivedParameter>
@param node: Node containing the <DerivedParameter> element @type node: xml.etree.Element
Parses <DerivedVariable>
@param node: Node containing the <DerivedVariable> element @type node: xml.etree.Element
@raise ParseError: Raised when no name of specified for the derived variable.
Parses <Dimension>
@param node: Node containing the <Dimension> element @type node: xml.etree.Element
@raise ParseError: When the name is not a string or if the dimension is not a signed integer.
Parses <Dynamics>
@param node: Node containing the <Behaviour> element @type node: xml.etree.Element
Parses <EventConnection>
@param node: Node containing the <EventConnection> element @type node: xml.etree.Element
Parses <EventOut>
@param node: Node containing the <EventOut> element @type node: xml.etree.Element
Parses <EventPort>
@param node: Node containing the <EventPort> element @type node: xml.etree.Element
Parses <EventRecord>
@param node: Node containing the <EventRecord> element @type node: xml.etree.Element
Parses <EventWriter>
@param node: Node containing the <EventWriter> element @type node: xml.etree.Element
Parses <Exposure>
@param node: Node containing the <Exposure> element @type node: xml.etree.Element
@raise ParseError: Raised when the exposure name is not being defined in the context of a component type.
Parses <Fixed>
@param node: Node containing the <Fixed> element @type node: xml.etree.Element
Parses <ForEach>
@param node: Node containing the <ForEach> element @type node: xml.etree.Element
Parses <Function>
@param node: Node containing the <Function> element @type node: xml.etree.Element
MV: added function for pre and post coupling behavior
Parses <Include>
@param node: Node containing the <Include> element @type node: xml.etree.Element
@raise ParseError: Raised when the file to be included is not specified.
Parses <IndexParameter>
@param node: Node containing the <IndexParameter> element @type node: xml.etree.Element
@raise ParseError: Raised when the IndexParameter does not have a name.
Parses <InstanceRequirement>
@param node: Node containing the <InstanceRequirement> element @type node: xml.etree.Element
Parses <KineticScheme>
@param node: Node containing the <KineticScheme> element @type node: xml.etree.Element
Parses <Link>
@param node: Node containing the <Link> element @type node: xml.etree.Element
Parses <MultiInstantiate>
@param node: Node containing the <MultiInstantiate> element @type node: xml.etree.Element
Parses <OnCondition>
@param node: Node containing the <OnCondition> element @type node: xml.etree.Element
Parses <OnEntry>
@param node: Node containing the <OnEntry> element @type node: xml.etree.Element
Parses <OnEvent>
@param node: Node containing the <OnEvent> element @type node: xml.etree.Element
Parses <OnStart>
@param node: Node containing the <OnStart> element @type node: xml.etree.Element
Parses <Parameter>
@param node: Node containing the <Parameter> element @type node: xml.etree.Element
@raise ParseError: Raised when the parameter does not have a name. @raise ParseError: Raised when the parameter does not have a dimension.
Parses <Path>
@param node: Node containing the <Path> element @type node: xml.etree.Element
Parses <Property>
@param node: Node containing the <Property> element @type node: xml.etree.Element
@raise ParseError: Raised when the property does not have a name. @raise ParseError: Raised when the property does not have a dimension.
Parses <Record>
@param node: Node containing the <Record> element @type node: xml.etree.Element
Parses <Regime>
@param node: Node containing the <Behaviour> element @type node: xml.etree.Element
Parses <Requirement>
@param node: Node containing the <Requirement> element @type node: xml.etree.Element
Parses <Run>
@param node: Node containing the <Run> element @type node: xml.etree.Element
Parses <Show>
@param node: Node containing the <Show> element @type node: xml.etree.Element
Parses <Simulation>
@param node: Node containing the <Simulation> element @type node: xml.etree.Element
Parses <StateAssignment>
@param node: Node containing the <StateAssignment> element @type node: xml.etree.Element
Parses <StateVariable>
@param node: Node containing the <StateVariable> element @type node: xml.etree.Element
@raise ParseError: Raised when the state variable is not being defined in the context of a component type.
Parses <Structure>
@param node: Node containing the <Structure> element @type node: xml.etree.Element
Parses <Target>
@param node: Node containing the <Target> element @type node: xml.etree.Element
Parses <Text>
@param node: Node containing the <Text> element @type node: xml.etree.Element
Parses <TimeDerivative>
@param node: Node containing the <TimeDerivative> element @type node: xml.etree.Element
@raise ParseError: Raised when the time derivative does not hava a variable name of a value.
Parses <Transition>
@param node: Node containing the <Transition> element @type node: xml.etree.Element
Parses <Tunnel>
@param node: Node containing the <Tunnel> element @type node: xml.etree.Element
@raise ParseError: Raised when the Tunnel does not have a name.
Parses <Unit>
@param node: Node containing the <Unit> element @type node: xml.etree.Element
@raise ParseError: When the name is not a string or the unit specfications are incorrect.
@raise ModelError: When the unit refers to an undefined dimension.
Parses <With>
@param node: Node containing the <With> element @type node: xml.etree.Element
Process child tags.
@param node: Current node being parsed. @type node: xml.etree.Element
@raise ParseError: Raised when an unexpected nested tag is found.
Dictionary of xml tags to parse methods @type: dict(string -> function)
Dictionary mapping each tag to it’s list of valid child tags. @type: dict(string -> string)
Expression parser
@author: Gautham Ganapathy @organization: LEMS (http://neuroml.org/lems/, https://github.com/organizations/LEMS) @contact: gautham@lisphacker.org
MAvdVlag: added pow(f,l) function for c translations and ** for python power function. Removed H as a known function
Bases: tvb.dsl.NeuroML.lems.base.base.LEMSBase
Base class for a node in the expression parse tree.
Node type. @type: enum(ExprNode.OP, ExprNode.VALUE)
Bases: tvb.dsl.NeuroML.lems.base.base.LEMSBase
Parser class for parsing an expression and generating a parse tree.
Dictionary mapping operators to their priorities. @type: dict(string -> Integer)
Checks if a token string contains a function.
@param str: Token string to be checked. @type str: string
@return: True if the token string contains a function. @rtype: Boolean
Checks if a token string contains an operator.
@param str: Token string to be checked. @type str: string
@return: True if the token string contains an operator. @rtype: Boolean
Checks if a token string contains a symbol.
@param str: Token string to be checked. @type str: string
@return: True if the token string contains a symbol. @rtype: Boolean
MV: Added the part to recognize ** for power
Tokenizes and parses an arithmetic expression into a parse tree.
@return: Returns a token string. @rtype: lems.parser.expr.ExprNode
Expression to be parsed. @type: string
Parses a tokenized arithmetic expression into a parse tree. It calls itself recursively to handle bracketed subexpressions.
@return: Returns a token string. @rtype: lems.parser.expr.ExprNode
@attention: Does not handle unary minuses at the moment. Needs to be fixed.
List of tokens from the expression to be parsed. @type: list(string)
Bases: tvb.dsl.NeuroML.lems.parser.expr.ExprNode
Unary function node in an expression parse tree. This will always be a non-leaf node.
Funcion stored in this node. @type: string
Parameter. @type: lems.parser.expr.ExprNode
Bases: tvb.dsl.NeuroML.lems.parser.expr.ExprNode
Operation node in an expression parse tree. This will always be a non-leaf node.
Left operand. @type: lems.parser.expr.ExprNode
Operation stored in this node. @type: string
Right operand. @type: lems.parser.expr.ExprNode
Bases: tvb.dsl.NeuroML.lems.parser.expr.ExprNode
Value node in an expression parse tree. This will always be a leaf node.
Value to be stored in this node. @type: string