From 57ba1768f8ccab36cbb654f6eb551beccb2938bc Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sun, 5 May 2024 04:16:17 -0700 Subject: [PATCH] typegen: hyprland module + lockfile update --- Justfile | 4 ++++ flake.lock | 8 ++++---- typegen/src/parse.rs | 2 +- typegen/src/resolver.rs | 4 ++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Justfile b/Justfile index 38e036e..f07f947 100644 --- a/Justfile +++ b/Justfile @@ -16,6 +16,8 @@ clean: rm -rf content/docs/types/Quickshell.DBusMenu rm -rf data/modules/Quickshell.Service.SystemTray rm -rf content/docs/types/Quickshell.Service.SystemTray + rm -rf data/modules/Quickshell.Hyprland + rm -rf content/docs/types/Quickshell.Hyprland buildtypegen: ({{build_typegen}} && cd typegen && cargo build) || true @@ -27,11 +29,13 @@ typedocs: clean buildtypegen {{typegen_bin}} gentypes {{src_path}}/wayland/module.md build/types/types/Quickshell.Wayland.json {{typegen_bin}} gentypes {{src_path}}/dbus/dbusmenu/module.md build/types/types/Quickshell.DBusMenu.json {{typegen_bin}} gentypes {{src_path}}/services/status_notifier/module.md build/types/types/Quickshell.Service.SystemTray.json + {{typegen_bin}} gentypes {{src_path}}/wayland/hyprland/module.md build/types/types/Quickshell.Hyprland.json sh -c '{{typegen_bin}} gendocs {{src_path}}/core/module.md data/modules/Quickshell content/docs/types/Quickshell types/* build/types/types/*' sh -c '{{typegen_bin}} gendocs {{src_path}}/io/module.md data/modules/Quickshell.Io content/docs/types/Quickshell.Io types/* build/types/types/*' sh -c '{{typegen_bin}} gendocs {{src_path}}/wayland/module.md data/modules/Quickshell.Wayland content/docs/types/Quickshell.Wayland types/* build/types/types/*' sh -c '{{typegen_bin}} gendocs {{src_path}}/dbus/dbusmenu/module.md data/modules/Quickshell.DBusMenu content/docs/types/Quickshell.DBusMenu types/* build/types/types/*' sh -c '{{typegen_bin}} gendocs {{src_path}}/services/status_notifier/module.md data/modules/Quickshell.Service.SystemTray content/docs/types/Quickshell.Service.SystemTray types/* build/types/types/*' + sh -c '{{typegen_bin}} gendocs {{src_path}}/wayland/hyprland/module.md data/modules/Quickshell.Hyprland content/docs/types/Quickshell.Hyprland types/* build/types/types/*' serve: typedocs hugo server --buildDrafts --disableFastRender diff --git a/flake.lock b/flake.lock index 96418ca..b4e466c 100644 --- a/flake.lock +++ b/flake.lock @@ -22,11 +22,11 @@ ] }, "locked": { - "lastModified": 1714557323, - "narHash": "sha256-FJIiI56bAHpH+qrWXg2AjimsUs0lUDRaOw7peIm2MgQ=", + "lastModified": 1714907559, + "narHash": "sha256-TDBe2SvrBwXIfkHLFn6BEnVWdO4BcWglsVH0YqhiIJg=", "ref": "refs/heads/master", - "rev": "e7cfb5cf37de6956eaf9343c4a69e951f8d268f5", - "revCount": 171, + "rev": "6e9bb4183ca0d7dbab6841f85a25961388c10c81", + "revCount": 172, "type": "git", "url": "https://git.outfoxxed.me/outfoxxed/quickshell" }, diff --git a/typegen/src/parse.rs b/typegen/src/parse.rs index cb51576..1abcacd 100644 --- a/typegen/src/parse.rs +++ b/typegen/src/parse.rs @@ -132,7 +132,7 @@ impl Parser { Self { class_regex: Regex::new(r#"(?(\s*\/\/\/.*\n)+)?\s*class\s+(?\w+)(?:\s*:\s*public\s+(?\w+)(\s*,(\s*\w+)*)*)?\s*\{(?[\s\S]*?)};"#).unwrap(), macro_regex: Regex::new(r#"(?(\s*\/\/\/.*\n)+)?\s*(?QSDOC_HIDE\s)?(?(Q|QML|QSDOC)_\w+)\s*(\(\s*(?.*)\s*\))?;"#).unwrap(), - property_regex: Regex::new(r#"^\s*(?(\w|::|, |<|>)+)\*?\s+(?\w+)(\s+(MEMBER\s+(?\w+)|READ\s+(?\w+)|WRITE\s+(?\w+)|NOTIFY\s+(?\w+)|(?CONSTANT)))+\s*$"#).unwrap(), + property_regex: Regex::new(r#"^\s*(?(\w|::|, |<|>|\*)+)\*?\s+(?\w+)(\s+(MEMBER\s+(?\w+)|READ\s+(?\w+)|WRITE\s+(?\w+)|NOTIFY\s+(?\w+)|(?CONSTANT)))+\s*$"#).unwrap(), fn_regex: Regex::new(r#"(?(\s*\/\/\/.*\n)+)?\s*Q_INVOKABLE\s+(\[\[.*\]\]\s+)?(?(\w|::|<|>)+\*?)\s+(?\w+)\((?[\s\S]*?)\)(\s*const)?;"#).unwrap(), signal_regex: Regex::new(r#"(?(\s*\/\/\/.*\n)+)?\s*void\s+(?\w+)\((?[\s\S]*?)\);"#).unwrap(), fn_param_regex: Regex::new(r#"(const\s+)?(?(\w|::|<|>)+\*?)&?\s+(?\w+)(,|$)"#).unwrap(), diff --git a/typegen/src/resolver.rs b/typegen/src/resolver.rs index 7f7192f..af43653 100644 --- a/typegen/src/resolver.rs +++ b/typegen/src/resolver.rs @@ -119,6 +119,10 @@ pub fn resolve_types( list = true; } else if ctype.starts_with("QList<") { ctype = &ctype[6..ctype.len() - 1]; + if ctype.ends_with('*') { + ctype = &ctype[0..ctype.len() - 1]; + } + list = true; }