Skip to content

Commit

Permalink
Highlight device model and subcircuit definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
rafael1193 committed Dec 13, 2014
1 parent b3ba579 commit c96baa1
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions spicegui/data/spice-netlist.lang
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@
<definitions>
<define-regex id="name">[[:alpha:]_][[:alnum:].:_-]*</define-regex>

<context id="device-model">
<match extended="true">
(?i)^(.model)\s+([\w.:]*)
</match>
<include>
<context sub-pattern="1" style-ref="keyword"/>
<context sub-pattern="2" style-ref="statement"/>
</include>
</context>

<context id="subcircuit-definition">
<match extended="true">
(?i)^(.subckt)\s+([\w.:]*)
</match>
<include>
<context sub-pattern="1" style-ref="keyword"/>
<context sub-pattern="2" style-ref="statement"/>
</include>
</context>

<context id="first-line-comment" style-ref="comment" first-line-only="true">
<start>^</start>
<end>$</end>
Expand Down Expand Up @@ -52,18 +72,7 @@
</include>
</context>


<context id="string" end-at-line-end="true" style-ref="string">
<start>"</start>
<end>"</end>
<include>
<context id="escape" style-ref="escaped-character">
<match>\\.</match>
</context>
</include>
</context>

<context id="model" style-ref="statement">
<context id="device-instance" style-ref="statement">
<match>^[ ]*[\w.:]{2,}</match>
</context>

Expand Down Expand Up @@ -107,6 +116,8 @@

<context id="spice-netlist" class="no-spell-check">
<include>
<context ref="device-model"/>
<context ref="subcircuit-definition"/>
<context ref="def:string"/>
<context ref="def:single-quoted-string"/>
<context ref="statement"/>
Expand All @@ -116,7 +127,7 @@
<context ref="c-comment"/>
<context ref="first-line-comment"/>
<context ref="parameter-name"/>
<context ref="model"/>
<context ref="device-instance"/>
</include>
</context>
</definitions>
Expand Down

0 comments on commit c96baa1

Please sign in to comment.