Added support for Tao syntax

This commit is contained in:
Joshua Barretto 2025-09-23 22:36:47 +01:00
parent aee42780be
commit d45deb2685

View file

@ -35,6 +35,10 @@ impl LangPack {
highlighter: Highlighter::default().python(),
comment_syntax: Some(vec!['#', ' ']),
},
"tao" => Self {
highlighter: Highlighter::default().tao(),
comment_syntax: Some(vec!['#', ' ']),
},
_ => Self {
highlighter: Highlighter::default(),
comment_syntax: None,
@ -191,6 +195,23 @@ impl Highlighter {
.clike()
}
pub fn tao(self) -> Self {
self
// Keywords
.with(TokenKind::Keyword, r"\b[(data)(member)(def)(class)(type)(effect)(import)(handle)(with)(match)(if)(else)(for)(of)(let)(fn)(return)(in)(mod)(where)(when)(do)]\b")
// Primitives
.with(TokenKind::Type, r"\b[(Str)(Bool)(Nat)(Char)]\b")
// Builtins
.with(TokenKind::Macro, r"\b[(True)(False)]\b")
// Doc comments
.with(TokenKind::Doc, r"^##[^$]*$")
// Comments
.with(TokenKind::Comment, r"^#[^$]*$")
// Attributes
.with(TokenKind::Attribute, r"\$!?\[[^\]]*\]")
.clike()
}
pub fn toml(self) -> Self {
self
// Header