forked from thomasysliu/Gedit-SPICE-syntax-highlighting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspice.lang
167 lines (151 loc) · 5.11 KB
/
spice.lang
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?xml version="1.0" encoding="UTF-8"?>
<language id="spice" _name="SPICE" version="2.0" _section="Source">
<metadata>
<property name="mimetypes">text/x-sp;text/x-spsrc</property>
<property name="globs">*.sp;*.net;*.sub;*.cir;*.ckt;*.cdl;*.mdl;*.mod;*.scs;*.spi</property>
</metadata>
<styles>
<style id="comment" _name="Comment" map-to="def:comment" />
<style id="string" _name="String" map-to="def:string" />
<style id="escaped-character" _name="Escaped Character" map-to="def:special-char" />
<style id="preprocessor" _name="Preprocessor" map-to="def:preprocessor" />
<style id="included-file" _name="Included File" map-to="def:string" />
<style id="char" _name="Character" map-to="def:character" />
<style id="keyword" _name="Keyword" map-to="def:keyword" />
<style id="type" _name="Data Type" map-to="def:type" />
<style id="attribute-name" _name="Attribute name" map-to="def:identifier" />
<style id="number" _name="Number" map-to="def:number" />
<style id="constant" _name="Constant" map-to="def:preprocessor" />
</styles>
<default-regex-options case-sensitive="false" />
<definitions>
<context id="spice">
<include>
<define-regex id="prefix">[a-zA-Z_][a-zA-Z0-9._-]*</define-regex>
<define-regex id="name">[a-zA-Z_][a-zA-Z0-9.:_-]*</define-regex>
<!-- Comments -->
<context id="comment" style-ref="comment">
<start>(\*|\;|\$)</start>
<end>$</end>
<include>
<context id="net-address" style-ref="net-address" extend-parent="false">
<match>(http(s)?|ftp):\/\/[^\s]*</match>
</context>
</include>
</context>
<!-- Values and Numbers -->
<context id="values" style-ref="constant">
<match>[ \t][-+]?((([0-9]+)\.?([0-9]+)([eE][-+]?[0-9]+)?[fpnumcdhkMegGTAVWFHzHSsC]{0,3})|([0-9]+[fpnumcdhkMegGTAVWFHzHSsC]{1,3}))</match>
</context>
<!-- Parameter Value -->
<context id="param-value" end-at-line-end="true" style-ref="string">
<start>(v|i)?("|'|{|\[|\()</start>
<end>("|'|}|\]|\))</end>
<include>
<context id="escaped-character" style-ref="escaped-character">
<match>\\.</match>
</context>
<context ref="values" />
</include>
</context>
<!-- Attribute Names -->
<context id="attribute-name" style-ref="attribute-name" class="no-spell-check">
<match>\b\%{name}\s*=</match>
</context>
<!-- Simulation Commands -->
<context id="sim-commands" style-ref="keyword">
<prefix>^\.</prefix>
<keyword>subckt</keyword>
<keyword>model</keyword>
<keyword>tran</keyword>
<keyword>temp</keyword>
<keyword>ac</keyword>
<keyword>dc</keyword>
<keyword>four</keyword>
<keyword>disto</keyword>
<keyword>sens</keyword>
<keyword>noise</keyword>
<keyword>tf</keyword>
<keyword>pz</keyword>
<keyword>print</keyword>
<keyword>plot</keyword>
<keyword>op</keyword>
<keyword>option</keyword>
<keyword>ends</keyword>
</context>
<!-- Sources -->
<context id="sources" style-ref="type">
<keyword>^v\w*</keyword>
<keyword>^i\w*</keyword>
</context>
<!-- Switch Source (had to be separated because of conflicts with sin and sffm. -->
<context id="sources-switch" style-ref="type">
<match>^(S|s)\w+\s</match>
</context>
<!-- Passive Components -->
<context id="passives" style-ref="type">
<keyword>^r\w*</keyword>
<keyword>^c\w*</keyword>
<keyword>^l\w*</keyword>
<keyword>^k\w*</keyword>
<keyword>^y\w*</keyword>
<keyword>^t\w*</keyword>
</context>
<!-- Active Components -->
<context id="actives" style-ref="type">
<keyword>^d\w*</keyword>
<keyword>^q\w*</keyword>
<keyword>^m\w*</keyword>
<keyword>^j\w*</keyword>
<keyword>^x\w*</keyword>
</context>
<!-- Commands -->
<context id="commands" style-ref="preprocessor">
<prefix>.</prefix>
<keyword>include</keyword>
<keyword>lib</keyword>
<keyword>param</keyword>
<keyword>probe</keyword>
<keyword>nodeset</keyword>
<keyword>ic</keyword>
<keyword>end</keyword>
</context>
<!-- Functions -->
<context id="functions" style-ref="escaped-character">
<keyword>abs</keyword>
<keyword>ac</keyword>
<keyword>acos</keyword>
<keyword>asin</keyword>
<keyword>atan</keyword>
<keyword>cos</keyword>
<keyword>cosh</keyword>
<keyword>db</keyword>
<keyword>dc</keyword>
<keyword>dec</keyword>
<keyword>exp</keyword>
<keyword>int</keyword>
<keyword>lin</keyword>
<keyword>log</keyword>
<keyword>log10</keyword>
<keyword>lv</keyword>
<keyword>lx</keyword>
<keyword>max</keyword>
<keyword>min</keyword>
<keyword>oct</keyword>
<keyword>pow</keyword>
<keyword>pulse</keyword>
<keyword>pwl</keyword>
<keyword>pwr</keyword>
<keyword>sffm</keyword>
<keyword>sgn</keyword>
<keyword>sign</keyword>
<keyword>sin</keyword>
<keyword>sinh</keyword>
<keyword>sqrt</keyword>
<keyword>tan</keyword>
<keyword>tanh</keyword>
</context>
</include>
</context>
</definitions>
</language>