]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Added syntax highlighting configuration files (with documentation on how to install...
authorDale Weiler <killfieldengine@gmail.com>
Tue, 16 Apr 2013 20:24:33 +0000 (20:24 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Tue, 16 Apr 2013 20:24:33 +0000 (20:24 +0000)
syntax/README [new file with mode: 0644]
syntax/geany/README [new file with mode: 0644]
syntax/geany/filetypes.qc [new file with mode: 0644]
syntax/kate/README [new file with mode: 0644]
syntax/kate/qc.xml [new file with mode: 0644]
syntax/nano/README [new file with mode: 0644]
syntax/nano/qc.nanorc [new file with mode: 0644]

diff --git a/syntax/README b/syntax/README
new file mode 100644 (file)
index 0000000..8b386d8
--- /dev/null
@@ -0,0 +1,18 @@
+Here exists some syntax highlighting configuration files for various
+text editors. Inside each directory exists some documentaiton on how
+you can install the configuration file correctly.
+
+Currently the supported text editors:
+    geany  - GTK  text editor (not gedit)
+    kate   - KDE  text editor (the default text editor that comes with KDE)
+    nano   - base text editor (comes with every base distribution of linux)
+
+
+Other text editors we plan to provide syntax highlighting configuration
+files for (but never got around to figuring out)
+    vim
+    emacs
+    gedit
+
+If your text editor is not supported and you'd like to create syntax
+highlighting support for it, don't hesitate to share it with us.
diff --git a/syntax/geany/README b/syntax/geany/README
new file mode 100644 (file)
index 0000000..c527d3f
--- /dev/null
@@ -0,0 +1,8 @@
+To use the geany syntax highlighting install filetypes.qc to the syntax
+directory for geany.
+
+# Can be installed globally to
+/usr/share/geany/
+
+# Can be installed locally to
+~/.config/geany/filedefs/
diff --git a/syntax/geany/filetypes.qc b/syntax/geany/filetypes.qc
new file mode 100644 (file)
index 0000000..d84bb7e
--- /dev/null
@@ -0,0 +1,55 @@
+[styling]
+default=default
+comment=comment
+commentline=comment_line
+commentdoc=comment_doc
+preprocessorcomment=comment
+number=number_1
+word=keyword_1
+word2=keyword_2
+string=string_1
+stringraw=string_2
+character=character
+uuid=other
+preprocessor=preprocessor
+operator=operator
+identifier=identifier_1
+stringeol=string_eol
+verbatim=string_2
+regex=regex
+commentlinedoc=comment_line_doc
+commentdockeyword=comment_doc_keyword
+commentdockeyworderror=comment_doc_keyword_error
+globalclass=class
+tripleverbatim=string_2
+hashquotedstring=string_2
+
+[keywords]
+primary=break case const continue string default do else enum float for goto if return switch typedef void while false nil true
+secondary=
+docComment=
+
+[lexer_properties]
+styling.within.preprocessor=1
+lexer.cpp.track.preprocessor=0
+preprocessor.symbol.$(file.patterns.cpp)=#
+preprocessor.start.$(file.patterns.cpp)=if ifdef ifndef
+preprocessor.middle.$(file.patterns.cpp)=else elif
+preprocessor.end.$(file.patterns.cpp)=endif
+
+[settings]
+extension=qc
+comment_single=//
+comment_open=/*
+comment_close=*/
+comment_use_indent=true
+context_action_cmd=
+
+[indentation]
+width=4
+type=0
+
+[build_settings]
+compiler=gmqcc -Wall "%f" -o "%e"
+linker=
+run_cmd=qcvm "./%e"
diff --git a/syntax/kate/README b/syntax/kate/README
new file mode 100644 (file)
index 0000000..08201ae
--- /dev/null
@@ -0,0 +1,9 @@
+To use the Kate syntax highlighting install qc.xml to the syntax
+directory for geany.
+
+# Can be installed globally to
+$KDEDIR/share/apps/katepart/syntax
+
+if $KDEDIR is unset you can lookup the folder directory with
+ke4-config --prefix if that doesn't work chances are KDEDIR is
+/usr
diff --git a/syntax/kate/qc.xml b/syntax/kate/qc.xml
new file mode 100644 (file)
index 0000000..2f49dba
--- /dev/null
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE language SYSTEM "language.dtd">
+<language name="QuakeC" section="Sources"
+          version="1.00" kateversion="2.4"
+          indenter="cstyle"
+          extensions="*.qc;*.QC;*.qh"
+          mimetype=""
+          priority="5"
+          author="Dale Weiler">
+  <highlighting>
+    <list name="keywords">
+      <item> break </item>
+      <item> case </item>
+      <item> continue </item>
+      <item> default </item>
+      <item> do </item>
+      <item> else </item>
+      <item> enum </item>
+      <item> for </item>
+      <item> goto </item>
+      <item> if </item>
+      <item> return </item>
+      <item> switch </item>
+      <item> typedef </item>
+      <item> while </item>
+      <item> nil </item>
+    </list>
+    <list name="types">
+      <item> const </item>
+      <item> vector </item>
+      <item> float </item>
+      <item> void </item>
+      <item> string </item>
+    </list>
+    <contexts>
+      <context attribute="Normal Text" lineEndContext="#stay" name="Normal">
+        <DetectSpaces />
+    <RegExpr attribute="Preprocessor" context="Outscoped" String="#\s*if\s+0\s*$" beginRegion="PP" firstNonSpace="true" />
+        <DetectChar context="AfterHash" char="#" firstNonSpace="true" lookAhead="true" />
+        <StringDetect attribute="Region Marker" context="Region Marker" String="//BEGIN" beginRegion="Region1" firstNonSpace="true" />
+        <StringDetect attribute="Region Marker" context="Region Marker" String="//END" endRegion="Region1" firstNonSpace="true" />
+        <keyword attribute="Keyword" context="#stay" String="keywords"/>
+        <keyword attribute="Data Type" context="#stay" String="types"/>
+        <DetectIdentifier />
+        <DetectChar attribute="Symbol" context="#stay" char="{" beginRegion="Brace1" />
+        <DetectChar attribute="Symbol" context="#stay" char="}" endRegion="Brace1" />
+        <Float attribute="Float" context="#stay">
+          <AnyChar String="fF" attribute="Float" context="#stay"/>
+        </Float>
+        <HlCHex attribute="Hex" context="#stay"/>
+        <Int attribute="Decimal" context="#stay" >
+          <StringDetect attribute="Decimal" context="#stay" String="ULL" insensitive="TRUE"/>
+          <StringDetect attribute="Decimal" context="#stay" String="LUL" insensitive="TRUE"/>
+          <StringDetect attribute="Decimal" context="#stay" String="LLU" insensitive="TRUE"/>
+          <StringDetect attribute="Decimal" context="#stay" String="UL" insensitive="TRUE"/>
+          <StringDetect attribute="Decimal" context="#stay" String="LU" insensitive="TRUE"/>
+          <StringDetect attribute="Decimal" context="#stay" String="LL" insensitive="TRUE"/>
+          <StringDetect attribute="Decimal" context="#stay" String="U" insensitive="TRUE"/>
+          <StringDetect attribute="Decimal" context="#stay" String="L" insensitive="TRUE"/>
+        </Int>
+        <HlCChar attribute="Char" context="#stay"/>
+        <DetectChar attribute="String" context="String" char="&quot;"/>
+        <Detect2Chars attribute="Comment" context="Commentar 1" char="/" char1="/"/>
+        <Detect2Chars attribute="Comment" context="Commentar 2" char="/" char1="*" beginRegion="Comment"/>
+        <AnyChar attribute="Symbol" context="#stay" String=":!%&amp;()+,-/.*&lt;=&gt;?[]|~^&#59;"/>
+      </context>
+
+      <context attribute="String" lineEndContext="#pop" name="String">
+        <LineContinue attribute="String" context="#stay"/>
+        <HlCStringChar attribute="String Char" context="#stay"/>
+        <DetectChar attribute="String" context="#pop" char="&quot;"/>
+      </context>
+
+      <context attribute="Region Marker" lineEndContext="#pop" name="Region Marker">
+      </context>
+
+      <context attribute="Comment" lineEndContext="#pop" name="Commentar 1">
+        <LineContinue attribute="Comment" context="#stay"/>
+        <IncludeRules context="##Alerts" />
+      </context>
+
+      <context attribute="Comment" lineEndContext="#stay" name="Commentar 2">
+        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment"/>
+        <IncludeRules context="##Alerts" />
+      </context>
+
+      <context attribute="Error" lineEndContext="#pop" name="AfterHash">
+        <!-- define, elif, else, endif, error, if, ifdef, ifndef, include, include_next, line, pragma, undef, warning -->
+        <RegExpr attribute="Preprocessor" context="Preprocessor" String="#\s*if(?:def|ndef)?(?=\s+\S)" insensitive="true" beginRegion="PP" firstNonSpace="true" />
+        <RegExpr attribute="Preprocessor" context="Preprocessor" String="#\s*endif" insensitive="true" endRegion="PP" firstNonSpace="true" />
+        <RegExpr attribute="Preprocessor" context="Define" String="#\s*define.*((?=\\))" insensitive="true" firstNonSpace="true" />
+        <RegExpr attribute="Preprocessor" context="Preprocessor" String="#\s*(?:el(?:se|if)|include(?:_next)?|define|undef|line|error|warning|pragma)" insensitive="true" firstNonSpace="true" />
+        <RegExpr attribute="Preprocessor" context="Preprocessor" String="#\s+[0-9]+" insensitive="true" firstNonSpace="true" />
+      </context>
+
+      <context attribute="Preprocessor" lineEndContext="#pop" name="Preprocessor">
+        <LineContinue attribute="Preprocessor" context="#stay"/>
+        <RangeDetect attribute="Prep. Lib" context="#stay" char="&quot;" char1="&quot;"/>
+        <RangeDetect attribute="Prep. Lib" context="#stay" char="&lt;" char1="&gt;"/>
+        <IncludeRules context="##Doxygen" />
+        <Detect2Chars attribute="Comment" context="Commentar/Preprocessor" char="/" char1="*" beginRegion="Comment2" />
+        <Detect2Chars attribute="Comment" context="Commentar 1" char="/" char1="/" />
+      </context>
+
+      <context attribute="Preprocessor" lineEndContext="#pop" name="Define">
+        <LineContinue attribute="Preprocessor" context="#stay"/>
+      </context>
+
+      <context attribute="Comment" lineEndContext="#stay" name="Commentar/Preprocessor">
+        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment2" />
+      </context>
+
+      <context attribute="Comment" lineEndContext="#stay" name="Outscoped" >
+        <DetectSpaces />
+        <DetectIdentifier />
+        <DetectChar attribute="String" context="String" char="&quot;"/>
+        <Detect2Chars attribute="Comment" context="Commentar 1" char="/" char1="/"/>
+        <Detect2Chars attribute="Comment" context="Commentar 2" char="/" char1="*" beginRegion="Comment"/>
+        <RegExpr attribute="Comment" context="Outscoped intern" String="#\s*if" beginRegion="PP" firstNonSpace="true" />
+        <RegExpr attribute="Preprocessor" context="#pop" String="#\s*el(?:se|if)" firstNonSpace="true" />
+        <RegExpr attribute="Preprocessor" context="#pop" String="#\s*endif" endRegion="PP" firstNonSpace="true" />
+      </context>
+
+      <context attribute="Comment" lineEndContext="#stay" name="Outscoped intern">
+        <DetectSpaces />
+        <DetectIdentifier />
+        <DetectChar attribute="String" context="String" char="&quot;"/>
+        <Detect2Chars attribute="Comment" context="Commentar 1" char="/" char1="/"/>
+        <Detect2Chars attribute="Comment" context="Commentar 2" char="/" char1="*" beginRegion="Comment"/>
+        <RegExpr attribute="Comment" context="Outscoped intern" String="#\s*if" beginRegion="PP" firstNonSpace="true" />
+        <RegExpr attribute="Comment" context="#pop" String="#\s*endif" endRegion="PP" firstNonSpace="true" />
+      </context>
+    </contexts>
+    <itemDatas>
+      <itemData name="Normal Text"  defStyleNum="dsNormal" spellChecking="false"/>
+      <itemData name="Keyword"      defStyleNum="dsKeyword" spellChecking="false"/>
+      <itemData name="Data Type"    defStyleNum="dsDataType" spellChecking="false"/>
+      <itemData name="Decimal"      defStyleNum="dsDecVal" spellChecking="false"/>
+      <itemData name="Hex"          defStyleNum="dsBaseN" spellChecking="false"/>
+      <itemData name="Float"        defStyleNum="dsFloat" spellChecking="false"/>
+      <itemData name="String"       defStyleNum="dsString"/>
+      <itemData name="String Char"  defStyleNum="dsChar"/>
+      <itemData name="Comment"      defStyleNum="dsComment"/>
+      <itemData name="Symbol"       defStyleNum="dsNormal" spellChecking="false"/>
+      <itemData name="Preprocessor" defStyleNum="dsOthers" spellChecking="false"/>
+    </itemDatas>
+  </highlighting>
+  <general>
+    <comments>
+      <comment name="singleLine" start="//" />
+      <comment name="multiLine" start="/*" end="*/" />
+    </comments>
+    <keywords casesensitive="1" additionalDeliminator="'&quot;" />
+  </general>
+</language>
diff --git a/syntax/nano/README b/syntax/nano/README
new file mode 100644 (file)
index 0000000..edd9d3f
--- /dev/null
@@ -0,0 +1,12 @@
+To use the nano syntax highlighting install qc.nanorc somewhere and
+add:
+
+include /directory/qc.nanorc
+
+to your nanorc file located at ~/.nanorc. If the file doesn't exist
+create it.
+
+Optionally you can install it globally by installing qc.nanorc to
+/usr/share/nano
+
+However you still need to provide the include to your ~/.nanorc
diff --git a/syntax/nano/qc.nanorc b/syntax/nano/qc.nanorc
new file mode 100644 (file)
index 0000000..5222485
--- /dev/null
@@ -0,0 +1,22 @@
+# Language:   QuakeC
+# Maintainer: Dale Weiler
+
+syntax "qc" "\.(qc|QC)$" "\.(qh|QH)$"
+color brightred "\<[A-Z_][0-9A-Z_]+\>" 
+color green "\<(float|string|enum|void|const|typedef|nil)\>"
+color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
+color magenta "\<(goto|continue|break|return)\>"
+color brightcyan "^[[:space:]]*#[[:space:]]*(define|include|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
+color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
+
+color brightyellow "<[^=       ]*>" ""(\\.|[^"])*""
+
+## This string is VERY resource intensive!
+color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
+
+## Comment highlighting
+color brightblue "//.*"
+color brightblue start="/\*" end="\*/"
+
+## Trailing whitespace
+color ,green "[[:space:]]+$"