about summary refs log tree commit diff
path: root/tools/emacs-pkgs/treecrumbs
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@tvl.su>2024-03-10T19·14+0300
committerclbot <clbot@tvl.fyi>2024-03-10T19·35+0000
commit13b0f80e4fa6fcbec86edc79efad31cd6fa2b134 (patch)
tree69c634e5287e2cb115a7e3b42e321dd43b5c184e /tools/emacs-pkgs/treecrumbs
parent6280706ecd17e889e0dd42ac3845864ed7e2e49e (diff)
feat(treecrumbs): support for TOML r/7672
Similar to YAML, but with more weird keys and with sections.

Change-Id: I94d69d2f0e53366855ccb5d99a432c6a0361a910
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11126
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tools/emacs-pkgs/treecrumbs')
-rw-r--r--tools/emacs-pkgs/treecrumbs/treecrumbs.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/emacs-pkgs/treecrumbs/treecrumbs.el b/tools/emacs-pkgs/treecrumbs/treecrumbs.el
index 54e2160385a0..cd49324ad747 100644
--- a/tools/emacs-pkgs/treecrumbs/treecrumbs.el
+++ b/tools/emacs-pkgs/treecrumbs/treecrumbs.el
@@ -95,6 +95,18 @@ The defined languages are stored in `treecrumbs-languages'."
   ("pair" . ((pair key: (string (string_content) @key))))
   ("array" . "[]"))
 
+(define-treecrumbs-language toml
+  ;; TOML has sections, key names and arrays. Sections are the only
+  ;; relevant difference to YAML. Nested keys are not parsed, and just
+  ;; displayed as-is.
+  ("table" . ((table (_) @key)) )
+  ;; TODO: query cannot match on pair in inline_table, hence matching
+  ;; directly on keys
+  ("pair" . ([(dotted_key)
+              (quoted_key)
+              (bare_key)]))
+  ("array" . "[]"))
+
 (define-treecrumbs-language cpp
   ;; In C++ files, crumbs are generated from namespaces and
   ;; identifier declarations.