11.1.12.12. Parser¶
This module implements a partial SPICE netlist parser.
See the cir2py tool for an example of usage of the parser.
It would be difficult to implement a full parser for Ngspice since the syntax is mainly contextual.
-
class
PySpice.Spice.Parser.
Element
(line)[source]¶ Bases:
PySpice.Spice.Parser.Statement
This class implements an element definition.
“{ expression }” are allowed in device line.
-
property
name
¶ Name of the element
-
property
-
class
PySpice.Spice.Parser.
Include
(line)[source]¶ Bases:
PySpice.Spice.Parser.Statement
This class implements a include definition.
-
class
PySpice.Spice.Parser.
Lib
(line)[source]¶ Bases:
PySpice.Spice.Parser.Statement
This class implements a library definition.
-
class
PySpice.Spice.Parser.
Line
(line, line_range, end_of_line_comment)[source]¶ Bases:
object
This class implements a line in the netlist.
-
property
comment
¶
-
property
is_comment
¶
-
read_words
(start_location, number_of_words)[source]¶ Read a fixed number of words separated by space.
-
property
-
class
PySpice.Spice.Parser.
Model
(line)[source]¶ Bases:
PySpice.Spice.Parser.Statement
This class implements a model definition.
Spice syntax:
.model mname type (pname1=pval1 pname2=pval2)
-
property
name
¶ Name of the model
-
property
-
class
PySpice.Spice.Parser.
PrefixData
(prefix, classes)[source]¶ Bases:
object
This class represents a device prefix.
-
property
single
¶
-
property
-
class
PySpice.Spice.Parser.
SpiceParser
(path=None, source=None, end_of_line_comment=('$', '//', ';'), recurse=False, section=None)[source]¶ Bases:
object
This class parse a Spice netlist file and build a syntax tree.
Public Attributes:
circuit
models
subcircuits
incl_libs
-
class
PySpice.Spice.Parser.
Statement
(line, statement=None)[source]¶ Bases:
object
This class implements a statement, in fact a line in a Spice netlist.
-
class
PySpice.Spice.Parser.
SubCircuitStatement
(line)[source]¶ Bases:
PySpice.Spice.Parser.Statement
This class implements a sub-circuit definition.
Spice syntax:
.SUBCKT name node1 ... param1=value1 ...
-
property
name
¶ Name of the sub-circuit.
-
property
nodes
¶ Nodes of the sub-circuit.
-
property
-
class
PySpice.Spice.Parser.
Title
(line)[source]¶ Bases:
PySpice.Spice.Parser.Statement
This class implements a title definition.