pingspice.analysis.param.SpecsParser(ParserBase)
class documentation
Part of pingspice.analysis.param
(View In Hierarchy)
I parse text or text files defining the specifications of a device.
A single attribute value is defined with the construct name =
value
or name value
.
A dict of values is defined with just the dict name
on a
line by itself followed by a line of hyphens, e.g., -----
.
Then, after the hyphens, one or more key value
lines. (Zero
lines should make an empty dict, but is not supported.) Then another line
of hyphens.
But dicts can be stacked! If a key has two parts separated by a
colon, the first part is an entry in the top-level dict that is actually
another dict, and the second part is an entry in that dict. The file
RFP12N10L.specs included in the lib
sub-package uses this for
its params dict:
params ------------------------------------------- 351:Rg 990 351:ttrig 2E-4 351:Vbatt 62.7 361:Rg 82000 361:ttrig 2E-4 361:Vbatt 63.343 371:ttrig 2E-3 371:Vbatt 63.42 -------------------------------------------
There are three sub-dicts inside params, accessible with the keys 351, 361, and 371.
Construct me with an instance of Setups
and
call my instance to obtain a Specs
object
with the specifications as its attributes.
Comments (lines beginning with '#', and trailing parts of a line after a '#') and blank lines are ignored.
Method | __init__ | Undocumented |
Method | parseName | I call this when I encounter a line defining a new entry, with the first and possibly only token being the entry's name. |
Method | parse | I call this when I encounter a line defining just one or more space-delimited values, once per value. |
Method | add | Adds something to my Specs instance
s. There are three possibilities. |
Method | __call__ | Returns a new populated instance of Specs . |
Inherited from ParserBase:
Method | readLines | Undocumented |
I call this when I encounter a line defining a new entry, with the first and possibly only token being the entry's name.
I call this when I encounter a line defining just one or more space-delimited values, once per value.
Adds something to my Specs
instance
s. There are three possibilities.
-
If key is
None
and I have noDictStack
in progress, adds an attribute name with value to mySpecs
object. -
If key is
None
and I have aDictStack
in progress, adds an entry to its top level, referenced by name with the value. -
With a key, adds a new sub-dict to my
DictStack
(one must be in progress) and an entry to that, referenced by key with the value.