From 9e65a4cc9bd99d71243db136ec9a00c3606eae0e Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sun, 8 Oct 2023 17:37:16 +0200 Subject: [PATCH] feat: map more types --- src/awesomewmdtl/init.tl | 1 + src/awesomewmdtl/visitors/type_mapping.tl | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/awesomewmdtl/init.tl b/src/awesomewmdtl/init.tl index 05cf543..9134041 100644 --- a/src/awesomewmdtl/init.tl +++ b/src/awesomewmdtl/init.tl @@ -149,6 +149,7 @@ for _, node in dag.iter_global_nodes(module_dag) do end local global_module_ast = ast.create_node("module", "global_env_def", "global_env_def", true) -- Declare global types +table.insert(global_module_ast.children, ast.create_node("type", "Gears_Shape_Function", { "(function(cr: any, width: integer, height: integer))" }, true)) table.insert(global_module_ast.children, ast.create_node("type", "Color", { "any" }, true)) table.insert(global_module_ast.children, ast.create_node("type", "Surface", { "any" }, true)) table.insert(global_module_ast.children, ast.create_node("type", "Cairo_Context", { "any" }, true)) diff --git a/src/awesomewmdtl/visitors/type_mapping.tl b/src/awesomewmdtl/visitors/type_mapping.tl index 9439aae..770ab3a 100644 --- a/src/awesomewmdtl/visitors/type_mapping.tl +++ b/src/awesomewmdtl/visitors/type_mapping.tl @@ -1,19 +1,21 @@ local type Node = require("awesomewmdtl.types.Node") --- Special types I don't want to deal with for now -local gears_shape_function = "function(cr: any, width: integer, height: integer)" - local type_map : { string : string } = { awesome = "Awesome", bool = "boolean", + ["surface._native"] = "Surface", + cairo_context = "Cairo_Context", + color = "Color", client = "Client", - ["gears.shape"] = gears_shape_function, + ["gears.shape"] = "Gears_Shape_Function", ["gears.surface"] = "Surface", image = "Image", int = "integer", layout = "Layout", + raw_surface = "Surface", + raw_curface = "Surface", -- typo that should be fixed in the Client doc screen = "Screen", - shape = gears_shape_function, + shape = "Gears_Shape_Function", surface = "Surface", tag = "Tag", widget = "wibox.widget",