[gtksourceview: 1/2] lean.lang: highlight attributes




commit 2ab8214575e2504d33ba9d73002e3ca31d9283a7
Author: Elias Aebi <353-eyelash users noreply gitlab gnome org>
Date:   Fri Aug 26 11:15:40 2022 +0200

    lean.lang: highlight attributes

 data/language-specs/lean.lang       | 10 ++++++++++
 tests/syntax-highlighting/file.lean |  5 +++--
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/data/language-specs/lean.lang b/data/language-specs/lean.lang
index 8dac67d9..fb9cf0eb 100644
--- a/data/language-specs/lean.lang
+++ b/data/language-specs/lean.lang
@@ -31,6 +31,7 @@
 
   <styles>
     <style id="comment" name="Comment" map-to="def:comment"/>
+    <style id="attribute" name="Attribute" map-to="def:preprocessor"/>
     <style id="command" name="Command" map-to="def:preprocessor"/>
     <style id="keyword" name="Keyword" map-to="def:keyword"/>
     <style id="identifier" name="Identifier"/>
@@ -58,6 +59,14 @@
       </include>
     </context>
 
+    <context id="attribute" style-ref="attribute">
+      <start>@\[</start>
+      <end>\]</end>
+      <include>
+        <context ref="lean"/>
+      </include>
+    </context>
+
     <context id="command" style-ref="command">
       <match extended="true">
         ^\s*\#(
@@ -160,6 +169,7 @@
       <include>
         <context ref="line-comment"/>
         <context ref="block-comment"/>
+        <context ref="attribute"/>
         <context ref="command"/>
         <context ref="keyword"/>
         <context ref="identifier"/>
diff --git a/tests/syntax-highlighting/file.lean b/tests/syntax-highlighting/file.lean
index 13df9a11..01338465 100644
--- a/tests/syntax-highlighting/file.lean
+++ b/tests/syntax-highlighting/file.lean
@@ -5,11 +5,12 @@
   /- nested block comment -/
 -/
 
-def main : IO Unit :=
+@[noinline]
+def helloWorld : IO Unit :=
   let a := 1
   let a1 := 0b1
   let a₂ := 0x1
   let a' := '1'
   IO.println "Hello World"
 
-#eval main
+#eval helloWorld


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]