help-source-highlight
[Top][All Lists]
Advanced

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

Re: [Help-source-highlight] [PATCH] Add support for Hare


From: Lorenzo Bettini
Subject: Re: [Help-source-highlight] [PATCH] Add support for Hare
Date: Fri, 24 Jun 2022 10:52:49 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0

Yes, non-members require moderator approval

Thanks for the contribution but it would be better if you submit the patch directly through the savannah web interface

On 21/06/22 09:46, Conrad Hoffmann via Help-source-highlight wrote:
Hare homepage: https://harelang.org
---
Sending this a second time, as first try does not show up in archive,
presumably due to non-members requiring moderator approval?

The language is still evolving a bit, and I may have missed a few edge
cases, but this definition should be a pretty good start. You can find
renderings of two example files from the standard library and one
example from the tutorial here:

* https://bitfehler.net/database.html
* https://bitfehler.net/lookup.html
* https://bitfehler.net/num.html

  src/hare.lang   | 34 ++++++++++++++++++++++++++++++++++
  src/lang.map    |  2 ++
  tests/lang.list |  2 ++
  3 files changed, 38 insertions(+)
  create mode 100644 src/hare.lang

diff --git a/src/hare.lang b/src/hare.lang
new file mode 100644
index 0000000..ad9f7f4
--- /dev/null
+++ b/src/hare.lang
@@ -0,0 +1,34 @@
+# definitions for Hare
+
+include "c_comment.lang"
+
+label = "@fini|@init|@noreturn|@test"
+
+(keyword,normal,usertype) =
+  `(\<(?:type))([[:blank:]]+)([[:alnum:]_]+)`
+
+preproc = '^use[[:blank:]]+([[:word:]]+)(::[[:word:]{}]*)*;'
+
+number =
+'\<[+-]?((0x[[:xdigit:]]+)|(0o[0-7]+)|(0b[01]+)|(([[:digit:]]*\.)?
+[[:digit:]]+([eE][+-]?[[:digit:]]+)?))(f32|f64)?(([iu](8|16|32|64)?)|z)?\>'
+number = "false|null|true"
+
+include "c_string.lang"
+
+keyword = "abort|alloc|append|as|assert",
+  "break|case|const|continue",
+  "def|defer|delete|else|export|for|free",
+  "if|is|len|let|match|offset",
+  "return|static|switch|type|use|yield|_"
+
+type = "bool|char|double|enum|f32|f64|fn",
+  "i16|i32|i64|i8|int|nullable|rune|size|str",
+  "struct|u16|u32|u64|u8|uint|uintptr|union|void"
+
+symbol = "~","%","^","*","(",")","-","+","=","[",
+        "]","\\",":",";",",",".","/","&","<",">","\|"
+
+cbracket = "{|}|!|?"
+
+include "function.lang"
diff --git a/src/lang.map b/src/lang.map
index a428eb6..e748a8b 100644
--- a/src/lang.map
+++ b/src/lang.map
@@ -11,6 +11,8 @@ cs = csharp.lang
  csharp = csharp.lang
  go = go.lang
  h = cpp.lang
+ha = hare.lang
+hare = hare.lang
  hh = cpp.lang
  H = cpp.lang
  hpp = cpp.lang
diff --git a/tests/lang.list b/tests/lang.list
index cd120f9..4f61e7d 100644
--- a/tests/lang.list
+++ b/tests/lang.list
@@ -56,6 +56,8 @@ glsl = glsl.lang
  go = go.lang
  groovy = groovy.lang
  h = cpp.lang
+ha = hare.lang
+hare = hare.lang
  haskell = haskell.lang
  haxe = haxe.lang
  hh = cpp.lang

--
Prof. Lorenzo Bettini, Computer Science, DISIA, Univ. Firenze
HOME: https://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition



reply via email to

[Prev in Thread] Current Thread [Next in Thread]