<commit_before>"""
This module defines a grammar for SPICE-like netlists.

Copyright 2015--2022 <NAME>, UCECE
"""

# SPICE also considers = a delimiter.
delimiters = ' \t(),'

# Comment characters; these must be in the first column.
comments = r'#%*'

# Each line defines a rule.  The field before the colon is the classname.  This
# must be unique.
# The second field (up to name) is used to match the rule along with the optional
# keyword parameter.
# Optional parameters are in square brackets.
rules = r"""
A: Aname Np; Annotation
ADC: ADCname Np Nm; ADC
AM: AMname Np Nm; Ammeter
BAT: BATname Np Nm [Value=name]; Battery
C: Cname Np Nm [Value=name] [IC]; Capacitor
Cable: Cablename; Cable
CPE: CPEname Np Nm [Value=name] [Power]; Constant phase element
D: Dname Np Nm; Diode
DAC: DACname Np Nm; DAC
Dled: Dname Np Nm led; Light emitting diode
Dzener: Dname Np Nm zener; Zener diode
Dphoto: Dname Np Nm photo; Photo diode
Dtunnel: Dname Np Nm tunnel; Tunnel diode
Dschottky: Dname Np Nm schottky; Schottky diode
E: Ename Np Nm Ncp Ncm [Value=name] [Ac=0]; Voltage controlled voltage source
VCVS: VCVSname Np Nm Ncp Ncm [Value=name]; Voltage controlled voltage source
Eopamp: Ename Np Nm opamp Ncp Ncm [Ad=name] [Ac=0] [Ro=0]; Opamp
Efdopamp: Ename Np Nm fdopamp Ncp Ncm Nocm [Ad=name] [Ac=0]; Fully differential opamp
Einamp: Ename Np Nm inamp Ncp Ncm NRp NRm [Ad=name] [Ac=0] [Rf=Rf]; Instrumentation opamp
Eamp: Ename Np Nm amp Ncp Ncm [Ad=name] [Ac=0]; Amplifier
F: Fname Np Nm Vcontrol [Value=name]; Current controlled current source (note the control current is specified through a voltage source)
CCCS: CCCSname Np Nm Vcontrol [Value=name]; Current controlled current source (note the control current is specified through a voltage source)
FB: FBname Np Nm; Ferrite bead
FS: FSname Np Nm; Fuse
G: Gname Np Nm Ncp Ncm [Value=name]; Voltage controlled current source
VCCS: VCCSname Np Nm Ncp Ncm [Value=name]; Voltage controlled current source
GY: GYname Np Nm Ncp Ncm [Value=name]; Gyrator
H: Hname Np Nm Vcontrol [Value=name]; Current controlled voltage source (note the control current is specified through a voltage source)
CCVS: CCVSname Np Nm Vcontrol [Value=name]; Current controlled voltage source (note the control current is specified through a voltage source)
I: Iname Np Nm [Value=name]; Current source
sI: Iname Np Nm s [Value=name]; s-domain current source
Idc: Iname Np Nm dc [Value=name]; DC current source
Istep: Iname Np Nm step [Value=name]; Step current source
Iac: Iname Np Nm ac [Value=name] [Phase] [Freq]; AC current source
Isin: Iname Np Nm sin Io Ia fo [td] [alpha] [Phase]; Sinusoidal current source
Inoise: Iname Np Nm noise [Value=name] [NID]; Noise current source
J: Jname Nd Ng Ns [Value=name]; N channel JFET
Jnjf: Jname Nd Ng Ns njf [Value=name]; N channel JFET
Jpjf: Jname Nd Ng Ns pjf [Value=name]; P channel JFET
k: kname Np Nm [Value=name] [IC]; Spring
K: Kname Lname1 Lname2 [Value=name]; Mutual inductance (L1 on left, L2 on right)
L: Lname Np Nm [Value=name] [IC]; Inductance
m: mname Np Nm [Value=name] [IC]; Mass
M: Mname Nd Ng Ns [Value=name]; N channel MOSFET
Mnmos: Mname Nd Ng Ns nmos [Value=name]; N channel MOSFET
Mpmos: Mname Nd Ng Ns pmos [Value=name]; P channel MOSFET
MISC: MISCname Np Nm; Miscellaneous circuitikz bipole
MT: MTname Np Nm; Motor
MX: MXname P P P; Mixer
NR: NRname Np Nm [Value=name]; Noiseless resistor
O: Oname Np Np; Open circuit
P: Pname Np Np; Port
Q: Qname Nc Nb Ne [Value=name]; NPN transistor
Qnpn: Qname Nc Nb Ne npn [Value=name]; NPN transistor
Qpnp: Qname Nc Nb Ne pnp [Value=name]; PNP transistor
r: rname Np Nm [Value=name]; Damper
R: Rname Np Nm [Value=name]; Resistor
RV: RVname Np Nm No [Value=name] [Value=name]; Potentiometer
Sbox: Sname box; Box
Scircle: Sname circle; Circle
Sellipse: Sname ellipse; Ellipse
Striangle: Sname triangle; Triangle
SPpp: SPname pp P P P; Summing point
SPpm: SPname pm P P P; Summing point
SPppp: SPname ppp P P P P; Summing point
SPpmm: SPname pmm P P P P; Summing point
SPppm: SPname ppm P P P P; Summing point
SWnc: SWname Np Nm nc; Switch normally closed
SWno: SWname Np Nm no; Switch normally open
SWpush: SWname Np Nm push; Pushbutton switch
SWspdt: SWname Nc Np Nm spdt; SPDT switch
TF: TFname Np Nm Ncp Ncm [Value=name]; Ideal transformer (works to DC!)
TFcore: TFname Np Nm Ncp Ncm core [Value=name]; Transformer with core (works to DC!)
TFtap: TFname Np Nm Ncp Ncm tap Nt Nt [Value=name]; Tapped transformer (works to DC!)
TFtapcore: TFname Np Nm Ncp Ncm tapcore Nt Nt [Value=name]; Tapped transformer with core (works to DC!)
TL: TLname Np Nm Ncp Ncm [Z0] [Gamma] [Length]; Transmission line
TLlossless: TLname Np Nm Ncp Ncm lossless [Z0] [Gamma] [Length]; Lossless transmission line
TP: TPname Np Nm Ncp Ncm; Generic two-port<commit_msg>Add defaults<commit_after>"""
This module defines a grammar for SPICE-like netlists.

Copyright 2015--2022 <NAME>, UCECE
"""

# SPICE also considers = a delimiter.
delimiters = ' \t(),'

# Comment characters; these must be in the first column.
comments = r'#%*'

# Each line defines a rule.  The field before the colon is the classname.  This
# must be unique.
# The second field (up to name) is used to match the rule along with the optional
# keyword parameter.
# Optional parameters are in square brackets.
rules = r"""
A: Aname Np; Annotation
ADC: ADCname Np Nm; ADC
AM: AMname Np Nm; Ammeter
BAT: BATname Np Nm [Value=name]; Battery
C: Cname Np Nm [Value=name] [IC]; Capacitor
Cable: Cablename; Cable
CPE: CPEname Np Nm [Value=name] [Power=1]; Constant phase element
D: Dname Np Nm; Diode
DAC: DACname Np Nm; DAC
Dled: Dname Np Nm led; Light emitting diode
Dzener: Dname Np Nm zener; Zener diode
Dphoto: Dname Np Nm photo; Photo diode
Dtunnel: Dname Np Nm tunnel; Tunnel diode
Dschottky: Dname Np Nm schottky; Schottky diode
E: Ename Np Nm Ncp Ncm [Value=name] [Ac=0]; Voltage controlled voltage source
VCVS: VCVSname Np Nm Ncp Ncm [Value=name]; Voltage controlled voltage source
Eopamp: Ename Np Nm opamp Ncp Ncm [Ad=name] [Ac=0] [Ro=0]; Opamp
Efdopamp: Ename Np Nm fdopamp Ncp Ncm Nocm [Ad=name] [Ac=0]; Fully differential opamp
Einamp: Ename Np Nm inamp Ncp Ncm NRp NRm [Ad=name] [Ac=0] [Rf=Rf]; Instrumentation opamp
Eamp: Ename Np Nm amp Ncp Ncm [Ad=name] [Ac=0]; Amplifier
F: Fname Np Nm Vcontrol [Value=name]; Current controlled current source (note the control current is specified through a voltage source)
CCCS: CCCSname Np Nm Vcontrol [Value=name]; Current controlled current source (note the control current is specified through a voltage source)
FB: FBname Np Nm; Ferrite bead
FS: FSname Np Nm; Fuse
G: Gname Np Nm Ncp Ncm [Value=name]; Voltage controlled current source
VCCS: VCCSname Np Nm Ncp Ncm [Value=name]; Voltage controlled current source
GY: GYname Np Nm Ncp Ncm [Value=name]; Gyrator
H: Hname Np Nm Vcontrol [Value=name]; Current controlled voltage source (note the control current is specified through a voltage source)
CCVS: CCVSname Np Nm Vcontrol [Value=name]; Current controlled voltage source (note the control current is specified through a voltage source)
I: Iname Np Nm [Value=name]; Current source
sI: Iname Np Nm s [Value=name]; s-domain current source
Idc: Iname Np Nm dc [Value=name]; DC current source
Istep: Iname Np Nm step [Value=name]; Step current source
Iac: Iname Np Nm ac [Value=name] [Phase] [Freq]; AC current source
Isin: Iname Np Nm sin Io Ia fo [td] [alpha] [Phase]; Sinusoidal current source
Inoise: Iname Np Nm noise [Value=name] [NID]; Noise current source
J: Jname Nd Ng Ns [Value=name]; N channel JFET
Jnjf: Jname Nd Ng Ns njf [Value=name]; N channel JFET
Jpjf: Jname Nd Ng Ns pjf [Value=name]; P channel JFET
k: kname Np Nm [Value=name] [IC]; Spring
K: Kname Lname1 Lname2 [Value=name]; Mutual inductance (L1 on left, L2 on right)
L: Lname Np Nm [Value=name] [IC]; Inductance
m: mname Np Nm [Value=name] [IC]; Mass
M: Mname Nd Ng Ns [Value=name]; N channel MOSFET
Mnmos: Mname Nd Ng Ns nmos [Value=name]; N channel MOSFET
Mpmos: Mname Nd Ng Ns pmos [Value=name]; P channel MOSFET
MISC: MISCname Np Nm; Miscellaneous circuitikz bipole
MT: MTname Np Nm; Motor
MX: MXname P P P; Mixer
NR: NRname Np Nm [Value=name]; Noiseless resistor
O: Oname Np Np; Open circuit
P: Pname Np Np; Port
Q: Qname Nc Nb Ne [Value=name]; NPN transistor
Qnpn: Qname Nc Nb Ne npn [Value=name]; NPN transistor
Qpnp: Qname Nc Nb Ne pnp [Value=name]; PNP transistor
r: rname Np Nm [Value=name]; Damper
R: Rname Np Nm [Value=name]; Resistor
RV: RVname Np Nm No [Value=name] [Value=name]; Potentiometer
Sbox: Sname box; Box
Scircle: Sname circle; Circle
Sellipse: Sname ellipse; Ellipse
Striangle: Sname triangle; Triangle
SPpp: SPname pp P P P; Summing point
SPpm: SPname pm P P P; Summing point
SPppp: SPname ppp P P P P; Summing point
SPpmm: SPname pmm P P P P; Summing point
SPppm: SPname ppm P P P P; Summing point
SWnc: SWname Np Nm nc; Switch normally closed
SWno: SWname Np Nm no; Switch normally open
SWpush: SWname Np Nm push; Pushbutton switch
SWspdt: SWname Nc Np Nm spdt; SPDT switch
TF: TFname Np Nm Ncp Ncm [Value=name]; Ideal transformer (works to DC!)
TFcore: TFname Np Nm Ncp Ncm core [Value=name]; Transformer with core (works to DC!)
TFtap: TFname Np Nm Ncp Ncm tap Nt Nt [Value=name]; Tapped transformer (works to DC!)
TFtapcore: TFname Np Nm Ncp Ncm tapcore Nt Nt [Value=name]; Tapped transformer with core (works to DC!)
TL: TLname Np Nm Ncp Ncm [Z0=Z0] [Gamma=Gamma] [Length=l]; Transmission line
TLlossless: TLname Np Nm Ncp Ncm lossless [Z0=Z0] [Gamma=Gamma] [Length=l]; Lossless transmission line
TP: TPname Np Nm Ncp Ncm; Generic two-port
{'fraction_non_alphanumeric': 0.08828753526277296, 'fraction_numerical': 0.0044927384808275, 'mean_word_length': 4.930607187112764, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4070875', 'n_tokens_mistral': 3636, 'n_tokens_neox': 3497, 'n_words': 1548}