================
@@ -0,0 +1,106 @@
+import argparse
+from typing import TypedDict, Union, Optional, TextIO, NotRequired
+from dataclasses import dataclass
+import json
+
+
+class Property(TypedDict):
+    name: str
+    type: str
+    default: NotRequired[str]
+    description: NotRequired[str]
+
+
+class PropertyGroup(TypedDict):
+    path: str
+    """The full path to this group separated by dots"""
+    properties: list[Property]
+
+
+@dataclass
+class PropertyTree:
+    items: dict[str, Union["PropertyTree", Property]]
+
+
+def append_group(tree: PropertyTree, group: PropertyGroup):
+    segments = group["path"].split(".") if group["path"] else []
+
+    subtree = tree
+    for segment in segments:
+        if segment not in subtree.items:
+            subtree.items[segment] = PropertyTree(items={})
+        subtree = subtree.items[segment]
+        assert isinstance(subtree, PropertyTree)
+
+    for property in group["properties"]:
+        subtree.items[property["name"]] = property
+
+
+def print_property(f: TextIO, path: str, property: Property):
+    f.write(f"```{{lldbsetting}} {path}\n")
----------------
Nerixyz wrote:

They're invoking a Sphinx directive (see [MyST 
docs](https://myst-parser.readthedocs.io/en/latest/syntax/roles-and-directives.html)).
 It's similar to `.. lldbsetting::` in RST.

https://github.com/llvm/llvm-project/pull/168245
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to