]> git.lizzy.rs Git - rust.git/commitdiff
Gedit/gtksourceview language spec: add raw strings
authorSimon Sapin <simon.sapin@exyr.org>
Tue, 29 Jul 2014 21:05:37 +0000 (22:05 +0100)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 29 Jul 2014 22:44:35 +0000 (15:44 -0700)
… and color (raw) strings as such in attributes.
This fixes cases where a string contains ] inside an attribute:
that ] used to incorrectly end the attribute coloring.

For large (many lines) doc comments, I’ve found preferable to use
`#![doc = r#"..."#]` to avoid prefixing every line with `//!`.

src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang

index 7c9780456cf4763e5895d1c101cab31663586638..a934c426857e879f3eec4ca0e4bbefb5920119ba 100644 (file)
       <match>\\\%{common_escape}</match>
     </context>
 
+    <context id="raw-string" style-ref="string" class="string" class-disabled="no-spell-check">
+      <start>r(#*)"</start>
+      <end>"\%{1@start}</end>
+      <include>
+        <context ref="def:line-continue"/>
+      </include>
+    </context>
+
     <context id="string" style-ref="string" class="string" class-disabled="no-spell-check">
       <start>"</start>
       <end>"</end>
       <end>\]</end>
       <include>
         <context ref="def:in-comment"/>
+        <context ref="string"/>
+        <context ref="raw-string"/>
       </include>
     </context>
 
         <context ref="number"/>
         <context ref="scope"/>
         <context ref="string"/>
+        <context ref="raw-string"/>
         <context ref="char"/>
         <context ref="lifetime"/>
         <context ref="attribute"/>