Permalink
Browse files

Update to elixir v1.3.x

  • Loading branch information...
1 parent c89b2d6 commit cac8c0f5f3681056d99f86620f91dfde15d12f92 @SteffenBauer committed Jul 6, 2016
Showing with 350 additions and 36 deletions.
  1. +4 −1 README.md
  2. +63 −35 elixir.lang
  3. +283 −0 old_versions/elixir_1.2.x.lang
View
@@ -4,7 +4,7 @@ elixir-gtksourceview
GtkSourceView syntax highlighting for the [Elixir programming language](http://elixir-lang.org/)
-Covers Elixir version 1.2.x
+Covers Elixir version 1.3.x
## Usage:
@@ -22,6 +22,9 @@ Versions for older Elixir releases can be found in `old_versions`
Have also a look at [elixir-ctags](https://github.com/mmorearty/elixir-ctags) to further enhance your gedit experience when writing Elixir code.
+## Please note:
+I reorganized the language definition file in order to include an experimental setup. It should now highlight ExUnit language elements only in the according context of elixir unit testing files. Please submit an issue report should you encounter any problems.
+
### License
This language definition file is licensed under the GNU Lesser General Public License 3.0.
View
@@ -26,7 +26,7 @@
GtkSourceView Syntax highlighting for the Elixir programming language
- Covers Elixir 1.2.x
+ Covers Elixir 1.3.x
-->
@@ -58,18 +58,16 @@
</styles>
<definitions>
- <context id="elixir" class="no-spell-check">
- <include>
- <context ref="def:shebang"/>
- <context ref="def:shell-like-comment"/>
+ <context id="quoted-string">
+ <include>
<context id="multiline-double-quoted-string" style-ref="string">
- <start>(~[crswCRSW])?"""</start>
+ <start>(~[crswCRSWDTN])?"""</start>
<end>^\s*"""</end>
</context>
<context id="multiline-single-quoted-string" style-ref="string">
- <start>(~[crswCRSW])?'''</start>
+ <start>(~[crswCRSWDTN])?'''</start>
<end>^\s*'''</end>
</context>
@@ -86,24 +84,11 @@
<context ref="def:escape"/>
<context ref="string-interpolation"/> </include>
</context>
+ </include>
+ </context>
- <context id="line-comment" style-ref="comment" end-at-line-end="true">
- <start>#</start>
- <include> <context ref="def:in-line-comment"/> </include>
- </context>
-
- <context id="atom" style-ref="atom">
- <match>\:[a-zA-Z_](\w)*(!|\?)?</match>
- </context>
-
- <context id="charcode" style-ref="charcode">
- <match extended="true">(?&lt;![\w\.])((\?.)|(\?\\.))(?![\w\.])</match>
- </context>
-
- <context id="codepoint" style-ref="codepoint" extend-parent="false">
- <match>\\u(([0-9a-fA-F]){4}|({[0-9a-fA-F]{1,6}}))</match>
- </context>
-
+ <context id="sigils">
+ <include>
<context id="sigil-parentheses-interpolation" style-ref="sigil">
<start>~[crsw]\(</start> <end>\)[fgimrsuxbac]*</end>
<include> <context ref="codepoint"/>
@@ -161,9 +146,36 @@
</context>
<context id="sigil-without-interpolation" style-ref="sigil">
- <match>~[CRSW](\((.)*?\)|\[(.)*?\]|\{(.)*?\}|&lt;(.)*?&gt;|\|(.)*?\||/(.)*/|"(.)*"|'(.)*')[fgimrsuxbac]*</match>
+ <match>~[CRSWDTN](\((.)*?\)|\[(.)*?\]|\{(.)*?\}|&lt;(.)*?&gt;|\|(.)*?\||/(.)*/|"(.)*"|'(.)*')[fgimrsuxbac]*</match>
+ </context>
+ </include>
+ </context>
+
+
+ <context id="elixir-std">
+ <include>
+ <context ref="def:shebang"/>
+ <context ref="def:shell-like-comment"/>
+ <context ref="quoted-string"/>
+
+ <context id="line-comment" style-ref="comment" end-at-line-end="true">
+ <start>#</start>
+ <include> <context ref="def:in-line-comment"/> </include>
+ </context>
+ <context id="atom" style-ref="atom">
+ <match>\:[a-zA-Z_](\w)*(!|\?)?</match>
+ </context>
+
+ <context id="charcode" style-ref="charcode">
+ <match extended="true">(?&lt;![\w\.])((\?.)|(\?\\.))(?![\w\.])</match>
</context>
+ <context id="codepoint" style-ref="codepoint" extend-parent="false">
+ <match>\\u(([0-9a-fA-F]){4}|({[0-9a-fA-F]{1,6}}))</match>
+ </context>
+
+ <context ref="sigils"/>
+
<context id="kernel_special_chars" style-ref="builtin-name">
<match extended="true">
(\s|^)(alias|var|struct)\!|(\s|^)(match|(function|macro)_exported)\?|(\^(?=[\w]+))|((\\|&amp;|\|){2})|((-|\=|\|)&gt;)
@@ -244,39 +256,55 @@
<keyword>and|or|not</keyword>
<keyword>throw|raise|reraise</keyword>
<keyword>hd|tl|in|length|elem|put_elem|destructure</keyword>
- <keyword>to_(string|char_list)</keyword>
+ <keyword>to_(string|char_list|charlist)</keyword>
<keyword>is_(atom|binary|bitstring|boolean|float|function|integer|list|map|nil|number|pid|port|reference|tuple)</keyword>
<keyword>(bit|byte|map|tuple)_size</keyword>
<keyword>binary_part</keyword>
<keyword>def(delegate|exception|impl|macro|macrop|module|overridable|p|protocol|struct)?</keyword>
- <keyword>sigil_[crswCRSW]</keyword>
+ <keyword>sigil_[crswCRSWDNT]</keyword>
<keyword>if|else|unless|cond</keyword>
<keyword>binding</keyword>
<keyword>node|self|spawn|spawn_link|spawn_monitor|send|exit</keyword>
- <keyword>struct|get_and_update_in|get_in|put_in|update_in</keyword>
+ <keyword>struct|get_and_update_in|get_in|put_in|pop_in|update_in</keyword>
<keyword>apply|inspect|make_ref|use</keyword>
</context>
+ <context id="keyword" style-ref="keyword">
+ <match extended="true">
+ (?&lt;![\w\.])[a-zA-Z_]*(\w)*(!|\?)?\:
+ </match>
+ </context>
+
+ </include>
+ </context>
+
+ <context id="elixir-exunit">
+ <start>ExUnit</start>
+ <include>
<context id="exunit" style-ref="builtin-name">
<keyword>(doc)?test</keyword>
+ <keyword>describe</keyword>
<keyword>assert(_in_delta|_raise|_receive|_received)?</keyword>
<keyword>refute(_in_delta|_receive|_received)?</keyword>
<keyword>flunk</keyword>
<keyword>catch(_error|_exit|_throw)</keyword>
<keyword>setup(_all)?</keyword>
<keyword>on_exit</keyword>
- <keyword>capture_io</keyword>
+ <keyword>capture(_io|_log)</keyword>
+ <keyword>register(_attribute|_test)</keyword>
<keyword>using</keyword>
</context>
-
- <context id="keyword" style-ref="keyword">
- <match extended="true">
- (?&lt;![\w\.])[a-zA-Z_]*(\w)*(!|\?)?\:
- </match>
- </context>
+ <context ref="elixir-std"/>
+ </include>
+ </context>
+ <context id="elixir" class="no-spell-check">
+ <include>
+ <context ref="elixir-exunit"/>
+ <context ref="elixir-std"/>
</include>
</context>
+
</definitions>
</language>
Oops, something went wrong.

0 comments on commit cac8c0f

Please sign in to comment.