[gtksourceview: 1/3] lean.lang: fix highlighting of identifiers




commit 817b6fc32f49fd3cb2bc1962e37ce8bca63f8999
Author: Elias Aebi <353-eyelash users noreply gitlab gnome org>
Date:   Sun Jul 24 13:08:33 2022 +0200

    lean.lang: fix highlighting of identifiers

 data/language-specs/lean.lang       | 12 +++++++++++-
 tests/syntax-highlighting/file.lean |  6 +++---
 2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/data/language-specs/lean.lang b/data/language-specs/lean.lang
index 2cb0e051..4060db58 100644
--- a/data/language-specs/lean.lang
+++ b/data/language-specs/lean.lang
@@ -4,7 +4,7 @@
  This file is part of GtkSourceView
 
  Authors: Elias Aebi
- Copyright (C) 2021 Elias Aebi
+ Copyright (C) 2021-2022 Elias Aebi
 
  GtkSourceView is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
@@ -33,6 +33,7 @@
     <style id="comment" name="Comment" map-to="def:comment"/>
     <style id="command" name="Command" map-to="def:preprocessor"/>
     <style id="keyword" name="Keyword" map-to="def:keyword"/>
+    <style id="identifier" name="Identifier"/>
     <style id="string" name="String" map-to="def:string"/>
     <style id="character" name="Character" map-to="def:character"/>
     <style id="escaped-character" name="Escaped Character" map-to="def:special-char"/>
@@ -101,6 +102,14 @@
       <keyword>λ</keyword>
     </context>
 
+    <context id="identifier" style-ref="identifier">
+      <match extended="true">
+        (?![λΠΣ])[a-zA-Zα-ωΑ-Ωἀ-῾ϊ-ϻ℀-⅏_]
+        (?:(?![λΠΣ])[a-zA-Zα-ωΑ-Ωἀ-῾ϊ-ϻ℀-⅏_0-9'ⁿ₀-₉ₐ-ₜᵢ-ᵪ])*
+        | «[^«»\r\n\t]*»
+      </match>
+    </context>
+
     <define-regex id="string-escape" extended="true">
       \\(
           \\
@@ -152,6 +161,7 @@
         <context ref="block-comment"/>
         <context ref="command"/>
         <context ref="keyword"/>
+        <context ref="identifier"/>
         <context ref="string"/>
         <context ref="character"/>
         <context ref="numeric"/>
diff --git a/tests/syntax-highlighting/file.lean b/tests/syntax-highlighting/file.lean
index 5b92b00a..13df9a11 100644
--- a/tests/syntax-highlighting/file.lean
+++ b/tests/syntax-highlighting/file.lean
@@ -7,9 +7,9 @@
 
 def main : IO Unit :=
   let a := 1
-  let b := 0b1
-  let c := 0x1
-  let d := '1'
+  let a1 := 0b1
+  let a₂ := 0x1
+  let a' := '1'
   IO.println "Hello World"
 
 #eval main


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