From 2096724cd4dd6ad1a04f6fd88f57f8d37d21ef118bdd82561dbfa737606c8417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Bj=C3=B6rnstam?= Date: Sat, 17 Oct 2026 17:59:18 +0200 Subject: [PATCH 1/3] TmTheme and TmStyleMode are grammars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bjolang 0.2.0 refuses #:tag on a union case: a grammar reads a quoted literal now. The two unions are grammars of bare keywords, so #:theme 'dark-plus and #:style 'classes read as before, and the types and their cases keep their names. 🤖 Generated with [ECA](https://eca.dev) (anthropic/claude-opus-4-7) Co-Authored-By: eca-agent --- src/core.bjo | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/src/core.bjo b/src/core.bjo index 33bc35c..1d6198f 100644 --- a/src/core.bjo +++ b/src/core.bjo @@ -156,31 +156,33 @@ ;; --------------------------------------------------------------------------- ;; VS Code's themes, the ones TextMateSharp carries: #:theme 'dark-plus. -(type (: TmTheme (Union (: ThemeDarkPlus #:tag dark-plus) - (: ThemeLightPlus #:tag light-plus) - (: ThemeDark #:tag dark) - (: ThemeLight #:tag light) - (: ThemeMonokai #:tag monokai) - (: ThemeDimmedMonokai #:tag dimmed-monokai) - (: ThemeOneDark #:tag one-dark) - (: ThemeAtomOneDark #:tag atom-one-dark) - (: ThemeAtomOneLight #:tag atom-one-light) - (: ThemeDracula #:tag dracula) - (: ThemeSolarizedDark #:tag solarized-dark) - (: ThemeSolarizedLight #:tag solarized-light) - (: ThemeQuietLight #:tag quiet-light) - (: ThemeKimbieDark #:tag kimbie-dark) - (: ThemeTomorrowNightBlue #:tag tomorrow-night-blue) - (: ThemeAbyss #:tag abyss) - (: ThemeRed #:tag red) - (: ThemeHighContrastDark #:tag high-contrast-dark) - (: ThemeHighContrastLight #:tag high-contrast-light) - (: ThemeVisualStudioDark #:tag visual-studio-dark) - (: ThemeVisualStudioLight #:tag visual-studio-light)))) +(def/grammar TmTheme + (:or (: ThemeDarkPlus 'dark-plus) + (: ThemeLightPlus 'light-plus) + (: ThemeDark 'dark) + (: ThemeLight 'light) + (: ThemeMonokai 'monokai) + (: ThemeDimmedMonokai 'dimmed-monokai) + (: ThemeOneDark 'one-dark) + (: ThemeAtomOneDark 'atom-one-dark) + (: ThemeAtomOneLight 'atom-one-light) + (: ThemeDracula 'dracula) + (: ThemeSolarizedDark 'solarized-dark) + (: ThemeSolarizedLight 'solarized-light) + (: ThemeQuietLight 'quiet-light) + (: ThemeKimbieDark 'kimbie-dark) + (: ThemeTomorrowNightBlue 'tomorrow-night-blue) + (: ThemeAbyss 'abyss) + (: ThemeRed 'red) + (: ThemeHighContrastDark 'high-contrast-dark) + (: ThemeHighContrastLight 'high-contrast-light) + (: ThemeVisualStudioDark 'visual-studio-dark) + (: ThemeVisualStudioLight 'visual-studio-light))) ;; How a node is coloured: #:style 'inline or #:style 'classes. -(type (: TmStyleMode (Union (: StyleInline #:tag inline) - (: StyleClasses #:tag classes)))) +(def/grammar TmStyleMode + (:or (: StyleInline 'inline) + (: StyleClasses 'classes))) ;; How a piece of text looks. None is the theme's own colour, which the pre ;; around the code already has. From c4efb432cddcfee677b0422b57a66f1e62513247e105bf61029bd5142dd5016a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Bj=C3=B6rnstam?= Date: Sat, 17 Oct 2026 17:59:22 +0200 Subject: [PATCH 2/3] 0.2.0 --- manifest.bjodat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.bjodat b/manifest.bjodat index cdba4d7..bb543f5 100644 --- a/manifest.bjodat +++ b/manifest.bjodat @@ -1,6 +1,6 @@ (package (name (textmate-bjolang)) - (version "0.1.3") + (version "0.2.0") (description "Syntax highlighting for Bjolang: VS Code's TextMate grammars and themes, through TextMateSharp, as (text xml) nodes.") (license "MPL-2.0") From 9eb71666db9bc91091c50c3e7ede3cdc1e6f6b22d8b343059b7575cd077ccc7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Bj=C3=B6rnstam?= Date: Sat, 17 Oct 2026 18:43:33 +0200 Subject: [PATCH 3/3] The demo test expects a list as it is printed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The check of several lines wanted the nodes as '((span ...) ...). ->str writes a list without a quote, so the check failed. It wants ((span ...) ...) now. 🤖 Generated with [ECA](https://eca.dev) (anthropic/claude-opus-4-7) Co-Authored-By: eca-agent --- tests/demo.bjo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/demo.bjo b/tests/demo.bjo index aba0bb9..669b618 100644 --- a/tests/demo.bjo +++ b/tests/demo.bjo @@ -149,7 +149,7 @@ " (code (@ (class \"language-csharp\")) (span (@ (style \"color:#B5CEA8\")) \"1\")))")) (expect "several lines, a newline between them" (->str (highlight->nodes cs "1\n2" #:style 'classes)) - (str "'((span (@ (class \"tm-constant tm-constant-numeric\")) \"1\") \"\\n\"" + (str "((span (@ (class \"tm-constant tm-constant-numeric\")) \"1\") \"\\n\"" " (span (@ (class \"tm-constant tm-constant-numeric\")) \"2\"))")) ;; --- the stylesheet ---------------------------------------------------------