mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-03-22 18:51:24 +00:00
Add syntax configuration file for gtksourceview (this allows QC code syntax highlighting for GNOMEs default text view in nautilus, gedit, and sandy + other gtksouceview based editors).
This commit is contained in:
parent
c362826dc6
commit
7def17eed5
3 changed files with 184 additions and 3 deletions
|
@ -5,9 +5,12 @@ you can install the configuration file correctly.
|
|||
Currently the supported text editors:
|
||||
geany
|
||||
kate
|
||||
kwrite - uses kate syntax highlighting
|
||||
kdevelop - uses kate syntax highlighting
|
||||
QtCreator - supports kate syntax highlighting
|
||||
kwrite - uses kate syntax highlighting
|
||||
kdevelop - uses kate syntax highlighting
|
||||
QtCreator - supports kate syntax highlighting
|
||||
gtksourceview - main source viewer in GNOME
|
||||
gedit - uses gtksourceview
|
||||
sandy - uses gtksourceview
|
||||
nano
|
||||
|
||||
|
||||
|
|
5
syntax/gtksourceview/README
Normal file
5
syntax/gtksourceview/README
Normal file
|
@ -0,0 +1,5 @@
|
|||
To use the gtksourceview syntax highlighting install qc.lang to the syntax
|
||||
directory for gtksourceview
|
||||
|
||||
# Can be installed globally to
|
||||
/usr/share/gtksourceview-[version]/language-specs/
|
173
syntax/gtksourceview/qc.lang
Normal file
173
syntax/gtksourceview/qc.lang
Normal file
|
@ -0,0 +1,173 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<language id="qc" _name="QuakeC" version="1.0" _section="Sources">
|
||||
<metadata>
|
||||
<property name="globs">*.qc</property>
|
||||
<property name="line-comment-start">//</property>
|
||||
<property name="block-comment-start">/*</property>
|
||||
<property name="block-comment-end">*/</property>
|
||||
</metadata>
|
||||
|
||||
<styles>
|
||||
<style id="comment" _name="Comment" map-to="def:comment"/>
|
||||
<style id="string" _name="String" map-to="def:string"/>
|
||||
<style id="preprocessor" _name="Preprocessor" map-to="def:preprocessor"/>
|
||||
<style id="common-defines" _name="Common Defines" map-to="def:special-constant"/>
|
||||
<style id="included-file" _name="Included File" map-to="def:string"/>
|
||||
<style id="keyword" _name="Keyword" map-to="def:keyword"/>
|
||||
<style id="type" _name="Data Type" map-to="def:type"/>
|
||||
<style id="escaped-character" _name="Escaped Character" map-to="def:special-char"/>
|
||||
<style id="floating-point" _name="Floating point number" map-to="def:floating-point"/>
|
||||
<style id="decimal" _name="Decimal number" map-to="def:decimal"/>
|
||||
<style id="hexadecimal" _name="Hexadecimal number" map-to="def:base-n-integer"/>
|
||||
<style id="boolean" _name="Boolean value" map-to="def:boolean"/>
|
||||
</styles>
|
||||
|
||||
<definitions>
|
||||
|
||||
<!--regexs-->
|
||||
<define-regex id="preproc-start">^\s*#\s*</define-regex>
|
||||
<define-regex id="escaped-character" extended="true">
|
||||
\\( # leading backslash
|
||||
[\\\"\'nrbtfav\?] | # escaped character
|
||||
[0-7]{1,3} | # one, two, or three octal digits
|
||||
x[0-9A-Fa-f]+ # 'x' followed by hex digits
|
||||
)
|
||||
</define-regex>
|
||||
|
||||
<!-- Preprocessor -->
|
||||
<context id="if0-comment" style-ref="comment">
|
||||
<start>\%{preproc-start}if\b\s*0\b</start>
|
||||
<end>\%{preproc-start}(endif|else|elif)\b</end>
|
||||
<include>
|
||||
<context id="if-in-if0">
|
||||
<start>\%{preproc-start}if(n?def)?\b</start>
|
||||
<end>\%{preproc-start}endif\b</end>
|
||||
<include>
|
||||
<context ref="if-in-if0"/>
|
||||
<context ref="def:in-comment"/>
|
||||
</include>
|
||||
</context>
|
||||
<context ref="def:in-comment"/>
|
||||
</include>
|
||||
</context>
|
||||
<context id="include" style-ref="preprocessor">
|
||||
<match extended="true">
|
||||
\%{preproc-start}
|
||||
(include|import)\s*
|
||||
(".*?"|<.*>)
|
||||
</match>
|
||||
<include>
|
||||
<context id="included-file" sub-pattern="2" style-ref="included-file"/>
|
||||
</include>
|
||||
</context>
|
||||
<context id="preprocessor" style-ref="preprocessor" end-at-line-end="true">
|
||||
<start extended="true">
|
||||
\%{preproc-start}
|
||||
(define|undef|error|pragma|ident|if(n?def)?|else|elif|endif|line|warning)
|
||||
\b
|
||||
</start>
|
||||
<include>
|
||||
<context ref="def:line-continue" ignore-style="true"/>
|
||||
<context ref="string" ignore-style="true"/>
|
||||
<context ref="def:qc-like-comment"/>
|
||||
<context ref="def:qc-like-comment-multiline"/>
|
||||
</include>
|
||||
</context>
|
||||
|
||||
<context id="float" style-ref="floating-point">
|
||||
<match extended="true">
|
||||
(?<![\w\.])
|
||||
((\.[0-9]+ | [0-9]+\.[0-9]*) ([Ee][+-]?[0-9]*)? |
|
||||
([0-9]+[Ee][+-]?[0-9]*))
|
||||
[fFlL]?
|
||||
(?![\w\.])
|
||||
</match>
|
||||
</context>
|
||||
|
||||
<context id="hexadecimal" style-ref="hexadecimal">
|
||||
<match extended="true">
|
||||
(?<![\w\.])
|
||||
0[xX][a-fA-F0-9]+[uUlL]*
|
||||
(?![\w\.])
|
||||
</match>
|
||||
</context>
|
||||
|
||||
<context id="invalid-hexadecimal" style-ref="error">
|
||||
<match extended="true">
|
||||
(?<![\w\.])
|
||||
0[xX][a-fA-F0-9]*[g-zG-Z][a-zA-Z0-9]*[uUlL]*
|
||||
(?![\w\.])
|
||||
</match>
|
||||
</context>
|
||||
|
||||
<context id="decimal" style-ref="decimal">
|
||||
<match extended="true">
|
||||
(?<![\w\.])
|
||||
(0|[1-9][0-9]*)[uUlL]*
|
||||
(?![\w\.])
|
||||
</match>
|
||||
</context>
|
||||
|
||||
<context id="keywords" style-ref="keyword">
|
||||
<keyword>break</keyword>
|
||||
<keyword>case</keyword>
|
||||
<keyword>continue</keyword>
|
||||
<keyword>default</keyword>
|
||||
<keyword>do</keyword>
|
||||
<keyword>else</keyword>
|
||||
<keyword>enum</keyword>
|
||||
<keyword>for</keyword>
|
||||
<keyword>goto</keyword>
|
||||
<keyword>if</keyword>
|
||||
<keyword>return</keyword>
|
||||
<keyword>switch</keyword>
|
||||
<keyword>typedef</keyword>
|
||||
<keyword>while</keyword>
|
||||
<keyword>nil</keyword>
|
||||
</context>
|
||||
|
||||
<context id="types" style-ref="type">
|
||||
<keyword>bool</keyword>
|
||||
<keyword>string</keyword>
|
||||
<keyword>vector</keyword>
|
||||
<keyword>float</keyword>
|
||||
<keyword>void</keyword>
|
||||
</context>
|
||||
|
||||
<context id="boolean" style-ref="boolean">
|
||||
<keyword>true</keyword>
|
||||
<keyword>false</keyword>
|
||||
</context>
|
||||
|
||||
<context id="common-defines" style-ref="common-defines">
|
||||
<keyword>__LINE__</keyword>
|
||||
<keyword>__FILE__</keyword>
|
||||
<keyword>__TIME__</keyword>
|
||||
<keyword>__RANDOM__</keyword>
|
||||
<keyword>__RANDOM_LAST__</keyword>
|
||||
<keyword>__COUNTER__</keyword>
|
||||
<keyword>__COUNTER_LAST__</keyword>
|
||||
<keyword>__DATE__</keyword>
|
||||
</context>
|
||||
|
||||
<context id="qc" class="no-spell-check">
|
||||
<include>
|
||||
<context ref="def:qc-like-comment"/>
|
||||
<context ref="def:qc-like-comment-multiline"/>
|
||||
<context ref="def:qc-like-close-comment-outside-comment"/>
|
||||
<context ref="if0-comment"/>
|
||||
<context ref="include"/>
|
||||
<context ref="preprocessor"/>
|
||||
<context ref="string"/>
|
||||
<context ref="float"/>
|
||||
<context ref="hexadecimal"/>
|
||||
<context ref="invalid-hexadecimal"/>
|
||||
<context ref="decimal"/>
|
||||
<context ref="keywords"/>
|
||||
<context ref="types"/>
|
||||
<context ref="boolean"/>
|
||||
<context ref="common-defines"/>
|
||||
</include>
|
||||
</context>
|
||||
</definitions>
|
||||
</language>
|
Loading…
Reference in a new issue